From 57dd9e0836748f57a81d045c9896ca7f5ae8bf52 Mon Sep 17 00:00:00 2001 From: No Author Date: Fri, 4 May 2001 21:54:25 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create branch 'RSE'. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/RSE@88989 13f79535-47bb-0310-9956-ffa450edef68 --- .cvsignore | 27 - .gdbinit | 73 - ABOUT_APACHE | 267 - Apache.dsp | 99 - Apache.dsw | 668 -- Apache.mak | 373 - CHANGES | 9528 ----------------- INSTALL | 466 - InstallBin.dsp | 109 - KEYS | 722 -- LICENSE | 58 - Makefile.in | 118 - Makefile.win | 226 - README | 75 - STATUS | 848 -- acinclude.m4 | 351 - build/binbuild.sh | 296 - build/bsd_makefile | 71 - build/build-modules-c.awk | 56 - build/buildexports.awk | 3 - build/buildexports.sh | 34 - build/buildinfo.sh | 160 - build/config-stubs | 27 - build/default.pl | 496 - build/fastgen.sh | 112 - build/fixwin32mak.pl | 47 - build/httpd_roll_release | 110 - build/install.sh | 112 - build/library.mk | 60 - build/ltlib.mk | 61 - build/mkdep.perl | 92 - build/mkdir.sh | 35 - build/program.mk | 60 - build/rules.mk | 248 - build/special.mk | 76 - build/sysv_makefile | 71 - buildconf | 128 - config.layout | 251 - configure.in | 368 - docs/STATUS | 107 - docs/cgi-examples/printenv | 13 - docs/cgi-examples/test-cgi | 31 - docs/conf/highperformance-std.conf | 69 - docs/conf/httpd-std.conf | 941 -- docs/conf/httpd-win.conf | 851 -- docs/conf/magic | 371 - docs/conf/mime.types | 428 - docs/docroot/README.rus | 18 - docs/docroot/apache_pb.gif | Bin 2326 -> 0 bytes docs/docroot/apache_pb2.gif | Bin 2414 -> 0 bytes docs/docroot/apache_pb2_ani.gif | Bin 2160 -> 0 bytes docs/docroot/index.html.ca | 51 - docs/docroot/index.html.cz | 51 - docs/docroot/index.html.de | 61 - docs/docroot/index.html.dk | 47 - docs/docroot/index.html.ee | 53 - docs/docroot/index.html.el | 37 - docs/docroot/index.html.en | 38 - docs/docroot/index.html.es | 51 - docs/docroot/index.html.et | 53 - docs/docroot/index.html.fr | 47 - docs/docroot/index.html.he.iso8859-8 | 54 - docs/docroot/index.html.it | 39 - docs/docroot/index.html.ja.iso2022-jp | 42 - docs/docroot/index.html.ja.jis | 42 - docs/docroot/index.html.kr.iso-kr | 40 - docs/docroot/index.html.kr.iso2022-kr | 40 - docs/docroot/index.html.ltz | 37 - docs/docroot/index.html.lu | 37 - docs/docroot/index.html.nl | 54 - docs/docroot/index.html.no | 48 - docs/docroot/index.html.po.iso-pl | 40 - docs/docroot/index.html.pt | 42 - docs/docroot/index.html.pt-br | 46 - docs/docroot/index.html.ru.cp-1251 | 34 - docs/docroot/index.html.ru.cp866 | 34 - docs/docroot/index.html.ru.iso-ru | 34 - docs/docroot/index.html.ru.koi8-r | 34 - docs/docroot/index.html.ru.ucs2 | Bin 3134 -> 0 bytes docs/docroot/index.html.ru.ucs4 | Bin 6268 -> 0 bytes docs/docroot/index.html.ru.utf8 | 34 - docs/docroot/index.html.se | 43 - docs/docroot/index.html.tw | 46 - docs/docroot/index.html.tw.Big5 | 46 - docs/doxygen.conf | 21 - docs/icons/README | 158 - docs/icons/a.gif | Bin 246 -> 0 bytes docs/icons/alert.black.gif | Bin 242 -> 0 bytes docs/icons/alert.red.gif | Bin 247 -> 0 bytes docs/icons/apache_pb.gif | Bin 2326 -> 0 bytes docs/icons/apache_pb2.gif | Bin 2414 -> 0 bytes docs/icons/apache_pb2_ani.gif | Bin 2160 -> 0 bytes docs/icons/back.gif | Bin 216 -> 0 bytes docs/icons/ball.gray.gif | Bin 233 -> 0 bytes docs/icons/ball.red.gif | Bin 205 -> 0 bytes docs/icons/binary.gif | Bin 246 -> 0 bytes docs/icons/binhex.gif | Bin 246 -> 0 bytes docs/icons/blank.gif | Bin 148 -> 0 bytes docs/icons/bomb.gif | Bin 308 -> 0 bytes docs/icons/box1.gif | Bin 251 -> 0 bytes docs/icons/box2.gif | Bin 268 -> 0 bytes docs/icons/broken.gif | Bin 247 -> 0 bytes docs/icons/burst.gif | Bin 235 -> 0 bytes docs/icons/c.gif | Bin 242 -> 0 bytes docs/icons/comp.blue.gif | Bin 251 -> 0 bytes docs/icons/comp.gray.gif | Bin 246 -> 0 bytes docs/icons/compressed.gif | Bin 1038 -> 0 bytes docs/icons/continued.gif | Bin 214 -> 0 bytes docs/icons/dir.gif | Bin 225 -> 0 bytes docs/icons/down.gif | Bin 163 -> 0 bytes docs/icons/dvi.gif | Bin 238 -> 0 bytes docs/icons/f.gif | Bin 236 -> 0 bytes docs/icons/folder.gif | Bin 225 -> 0 bytes docs/icons/folder.open.gif | Bin 242 -> 0 bytes docs/icons/folder.sec.gif | Bin 243 -> 0 bytes docs/icons/forward.gif | Bin 219 -> 0 bytes docs/icons/generic.gif | Bin 221 -> 0 bytes docs/icons/generic.red.gif | Bin 220 -> 0 bytes docs/icons/generic.sec.gif | Bin 249 -> 0 bytes docs/icons/hand.right.gif | Bin 217 -> 0 bytes docs/icons/hand.up.gif | Bin 223 -> 0 bytes docs/icons/icon.sheet.gif | Bin 11977 -> 0 bytes docs/icons/image1.gif | Bin 274 -> 0 bytes docs/icons/image2.gif | Bin 309 -> 0 bytes docs/icons/image3.gif | Bin 286 -> 0 bytes docs/icons/index.gif | Bin 268 -> 0 bytes docs/icons/layout.gif | Bin 276 -> 0 bytes docs/icons/left.gif | Bin 172 -> 0 bytes docs/icons/link.gif | Bin 249 -> 0 bytes docs/icons/movie.gif | Bin 243 -> 0 bytes docs/icons/p.gif | Bin 237 -> 0 bytes docs/icons/patch.gif | Bin 251 -> 0 bytes docs/icons/pdf.gif | Bin 249 -> 0 bytes docs/icons/pie0.gif | Bin 188 -> 0 bytes docs/icons/pie1.gif | Bin 198 -> 0 bytes docs/icons/pie2.gif | Bin 198 -> 0 bytes docs/icons/pie3.gif | Bin 191 -> 0 bytes docs/icons/pie4.gif | Bin 193 -> 0 bytes docs/icons/pie5.gif | Bin 189 -> 0 bytes docs/icons/pie6.gif | Bin 186 -> 0 bytes docs/icons/pie7.gif | Bin 185 -> 0 bytes docs/icons/pie8.gif | Bin 173 -> 0 bytes docs/icons/portal.gif | Bin 254 -> 0 bytes docs/icons/ps.gif | Bin 244 -> 0 bytes docs/icons/quill.gif | Bin 267 -> 0 bytes docs/icons/right.gif | Bin 172 -> 0 bytes docs/icons/screw1.gif | Bin 258 -> 0 bytes docs/icons/screw2.gif | Bin 263 -> 0 bytes docs/icons/script.gif | Bin 242 -> 0 bytes docs/icons/small/README.txt | 6 - docs/icons/small/back.gif | Bin 129 -> 0 bytes docs/icons/small/binary.gif | Bin 134 -> 0 bytes docs/icons/small/binhex.gif | Bin 131 -> 0 bytes docs/icons/small/blank.gif | Bin 55 -> 0 bytes docs/icons/small/broken.gif | Bin 139 -> 0 bytes docs/icons/small/burst.gif | Bin 128 -> 0 bytes docs/icons/small/comp1.gif | Bin 130 -> 0 bytes docs/icons/small/comp2.gif | Bin 131 -> 0 bytes docs/icons/small/compressed.gif | Bin 128 -> 0 bytes docs/icons/small/continued.gif | Bin 114 -> 0 bytes docs/icons/small/dir.gif | Bin 132 -> 0 bytes docs/icons/small/dir2.gif | Bin 122 -> 0 bytes docs/icons/small/doc.gif | Bin 191 -> 0 bytes docs/icons/small/forward.gif | Bin 125 -> 0 bytes docs/icons/small/generic.gif | Bin 116 -> 0 bytes docs/icons/small/generic2.gif | Bin 127 -> 0 bytes docs/icons/small/generic3.gif | Bin 113 -> 0 bytes docs/icons/small/image.gif | Bin 126 -> 0 bytes docs/icons/small/image2.gif | Bin 138 -> 0 bytes docs/icons/small/index.gif | Bin 145 -> 0 bytes docs/icons/small/key.gif | Bin 187 -> 0 bytes docs/icons/small/movie.gif | Bin 134 -> 0 bytes docs/icons/small/patch.gif | Bin 182 -> 0 bytes docs/icons/small/ps.gif | Bin 184 -> 0 bytes docs/icons/small/rainbow.gif | Bin 3811 -> 0 bytes docs/icons/small/sound.gif | Bin 130 -> 0 bytes docs/icons/small/sound2.gif | Bin 119 -> 0 bytes docs/icons/small/tar.gif | Bin 132 -> 0 bytes docs/icons/small/text.gif | Bin 128 -> 0 bytes docs/icons/small/transfer.gif | Bin 124 -> 0 bytes docs/icons/small/unknown.gif | Bin 131 -> 0 bytes docs/icons/small/uu.gif | Bin 125 -> 0 bytes docs/icons/sound1.gif | Bin 248 -> 0 bytes docs/icons/sound2.gif | Bin 221 -> 0 bytes docs/icons/sphere1.gif | Bin 285 -> 0 bytes docs/icons/sphere2.gif | Bin 264 -> 0 bytes docs/icons/tar.gif | Bin 219 -> 0 bytes docs/icons/tex.gif | Bin 251 -> 0 bytes docs/icons/text.gif | Bin 229 -> 0 bytes docs/icons/transfer.gif | Bin 242 -> 0 bytes docs/icons/unknown.gif | Bin 245 -> 0 bytes docs/icons/up.gif | Bin 164 -> 0 bytes docs/icons/uu.gif | Bin 236 -> 0 bytes docs/icons/uuencoded.gif | Bin 236 -> 0 bytes docs/icons/world1.gif | Bin 228 -> 0 bytes docs/icons/world2.gif | Bin 261 -> 0 bytes docs/man/ab.8 | 289 - docs/man/apachectl.8 | 132 - docs/man/apxs.8 | 458 - docs/man/dbmmanage.1 | 170 - docs/man/htdigest.1 | 95 - docs/man/htpasswd.1 | 250 - docs/man/httpd.8 | 189 - docs/man/logresolve.8 | 86 - docs/man/rotatelogs.8 | 88 - docs/man/suexec.8 | 75 - docs/manual/LICENSE | 58 - docs/manual/bind.html | 78 - docs/manual/bind.html.en | 78 - docs/manual/cgi_path.html | 93 - docs/manual/cgi_path.html.en | 93 - docs/manual/configuring.html.en | 248 - docs/manual/configuring.html.html | 1 - docs/manual/configuring.html.ja.jis | 247 - docs/manual/content-negotiation.html | 590 - docs/manual/content-negotiation.html.en | 590 - docs/manual/custom-error.html | 177 - docs/manual/custom-error.html.en | 177 - docs/manual/developer/API.html | 1161 -- docs/manual/developer/debugging.html | 178 - docs/manual/developer/documenting | 43 - docs/manual/developer/footer.html | 8 - docs/manual/developer/header.html | 6 - docs/manual/developer/hooks.html | 207 - docs/manual/developer/index.html | 25 - docs/manual/developer/layeredio.html | 76 - docs/manual/developer/modules.html | 203 - docs/manual/developer/modules.html.en | 203 - docs/manual/dns-caveats.html | 188 - docs/manual/dso.html | 394 - docs/manual/dso.html.en | 394 - docs/manual/ebcdic.html | 505 - docs/manual/env.html | 305 - docs/manual/env.html.en | 305 - docs/manual/expand.pl | 104 - docs/manual/filter.html | 58 - docs/manual/filter.html.en | 58 - docs/manual/footer.html | 6 - docs/manual/handler.html.en | 152 - docs/manual/handler.html.html | 1 - docs/manual/handler.html.ja.jis | 146 - docs/manual/header.html | 6 - docs/manual/howto/cgi.html.en | 499 - docs/manual/howto/cgi.html.ja.jis | 495 - docs/manual/howto/footer.html | 8 - docs/manual/howto/header.html | 6 - docs/manual/howto/ssi.html.en | 521 - docs/manual/howto/ssi.html.ja.jis | 501 - docs/manual/images/apache_header.gif | Bin 4084 -> 0 bytes docs/manual/images/custom_errordocs.gif | Bin 23291 -> 0 bytes docs/manual/images/home.gif | Bin 1465 -> 0 bytes docs/manual/images/index.gif | Bin 1540 -> 0 bytes docs/manual/images/mod_rewrite_fig1.fig | 60 - docs/manual/images/mod_rewrite_fig1.gif | Bin 3525 -> 0 bytes docs/manual/images/mod_rewrite_fig2.fig | 50 - docs/manual/images/mod_rewrite_fig2.gif | Bin 2553 -> 0 bytes docs/manual/images/pixel.gif | Bin 61 -> 0 bytes docs/manual/images/sub.gif | Bin 6083 -> 0 bytes docs/manual/index.html.en | 178 - docs/manual/index.html.fr | 163 - docs/manual/index.html.html | 1 - docs/manual/index.html.ja.jis | 179 - docs/manual/install-tpf.html | 342 - docs/manual/install.html | 199 - docs/manual/install.html.en | 199 - docs/manual/invoking.html | 118 - docs/manual/invoking.html.en | 118 - docs/manual/location.html | 68 - docs/manual/misc/API.html | 1161 -- docs/manual/misc/FAQ-A.html | 321 - docs/manual/misc/FAQ-B.html | 441 - docs/manual/misc/FAQ-C.html | 273 - docs/manual/misc/FAQ-D.html | 432 - docs/manual/misc/FAQ-E.html | 626 -- docs/manual/misc/FAQ-F.html | 564 - docs/manual/misc/FAQ-G.html | 406 - docs/manual/misc/FAQ-H.html | 267 - docs/manual/misc/FAQ-I.html | 271 - docs/manual/misc/FAQ.html | 111 - docs/manual/misc/client_block_api.html | 95 - docs/manual/misc/compat_notes.html | 135 - docs/manual/misc/custom_errordocs.html | 433 - docs/manual/misc/descriptors.html | 182 - docs/manual/misc/fin_wait_2.html | 324 - docs/manual/misc/footer.html | 8 - docs/manual/misc/header.html | 6 - docs/manual/misc/howto.html | 208 - docs/manual/misc/index.html | 101 - docs/manual/misc/known_client_problems.html | 305 - docs/manual/misc/perf-tuning.html | 906 -- docs/manual/misc/rewriteguide.html | 1906 ---- docs/manual/misc/security_tips.html | 231 - docs/manual/misc/tutorials.html | 209 - docs/manual/mod/core.html | 2703 ----- docs/manual/mod/directive-dict.html | 283 - docs/manual/mod/directive-dict.html.en | 283 - docs/manual/mod/directives.html | 246 - docs/manual/mod/footer.html | 8 - docs/manual/mod/header.html | 6 - docs/manual/mod/index-bytype.html | 182 - docs/manual/mod/index.html | 131 - docs/manual/mod/mod_access.html | 346 - docs/manual/mod/mod_actions.html | 140 - docs/manual/mod/mod_alias.html | 415 - docs/manual/mod/mod_asis.html | 91 - docs/manual/mod/mod_auth.html | 246 - docs/manual/mod/mod_auth_anon.html | 322 - docs/manual/mod/mod_auth_db.html | 250 - docs/manual/mod/mod_auth_dbm.html | 242 - docs/manual/mod/mod_auth_digest.html | 412 - docs/manual/mod/mod_autoindex.html | 900 -- docs/manual/mod/mod_cern_meta.html | 169 - docs/manual/mod/mod_cgi.html | 242 - docs/manual/mod/mod_charset_lite.html | 285 - docs/manual/mod/mod_dav.html | 253 - docs/manual/mod/mod_dir.html | 119 - docs/manual/mod/mod_env.html | 159 - docs/manual/mod/mod_example.html | 201 - docs/manual/mod/mod_expires.html | 350 - docs/manual/mod/mod_ext_filter.html | 292 - docs/manual/mod/mod_file_cache.html | 268 - docs/manual/mod/mod_headers.html | 147 - docs/manual/mod/mod_imap.html | 349 - docs/manual/mod/mod_include.html | 469 - docs/manual/mod/mod_info.html | 127 - docs/manual/mod/mod_isapi.html | 376 - docs/manual/mod/mod_log_config.html | 476 - docs/manual/mod/mod_mime.html | 616 -- docs/manual/mod/mod_mime_magic.html | 289 - docs/manual/mod/mod_mmap_static.html | 152 - docs/manual/mod/mod_negotiation.html | 223 - docs/manual/mod/mod_proxy.html | 26 - docs/manual/mod/mod_rewrite.html | 1928 ---- docs/manual/mod/mod_setenvif.html | 422 - docs/manual/mod/mod_so.html | 192 - docs/manual/mod/mod_speling.html | 137 - docs/manual/mod/mod_status.html | 173 - docs/manual/mod/mod_unique_id.html | 205 - docs/manual/mod/mod_userdir.html | 139 - docs/manual/mod/mod_usertrack.html | 224 - docs/manual/mod/mod_vhost_alias.html | 345 - docs/manual/mod/module-dict.html | 144 - docs/manual/mod/module-dict.html.en | 144 - docs/manual/mod/mpm_common.html | 774 -- docs/manual/mod/mpm_winnt.html | 59 - docs/manual/mod/perchild.html | 170 - docs/manual/mod/prefork.html | 171 - docs/manual/mod/threaded.html | 105 - docs/manual/mpm.html | 90 - docs/manual/mpm.html.en | 90 - docs/manual/new_features_2_0.html | 94 - docs/manual/new_features_2_0.html.en | 94 - docs/manual/new_features_2_0.html.fr | 89 - docs/manual/platform/footer.html | 8 - docs/manual/platform/header.html | 6 - docs/manual/platform/netware.html | 285 - docs/manual/platform/perf-bsd44.html | 262 - docs/manual/platform/perf-dec.html | 286 - docs/manual/platform/perf-hp.html | 122 - docs/manual/platform/perf.html | 175 - docs/manual/platform/readme-tpf.html | 214 - docs/manual/platform/unixware.html | 69 - docs/manual/platform/win_compiling.html | 180 - docs/manual/platform/win_service.html | 325 - docs/manual/platform/windows.html | 514 - docs/manual/process-model.html | 76 - docs/manual/programs/ab.html | 124 - docs/manual/programs/apachectl.html | 84 - docs/manual/programs/apxs.html | 271 - docs/manual/programs/dbmmanage.html | 105 - docs/manual/programs/footer.html | 8 - docs/manual/programs/header.html | 6 - docs/manual/programs/htdigest.html | 52 - docs/manual/programs/htpasswd.html | 160 - docs/manual/programs/httpd.html | 108 - docs/manual/programs/index.html | 60 - docs/manual/programs/logresolve.html | 39 - docs/manual/programs/other.html | 48 - docs/manual/programs/rotatelogs.html | 43 - docs/manual/programs/suexec.html | 30 - docs/manual/search/manual-index.cgi | 256 - docs/manual/sections.html | 163 - docs/manual/sections.html.en | 163 - docs/manual/server-wide.html.en | 113 - docs/manual/server-wide.html.html | 1 - docs/manual/server-wide.html.ja.jis | 113 - docs/manual/stopping.html | 193 - docs/manual/stopping.html.en | 193 - docs/manual/suexec.html | 516 - docs/manual/suexec.html.en | 516 - docs/manual/upgrading.html | 143 - docs/manual/upgrading.html.en | 143 - docs/manual/upgrading.html.fr | 132 - docs/manual/urlmapping.html | 253 - docs/manual/urlmapping.html.en | 253 - docs/manual/vhosts/details.html | 380 - docs/manual/vhosts/examples.html | 628 -- docs/manual/vhosts/fd-limits.html | 59 - docs/manual/vhosts/fd-limits.html.en | 59 - docs/manual/vhosts/footer.html | 8 - docs/manual/vhosts/header.html | 6 - docs/manual/vhosts/host.html | 172 - docs/manual/vhosts/index.html | 65 - docs/manual/vhosts/index.html.en | 65 - docs/manual/vhosts/ip-based.html | 134 - docs/manual/vhosts/mass.html | 405 - docs/manual/vhosts/name-based.html | 169 - docs/manual/vhosts/name-based.html.en | 169 - docs/manual/vhosts/vhosts-in-depth.html | 396 - docs/manual/vhosts/virtual-host.html | 208 - emacs-style | 11 - hints.m4 | 63 - include/.cvsignore | 2 - include/.indent.pro | 54 - include/ap_compat.h | 12 - include/ap_config.h | 256 - include/ap_listen.h | 148 - include/ap_mmn.h | 110 - include/ap_mpm.h | 177 - include/ap_release.h | 80 - include/http_config.h | 1043 -- include/http_connection.h | 135 - include/http_core.h | 505 - include/http_log.h | 282 - include/http_main.h | 96 - include/http_protocol.h | 609 -- include/http_request.h | 329 - include/http_vhost.h | 123 - include/httpd.h | 1544 --- include/mpm_common.h | 171 - include/pcreposix.h | 99 - include/rfc1413.h | 84 - include/scoreboard.h | 263 - include/util_cfgtree.h | 117 - include/util_charset.h | 96 - include/util_date.h | 114 - include/util_ebcdic.h | 120 - include/util_filter.h | 450 - include/util_md5.h | 112 - include/util_script.h | 178 - include/util_uri.h | 207 - include/util_xml.h | 85 - libhttpd.dsp | 497 - libhttpd.mak | 2673 ----- modules/.cvsignore | 4 - modules/Makefile.in | 5 - modules/README | 55 - modules/aaa/.cvsignore | 10 - modules/aaa/.indent.pro | 54 - modules/aaa/Makefile.in | 3 - modules/aaa/config.m4 | 21 - modules/aaa/mod_access.c | 345 - modules/aaa/mod_access.exp | 1 - modules/aaa/mod_auth.c | 338 - modules/aaa/mod_auth.exp | 1 - modules/aaa/mod_auth_anon.c | 313 - modules/aaa/mod_auth_anon.dsp | 95 - modules/aaa/mod_auth_anon.exp | 1 - modules/aaa/mod_auth_anon.mak | 330 - modules/aaa/mod_auth_db.c | 419 - modules/aaa/mod_auth_db.module | 37 - modules/aaa/mod_auth_dbm.c | 358 - modules/aaa/mod_auth_dbm.dsp | 95 - modules/aaa/mod_auth_dbm.exp | 1 - modules/aaa/mod_auth_dbm.mak | 366 - modules/aaa/mod_auth_digest.c | 2083 ---- modules/aaa/mod_auth_digest.dsp | 95 - modules/aaa/mod_auth_digest.mak | 370 - modules/arch/win32/mod_isapi.c | 1299 --- modules/cache/.cvsignore | 10 - modules/cache/.indent.pro | 54 - modules/cache/Makefile.in | 3 - modules/cache/config.m4 | 11 - modules/cache/mod_file_cache.c | 468 - modules/cache/mod_file_cache.dsp | 95 - modules/cache/mod_file_cache.mak | 331 - modules/config5.m4 | 43 - modules/dav/fs/.cvsignore | 10 - modules/dav/fs/Makefile.in | 3 - modules/dav/fs/config6.m4 | 15 - modules/dav/fs/dbm.c | 259 - modules/dav/fs/lock.c | 1537 --- modules/dav/fs/mod_dav_fs.c | 142 - modules/dav/fs/mod_dav_fs.dsp | 119 - modules/dav/fs/mod_dav_fs.mak | 533 - modules/dav/fs/repos.c | 2077 ---- modules/dav/fs/repos.h | 110 - modules/dav/main/.cvsignore | 10 - modules/dav/main/Makefile.in | 3 - modules/dav/main/config5.m4 | 22 - modules/dav/main/liveprop.c | 177 - modules/dav/main/mod_dav.c | 4731 -------- modules/dav/main/mod_dav.dsp | 131 - modules/dav/main/mod_dav.h | 2231 ---- modules/dav/main/mod_dav.mak | 659 -- modules/dav/main/props.c | 1590 --- modules/dav/main/providers.c | 84 - modules/dav/main/std_liveprop.c | 229 - modules/dav/main/util.c | 1958 ---- modules/dav/main/util_lock.c | 826 -- modules/echo/.cvsignore | 10 - modules/echo/.indent.pro | 54 - modules/echo/Makefile.in | 3 - modules/echo/config.m4 | 11 - modules/echo/mod_echo.c | 136 - modules/experimental/.cvsignore | 11 - modules/experimental/.indent.pro | 54 - modules/experimental/Makefile.in | 3 - modules/experimental/README | 41 - modules/experimental/config.m4 | 14 - modules/experimental/mod_cache.c | 124 - modules/experimental/mod_cache.h | 65 - modules/experimental/mod_case_filter.c | 113 - modules/experimental/mod_charset_lite.c | 1142 -- modules/experimental/mod_disk_cache.c | 170 - modules/experimental/mod_example.c | 1198 --- modules/experimental/mod_ext_filter.c | 793 -- .../experimental/mod_generic_hook_export.c | 82 - .../experimental/mod_generic_hook_export.dsp | 95 - .../experimental/mod_generic_hook_export.h | 62 - .../experimental/mod_generic_hook_import.c | 83 - .../experimental/mod_generic_hook_import.dsp | 95 - modules/experimental/mod_optional_fn_export.c | 86 - modules/experimental/mod_optional_fn_export.h | 3 - modules/experimental/mod_optional_fn_import.c | 93 - modules/filters/.cvsignore | 10 - modules/filters/.indent.pro | 54 - modules/filters/Makefile.in | 3 - modules/filters/config.m4 | 11 - modules/filters/mod_include.c | 2854 ----- modules/filters/mod_include.exp | 1 - modules/filters/mod_include.h | 214 - modules/generators/.cvsignore | 10 - modules/generators/.indent.pro | 54 - modules/generators/Makefile.in | 3 - modules/generators/config5.m4 | 29 - modules/generators/mod_asis.c | 142 - modules/generators/mod_asis.exp | 1 - modules/generators/mod_autoindex.c | 1713 --- modules/generators/mod_autoindex.exp | 1 - modules/generators/mod_cgi.c | 1005 -- modules/generators/mod_cgi.exp | 1 - modules/generators/mod_cgid.c | 1300 --- modules/generators/mod_info.c | 491 - modules/generators/mod_info.dsp | 95 - modules/generators/mod_info.exp | 1 - modules/generators/mod_info.mak | 326 - modules/generators/mod_status.c | 787 -- modules/generators/mod_status.dsp | 95 - modules/generators/mod_status.exp | 1 - modules/generators/mod_status.mak | 330 - modules/generators/mod_suexec.c | 155 - modules/generators/mod_suexec.h | 64 - modules/http/.cvsignore | 10 - modules/http/.indent.pro | 54 - modules/http/Makefile.in | 3 - modules/http/config2.m4 | 10 - modules/http/http_core.c | 324 - modules/http/http_protocol.c | 2439 ----- modules/http/http_request.c | 574 - modules/http/mod_core.h | 99 - modules/http/mod_mime.c | 823 -- modules/http/mod_mime.exp | 1 - modules/loggers/.cvsignore | 10 - modules/loggers/.indent.pro | 54 - modules/loggers/Makefile.in | 3 - modules/loggers/config.m4 | 9 - modules/loggers/mod_log_config.c | 1229 --- modules/loggers/mod_log_config.exp | 1 - modules/loggers/mod_log_config.h | 75 - modules/mappers/.cvsignore | 10 - modules/mappers/.indent.pro | 54 - modules/mappers/Makefile.in | 3 - modules/mappers/config9.m4 | 33 - modules/mappers/mod_actions.c | 226 - modules/mappers/mod_actions.exp | 1 - modules/mappers/mod_alias.c | 443 - modules/mappers/mod_alias.exp | 1 - modules/mappers/mod_dir.c | 252 - modules/mappers/mod_dir.exp | 1 - modules/mappers/mod_imap.c | 925 -- modules/mappers/mod_imap.exp | 1 - modules/mappers/mod_negotiation.c | 2756 ----- modules/mappers/mod_negotiation.exp | 1 - modules/mappers/mod_rewrite.c | 4132 ------- modules/mappers/mod_rewrite.dsp | 95 - modules/mappers/mod_rewrite.exp | 1 - modules/mappers/mod_rewrite.h | 473 - modules/mappers/mod_rewrite.mak | 335 - modules/mappers/mod_so.c | 353 - modules/mappers/mod_speling.c | 569 - modules/mappers/mod_speling.dsp | 95 - modules/mappers/mod_speling.exp | 1 - modules/mappers/mod_speling.mak | 325 - modules/mappers/mod_userdir.c | 399 - modules/mappers/mod_userdir.exp | 1 - modules/mappers/mod_vhost_alias.c | 490 - modules/metadata/.cvsignore | 10 - modules/metadata/.indent.pro | 54 - modules/metadata/Makefile.in | 3 - modules/metadata/config.m4 | 23 - modules/metadata/mod_cern_meta.c | 406 - modules/metadata/mod_cern_meta.dsp | 95 - modules/metadata/mod_cern_meta.exp | 1 - modules/metadata/mod_cern_meta.mak | 327 - modules/metadata/mod_env.c | 276 - modules/metadata/mod_env.exp | 1 - modules/metadata/mod_expires.c | 520 - modules/metadata/mod_expires.dsp | 95 - modules/metadata/mod_expires.exp | 1 - modules/metadata/mod_expires.mak | 324 - modules/metadata/mod_headers.c | 269 - modules/metadata/mod_headers.dsp | 95 - modules/metadata/mod_headers.exp | 1 - modules/metadata/mod_headers.mak | 321 - modules/metadata/mod_mime_magic.c | 2501 ----- modules/metadata/mod_mime_magic.exp | 1 - modules/metadata/mod_setenvif.c | 471 - modules/metadata/mod_setenvif.exp | 1 - modules/metadata/mod_unique_id.c | 402 - modules/metadata/mod_unique_id.exp | 1 - modules/metadata/mod_usertrack.c | 328 - modules/metadata/mod_usertrack.dsp | 95 - modules/metadata/mod_usertrack.exp | 1 - modules/metadata/mod_usertrack.mak | 325 - modules/proxy/.cvsignore | 10 - modules/proxy/.indent.pro | 55 - modules/proxy/Makefile.in | 3 - modules/proxy/config.m4 | 24 - modules/proxy/libproxy.exp | 1 - modules/proxy/mod_proxy.c | 768 -- modules/proxy/mod_proxy.dsp | 123 - modules/proxy/mod_proxy.h | 259 - modules/proxy/mod_proxy.mak | 573 - modules/proxy/proxy_connect.c | 427 - modules/proxy/proxy_ftp.c | 1666 --- modules/proxy/proxy_http.c | 835 -- modules/proxy/proxy_util.c | 1187 -- modules/ssl/.cvsignore | 10 - modules/ssl/README | 163 - modules/ssl/README.dsov.fig | 346 - modules/ssl/README.dsov.ps | 1138 -- modules/ssl/mod_ssl.c | 248 - modules/ssl/mod_ssl.h | 854 -- modules/ssl/ssl_engine_config.c | 1093 -- modules/ssl/ssl_engine_dh.c | 255 - modules/ssl/ssl_engine_init.c | 1090 -- modules/ssl/ssl_engine_io.c | 728 -- modules/ssl/ssl_engine_kernel.c | 1905 ---- modules/ssl/ssl_engine_log.c | 326 - modules/ssl/ssl_engine_mutex.c | 397 - modules/ssl/ssl_engine_pphrase.c | 545 - modules/ssl/ssl_engine_rand.c | 215 - modules/ssl/ssl_engine_vars.c | 615 -- modules/ssl/ssl_expr.c | 119 - modules/ssl/ssl_expr.h | 139 - modules/ssl/ssl_expr_eval.c | 282 - modules/ssl/ssl_expr_parse.c | 605 -- modules/ssl/ssl_expr_parse.h | 29 - modules/ssl/ssl_expr_parse.y | 186 - modules/ssl/ssl_expr_scan.c | 2002 ---- modules/ssl/ssl_expr_scan.l | 261 - modules/ssl/ssl_scache.c | 204 - modules/ssl/ssl_scache_dbm.c | 440 - modules/ssl/ssl_scache_shmcb.c | 1343 --- modules/ssl/ssl_util.c | 437 - modules/ssl/ssl_util_ssl.c | 544 - modules/ssl/ssl_util_ssl.h | 115 - modules/test/.cvsignore | 7 - modules/test/.indent.pro | 54 - modules/test/README | 3 - modules/test/mod_autoindex.c | 1711 --- modules/test/mod_autoindex.exp | 1 - modules/test/mod_optional_fn_export.c | 86 - modules/test/mod_optional_fn_export.h | 3 - modules/test/mod_optional_fn_import.c | 93 - modules/test/mod_rndchunk.c | 179 - modules/test/mod_test_util_uri.c | 354 - modules/tls/.cvsignore | 6 - modules/tls/Makefile.in | 2 - modules/tls/README | 20 - modules/tls/config.m4 | 43 - modules/tls/mod_tls.c | 417 - modules/tls/openssl_state_machine.c | 268 - modules/tls/openssl_state_machine.h | 15 - os/.cvsignore | 2 - os/.indent.pro | 54 - os/Makefile.in | 4 - os/beos/.cvsignore | 5 - os/beos/Makefile.in | 5 - os/beos/beosd.c | 163 - os/beos/beosd.h | 95 - os/beos/config.m4 | 3 - os/beos/os.c | 84 - os/beos/os.h | 83 - os/bs2000/.cvsignore | 2 - os/bs2000/bs2login.c | 308 - os/bs2000/ebcdic.c | 252 - os/bs2000/ebcdic.h | 66 - os/bs2000/os-inline.c | 87 - os/bs2000/os.c | 76 - os/bs2000/os.h | 91 - os/config.m4 | 25 - os/os2/.cvsignore | 5 - os/os2/Makefile.in | 5 - os/os2/config.m4 | 3 - os/os2/core.mk | 7 - os/os2/core_header.def | 29 - os/os2/os-inline.c | 93 - os/os2/os.h | 96 - os/os2/util_os2.c | 183 - os/tpf/.cvsignore | 2 - os/tpf/TPFExport | 7 - os/tpf/ebcdic.c | 221 - os/tpf/ebcdic.h | 66 - os/tpf/os-inline.c | 87 - os/tpf/os.c | 178 - os/tpf/os.h | 145 - os/tpf/samples/linkdll.jcl | 121 - os/tpf/samples/loadset.jcl | 58 - os/unix/.cvsignore | 5 - os/unix/Makefile.in | 5 - os/unix/config.m4 | 7 - os/unix/os-inline.c | 87 - os/unix/os.h | 136 - os/unix/unixd.c | 372 - os/unix/unixd.h | 127 - os/win32/.cvsignore | 8 - os/win32/BaseAddr.ref | 26 - os/win32/apache.ico | Bin 1078 -> 0 bytes os/win32/apache.rc | 78 - os/win32/modules.c | 79 - os/win32/os.h | 129 - os/win32/util_win32.c | 514 - server/.cvsignore | 14 - server/.indent.pro | 54 - server/Makefile.in | 69 - server/buildmark.c | 67 - server/config.c | 1763 --- server/config.m4 | 29 - server/connection.c | 263 - server/core.c | 3336 ------ server/error_bucket.c | 106 - server/gen_test_char.c | 128 - server/gen_test_char.dsp | 90 - server/gen_test_char.mak | 300 - server/gen_uri_delims.c | 89 - server/gen_uri_delims.dsp | 90 - server/gen_uri_delims.mak | 203 - server/listen.c | 390 - server/log.c | 753 -- server/main.c | 464 - server/mpm/.cvsignore | 2 - server/mpm/MPM.NAMING | 13 - server/mpm/Makefile.in | 4 - server/mpm/beos/.cvsignore | 5 - server/mpm/beos/Makefile.in | 5 - server/mpm/beos/beos.c | 1122 -- server/mpm/beos/beos.h | 69 - server/mpm/beos/config5.m4 | 7 - server/mpm/beos/mpm.h | 77 - server/mpm/beos/mpm_default.h | 149 - server/mpm/config.m4 | 34 - server/mpm/experimental/perchild/.cvsignore | 5 - server/mpm/experimental/perchild/Makefile.in | 5 - server/mpm/experimental/perchild/config5.m4 | 6 - server/mpm/experimental/perchild/mpm.h | 91 - .../mpm/experimental/perchild/mpm_default.h | 147 - server/mpm/experimental/perchild/perchild.c | 1829 ---- server/mpm/monitoring-services.txt | 94 - server/mpm/perchild/.cvsignore | 5 - server/mpm/perchild/Makefile.in | 5 - server/mpm/perchild/config5.m4 | 6 - server/mpm/perchild/mpm.h | 91 - server/mpm/perchild/mpm_default.h | 147 - server/mpm/perchild/perchild.c | 1829 ---- server/mpm/prefork/.cvsignore | 5 - server/mpm/prefork/Makefile.in | 5 - server/mpm/prefork/config.m4 | 3 - server/mpm/prefork/mpm.h | 80 - server/mpm/prefork/mpm_default.h | 135 - server/mpm/prefork/prefork.c | 1515 --- server/mpm/spmt_os2/.cvsignore | 5 - server/mpm/spmt_os2/Makefile.in | 5 - server/mpm/spmt_os2/config5.m4 | 5 - server/mpm/spmt_os2/mpm.h | 74 - server/mpm/spmt_os2/mpm_default.h | 123 - server/mpm/spmt_os2/spmt_os2.c | 1322 --- server/mpm/threaded/.cvsignore | 5 - server/mpm/threaded/Makefile.in | 5 - server/mpm/threaded/config5.m4 | 5 - server/mpm/threaded/mpm.h | 79 - server/mpm/threaded/mpm_default.h | 154 - server/mpm/threaded/threaded.c | 1450 --- server/mpm/winnt/Win9xConHook.c | 739 -- server/mpm/winnt/Win9xConHook.def | 10 - server/mpm/winnt/Win9xConHook.dsp | 103 - server/mpm/winnt/Win9xConHook.h | 99 - server/mpm/winnt/mpm.h | 71 - server/mpm/winnt/mpm_default.h | 135 - server/mpm/winnt/mpm_winnt.c | 2114 ---- server/mpm/winnt/mpm_winnt.h | 159 - server/mpm/winnt/registry.c | 489 - server/mpm/winnt/service.c | 1292 --- server/mpm_common.c | 344 - server/protocol.c | 1176 -- server/request.c | 1133 -- server/rfc1413.c | 288 - server/scoreboard.c | 340 - server/util.c | 1907 ---- server/util_cfgtree.c | 89 - server/util_charset.c | 99 - server/util_date.c | 306 - server/util_debug.c | 120 - server/util_ebcdic.c | 168 - server/util_filter.c | 305 - server/util_md5.c | 215 - server/util_script.c | 652 -- server/util_uri.c | 359 - server/util_xml.c | 134 - server/vhost.c | 1017 -- srclib/.cvsignore | 3 - srclib/Makefile.in | 4 - srclib/pcre/.cvsignore | 22 - srclib/pcre/AUTHORS | 6 - srclib/pcre/COPYING | 32 - srclib/pcre/ChangeLog | 615 -- srclib/pcre/INSTALL | 185 - srclib/pcre/LICENCE | 44 - srclib/pcre/Makefile.in | 20 - srclib/pcre/NEWS | 46 - srclib/pcre/NON-UNIX-USE | 50 - srclib/pcre/README | 239 - srclib/pcre/RunTest | 94 - srclib/pcre/config.guess | 1121 -- srclib/pcre/config.hw | 28 - srclib/pcre/config.in | 33 - srclib/pcre/config.sub | 1232 --- srclib/pcre/configure.in | 75 - srclib/pcre/dftables.c | 148 - srclib/pcre/dftables.dsp | 165 - srclib/pcre/dftables.mak | 255 - srclib/pcre/dll.mk | 60 - srclib/pcre/doc/Tech.Notes | 242 - srclib/pcre/doc/pcre.3 | 1701 --- srclib/pcre/doc/pcre.html | 2258 ---- srclib/pcre/doc/pcre.txt | 1977 ---- srclib/pcre/doc/pcreposix.3 | 141 - srclib/pcre/doc/pcreposix.html | 182 - srclib/pcre/doc/pcreposix.txt | 150 - srclib/pcre/doc/pcretest.txt | 217 - srclib/pcre/doc/perltest.txt | 23 - srclib/pcre/doc/pgrep.1 | 76 - srclib/pcre/doc/pgrep.html | 105 - srclib/pcre/doc/pgrep.txt | 86 - srclib/pcre/get.c | 189 - srclib/pcre/install-sh | 251 - srclib/pcre/internal.h | 376 - srclib/pcre/ltconfig | 3078 ------ srclib/pcre/ltmain.sh | 4012 ------- srclib/pcre/maketables.c | 132 - srclib/pcre/pcre-config.in | 59 - srclib/pcre/pcre.c | 4828 --------- srclib/pcre/pcre.def | 19 - srclib/pcre/pcre.dsp | 200 - srclib/pcre/pcre.hw | 107 - srclib/pcre/pcre.in | 107 - srclib/pcre/pcre.mak | 348 - srclib/pcre/pcreposix.c | 276 - srclib/pcre/pcreposix.dsp | 159 - srclib/pcre/pcreposix.h | 88 - srclib/pcre/pcreposix.mak | 285 - srclib/pcre/pcretest.c | 1072 -- srclib/pcre/perltest | 169 - srclib/pcre/pgrep.c | 225 - srclib/pcre/study.c | 397 - srclib/pcre/testdata/testinput1 | 1901 ---- srclib/pcre/testdata/testinput2 | 710 -- srclib/pcre/testdata/testinput3 | 1710 --- srclib/pcre/testdata/testinput4 | 64 - srclib/pcre/testdata/testoutput1 | 2924 ----- srclib/pcre/testdata/testoutput2 | 2072 ---- srclib/pcre/testdata/testoutput3 | 2967 ----- srclib/pcre/testdata/testoutput4 | 115 - support/.cvsignore | 27 - support/.indent.pro | 54 - support/Makefile.in | 46 - support/README | 62 - support/SHA1/README.sha1 | 34 - support/SHA1/convert-sha1.pl | 36 - support/SHA1/htpasswd-sha1.pl | 22 - support/SHA1/ldif-sha1.example | 19 - support/ab.c | 1670 --- support/ab.dsp | 90 - support/ab.mak | 290 - support/apachectl.in | 234 - support/apxs.in | 646 -- support/dbmmanage | 350 - support/dbmmanage.in | 350 - support/htdigest.c | 318 - support/htdigest.dsp | 90 - support/htdigest.mak | 291 - support/htpasswd.c | 679 -- support/htpasswd.dsp | 90 - support/htpasswd.mak | 294 - support/httpd.exp | 711 -- support/log_server_status | 114 - support/log_server_status.in | 114 - support/logresolve.c | 378 - support/logresolve.dsp | 90 - support/logresolve.mak | 214 - support/logresolve.pl | 261 - support/logresolve.pl.in | 261 - support/phf_abuse_log.cgi | 22 - support/phf_abuse_log.cgi.in | 22 - support/rotatelogs.c | 208 - support/rotatelogs.dsp | 90 - support/rotatelogs.mak | 212 - support/split-logfile | 98 - support/split-logfile.in | 98 - support/suexec.c | 634 -- support/suexec.h | 140 - test/.cvsignore | 16 - test/.indent.pro | 54 - test/Makefile.in | 19 - test/README | 3 - test/check_chunked | 42 - test/cls.c | 166 - test/tcpdumpscii.txt | 50 - test/test-writev.c | 85 - test/test_date.c | 180 - test/test_find.c | 62 - test/test_limits.c | 200 - test/test_parser.c | 59 - test/test_select.c | 30 - test/time-sem.c | 572 - test/zb.c | 567 - 937 files changed, 262081 deletions(-) delete mode 100644 .cvsignore delete mode 100644 .gdbinit delete mode 100644 ABOUT_APACHE delete mode 100644 Apache.dsp delete mode 100644 Apache.dsw delete mode 100644 Apache.mak delete mode 100644 CHANGES delete mode 100644 INSTALL delete mode 100644 InstallBin.dsp delete mode 100644 KEYS delete mode 100644 LICENSE delete mode 100644 Makefile.in delete mode 100644 Makefile.win delete mode 100644 README delete mode 100644 STATUS delete mode 100644 acinclude.m4 delete mode 100755 build/binbuild.sh delete mode 100755 build/bsd_makefile delete mode 100644 build/build-modules-c.awk delete mode 100644 build/buildexports.awk delete mode 100755 build/buildexports.sh delete mode 100755 build/buildinfo.sh delete mode 100755 build/config-stubs delete mode 100644 build/default.pl delete mode 100755 build/fastgen.sh delete mode 100644 build/fixwin32mak.pl delete mode 100755 build/httpd_roll_release delete mode 100755 build/install.sh delete mode 100644 build/library.mk delete mode 100644 build/ltlib.mk delete mode 100644 build/mkdep.perl delete mode 100755 build/mkdir.sh delete mode 100644 build/program.mk delete mode 100644 build/rules.mk delete mode 100644 build/special.mk delete mode 100755 build/sysv_makefile delete mode 100755 buildconf delete mode 100644 config.layout delete mode 100644 configure.in delete mode 100644 docs/STATUS delete mode 100644 docs/cgi-examples/printenv delete mode 100644 docs/cgi-examples/test-cgi delete mode 100755 docs/conf/highperformance-std.conf delete mode 100644 docs/conf/httpd-std.conf delete mode 100644 docs/conf/httpd-win.conf delete mode 100644 docs/conf/magic delete mode 100644 docs/conf/mime.types delete mode 100644 docs/docroot/README.rus delete mode 100644 docs/docroot/apache_pb.gif delete mode 100644 docs/docroot/apache_pb2.gif delete mode 100644 docs/docroot/apache_pb2_ani.gif delete mode 100644 docs/docroot/index.html.ca delete mode 100644 docs/docroot/index.html.cz delete mode 100644 docs/docroot/index.html.de delete mode 100644 docs/docroot/index.html.dk delete mode 100644 docs/docroot/index.html.ee delete mode 100644 docs/docroot/index.html.el delete mode 100644 docs/docroot/index.html.en delete mode 100644 docs/docroot/index.html.es delete mode 100644 docs/docroot/index.html.et delete mode 100644 docs/docroot/index.html.fr delete mode 100644 docs/docroot/index.html.he.iso8859-8 delete mode 100644 docs/docroot/index.html.it delete mode 100644 docs/docroot/index.html.ja.iso2022-jp delete mode 100644 docs/docroot/index.html.ja.jis delete mode 100644 docs/docroot/index.html.kr.iso-kr delete mode 100644 docs/docroot/index.html.kr.iso2022-kr delete mode 100644 docs/docroot/index.html.ltz delete mode 100644 docs/docroot/index.html.lu delete mode 100644 docs/docroot/index.html.nl delete mode 100644 docs/docroot/index.html.no delete mode 100644 docs/docroot/index.html.po.iso-pl delete mode 100644 docs/docroot/index.html.pt delete mode 100644 docs/docroot/index.html.pt-br delete mode 100644 docs/docroot/index.html.ru.cp-1251 delete mode 100644 docs/docroot/index.html.ru.cp866 delete mode 100644 docs/docroot/index.html.ru.iso-ru delete mode 100644 docs/docroot/index.html.ru.koi8-r delete mode 100644 docs/docroot/index.html.ru.ucs2 delete mode 100644 docs/docroot/index.html.ru.ucs4 delete mode 100644 docs/docroot/index.html.ru.utf8 delete mode 100644 docs/docroot/index.html.se delete mode 100644 docs/docroot/index.html.tw delete mode 100644 docs/docroot/index.html.tw.Big5 delete mode 100644 docs/doxygen.conf delete mode 100644 docs/icons/README delete mode 100644 docs/icons/a.gif delete mode 100644 docs/icons/alert.black.gif delete mode 100644 docs/icons/alert.red.gif delete mode 100644 docs/icons/apache_pb.gif delete mode 100644 docs/icons/apache_pb2.gif delete mode 100644 docs/icons/apache_pb2_ani.gif delete mode 100644 docs/icons/back.gif delete mode 100644 docs/icons/ball.gray.gif delete mode 100644 docs/icons/ball.red.gif delete mode 100644 docs/icons/binary.gif delete mode 100644 docs/icons/binhex.gif delete mode 100644 docs/icons/blank.gif delete mode 100644 docs/icons/bomb.gif delete mode 100644 docs/icons/box1.gif delete mode 100644 docs/icons/box2.gif delete mode 100644 docs/icons/broken.gif delete mode 100644 docs/icons/burst.gif delete mode 100644 docs/icons/c.gif delete mode 100644 docs/icons/comp.blue.gif delete mode 100644 docs/icons/comp.gray.gif delete mode 100644 docs/icons/compressed.gif delete mode 100644 docs/icons/continued.gif delete mode 100644 docs/icons/dir.gif delete mode 100644 docs/icons/down.gif delete mode 100644 docs/icons/dvi.gif delete mode 100644 docs/icons/f.gif delete mode 100644 docs/icons/folder.gif delete mode 100644 docs/icons/folder.open.gif delete mode 100644 docs/icons/folder.sec.gif delete mode 100644 docs/icons/forward.gif delete mode 100644 docs/icons/generic.gif delete mode 100644 docs/icons/generic.red.gif delete mode 100644 docs/icons/generic.sec.gif delete mode 100644 docs/icons/hand.right.gif delete mode 100644 docs/icons/hand.up.gif delete mode 100644 docs/icons/icon.sheet.gif delete mode 100644 docs/icons/image1.gif delete mode 100644 docs/icons/image2.gif delete mode 100644 docs/icons/image3.gif delete mode 100644 docs/icons/index.gif delete mode 100644 docs/icons/layout.gif delete mode 100644 docs/icons/left.gif delete mode 100644 docs/icons/link.gif delete mode 100644 docs/icons/movie.gif delete mode 100644 docs/icons/p.gif delete mode 100644 docs/icons/patch.gif delete mode 100644 docs/icons/pdf.gif delete mode 100644 docs/icons/pie0.gif delete mode 100644 docs/icons/pie1.gif delete mode 100644 docs/icons/pie2.gif delete mode 100644 docs/icons/pie3.gif delete mode 100644 docs/icons/pie4.gif delete mode 100644 docs/icons/pie5.gif delete mode 100644 docs/icons/pie6.gif delete mode 100644 docs/icons/pie7.gif delete mode 100644 docs/icons/pie8.gif delete mode 100644 docs/icons/portal.gif delete mode 100644 docs/icons/ps.gif delete mode 100644 docs/icons/quill.gif delete mode 100644 docs/icons/right.gif delete mode 100644 docs/icons/screw1.gif delete mode 100644 docs/icons/screw2.gif delete mode 100644 docs/icons/script.gif delete mode 100644 docs/icons/small/README.txt delete mode 100644 docs/icons/small/back.gif delete mode 100644 docs/icons/small/binary.gif delete mode 100644 docs/icons/small/binhex.gif delete mode 100644 docs/icons/small/blank.gif delete mode 100644 docs/icons/small/broken.gif delete mode 100644 docs/icons/small/burst.gif delete mode 100644 docs/icons/small/comp1.gif delete mode 100644 docs/icons/small/comp2.gif delete mode 100644 docs/icons/small/compressed.gif delete mode 100644 docs/icons/small/continued.gif delete mode 100644 docs/icons/small/dir.gif delete mode 100644 docs/icons/small/dir2.gif delete mode 100644 docs/icons/small/doc.gif delete mode 100644 docs/icons/small/forward.gif delete mode 100644 docs/icons/small/generic.gif delete mode 100644 docs/icons/small/generic2.gif delete mode 100644 docs/icons/small/generic3.gif delete mode 100644 docs/icons/small/image.gif delete mode 100644 docs/icons/small/image2.gif delete mode 100644 docs/icons/small/index.gif delete mode 100644 docs/icons/small/key.gif delete mode 100644 docs/icons/small/movie.gif delete mode 100644 docs/icons/small/patch.gif delete mode 100644 docs/icons/small/ps.gif delete mode 100644 docs/icons/small/rainbow.gif delete mode 100644 docs/icons/small/sound.gif delete mode 100644 docs/icons/small/sound2.gif delete mode 100644 docs/icons/small/tar.gif delete mode 100644 docs/icons/small/text.gif delete mode 100644 docs/icons/small/transfer.gif delete mode 100644 docs/icons/small/unknown.gif delete mode 100644 docs/icons/small/uu.gif delete mode 100644 docs/icons/sound1.gif delete mode 100644 docs/icons/sound2.gif delete mode 100644 docs/icons/sphere1.gif delete mode 100644 docs/icons/sphere2.gif delete mode 100644 docs/icons/tar.gif delete mode 100644 docs/icons/tex.gif delete mode 100644 docs/icons/text.gif delete mode 100644 docs/icons/transfer.gif delete mode 100644 docs/icons/unknown.gif delete mode 100644 docs/icons/up.gif delete mode 100644 docs/icons/uu.gif delete mode 100644 docs/icons/uuencoded.gif delete mode 100644 docs/icons/world1.gif delete mode 100644 docs/icons/world2.gif delete mode 100644 docs/man/ab.8 delete mode 100644 docs/man/apachectl.8 delete mode 100644 docs/man/apxs.8 delete mode 100644 docs/man/dbmmanage.1 delete mode 100644 docs/man/htdigest.1 delete mode 100644 docs/man/htpasswd.1 delete mode 100644 docs/man/httpd.8 delete mode 100644 docs/man/logresolve.8 delete mode 100644 docs/man/rotatelogs.8 delete mode 100644 docs/man/suexec.8 delete mode 100644 docs/manual/LICENSE delete mode 100644 docs/manual/bind.html delete mode 100644 docs/manual/bind.html.en delete mode 100644 docs/manual/cgi_path.html delete mode 100644 docs/manual/cgi_path.html.en delete mode 100644 docs/manual/configuring.html.en delete mode 100644 docs/manual/configuring.html.html delete mode 100644 docs/manual/configuring.html.ja.jis delete mode 100644 docs/manual/content-negotiation.html delete mode 100644 docs/manual/content-negotiation.html.en delete mode 100644 docs/manual/custom-error.html delete mode 100644 docs/manual/custom-error.html.en delete mode 100644 docs/manual/developer/API.html delete mode 100644 docs/manual/developer/debugging.html delete mode 100644 docs/manual/developer/documenting delete mode 100644 docs/manual/developer/footer.html delete mode 100644 docs/manual/developer/header.html delete mode 100644 docs/manual/developer/hooks.html delete mode 100644 docs/manual/developer/index.html delete mode 100644 docs/manual/developer/layeredio.html delete mode 100644 docs/manual/developer/modules.html delete mode 100644 docs/manual/developer/modules.html.en delete mode 100644 docs/manual/dns-caveats.html delete mode 100644 docs/manual/dso.html delete mode 100644 docs/manual/dso.html.en delete mode 100644 docs/manual/ebcdic.html delete mode 100644 docs/manual/env.html delete mode 100644 docs/manual/env.html.en delete mode 100644 docs/manual/expand.pl delete mode 100644 docs/manual/filter.html delete mode 100644 docs/manual/filter.html.en delete mode 100644 docs/manual/footer.html delete mode 100644 docs/manual/handler.html.en delete mode 100644 docs/manual/handler.html.html delete mode 100644 docs/manual/handler.html.ja.jis delete mode 100644 docs/manual/header.html delete mode 100644 docs/manual/howto/cgi.html.en delete mode 100644 docs/manual/howto/cgi.html.ja.jis delete mode 100644 docs/manual/howto/footer.html delete mode 100644 docs/manual/howto/header.html delete mode 100644 docs/manual/howto/ssi.html.en delete mode 100644 docs/manual/howto/ssi.html.ja.jis delete mode 100644 docs/manual/images/apache_header.gif delete mode 100644 docs/manual/images/custom_errordocs.gif delete mode 100644 docs/manual/images/home.gif delete mode 100644 docs/manual/images/index.gif delete mode 100644 docs/manual/images/mod_rewrite_fig1.fig delete mode 100644 docs/manual/images/mod_rewrite_fig1.gif delete mode 100644 docs/manual/images/mod_rewrite_fig2.fig delete mode 100644 docs/manual/images/mod_rewrite_fig2.gif delete mode 100644 docs/manual/images/pixel.gif delete mode 100644 docs/manual/images/sub.gif delete mode 100644 docs/manual/index.html.en delete mode 100644 docs/manual/index.html.fr delete mode 100644 docs/manual/index.html.html delete mode 100644 docs/manual/index.html.ja.jis delete mode 100644 docs/manual/install-tpf.html delete mode 100644 docs/manual/install.html delete mode 100644 docs/manual/install.html.en delete mode 100644 docs/manual/invoking.html delete mode 100644 docs/manual/invoking.html.en delete mode 100644 docs/manual/location.html delete mode 100644 docs/manual/misc/API.html delete mode 100644 docs/manual/misc/FAQ-A.html delete mode 100644 docs/manual/misc/FAQ-B.html delete mode 100644 docs/manual/misc/FAQ-C.html delete mode 100644 docs/manual/misc/FAQ-D.html delete mode 100644 docs/manual/misc/FAQ-E.html delete mode 100644 docs/manual/misc/FAQ-F.html delete mode 100644 docs/manual/misc/FAQ-G.html delete mode 100644 docs/manual/misc/FAQ-H.html delete mode 100644 docs/manual/misc/FAQ-I.html delete mode 100644 docs/manual/misc/FAQ.html delete mode 100644 docs/manual/misc/client_block_api.html delete mode 100644 docs/manual/misc/compat_notes.html delete mode 100644 docs/manual/misc/custom_errordocs.html delete mode 100644 docs/manual/misc/descriptors.html delete mode 100644 docs/manual/misc/fin_wait_2.html delete mode 100644 docs/manual/misc/footer.html delete mode 100644 docs/manual/misc/header.html delete mode 100644 docs/manual/misc/howto.html delete mode 100644 docs/manual/misc/index.html delete mode 100644 docs/manual/misc/known_client_problems.html delete mode 100644 docs/manual/misc/perf-tuning.html delete mode 100644 docs/manual/misc/rewriteguide.html delete mode 100644 docs/manual/misc/security_tips.html delete mode 100644 docs/manual/misc/tutorials.html delete mode 100644 docs/manual/mod/core.html delete mode 100644 docs/manual/mod/directive-dict.html delete mode 100644 docs/manual/mod/directive-dict.html.en delete mode 100644 docs/manual/mod/directives.html delete mode 100644 docs/manual/mod/footer.html delete mode 100644 docs/manual/mod/header.html delete mode 100644 docs/manual/mod/index-bytype.html delete mode 100644 docs/manual/mod/index.html delete mode 100644 docs/manual/mod/mod_access.html delete mode 100644 docs/manual/mod/mod_actions.html delete mode 100644 docs/manual/mod/mod_alias.html delete mode 100644 docs/manual/mod/mod_asis.html delete mode 100644 docs/manual/mod/mod_auth.html delete mode 100644 docs/manual/mod/mod_auth_anon.html delete mode 100644 docs/manual/mod/mod_auth_db.html delete mode 100644 docs/manual/mod/mod_auth_dbm.html delete mode 100644 docs/manual/mod/mod_auth_digest.html delete mode 100644 docs/manual/mod/mod_autoindex.html delete mode 100644 docs/manual/mod/mod_cern_meta.html delete mode 100644 docs/manual/mod/mod_cgi.html delete mode 100644 docs/manual/mod/mod_charset_lite.html delete mode 100644 docs/manual/mod/mod_dav.html delete mode 100644 docs/manual/mod/mod_dir.html delete mode 100644 docs/manual/mod/mod_env.html delete mode 100644 docs/manual/mod/mod_example.html delete mode 100644 docs/manual/mod/mod_expires.html delete mode 100644 docs/manual/mod/mod_ext_filter.html delete mode 100644 docs/manual/mod/mod_file_cache.html delete mode 100644 docs/manual/mod/mod_headers.html delete mode 100644 docs/manual/mod/mod_imap.html delete mode 100644 docs/manual/mod/mod_include.html delete mode 100644 docs/manual/mod/mod_info.html delete mode 100644 docs/manual/mod/mod_isapi.html delete mode 100644 docs/manual/mod/mod_log_config.html delete mode 100644 docs/manual/mod/mod_mime.html delete mode 100644 docs/manual/mod/mod_mime_magic.html delete mode 100644 docs/manual/mod/mod_mmap_static.html delete mode 100644 docs/manual/mod/mod_negotiation.html delete mode 100644 docs/manual/mod/mod_proxy.html delete mode 100644 docs/manual/mod/mod_rewrite.html delete mode 100644 docs/manual/mod/mod_setenvif.html delete mode 100644 docs/manual/mod/mod_so.html delete mode 100644 docs/manual/mod/mod_speling.html delete mode 100644 docs/manual/mod/mod_status.html delete mode 100644 docs/manual/mod/mod_unique_id.html delete mode 100644 docs/manual/mod/mod_userdir.html delete mode 100644 docs/manual/mod/mod_usertrack.html delete mode 100644 docs/manual/mod/mod_vhost_alias.html delete mode 100644 docs/manual/mod/module-dict.html delete mode 100644 docs/manual/mod/module-dict.html.en delete mode 100644 docs/manual/mod/mpm_common.html delete mode 100644 docs/manual/mod/mpm_winnt.html delete mode 100644 docs/manual/mod/perchild.html delete mode 100644 docs/manual/mod/prefork.html delete mode 100644 docs/manual/mod/threaded.html delete mode 100644 docs/manual/mpm.html delete mode 100644 docs/manual/mpm.html.en delete mode 100644 docs/manual/new_features_2_0.html delete mode 100644 docs/manual/new_features_2_0.html.en delete mode 100644 docs/manual/new_features_2_0.html.fr delete mode 100644 docs/manual/platform/footer.html delete mode 100644 docs/manual/platform/header.html delete mode 100644 docs/manual/platform/netware.html delete mode 100644 docs/manual/platform/perf-bsd44.html delete mode 100644 docs/manual/platform/perf-dec.html delete mode 100644 docs/manual/platform/perf-hp.html delete mode 100644 docs/manual/platform/perf.html delete mode 100644 docs/manual/platform/readme-tpf.html delete mode 100644 docs/manual/platform/unixware.html delete mode 100644 docs/manual/platform/win_compiling.html delete mode 100644 docs/manual/platform/win_service.html delete mode 100644 docs/manual/platform/windows.html delete mode 100644 docs/manual/process-model.html delete mode 100644 docs/manual/programs/ab.html delete mode 100644 docs/manual/programs/apachectl.html delete mode 100644 docs/manual/programs/apxs.html delete mode 100644 docs/manual/programs/dbmmanage.html delete mode 100644 docs/manual/programs/footer.html delete mode 100644 docs/manual/programs/header.html delete mode 100644 docs/manual/programs/htdigest.html delete mode 100644 docs/manual/programs/htpasswd.html delete mode 100644 docs/manual/programs/httpd.html delete mode 100755 docs/manual/programs/index.html delete mode 100644 docs/manual/programs/logresolve.html delete mode 100755 docs/manual/programs/other.html delete mode 100644 docs/manual/programs/rotatelogs.html delete mode 100644 docs/manual/programs/suexec.html delete mode 100644 docs/manual/search/manual-index.cgi delete mode 100644 docs/manual/sections.html delete mode 100644 docs/manual/sections.html.en delete mode 100644 docs/manual/server-wide.html.en delete mode 100644 docs/manual/server-wide.html.html delete mode 100644 docs/manual/server-wide.html.ja.jis delete mode 100644 docs/manual/stopping.html delete mode 100644 docs/manual/stopping.html.en delete mode 100644 docs/manual/suexec.html delete mode 100644 docs/manual/suexec.html.en delete mode 100644 docs/manual/upgrading.html delete mode 100644 docs/manual/upgrading.html.en delete mode 100644 docs/manual/upgrading.html.fr delete mode 100755 docs/manual/urlmapping.html delete mode 100755 docs/manual/urlmapping.html.en delete mode 100644 docs/manual/vhosts/details.html delete mode 100644 docs/manual/vhosts/examples.html delete mode 100644 docs/manual/vhosts/fd-limits.html delete mode 100644 docs/manual/vhosts/fd-limits.html.en delete mode 100644 docs/manual/vhosts/footer.html delete mode 100644 docs/manual/vhosts/header.html delete mode 100644 docs/manual/vhosts/host.html delete mode 100644 docs/manual/vhosts/index.html delete mode 100644 docs/manual/vhosts/index.html.en delete mode 100644 docs/manual/vhosts/ip-based.html delete mode 100644 docs/manual/vhosts/mass.html delete mode 100644 docs/manual/vhosts/name-based.html delete mode 100644 docs/manual/vhosts/name-based.html.en delete mode 100644 docs/manual/vhosts/vhosts-in-depth.html delete mode 100644 docs/manual/vhosts/virtual-host.html delete mode 100644 emacs-style delete mode 100644 hints.m4 delete mode 100644 include/.cvsignore delete mode 100644 include/.indent.pro delete mode 100644 include/ap_compat.h delete mode 100644 include/ap_config.h delete mode 100644 include/ap_listen.h delete mode 100644 include/ap_mmn.h delete mode 100644 include/ap_mpm.h delete mode 100644 include/ap_release.h delete mode 100644 include/http_config.h delete mode 100644 include/http_connection.h delete mode 100644 include/http_core.h delete mode 100644 include/http_log.h delete mode 100644 include/http_main.h delete mode 100644 include/http_protocol.h delete mode 100644 include/http_request.h delete mode 100644 include/http_vhost.h delete mode 100644 include/httpd.h delete mode 100644 include/mpm_common.h delete mode 100644 include/pcreposix.h delete mode 100644 include/rfc1413.h delete mode 100644 include/scoreboard.h delete mode 100644 include/util_cfgtree.h delete mode 100644 include/util_charset.h delete mode 100644 include/util_date.h delete mode 100644 include/util_ebcdic.h delete mode 100644 include/util_filter.h delete mode 100644 include/util_md5.h delete mode 100644 include/util_script.h delete mode 100644 include/util_uri.h delete mode 100644 include/util_xml.h delete mode 100644 libhttpd.dsp delete mode 100644 libhttpd.mak delete mode 100644 modules/.cvsignore delete mode 100644 modules/Makefile.in delete mode 100644 modules/README delete mode 100644 modules/aaa/.cvsignore delete mode 100644 modules/aaa/.indent.pro delete mode 100644 modules/aaa/Makefile.in delete mode 100644 modules/aaa/config.m4 delete mode 100644 modules/aaa/mod_access.c delete mode 100644 modules/aaa/mod_access.exp delete mode 100644 modules/aaa/mod_auth.c delete mode 100644 modules/aaa/mod_auth.exp delete mode 100644 modules/aaa/mod_auth_anon.c delete mode 100644 modules/aaa/mod_auth_anon.dsp delete mode 100644 modules/aaa/mod_auth_anon.exp delete mode 100644 modules/aaa/mod_auth_anon.mak delete mode 100644 modules/aaa/mod_auth_db.c delete mode 100644 modules/aaa/mod_auth_db.module delete mode 100644 modules/aaa/mod_auth_dbm.c delete mode 100644 modules/aaa/mod_auth_dbm.dsp delete mode 100644 modules/aaa/mod_auth_dbm.exp delete mode 100644 modules/aaa/mod_auth_dbm.mak delete mode 100644 modules/aaa/mod_auth_digest.c delete mode 100644 modules/aaa/mod_auth_digest.dsp delete mode 100644 modules/aaa/mod_auth_digest.mak delete mode 100644 modules/arch/win32/mod_isapi.c delete mode 100644 modules/cache/.cvsignore delete mode 100644 modules/cache/.indent.pro delete mode 100644 modules/cache/Makefile.in delete mode 100644 modules/cache/config.m4 delete mode 100644 modules/cache/mod_file_cache.c delete mode 100644 modules/cache/mod_file_cache.dsp delete mode 100644 modules/cache/mod_file_cache.mak delete mode 100644 modules/config5.m4 delete mode 100644 modules/dav/fs/.cvsignore delete mode 100644 modules/dav/fs/Makefile.in delete mode 100644 modules/dav/fs/config6.m4 delete mode 100644 modules/dav/fs/dbm.c delete mode 100644 modules/dav/fs/lock.c delete mode 100644 modules/dav/fs/mod_dav_fs.c delete mode 100644 modules/dav/fs/mod_dav_fs.dsp delete mode 100644 modules/dav/fs/mod_dav_fs.mak delete mode 100644 modules/dav/fs/repos.c delete mode 100644 modules/dav/fs/repos.h delete mode 100644 modules/dav/main/.cvsignore delete mode 100644 modules/dav/main/Makefile.in delete mode 100644 modules/dav/main/config5.m4 delete mode 100644 modules/dav/main/liveprop.c delete mode 100644 modules/dav/main/mod_dav.c delete mode 100644 modules/dav/main/mod_dav.dsp delete mode 100644 modules/dav/main/mod_dav.h delete mode 100644 modules/dav/main/mod_dav.mak delete mode 100644 modules/dav/main/props.c delete mode 100644 modules/dav/main/providers.c delete mode 100644 modules/dav/main/std_liveprop.c delete mode 100644 modules/dav/main/util.c delete mode 100644 modules/dav/main/util_lock.c delete mode 100644 modules/echo/.cvsignore delete mode 100644 modules/echo/.indent.pro delete mode 100644 modules/echo/Makefile.in delete mode 100644 modules/echo/config.m4 delete mode 100644 modules/echo/mod_echo.c delete mode 100644 modules/experimental/.cvsignore delete mode 100644 modules/experimental/.indent.pro delete mode 100644 modules/experimental/Makefile.in delete mode 100644 modules/experimental/README delete mode 100644 modules/experimental/config.m4 delete mode 100644 modules/experimental/mod_cache.c delete mode 100644 modules/experimental/mod_cache.h delete mode 100644 modules/experimental/mod_case_filter.c delete mode 100644 modules/experimental/mod_charset_lite.c delete mode 100644 modules/experimental/mod_disk_cache.c delete mode 100644 modules/experimental/mod_example.c delete mode 100644 modules/experimental/mod_ext_filter.c delete mode 100644 modules/experimental/mod_generic_hook_export.c delete mode 100644 modules/experimental/mod_generic_hook_export.dsp delete mode 100644 modules/experimental/mod_generic_hook_export.h delete mode 100644 modules/experimental/mod_generic_hook_import.c delete mode 100644 modules/experimental/mod_generic_hook_import.dsp delete mode 100644 modules/experimental/mod_optional_fn_export.c delete mode 100644 modules/experimental/mod_optional_fn_export.h delete mode 100644 modules/experimental/mod_optional_fn_import.c delete mode 100644 modules/filters/.cvsignore delete mode 100644 modules/filters/.indent.pro delete mode 100644 modules/filters/Makefile.in delete mode 100644 modules/filters/config.m4 delete mode 100644 modules/filters/mod_include.c delete mode 100644 modules/filters/mod_include.exp delete mode 100644 modules/filters/mod_include.h delete mode 100644 modules/generators/.cvsignore delete mode 100644 modules/generators/.indent.pro delete mode 100644 modules/generators/Makefile.in delete mode 100644 modules/generators/config5.m4 delete mode 100644 modules/generators/mod_asis.c delete mode 100644 modules/generators/mod_asis.exp delete mode 100644 modules/generators/mod_autoindex.c delete mode 100644 modules/generators/mod_autoindex.exp delete mode 100644 modules/generators/mod_cgi.c delete mode 100644 modules/generators/mod_cgi.exp delete mode 100644 modules/generators/mod_cgid.c delete mode 100644 modules/generators/mod_info.c delete mode 100644 modules/generators/mod_info.dsp delete mode 100644 modules/generators/mod_info.exp delete mode 100644 modules/generators/mod_info.mak delete mode 100644 modules/generators/mod_status.c delete mode 100644 modules/generators/mod_status.dsp delete mode 100644 modules/generators/mod_status.exp delete mode 100644 modules/generators/mod_status.mak delete mode 100644 modules/generators/mod_suexec.c delete mode 100644 modules/generators/mod_suexec.h delete mode 100644 modules/http/.cvsignore delete mode 100644 modules/http/.indent.pro delete mode 100644 modules/http/Makefile.in delete mode 100644 modules/http/config2.m4 delete mode 100644 modules/http/http_core.c delete mode 100644 modules/http/http_protocol.c delete mode 100644 modules/http/http_request.c delete mode 100644 modules/http/mod_core.h delete mode 100644 modules/http/mod_mime.c delete mode 100644 modules/http/mod_mime.exp delete mode 100644 modules/loggers/.cvsignore delete mode 100644 modules/loggers/.indent.pro delete mode 100644 modules/loggers/Makefile.in delete mode 100644 modules/loggers/config.m4 delete mode 100644 modules/loggers/mod_log_config.c delete mode 100644 modules/loggers/mod_log_config.exp delete mode 100644 modules/loggers/mod_log_config.h delete mode 100644 modules/mappers/.cvsignore delete mode 100644 modules/mappers/.indent.pro delete mode 100644 modules/mappers/Makefile.in delete mode 100644 modules/mappers/config9.m4 delete mode 100644 modules/mappers/mod_actions.c delete mode 100644 modules/mappers/mod_actions.exp delete mode 100644 modules/mappers/mod_alias.c delete mode 100644 modules/mappers/mod_alias.exp delete mode 100644 modules/mappers/mod_dir.c delete mode 100644 modules/mappers/mod_dir.exp delete mode 100644 modules/mappers/mod_imap.c delete mode 100644 modules/mappers/mod_imap.exp delete mode 100644 modules/mappers/mod_negotiation.c delete mode 100644 modules/mappers/mod_negotiation.exp delete mode 100644 modules/mappers/mod_rewrite.c delete mode 100644 modules/mappers/mod_rewrite.dsp delete mode 100644 modules/mappers/mod_rewrite.exp delete mode 100644 modules/mappers/mod_rewrite.h delete mode 100644 modules/mappers/mod_rewrite.mak delete mode 100644 modules/mappers/mod_so.c delete mode 100644 modules/mappers/mod_speling.c delete mode 100644 modules/mappers/mod_speling.dsp delete mode 100644 modules/mappers/mod_speling.exp delete mode 100644 modules/mappers/mod_speling.mak delete mode 100644 modules/mappers/mod_userdir.c delete mode 100644 modules/mappers/mod_userdir.exp delete mode 100644 modules/mappers/mod_vhost_alias.c delete mode 100644 modules/metadata/.cvsignore delete mode 100644 modules/metadata/.indent.pro delete mode 100644 modules/metadata/Makefile.in delete mode 100644 modules/metadata/config.m4 delete mode 100644 modules/metadata/mod_cern_meta.c delete mode 100644 modules/metadata/mod_cern_meta.dsp delete mode 100644 modules/metadata/mod_cern_meta.exp delete mode 100644 modules/metadata/mod_cern_meta.mak delete mode 100644 modules/metadata/mod_env.c delete mode 100644 modules/metadata/mod_env.exp delete mode 100644 modules/metadata/mod_expires.c delete mode 100644 modules/metadata/mod_expires.dsp delete mode 100644 modules/metadata/mod_expires.exp delete mode 100644 modules/metadata/mod_expires.mak delete mode 100644 modules/metadata/mod_headers.c delete mode 100644 modules/metadata/mod_headers.dsp delete mode 100644 modules/metadata/mod_headers.exp delete mode 100644 modules/metadata/mod_headers.mak delete mode 100644 modules/metadata/mod_mime_magic.c delete mode 100644 modules/metadata/mod_mime_magic.exp delete mode 100644 modules/metadata/mod_setenvif.c delete mode 100644 modules/metadata/mod_setenvif.exp delete mode 100644 modules/metadata/mod_unique_id.c delete mode 100644 modules/metadata/mod_unique_id.exp delete mode 100644 modules/metadata/mod_usertrack.c delete mode 100644 modules/metadata/mod_usertrack.dsp delete mode 100644 modules/metadata/mod_usertrack.exp delete mode 100644 modules/metadata/mod_usertrack.mak delete mode 100644 modules/proxy/.cvsignore delete mode 100644 modules/proxy/.indent.pro delete mode 100644 modules/proxy/Makefile.in delete mode 100644 modules/proxy/config.m4 delete mode 100644 modules/proxy/libproxy.exp delete mode 100644 modules/proxy/mod_proxy.c delete mode 100644 modules/proxy/mod_proxy.dsp delete mode 100644 modules/proxy/mod_proxy.h delete mode 100644 modules/proxy/mod_proxy.mak delete mode 100644 modules/proxy/proxy_connect.c delete mode 100644 modules/proxy/proxy_ftp.c delete mode 100644 modules/proxy/proxy_http.c delete mode 100644 modules/proxy/proxy_util.c delete mode 100644 modules/ssl/.cvsignore delete mode 100644 modules/ssl/README delete mode 100644 modules/ssl/README.dsov.fig delete mode 100644 modules/ssl/README.dsov.ps delete mode 100644 modules/ssl/mod_ssl.c delete mode 100644 modules/ssl/mod_ssl.h delete mode 100644 modules/ssl/ssl_engine_config.c delete mode 100644 modules/ssl/ssl_engine_dh.c delete mode 100644 modules/ssl/ssl_engine_init.c delete mode 100644 modules/ssl/ssl_engine_io.c delete mode 100644 modules/ssl/ssl_engine_kernel.c delete mode 100644 modules/ssl/ssl_engine_log.c delete mode 100644 modules/ssl/ssl_engine_mutex.c delete mode 100644 modules/ssl/ssl_engine_pphrase.c delete mode 100644 modules/ssl/ssl_engine_rand.c delete mode 100644 modules/ssl/ssl_engine_vars.c delete mode 100644 modules/ssl/ssl_expr.c delete mode 100644 modules/ssl/ssl_expr.h delete mode 100644 modules/ssl/ssl_expr_eval.c delete mode 100644 modules/ssl/ssl_expr_parse.c delete mode 100644 modules/ssl/ssl_expr_parse.h delete mode 100644 modules/ssl/ssl_expr_parse.y delete mode 100644 modules/ssl/ssl_expr_scan.c delete mode 100644 modules/ssl/ssl_expr_scan.l delete mode 100644 modules/ssl/ssl_scache.c delete mode 100644 modules/ssl/ssl_scache_dbm.c delete mode 100644 modules/ssl/ssl_scache_shmcb.c delete mode 100644 modules/ssl/ssl_util.c delete mode 100644 modules/ssl/ssl_util_ssl.c delete mode 100644 modules/ssl/ssl_util_ssl.h delete mode 100644 modules/test/.cvsignore delete mode 100644 modules/test/.indent.pro delete mode 100644 modules/test/README delete mode 100644 modules/test/mod_autoindex.c delete mode 100644 modules/test/mod_autoindex.exp delete mode 100644 modules/test/mod_optional_fn_export.c delete mode 100644 modules/test/mod_optional_fn_export.h delete mode 100644 modules/test/mod_optional_fn_import.c delete mode 100644 modules/test/mod_rndchunk.c delete mode 100644 modules/test/mod_test_util_uri.c delete mode 100644 modules/tls/.cvsignore delete mode 100644 modules/tls/Makefile.in delete mode 100644 modules/tls/README delete mode 100644 modules/tls/config.m4 delete mode 100644 modules/tls/mod_tls.c delete mode 100644 modules/tls/openssl_state_machine.c delete mode 100644 modules/tls/openssl_state_machine.h delete mode 100644 os/.cvsignore delete mode 100644 os/.indent.pro delete mode 100644 os/Makefile.in delete mode 100644 os/beos/.cvsignore delete mode 100644 os/beos/Makefile.in delete mode 100644 os/beos/beosd.c delete mode 100644 os/beos/beosd.h delete mode 100644 os/beos/config.m4 delete mode 100644 os/beos/os.c delete mode 100644 os/beos/os.h delete mode 100644 os/bs2000/.cvsignore delete mode 100644 os/bs2000/bs2login.c delete mode 100644 os/bs2000/ebcdic.c delete mode 100644 os/bs2000/ebcdic.h delete mode 100644 os/bs2000/os-inline.c delete mode 100644 os/bs2000/os.c delete mode 100644 os/bs2000/os.h delete mode 100644 os/config.m4 delete mode 100644 os/os2/.cvsignore delete mode 100644 os/os2/Makefile.in delete mode 100644 os/os2/config.m4 delete mode 100644 os/os2/core.mk delete mode 100644 os/os2/core_header.def delete mode 100644 os/os2/os-inline.c delete mode 100644 os/os2/os.h delete mode 100644 os/os2/util_os2.c delete mode 100644 os/tpf/.cvsignore delete mode 100644 os/tpf/TPFExport delete mode 100644 os/tpf/ebcdic.c delete mode 100644 os/tpf/ebcdic.h delete mode 100644 os/tpf/os-inline.c delete mode 100644 os/tpf/os.c delete mode 100644 os/tpf/os.h delete mode 100644 os/tpf/samples/linkdll.jcl delete mode 100644 os/tpf/samples/loadset.jcl delete mode 100644 os/unix/.cvsignore delete mode 100644 os/unix/Makefile.in delete mode 100644 os/unix/config.m4 delete mode 100644 os/unix/os-inline.c delete mode 100644 os/unix/os.h delete mode 100644 os/unix/unixd.c delete mode 100644 os/unix/unixd.h delete mode 100644 os/win32/.cvsignore delete mode 100644 os/win32/BaseAddr.ref delete mode 100644 os/win32/apache.ico delete mode 100644 os/win32/apache.rc delete mode 100644 os/win32/modules.c delete mode 100644 os/win32/os.h delete mode 100644 os/win32/util_win32.c delete mode 100644 server/.cvsignore delete mode 100644 server/.indent.pro delete mode 100644 server/Makefile.in delete mode 100644 server/buildmark.c delete mode 100644 server/config.c delete mode 100644 server/config.m4 delete mode 100644 server/connection.c delete mode 100644 server/core.c delete mode 100644 server/error_bucket.c delete mode 100644 server/gen_test_char.c delete mode 100644 server/gen_test_char.dsp delete mode 100644 server/gen_test_char.mak delete mode 100644 server/gen_uri_delims.c delete mode 100644 server/gen_uri_delims.dsp delete mode 100644 server/gen_uri_delims.mak delete mode 100644 server/listen.c delete mode 100644 server/log.c delete mode 100644 server/main.c delete mode 100644 server/mpm/.cvsignore delete mode 100644 server/mpm/MPM.NAMING delete mode 100644 server/mpm/Makefile.in delete mode 100644 server/mpm/beos/.cvsignore delete mode 100644 server/mpm/beos/Makefile.in delete mode 100644 server/mpm/beos/beos.c delete mode 100644 server/mpm/beos/beos.h delete mode 100644 server/mpm/beos/config5.m4 delete mode 100644 server/mpm/beos/mpm.h delete mode 100644 server/mpm/beos/mpm_default.h delete mode 100644 server/mpm/config.m4 delete mode 100644 server/mpm/experimental/perchild/.cvsignore delete mode 100644 server/mpm/experimental/perchild/Makefile.in delete mode 100644 server/mpm/experimental/perchild/config5.m4 delete mode 100644 server/mpm/experimental/perchild/mpm.h delete mode 100644 server/mpm/experimental/perchild/mpm_default.h delete mode 100644 server/mpm/experimental/perchild/perchild.c delete mode 100644 server/mpm/monitoring-services.txt delete mode 100644 server/mpm/perchild/.cvsignore delete mode 100644 server/mpm/perchild/Makefile.in delete mode 100644 server/mpm/perchild/config5.m4 delete mode 100644 server/mpm/perchild/mpm.h delete mode 100644 server/mpm/perchild/mpm_default.h delete mode 100644 server/mpm/perchild/perchild.c delete mode 100644 server/mpm/prefork/.cvsignore delete mode 100644 server/mpm/prefork/Makefile.in delete mode 100644 server/mpm/prefork/config.m4 delete mode 100644 server/mpm/prefork/mpm.h delete mode 100644 server/mpm/prefork/mpm_default.h delete mode 100644 server/mpm/prefork/prefork.c delete mode 100644 server/mpm/spmt_os2/.cvsignore delete mode 100644 server/mpm/spmt_os2/Makefile.in delete mode 100644 server/mpm/spmt_os2/config5.m4 delete mode 100644 server/mpm/spmt_os2/mpm.h delete mode 100644 server/mpm/spmt_os2/mpm_default.h delete mode 100644 server/mpm/spmt_os2/spmt_os2.c delete mode 100644 server/mpm/threaded/.cvsignore delete mode 100644 server/mpm/threaded/Makefile.in delete mode 100644 server/mpm/threaded/config5.m4 delete mode 100644 server/mpm/threaded/mpm.h delete mode 100644 server/mpm/threaded/mpm_default.h delete mode 100644 server/mpm/threaded/threaded.c delete mode 100644 server/mpm/winnt/Win9xConHook.c delete mode 100644 server/mpm/winnt/Win9xConHook.def delete mode 100644 server/mpm/winnt/Win9xConHook.dsp delete mode 100644 server/mpm/winnt/Win9xConHook.h delete mode 100644 server/mpm/winnt/mpm.h delete mode 100644 server/mpm/winnt/mpm_default.h delete mode 100644 server/mpm/winnt/mpm_winnt.c delete mode 100644 server/mpm/winnt/mpm_winnt.h delete mode 100644 server/mpm/winnt/registry.c delete mode 100644 server/mpm/winnt/service.c delete mode 100644 server/mpm_common.c delete mode 100644 server/protocol.c delete mode 100644 server/request.c delete mode 100644 server/rfc1413.c delete mode 100644 server/scoreboard.c delete mode 100644 server/util.c delete mode 100644 server/util_cfgtree.c delete mode 100644 server/util_charset.c delete mode 100644 server/util_date.c delete mode 100644 server/util_debug.c delete mode 100644 server/util_ebcdic.c delete mode 100644 server/util_filter.c delete mode 100644 server/util_md5.c delete mode 100644 server/util_script.c delete mode 100644 server/util_uri.c delete mode 100644 server/util_xml.c delete mode 100644 server/vhost.c delete mode 100644 srclib/.cvsignore delete mode 100644 srclib/Makefile.in delete mode 100644 srclib/pcre/.cvsignore delete mode 100644 srclib/pcre/AUTHORS delete mode 100644 srclib/pcre/COPYING delete mode 100644 srclib/pcre/ChangeLog delete mode 100644 srclib/pcre/INSTALL delete mode 100644 srclib/pcre/LICENCE delete mode 100644 srclib/pcre/Makefile.in delete mode 100644 srclib/pcre/NEWS delete mode 100644 srclib/pcre/NON-UNIX-USE delete mode 100644 srclib/pcre/README delete mode 100755 srclib/pcre/RunTest delete mode 100644 srclib/pcre/config.guess delete mode 100644 srclib/pcre/config.hw delete mode 100644 srclib/pcre/config.in delete mode 100644 srclib/pcre/config.sub delete mode 100644 srclib/pcre/configure.in delete mode 100644 srclib/pcre/dftables.c delete mode 100644 srclib/pcre/dftables.dsp delete mode 100644 srclib/pcre/dftables.mak delete mode 100644 srclib/pcre/dll.mk delete mode 100644 srclib/pcre/doc/Tech.Notes delete mode 100644 srclib/pcre/doc/pcre.3 delete mode 100644 srclib/pcre/doc/pcre.html delete mode 100644 srclib/pcre/doc/pcre.txt delete mode 100644 srclib/pcre/doc/pcreposix.3 delete mode 100644 srclib/pcre/doc/pcreposix.html delete mode 100644 srclib/pcre/doc/pcreposix.txt delete mode 100644 srclib/pcre/doc/pcretest.txt delete mode 100644 srclib/pcre/doc/perltest.txt delete mode 100644 srclib/pcre/doc/pgrep.1 delete mode 100644 srclib/pcre/doc/pgrep.html delete mode 100644 srclib/pcre/doc/pgrep.txt delete mode 100644 srclib/pcre/get.c delete mode 100755 srclib/pcre/install-sh delete mode 100644 srclib/pcre/internal.h delete mode 100755 srclib/pcre/ltconfig delete mode 100644 srclib/pcre/ltmain.sh delete mode 100644 srclib/pcre/maketables.c delete mode 100644 srclib/pcre/pcre-config.in delete mode 100644 srclib/pcre/pcre.c delete mode 100644 srclib/pcre/pcre.def delete mode 100644 srclib/pcre/pcre.dsp delete mode 100644 srclib/pcre/pcre.hw delete mode 100644 srclib/pcre/pcre.in delete mode 100644 srclib/pcre/pcre.mak delete mode 100644 srclib/pcre/pcreposix.c delete mode 100644 srclib/pcre/pcreposix.dsp delete mode 100644 srclib/pcre/pcreposix.h delete mode 100644 srclib/pcre/pcreposix.mak delete mode 100644 srclib/pcre/pcretest.c delete mode 100755 srclib/pcre/perltest delete mode 100644 srclib/pcre/pgrep.c delete mode 100644 srclib/pcre/study.c delete mode 100644 srclib/pcre/testdata/testinput1 delete mode 100644 srclib/pcre/testdata/testinput2 delete mode 100644 srclib/pcre/testdata/testinput3 delete mode 100644 srclib/pcre/testdata/testinput4 delete mode 100644 srclib/pcre/testdata/testoutput1 delete mode 100644 srclib/pcre/testdata/testoutput2 delete mode 100644 srclib/pcre/testdata/testoutput3 delete mode 100644 srclib/pcre/testdata/testoutput4 delete mode 100644 support/.cvsignore delete mode 100644 support/.indent.pro delete mode 100644 support/Makefile.in delete mode 100644 support/README delete mode 100644 support/SHA1/README.sha1 delete mode 100644 support/SHA1/convert-sha1.pl delete mode 100644 support/SHA1/htpasswd-sha1.pl delete mode 100644 support/SHA1/ldif-sha1.example delete mode 100644 support/ab.c delete mode 100644 support/ab.dsp delete mode 100644 support/ab.mak delete mode 100644 support/apachectl.in delete mode 100644 support/apxs.in delete mode 100644 support/dbmmanage delete mode 100644 support/dbmmanage.in delete mode 100644 support/htdigest.c delete mode 100644 support/htdigest.dsp delete mode 100644 support/htdigest.mak delete mode 100644 support/htpasswd.c delete mode 100644 support/htpasswd.dsp delete mode 100644 support/htpasswd.mak delete mode 100644 support/httpd.exp delete mode 100644 support/log_server_status delete mode 100644 support/log_server_status.in delete mode 100644 support/logresolve.c delete mode 100644 support/logresolve.dsp delete mode 100644 support/logresolve.mak delete mode 100644 support/logresolve.pl delete mode 100644 support/logresolve.pl.in delete mode 100644 support/phf_abuse_log.cgi delete mode 100644 support/phf_abuse_log.cgi.in delete mode 100644 support/rotatelogs.c delete mode 100644 support/rotatelogs.dsp delete mode 100644 support/rotatelogs.mak delete mode 100644 support/split-logfile delete mode 100644 support/split-logfile.in delete mode 100644 support/suexec.c delete mode 100644 support/suexec.h delete mode 100644 test/.cvsignore delete mode 100644 test/.indent.pro delete mode 100644 test/Makefile.in delete mode 100644 test/README delete mode 100644 test/check_chunked delete mode 100644 test/cls.c delete mode 100644 test/tcpdumpscii.txt delete mode 100644 test/test-writev.c delete mode 100644 test/test_date.c delete mode 100644 test/test_find.c delete mode 100644 test/test_limits.c delete mode 100644 test/test_parser.c delete mode 100644 test/test_select.c delete mode 100644 test/time-sem.c delete mode 100644 test/zb.c diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index c96441d142..0000000000 --- a/.cvsignore +++ /dev/null @@ -1,27 +0,0 @@ -config.nice -configure -missing -install-sh -mkinstalldirs -aclocal.m4 -.deps -generated_lists -buildmk.stamp -config.log -Makefile -libtool -shlibtool -config.status -modules.c -config.cache -config_vars.mk -.libs -httpd -modules.lo -Debug -Release -LibD -LibR -Apache.ncb -Apache.opt -InstallBin.plg diff --git a/.gdbinit b/.gdbinit deleted file mode 100644 index f65893c6d5..0000000000 --- a/.gdbinit +++ /dev/null @@ -1,73 +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 = (apr_table_entry_t *)((apr_array_header_t *)$arg0)->elts - set $n = ((apr_array_header_t *)$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 rh - run -f /home/dgaudet/ap2/conf/mpm.conf -end - -define ro - run -DONE_PROCESS -end - -define dump_string_array - set $a = (char **)((apr_array_header_t *)$arg0)->elts - set $n = (int)((apr_array_header_t *)$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 - -define dump_bucket - set $bucket = $arg0 - printf "bucket=%s(0x%lx), length=%ld, data=0x%lx\n", \ - $bucket->type->name, \ - (unsigned long)$bucket, (long)$bucket->length, \ - (unsigned long)$bucket->data -end -document dump_bucket - Print bucket info -end - -define dump_brigade - set $bb = $arg0 - set $bucket = ((&((apr_bucket_brigade *)$bb)->list))->next - set $sentinel = ((char *)((&(((apr_bucket_brigade *)$bb)->list)) \ - - ((size_t) &((struct apr_bucket *)0)->link))) - set $i = 0 - - printf "dump of brigade 0x%lx\n", (unsigned long)$bb - if $bucket == $sentinel - printf "brigade is empty\n" - end - - while $bucket != $sentinel - printf " %d: bucket=%s(0x%lx), length=%ld, data=0x%lx\n", \ - $i, $bucket->type->name, \ - (unsigned long)$bucket, (long)$bucket->length, \ - (unsigned long)$bucket->data - set $i = $i + 1 - set $bucket = $bucket->link.next - end -end -document dump_brigade - Print bucket brigade info -end diff --git a/ABOUT_APACHE b/ABOUT_APACHE deleted file mode 100644 index 6d47a5a882..0000000000 --- a/ABOUT_APACHE +++ /dev/null @@ -1,267 +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. Covalent, Illinois - 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", or for - Windows users, "comp.infosystems.www.servers.ms-windows". - -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 c3bd91aaea..0000000000 --- a/Apache.dsp +++ /dev/null @@ -1,99 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Apache" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.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 AllowPerConfigDependencies 0 -# 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 "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 /I "./include" /I "./os/win32" /I "./srclib/apr/include" /I "./srclib/apr-util/include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "SHARED_MODULE" /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 "_CONSOLE" /Fd"Release\Apache" /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 advapi32.lib ws2_32.lib mswsock.lib /nologo /subsystem:console /incremental:no /map /machine:I386 -# ADD LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /subsystem:console /incremental:no /map /machine:I386 - -!ELSEIF "$(CFG)" == "Apache - 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 /I "./include" /I "./os/win32" /I "./srclib/apr/include" /I "./srclib/apr-util/include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /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 "_CONSOLE" /Fd"Debug\Apache" /FD /c -# SUBTRACT CPP /YX -# 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:console /incremental:no /map /debug /machine:I386 -# ADD LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "Apache - Win32 Release" -# Name "Apache - Win32 Debug" -# Begin Source File - -SOURCE=.\os\win32\apache.ico -# End Source File -# Begin Source File - -SOURCE=.\os\win32\apache.rc -# End Source File -# Begin Source File - -SOURCE=.\server\main.c -# End Source File -# End Target -# End Project diff --git a/Apache.dsw b/Apache.dsw deleted file mode 100644 index 5966b163ce..0000000000 --- a/Apache.dsw +++ /dev/null @@ -1,668 +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 libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libaprutil - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - 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 mod_auth_anon - End Project Dependency - Begin Project Dependency - Project_Dep_Name mod_auth_dbm - End Project Dependency - Begin Project Dependency - Project_Dep_Name mod_auth_digest - End Project Dependency - Begin Project Dependency - Project_Dep_Name mod_cern_meta - End Project Dependency - Begin Project Dependency - Project_Dep_Name mod_dav_fs - End Project Dependency - Begin Project Dependency - Project_Dep_Name mod_expires - End Project Dependency - Begin Project Dependency - Project_Dep_Name mod_file_cache - End Project Dependency - Begin Project Dependency - Project_Dep_Name mod_headers - End Project Dependency - Begin Project Dependency - Project_Dep_Name mod_rewrite - End Project Dependency - Begin Project Dependency - Project_Dep_Name mod_speling - End Project Dependency - Begin Project Dependency - Project_Dep_Name mod_status - End Project Dependency - Begin Project Dependency - Project_Dep_Name mod_usertrack - End Project Dependency - Begin Project Dependency - Project_Dep_Name ab - End Project Dependency - Begin Project Dependency - Project_Dep_Name htpasswd - End Project Dependency - Begin Project Dependency - Project_Dep_Name htdigest - End Project Dependency - Begin Project Dependency - Project_Dep_Name logresolve - End Project Dependency - Begin Project Dependency - Project_Dep_Name rotatelogs - End Project Dependency - Begin Project Dependency - Project_Dep_Name mod_info - End Project Dependency -}}} - -############################################################################### - -Project: "ab"=".\support\ab.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name apr - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprutil - End Project Dependency -}}} - -############################################################################### - -Project: "apr"=".\srclib\apr\apr.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "aprutil"=".\srclib\apr-util\aprutil.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name apr - End Project Dependency - Begin Project Dependency - Project_Dep_Name xml - End Project Dependency -}}} - -############################################################################### - -Project: "dftables"=".\srclib\pcre\dftables.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gen_test_char"=".\server\gen_test_char.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name apr - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprutil - End Project Dependency -}}} - -############################################################################### - -Project: "gen_uri_delims"=".\server\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 apr - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprutil - End Project Dependency -}}} - -############################################################################### - -Project: "htpasswd"=".\support\htpasswd.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name apr - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprutil - End Project Dependency -}}} - -############################################################################### - -Project: "libapr"=".\srclib\apr\libapr.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "libaprutil"=".\srclib\apr-util\libaprutil.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name xml - End Project Dependency -}}} - -############################################################################### - -Project: "libhttpd"=".\libhttpd.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libaprutil - End Project Dependency - Begin Project Dependency - Project_Dep_Name pcre - End Project Dependency - Begin Project Dependency - Project_Dep_Name pcreposix - 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: "logresolve"=".\support\logresolve.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "mod_auth_anon"=".\modules\aaa\mod_auth_anon.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - End Project Dependency -}}} - -############################################################################### - -Project: "mod_auth_dbm"=".\modules\aaa\mod_auth_dbm.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libaprutil - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - End Project Dependency -}}} - -############################################################################### - -Project: "mod_auth_digest"=".\modules\aaa\mod_auth_digest.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libaprutil - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - End Project Dependency -}}} - -############################################################################### - -Project: "mod_cern_meta"=".\modules\metadata\mod_cern_meta.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - End Project Dependency -}}} - -############################################################################### - -Project: "mod_dav"=".\modules\dav\main\mod_dav.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libaprutil - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - End Project Dependency -}}} - -############################################################################### - -Project: "mod_dav_fs"=".\modules\dav\fs\mod_dav_fs.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libaprutil - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - End Project Dependency - Begin Project Dependency - Project_Dep_Name mod_dav - End Project Dependency -}}} - -############################################################################### - -Project: "mod_expires"=".\modules\metadata\mod_expires.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - End Project Dependency -}}} - -############################################################################### - -Project: "mod_file_cache"=".\modules\cache\mod_file_cache.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - End Project Dependency -}}} - -############################################################################### - -Project: "mod_generic_hook_import"=".\modules\experimental\mod_generic_hook_import.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libaprutil - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - End Project Dependency -}}} - -############################################################################### - -Project: "mod_generic_hook_export"=".\modules\experimental\mod_generic_hook_export.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libaprutil - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - End Project Dependency -}}} - -############################################################################### - -Project: "mod_headers"=".\modules\metadata\mod_headers.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - End Project Dependency -}}} - -############################################################################### - -Project: "mod_info"=".\modules\generators\mod_info.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - End Project Dependency -}}} - -############################################################################### - -Project: "mod_rewrite"=".\modules\mappers\mod_rewrite.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - End Project Dependency -}}} - -############################################################################### - -Project: "mod_speling"=".\modules\mappers\mod_speling.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - End Project Dependency -}}} - -############################################################################### - -Project: "mod_status"=".\modules\generators\mod_status.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - End Project Dependency -}}} - -############################################################################### - -Project: "mod_usertrack"=".\modules\metadata\mod_usertrack.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libhttpd - End Project Dependency -}}} - -############################################################################### - -Project: "pcre"=".\srclib\pcre\pcre.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name dftables - End Project Dependency -}}} - -############################################################################### - -Project: "pcreposix"=".\srclib\pcre\pcreposix.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name pcre - End Project Dependency -}}} - -############################################################################### - -Project: "rotatelogs"=".\support\rotatelogs.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "xml"=".\srclib\apr-util\xml\expat\lib\xml.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/Apache.mak b/Apache.mak deleted file mode 100644 index 99b7787053..0000000000 --- a/Apache.mak +++ /dev/null @@ -1,373 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on Apache.dsp -!IF "$(CFG)" == "" -CFG=Apache - Win32 Release -!MESSAGE No configuration specified. Defaulting to Apache - Win32 Release. -!ENDIF - -!IF "$(CFG)" != "Apache - Win32 Release" && "$(CFG)" != "Apache - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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 -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "Apache - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\Apache.exe" - -!ELSE - -ALL : "libhttpd - Win32 Release" "libaprutil - Win32 Release"\ - "libapr - Win32 Release" "$(OUTDIR)\Apache.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 ReleaseCLEAN" "libaprutil - Win32 ReleaseCLEAN"\ - "libhttpd - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\Apache.idb" - -@erase "$(INTDIR)\apache.res" - -@erase "$(INTDIR)\main.obj" - -@erase "$(OUTDIR)\Apache.exe" - -@erase "$(OUTDIR)\Apache.map" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "./include" /I "./os/win32" /I\ - "./srclib/apr/include" /I "./srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D\ - "_CONSOLE" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\Apache" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -RSC_PROJ=/l 0x809 /fo"$(INTDIR)\apache.res" /d "NDEBUG" -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\Apache.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib\ - /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\Apache.pdb"\ - /map:"$(INTDIR)\Apache.map" /machine:I386 /out:"$(OUTDIR)\Apache.exe" -LINK32_OBJS= \ - "$(INTDIR)\apache.res" \ - "$(INTDIR)\main.obj" \ - "$(OUTDIR)\libhttpd.lib" \ - ".\srclib\apr-util\Release\libaprutil.lib" \ - ".\srclib\apr\Release\libapr.lib" - -"$(OUTDIR)\Apache.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "Apache - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\Apache.exe" - -!ELSE - -ALL : "libhttpd - Win32 Debug" "libaprutil - Win32 Debug"\ - "libapr - Win32 Debug" "$(OUTDIR)\Apache.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 DebugCLEAN" "libaprutil - Win32 DebugCLEAN"\ - "libhttpd - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\Apache.idb" - -@erase "$(INTDIR)\apache.res" - -@erase "$(INTDIR)\main.obj" - -@erase "$(OUTDIR)\Apache.exe" - -@erase "$(OUTDIR)\Apache.map" - -@erase "$(OUTDIR)\Apache.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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\ - "_CONSOLE" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\Apache" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -RSC_PROJ=/l 0x809 /fo"$(INTDIR)\apache.res" /d "_DEBUG" -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\Apache.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib\ - /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\Apache.pdb"\ - /map:"$(INTDIR)\Apache.map" /debug /machine:I386 /out:"$(OUTDIR)\Apache.exe" -LINK32_OBJS= \ - "$(INTDIR)\apache.res" \ - "$(INTDIR)\main.obj" \ - "$(OUTDIR)\libhttpd.lib" \ - ".\srclib\apr-util\Debug\libaprutil.lib" \ - ".\srclib\apr\Debug\libapr.lib" - -"$(OUTDIR)\Apache.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "Apache - Win32 Release" || "$(CFG)" == "Apache - Win32 Debug" - -!IF "$(CFG)" == "Apache - Win32 Release" - -"libapr - Win32 Release" : - cd ".\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Release" - cd "..\.." - -"libapr - Win32 ReleaseCLEAN" : - cd ".\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\.." - -!ELSEIF "$(CFG)" == "Apache - Win32 Debug" - -"libapr - Win32 Debug" : - cd ".\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Debug" - cd "..\.." - -"libapr - Win32 DebugCLEAN" : - cd ".\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\.." - -!ENDIF - -!IF "$(CFG)" == "Apache - Win32 Release" - -"libaprutil - Win32 Release" : - cd ".\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\libaprutil.mak" CFG="libaprutil - Win32 Release"\ - - cd "..\.." - -"libaprutil - Win32 ReleaseCLEAN" : - cd ".\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libaprutil.mak"\ - CFG="libaprutil - Win32 Release" RECURSE=1 - cd "..\.." - -!ELSEIF "$(CFG)" == "Apache - Win32 Debug" - -"libaprutil - Win32 Debug" : - cd ".\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\libaprutil.mak" CFG="libaprutil - Win32 Debug" - cd "..\.." - -"libaprutil - Win32 DebugCLEAN" : - cd ".\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libaprutil.mak"\ - CFG="libaprutil - Win32 Debug" RECURSE=1 - cd "..\.." - -!ENDIF - -!IF "$(CFG)" == "Apache - Win32 Release" - -"libhttpd - Win32 Release" : - cd "." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Release" - cd "." - -"libhttpd - Win32 ReleaseCLEAN" : - cd "." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Release"\ - RECURSE=1 - cd "." - -!ELSEIF "$(CFG)" == "Apache - Win32 Debug" - -"libhttpd - Win32 Debug" : - cd "." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Debug" - cd "." - -"libhttpd - Win32 DebugCLEAN" : - cd "." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Debug"\ - RECURSE=1 - cd "." - -!ENDIF - -SOURCE=.\os\win32\apache.rc -DEP_RSC_APACH=\ - ".\os\win32\apache.ico"\ - - -!IF "$(CFG)" == "Apache - Win32 Release" - - -"$(INTDIR)\apache.res" : $(SOURCE) $(DEP_RSC_APACH) "$(INTDIR)" - $(RSC) /l 0x809 /fo"$(INTDIR)\apache.res" /i "os\win32" /d "NDEBUG" $(SOURCE) - - -!ELSEIF "$(CFG)" == "Apache - Win32 Debug" - - -"$(INTDIR)\apache.res" : $(SOURCE) $(DEP_RSC_APACH) "$(INTDIR)" - $(RSC) /l 0x809 /fo"$(INTDIR)\apache.res" /i "os\win32" /d "_DEBUG" $(SOURCE) - - -!ENDIF - -SOURCE=.\server\main.c -DEP_CPP_MAIN_=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_mpm.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_log.h"\ - ".\include\http_main.h"\ - ".\include\http_vhost.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_charset.h"\ - ".\include\util_ebcdic.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_getopt.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - ".\srclib\apr\include\apr_xlate.h"\ - -NODEP_CPP_MAIN_=\ - ".\include\ap_config_auto.h"\ - ".\server\xmlparse.h"\ - - -"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - - -!ENDIF - diff --git a/CHANGES b/CHANGES deleted file mode 100644 index 77d4cab913..0000000000 --- a/CHANGES +++ /dev/null @@ -1,9528 +0,0 @@ -Changes with Apache 2.0.18-dev - - *) Prevent a hang when a cgi handled by mod_cgid tries to read a - request body from its stdin but no reqest body is being written to - the cgi. [Jeff Trawick] - - *) mod_log_config: %c connection status incorrectly logged - as "-" (non-keepalive) when MaxKeepAliveRequests is set to 0. - [Bill Stoddard] - - *) Get mod_cern_meta working under Windows - [Bill Stoddard] - - *) Create Files, and thus MMAPs, out of the request pool, not the - connection pool. This solves a small resource leak that had us - not closing files until a connection was closed. In order to do - this, at the end of the core_output_filter, we loop through the - brigade and convert any data we have into a single HEAP bucket - that we know will survive clearing the request_rec. - [Ryan Bloom, Justin Erenkrantz , - Cliff Woolley] - - *) Completely revamp configure so that it preserves the standard make - variables CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS and LIBS by moving - the configure additions to EXTRA_* variables. Also, allow the user - to specify NOTEST_* values for all of the above, which eliminates the - need for THREAD_CPPFLAGS, THREAD_CFLAGS, and OPTIM. Fix the setting - of INCLUDES and EXTRA_INCLUDES. Check flags as they are added to - avoid pointless duplications. Fix the order in which flags are given - on the compile and link lines. Remove obsolete macros APR_DOEXTRA, - AC_ADD_LIBRARY, AC_CHECK_DEFINE, APACHE_PASSTHRU, and APACHE_ONCE. - Added APR_SAVE_THE_ENVIRONMENT and APR_RESTORE_THE_ENVIRONMENT macros. - Renamed AC_TYPE_RLIM_T macro to APACHE_TYPE_RLIM_T. [Roy Fielding] - - *) Get mod_tls to compile/work better on Windows. PR #7612 - [Bernhard Schrenk ] - - *) Fix shutdown/restart hangs in the threaded MPM. - [Jeff Trawick, Greg Ames, Ryan Bloom] - - *) Removed the keptalive boolean from conn_rec because it is now only - used by a single routine and can be replaced by a local variable. - [Greg Stein, Ryan Bloom, Roy Fielding] - - *) Patch prefork to put enough of the signal processing back in so that - signals are all handled properly now. The previous patch fixed the - deadlock race condition, but broke the user directed signal handling. - This fixes it to work the way it did before my previous prefork patch - (primarily, SIGTERM is now working). - - *) Change how input filters decide how much data is returned to the - higher filter. We used to use a field in the conn_rec, with this - change, we use an argument to ap_get_brigade to determine how much - data is retrieved. [Ryan Bloom] - - *) Fix seg fault at start-up introduced by Ryan's change to enable - modules to specify their own logging tags. mod_log_config - registers an optional function, ap_register_log_handler(). - ap_register_log_handler() was being called by http_core before - the directive hash table was created. This patch creates the - directive hash table before ap_register_log_handler() is - registered as an optional function. - [jean-frederic clere ] - - *) Add ap_set_int_slot() function - [John K. Sterling ] - - *) Under certain circumstances, Apache did not supply the - right response headers when requiring authentication. - [Gertjan van Wingerde ] PR#7114 - (This is a port of the change that went into Apache 1.3.19.) - - *) Allow modules to specify their own logging tags. This basically - allows a module to tell mod_log_config that when %x is encountered - a specific function should be called. Currently, x can be any single - character. It may be more useful to make this a string at some point. - [Ryan Bloom] - -Changes with Apache 2.0.17 - - *) If a higher-level filter handles the the byterange aspects of a - request, then the byterange filter should not try to redo the - work. The most common case of this happening, is a byterange - request going through the proxy, and the origin server handles - the byterange request. The proxy should ignore it. - [Graham Leggett ] - - *) Changed the threaded mpm to have child_main join to each of the - worker threads to make sure the kids are all gone before child_main - exits after a signal (cleanup from perform_idle_server_maintenance). - This is an extension of Ryans recent commit to make the child_main - the signal thread. - - *) Add more options to the ap_mpm_query function. This also allows MPMs to - report if their threads are dynamic or static. Finally, this also - implements a new API, ap_show_mpm, which returns the MPM that was - required into the core. [Harrie Hazewinkel ] - - *) Do not install the binaries from the support directory twice. - [jun-ichiro hagino ] - - *) The ap_f* functions should flush data to the filter that is passed - in, not the the filter after the one passed in. - [Ryan Morgan ] - - *) Make ab work again by changing its native types to apr types and formats. - [Justin Erenkrantz ] - - *) Move the byterange filter and all of the supporting functions back - to the HTTP module. The byterange filter turned out to be very - HTTP specific, and it belongs in the HTTP module. [Greg Stein] - - *) Make clean, distclean, and extraclean consistently according to the - Gnu makefile guidelines. [Justin Erenkrantz ] - - *) Fix errors in the renaming of the apr_threadattr_detach_xxx functions. - This may have been causing problems stopping processes in the threaded - mpm's. [Greg Ames] - - *) Fix content-length in mod_negotiation to a long int representation. - [William Rowe] - - *) Remove BindAddress from the default config file. - [giles@nemeton.com.au] - - *) Allow module authors to add a module to their Apache build using - --with-module, without re-running buildconf. The syntax is: - --with-module=module_type:/path/to/module.c - The configure script will copy the module.c file to - modules/module_type, and it will be added to the relevant Makefiles. - currently, this only works for static modules. [Ryan Bloom] - - *) Changes required to make prefork clean up idle children properly. - There was a window during which a starting worker deadlocks when - an idle cleanup arrives before it completes init. Apache then keeps - trying to cleanup the same deadlocked worker forever (until higher - pids come along, but it still will never reduce below the deadlocked - pid). Thus the number of children would not reduce to the correct - idle level. [Paul J. Reder] - -Changes with Apache 2.0.16 - - *) Change the default installation directory to /usr/local/apache2, - as now defined by the "Apache" layout in config.layout. [Marc Slemko] - - *) OS/2: Added support for building loadable modules as OS/2 DLLs. - [Brian Havard] - - *) Get MaxRequestsPerChild working with the Windows MPM. - [Bill Stoddard] - - *) Make generic hooks to work, with mod_generic_hook_import/export - experimental modules. [Ben Laurie, Will Rowe] - - *) Fix segfaults for configuration file syntax errors such as - "" followed by "" followed by "". [Jeff Trawick] - - *) Cleanup the --enable-layout option of configure. This makes - us use a consistent location for the config.layout file, and it - makes configure more portable. - [jun-ichiro hagino ] - - *) Changes to 'ab'; fixed int overrun's, added statistics, output in - csv/gnuplot format, rudimentary ssl support and various other tweaks - to make results more true to what is measured. The upshot of this it - turns out that 'ab' has often underreported the true performance of - apache. Often by a order of magnitude :-) See talk/paper of Sander - Temme at April ApacheCon 2001 for details. - [Dirk-Willem van Gulik] - - *) Clean up mod_cgid's temporary request pool. Besides fixing a - storage leak this ensures that some unnecessary pipes are closed. - [Jeff Trawick] - - *) Performance: Add quick_handler hook. This hook is called at the - very beginning of the request processing before location_walk, - translate_name, etc. This hook is useful for URI keyed content - caches like Mike Abbott's Quick Shortcut Cache. - [Bill Stoddard] - - *) top_module global variable renamed to ap_top_module [Perl] - - *) Move ap_set_last_modified to the core. This is a potentially - controversial change, because this is kind of HTTP specific. However - many protocols should be able to take advantage of this kind of - information. I expect that headers will need one more layer of - indirection for multi-protocol work, but this is a small step in - the right direction. [Ryan Bloom] - - *) Enable mod_status by default. This matches what Apache 1.3 does. - [Ed Korthof] - - *) Add a ScriptSock directive to the default config file. This is - only enabled when mod_cgid is used. - [Taketo Kabe ] - -Changes with Apache 2.0.15 - - *) Untangled the buildconf script and eliminated the need for build's - aclocal.m4, generated_lists, build.mk, build2.mk, and a host of other - libtool muck that is now under srclib/apr/build. [Roy Fielding] - - *) Win32: Don't accept more connections than we have worker threads - to handle. - [Bill Stoddard] - - *) Fix bug in the Unix threaded.c MPM that allowed child processes - to fork() new child processes. - [Bill Stoddard] - - *) Fix a major security problem with double-reverse lookup checking. - Previously, a client connecting over IPv4 would not be matched - properly when the server had an IPv6 listening socket. PR #7407 - [Taketo Kabe ] - - *) Change the way the beos MPM handles polling to allow it to stop and - restart. Problem was the sockets being polled were being reset by - the select call, so once it had accepted a connection it was no - longer listening on the UDP socket we use for shutdown instructions. - APR needs to be altered, patch on it's way. [David Reid] - - *) Empty out the brigade shared by ap_getline()/ap_get_client_block() - on error exit from ap_getline(). Some other code got upset because - the wrong data was in the brigade. [Greg Ames, Jeff Trawick] - - *) Handle ap_discard_request_body() being called more than once. - [Greg Ames, Jeff Trawick] - - *) Get rid of an inadvertent close of file descriptor 2 in - mod_mime_magic. [Greg Ames, Jeff Trawick] - - *) Add a hook, create_request. This hook allows modules to modify - a request while it is being created. This hook is called for all - request_rec's, main request, sub request, and internal redirect. - When this hook is called, the the r->main, r->prev, r->next - pointers have been set, so modules can determine what kind of - request this is. [Ryan Bloom] - - *) Cleanup the build process a bit more. The Apache configure - script no longer creates its own helper scripts, it just - uses APR's. - [jean-frederic clere ] - - *) Stop the forced downgrade of the connection to HTTP/1.0 for - proxy requests. [Graham Leggett] - - *) Avoid using sscanf to determine the HTTP protocol number in - the common case because sscanf is a performance hog. From - Mike Abbot's Accelerating Apache patch number 6. - [Mike Abbot , Bill Stoddard] - - *) Fix a security exposure in mod_access. Previously when IPv6 - listening sockets were used, allow/deny-from-IPv4-address rules - were not evaluated properly (PR #7407). Also, add the ability to - specify IPv6 address strings with optional prefix length on Allow - and Deny. [Jeff Trawick] - - *) Enhance rotatelogs so that a UTC offset can be specified, and - the logfile name can be formatted using strftime(3). (Brought - forward from 1.3.) [Ken Coar] - - *) Reimplement the Windows MPM (mpm_winnt.c) to eliminate calling - DuplicateHandle on an IOCompletionPort (a practice which - MS "discourages"). The new model does not rely on associating - the completion port with the listening sockets, thus the - completion port can be completely managed within the child - process. A dedicated thread accepts connections off the network, - then calls PostQueuedCompletionStatus() to wake up worker - threads blocked on the completion port. - [Bill Stoddard] - - *) Bring forward the --suexec-umask option which allows the - builder to preset the umask for suexec processes. [Ken Coar] - - *) Add a -V flag to suexec, which causes it to display the - compile-time settings with which it was built. (Only - usable by root or the AP_HTTPD_USER username.) [Ken Coar] - - *) Mod_include should always unset the content-length if the file is - going to be passed through send_parsed_content. There is no to - determine if the content will change before actually scanning the - entire content. It is far safer to just remove the C-L as long - as we are scanning it. [Ryan Bloom] - - *) Make sure Apache sends WWW-Authenticate during a reverse proxy - request and not Proxy-Authenticate. - [Graham Leggett ] - -Changes with Apache 2.0.14 - - *) Fix content-length computation. We ONLY compute a content-length if - We are not in a 1.1 request and we cannot chunk, and this is a keepalive - or we already have all the data. [Ryan Bloom] - - *) Report unbounded containers in the config file. Previously, a typo - in the directive could result in the rest of the config - file being silently ignored, with undesired defaults used. - [Jeff Trawick] - - *) Make the old_write filter use the ap_f* functions for the buffering. - [Ryan Bloom] - - *) Move more code from the http module into the core server. This - is core code, basically the default handler, the default input - and output filters, and all of the core configuration directives. - All of this code is required in order for the server to work, with or - without HTTP. The server is closer to working without the HTTP - module, although there is still more to do. [Ryan Bloom] - - *) Fix a number of SGI compile warnings throughout the server. Fix some - bad parameters to apr_bucket_read(). Fix a bad statement in - ap_method_in_list(). For the mod_rewrite cache use apr_time_t - consistently; we were mixing apr_time_t and time_t in invalid ways - before. In load_file(), call apr_dso_error() instead of - apr_strerror() so that we get a more specific string on some platforms. - PR #6980 [Jeff Trawick] - - *) Allow modules to query the MPM about it's execution profile. This - query API can and should be extended in the future, but for now, - max_daemons, and threading or forking is a very good start. - [Jon Travis ] - - *) Modify mod_include to send blocks of data no larger than 9k. - Without this, mod_include will wait until the whole file is parsed, - or the first tag is found to send any data to the client. - [Paul J. Reder ] - - *) Fix mod_info, so that and directives are - not displayed twice when displaying the current configuration. - [Ryan Morgan ] - - *) Add config directives to override DEFAULT_ERROR_MSG and - DEFAULT_TIME_FORMAT. This was sent in as PR 6193. - [Dan Rench ] - - *) Get mod_info building and loading on Win32. [William Rowe] - - *) Begin to move protocol independant functions out of mod_http. The goal - is to have only functions that are HTTP specific in the http directory. - [Ryan Bloom] - -Changes with Apache 2.0.13 - - *) Don't assume that there will always be multiple calls to the byterange - filter. It is possible that we will need to do byteranges with only - one call to the filter. [Ryan Morgan ] - - *) Move the error_bucket definition from the http module to the - core server. Every protocol will need this ability, not just - HTTP. [Ryan Bloom] - -Changes with Apache 2.0.12 - - *) Modify mod_file_cache to save pre-formatted strings for - content-length and last-modified headers for performance. - [Mike Abbot ] - - *) Namespace protect IOBUFSIZ since it is exposed in the API. - [Jon Travis ] - - *) Use "Basic" authentication instead of "basic" in ab, as the spec - says we should. [Andre Breiler ] - - *) Fix a seg fault in mod_userdir.c. We used to use the pw structure - without ever filling it out. This fixes PR 7271. - [Taketo Kabe and - Cliff Woolley ] - - *) Add a couple of GCC attribute tags to printf style functions. - [Jon Travis ] - - *) Add the correct language tag for interoperation with the Taiwanese - versions of MSIE and Netscape. [Clive Lin ] PR#7142 - - *) Migrate the perchild MPM to use the new apr signal child, and - APR thread functions. [Ryan Bloom] - - *) Close one copy of the CGI's stdout before creating the new process. - The CGI will still have stdout, because we have already dup'ed it. - This keeps Apache from waiting forever to send the results of a CGI - process that has forked a long-lived child process. - [Taketo Kabe ] - - *) Remove the rest of the pthreads functions from the threaded MPM. - This requires the APR support for a signal thread that was just - added. [Ryan Bloom] - - *) Make mod_dir use a fixup for sending a redirect to the browser. - Before this, we were using a handler, which doesn't make much - sense, because the handler wasn't generating any data, it would - either return a redirect error code, or DECLINED. This fits the - current hooks better. [Ryan Morgan ] - - *) Make the threaded MPM use APR threads instead of pthreads. - [Ryan Bloom] - - *) Get mod_tls to the point where it actually appears to work in all cases. - [Ben Laurie] - - *) implement --enable-modules and --enable-mods-shared for "all" and - "most". [Greg Stein] - - *) Move the threaded MPM to use APR locks instead of pthread locks. - [Ryan Bloom] - - *) Rename mpmt_pthread to threaded. This is more in line with the - fact that mpmt_pthread shouldn't be using pthreads directly, and - it is a smaller name that doesn't tie into anything. - [Ryan Bloom] - - *) Rename the module structures so that the exported symbol matches - the file name, and it is easier to automate the installation - process (generating LoadModule directives from the module filenames). - [Martin Kraemer] - - *) Remove the coalesce filter. With the ap_f* functions, this filter - is no longer needed. [Ryan Bloom] - -Changes with Apache 2.0.11 - - *) Remove the dexter MPM. Perchild is the same basic idea, but it has the - added feature of allowing a uid/gid per child process. If no - uid/gid is specified, then Perchild behaves exactly like dexter. - [Ryan Bloom] - - *) Get perchild building again. [Ryan Bloom] - - *) Don't disable threads just because we are using the prefork MPM. - If somebody wants to compile without threads, they must now add - --disable-threads to the configure command line. [Ryan Bloom] - - *) Begin to move the calls to update_child_status into common code, so - that each individual MPM does not need to update the scoreboard itself. - [Ryan Bloom] - - *) Allow mod_tls to compile under Unix boxes where openssl has been - installed to the system include files. - [Gomez Henri ] - - *) Cleanup the mod_tls configure process. This should remove any need - to hand-edit any files. We require OpenSSL 0.9.6 or later, but - configure doesn't check that yet. [Ryan Bloom] - - *) Add a very early prototype of SSL support (in mod_tls.c). It is - vital that you read modules/tls/README before attempting to build - it. [Ben Laurie] - - *) Fix a potential seg fault on all platforms. David Reid fixed this - on BEOS, but the problem could happen anywhere, so we don't want - to #ifdef it. [Cliff Woolley ] - - *) Add new LogFormat directive, %D, to log time it takes to serve a - request in microseconds. [Bill Stoddard] - - *) Change AddInputFilter and AddOutputFilter to SetInputFilter and - SetOutputFilter. This corresponds nicely with the other Set - directives, which operate on containers while the Add* directives - tend to work directly on extensions. [Ryan Bloom] - - *) Cleanup the header handling a bit. This uses the apr_brigade_* - functions for the buffering so that we don't need to compute - the length of the headers before we actually create the header - buffer. [Ryan Bloom] - - *) Allow filters to buffer data using the ap_f* functions. These have - become macros that resolve directly to apr_brigade_*. - [Ryan Bloom] - - *) Get the Unix MPM's to do a graceful restart again. If we are going - to register a cleanup with ap_cleanup_scoreboard, then we have to - kill the cleanup with the same function, and that function can't be - static. [Ryan Bloom] - - *) Install all required header files. Without these, it was not - possible to compile some modules outside of the server. - [Ryan Bloom] - - *) Fix the AliasMatch directive in Apache 2.0. When we brought a patch - forward from 1.3 to 2.0, we missed a single line, which broke regex - aliases. [Ryan Bloom] - - *) We have a poor abstraction in the protocol. This is a temporary - hack to fix the bug, but it will need to be fixed for real. If - we find an error while sending out a custom error response, we back - up to the first non-OK request and send the data. Then, when we send - the EOS from finalize_request_protocol, we go to the last request, - to ensure that we aren't sending an EOS to a request that has already - received one. Because the data is sent on a different request than - the EOS, the error text never gets sent down the filter stack. This - fixes the problem by finding the last request, and sending the data - with that request. [Ryan Bloom] - - *) Make the server status page show the correct restart time, and - thus the proper uptime. [Ryan Bloom] - - *) Move the CGI creation logic from mod_include to mod_cgi(d). This - should reduce the amount of duplicate code that is required to - create CGI processes. - [Paul J. Reder ] - - *) ap_new_connection() closes the socket and returns NULL if a socket - call fails. Usually this is due to a connection which has been - reset. [Jeff Trawick] - - *) Move the Apache version information out of httpd.h and into release.h. - This is in preparation for the first tag with the new tag and release - system. [Ryan Bloom] - - *) Begin restructuring scoreboard code to enable adding back in - the ability to use IPC other than shared memory. - Get mod_status working on Windows again. [Bill Stoddard] - - *) Make mod_status work with 2.0. This will work for prefork, - mpmt_pthread, and dexter. [Ryan Bloom] - - *) Correct a typo in httpd.conf. - [Kunihiro Tanaka ] PR#7154 - - *) Really fix mod_rewrite map lookups this time. [Tony Finch] - - *) Get the correct IP address if ServerName isn't set and we can't - find a fully-qualified domain name at startup. - PR#7170 [Danek Duvall ] - - *) Make mod_cgid work with SuExec. [Ryan Bloom] - - *) Adopt apr user/group name features for mod_rewrite. Eliminates some - 'extra' stat's for user/group since they should never occur, and now - resolves the SCRIPT_USER and SCRIPT_GROUP, including on WinNT NTFS - volumes. [William Rowe] - - *) Adopt apr features to simplify mod_includes. This changes the - behavior of the USER_NAME variable, unknown uid's are now reported - as USER_NAME="" rather than the old user#000 result. - WinNT now resolves USER_NAME on NTFS volumes. [William Rowe] - - *) Adopt apr features for simplifing mod_userdir, and accept the new - Win32/OS2 exceptions without hiccuping. [William Rowe] - - *) Replace configure --with-optim option by using and saving the - environment variable OPTIM instead. This is needed because configure - options do not support multiple flags separated by spaces. - [Roy Fielding] - - *) Fix some byterange handling. If we get a byte range that looks like - "-999999" where that is past the end of the file, we should return - a PARTIAL CONTENT status code, and return the whole file as one big - byterange. This matches the 1.3 handling now. [Ryan Bloom] - - *) Make the error bucket a real meta-data bucket. This means that the - bucket length is 0, and a read returns NULL data. If one of these - buckets is passed down after the headers are sent, this data will - just be ignored. [Greg Stein] - - *) The prefork MPM wasn't killing child processes correctly if a restart - signal was received while the process was serving a request. The child - process would become the equivalent of a second parent process. If - we break out of the accept loop, then we need to do die after cleaning - up after ourselves. [Ryan Bloom] - - *) Change the Prefork MPM to use SIGWINCH instead of SIGUSR1 for graceful - restarts. [Ryan Bloom] - - *) Modify the apr_stat/lstat/getfileinfo calls within apache to use - the most optimal APR_FINFO_wanted bits. This spares Win32 from - performing very expensive owner, group and permission lookups - and allows the server to function until these apr_finfo_t fields - are implemented under Win32. [William Rowe] - - *) Support for typedsafe optional functions - that is functions exported by - optional modules, which, therefore, may or may not be present, depending - on configuration. See the experimental modules mod_optional_fn_{ex,im}port - for sample code. [Ben Laurie] - - *) filters can now report an HTTP error to the server. This is done - by sending a brigade where the first bucket is an error_bucket. - This bucket is a simple bucket that stores an HTTP error and - a string. Currently the string is not used, but it may be needed - to output an error log. The http_header_filter will find this - bucket, and output the error text, and then return - AP_FILTER_ERROR, which informs the server that the error web page - has already been sent. [Ryan Bloom] - - *) If we get an error, then we should remove all filters except for - those critical to serving a web page. This fixes a bug, where - error pages were going through the byterange filter, even though - that made no sense. [Ryan Bloom] - - *) Relax the syntax checking of Host: headers in order to support - iDNS. PR#6635 [Tony Finch] - - *) Cleanup the byterange filter to use the apr_brigade_partition - and apr_bucket_copy functions. This removes a lot of very messy - code, and hopefully makes this filter more stable. - [Ryan Bloom] - - *) Remove AddModule and ClearModuleList directives. Both of these - directives were used to ensure that modules could be enabled - in the correct order. That requirement is now gone, because - we use hooks to ensure that modules are in the correct order. - [Ryan Bloom] - - *) When SuExec is specified, we need to add it to the list of - targets to be built. If we don't, then any changes to the - configuration won't affect SuExec, unless 'make suexec' is - specifically run. [Ryan Bloom] - - *) Cleaned out open_file from mod_file_cache, as apr now accepts - the APR_XTHREAD argument to open a file for consumption by - parallel threads on win32. [William Rowe] - - *) Correct a bug in determining when we follow symlinks. The code - expected a stat -1 result, not an apr_status_t positive error. - Also check if the APR_FINFO_USER fields are valid before we - follow the link. [William Rowe] - - *) Move initgroupgs, ap_uname2id and ap_gname2id from util.c to - mpm_common.c. These functions are only valid on some platforms, - so they should not be in the main-line code. [Ryan Bloom] - - *) Remove ap_chdir_file(). This function is not thread-safe, - and nobody is currently using it. [Ryan Bloom] - - *) Do not try to run make depend if there are no .c files in the - current directory, doing so makes `make depend` fail. - [Ryan Bloom] - - *) Update highperformance.conf to work with either prefork or - pthreads mpms. [Greg Ames] - - *) Stop checking to see if this is a pipelined request if we know - for a fact that it isn't. Basically, if r->connection->keepalive == 0. - This keeps us from making an extra read call when serving a 1.0 - request. [Ryan Bloom and Greg Stein] - - *) Fix the handling of variable expansion look-ahead in mod_rewrite, - i.e. syntax like %{LA-U:REMOTE_USER}, and also fix the parsing of - more complicated nested RewriteMap lookups. PR#7087 [Tony Finch] - - *) Fix the RFC number mentioned when complaining about a missing - Host: header. PR#7079 [Alexey Toptygin ] - - *) Fix an endless loop in ab which occurred when ab was posting - and the server dropped the connection unexpectedly. - [Jeff Trawick] - - *) Fix a segfault while handling request bodies in ap_http_filter(). - This problem has been seen with mod_dav usage as well as with - requests where the body was just being discarded. [Jeff Trawick] - - *) Some adjustment on the handling and automatic setting (via - hints.m4) of various compilation flags (eg: CFLAGS). Also, - add the capability to specify flags (NOTEST_CFLAGS and - NOTEST_LDFLAGS) which are used to compile Apache, but - not used during the configuration process. Useful for - flags like "-Werror". [Jim Jagielski] - - *) Stop using environment variables to force debug mode or - no detach. We now use the -D command line argument to - specify the correct mode. -DONE_PROCESS and -DNO_DETACH. - [Greg Stein, Ryan Bloom] - - *) Change handlers to use hooks. [Ben Laurie] - - *) Stop returning copies of filenames from both apr_file_t and - apr_dir_t. We pstrdup the filenames that we store in the - actual structures, so we don't need to pstrdup the strings again. - [Ryan Bloom] - - *) mod_cgi: Fix some problems where the wrong error value was being - traced. [Jeff Trawick] - - *) EBCDIC: Fix some missing ASCII conversion on some protocol data. - [Jeff Trawick] - - *) Add generic hooks. [Ben Laurie] - - *) Use a real pool to dup the error log descriptor. [Ryan Bloom] - - *) Fix a segfault caused by mod_ext_filter when the external filter - program does not exist. [Jeff Trawick] - - *) Fix an output truncation error when on an HTTP >= 1.0 request an - object of size between DEFAULT_BUCKET_SIZE and AP_MIN_BYTES_TO_WRITE - was served through mod_charset_lite (or anything else that would - create a transient bucket in this size range). ap_bucket_make_heap() - silently failed (fixed), transient_setaside() discovered it, but - ap_save_brigade() ignored it (fixed). [Jeff Trawick] - - *) Ignore \r\n or \n when using PEEK mode for input filters. The problem - is that some browsers send extra lines at the end of POST requests, and - we don't want to delay sending data back to the user just because the - browser isn't well behaved. [Ryan Bloom] - - *) Get SuEXEC working again. We can't send absolute paths to suExec - because it refuses to execute those programs. SuEXEC also wasn't - always recognizing configuration changes made using the autoconf - setup. [Ryan Bloom] - - *) Allow the buildconf process to find the config.m4 files in the correct - order. Basically, we can now name config.m4 files as config\d\d.m4, - and we will sort them correctly when inserting them into the build - process. [Ryan Bloom] - - *) Get mod_cgid to use apr calls for creating the actual CGI process. - This also allows mod_cgid to use ap_os_create_priviledged_process, - thus allowing for SuExec execution from mod_cgid. Currently, we do - not support everything that standard SuExec supports, but at least - it works minimally now. [Ryan Bloom] - - *) Allow SuExec to be configured from the ./configure command line. - [Ryan Bloom] - - *) Update some of the docs in README and INSTALL to reflect some of - the changes in Apache 2.0 [Cliff Woolley ] - - *) If we get EAGAIN returned from the call to apr_sendfile, then we - need to call sendfile again. This gets us serving large files - such as apache_2.0a9.tar.gz on FreeBSD again. [Ryan Bloom] - - *) Get the support programs building cleanly again. - [Cliff Woolley ] - - *) The Apache/Win32 Apache.exe and dll's now live in bin. The - current directory logic now backs up over bin/ to determine the - server root from the Apache.exe path. - - *) Apache/Win32 now follows the standard conventions of mod_foo.so - loadable modules, dynamic libs are all named libfoo.dll, and the - makefile.win populates the include, lib and libexec directories. - - *) Apache is now IPv6-capable. On systems where APR supports IPv6, - Apache gets IPv6 listening sockets by default. Additionally, the - Listen, NameVirtualHost, and directives support IPv6 - numeric address strings (e.g., "Listen [fe80::1]:8080"). - [Jeff Trawick] - - *) Modify the install directory layout. Modules are now installed in - modules/. Shared libraries should be installed in libraries/, but - we don't have any of those on Unix yet. All install directories - are modifyable at configure time. [Ryan Bloom] - - *) Install all header files in the same directory on Unix. [Ryan Bloom] - - *) Get the functions in server/linked into the server, regardless of - which modules linked into the server. This uses the same hack - for Apache that we use for APR and apr-util to ensure all of the - necessary functions are linked. As a part of thise, the CHARSET_EBCDIC - was renamed to AP_CHARSET_EBCDIC for namespace protection, and to make - the scripts a bit easier. - [Ryan Bloom] - - *) Rework the RFC1413 handling to make it thread-safe, use a timeout - on the query, and remove IPv4 dependencies. [Jeff Trawick] - - *) Get all of the auth modules to the point that they will install and - be loadable into the server. Our new build/install mechanism expects - that all modules will have a common name format. The auth modules - didn't use that format, so we didn't install them properly. - [Ryan Bloom] - - *) API routines ap_pgethostbyname() and ap_pduphostent() are no longer - available. Use apr_getaddrinfo() instead. [Jeff Trawick] - - *) Get "NameVirtualHost *" working in 2.0. [Ryan Bloom] - - *) Return HTTP_RANGE_NOT_SATISFIABLE if the every range requested starts - after the end of the response. [Ryan Bloom] - - *) Get byterange requests working with responses that do not have a - content-length. Because of the way byterange requests work, we have to - have all of the data before we can actually do the byterange, so we - can compute the content-length in the byterange filter. - [Ryan Bloom] - - *) Get exe CGI's working again on Windows. - [Allan Edwards] - - *) Get mod_cgid and mod_rewrite to work as DSOs by changing the way - they keep track of whether or not their post config hook has been - called before. Instead of a static variable (which is replaced when - the DSO is loaded a second time), use userdata in the process pool. - [Jeff Trawick] - -Changes with Apache 2.0a9 - - *) Win32 now requires perl to complete the final install step for users - to build + install on Win32. Makefile.win now rewrites @@ServerRoot@ - and installs the conf, htdocs and htdocs/manual directories. - [William Rowe] - - *) Make mod_include use a hash table to associate directive tags with - functions. This allows modules to implement their own SSI tags easily. - The idea is simple enough, a module can insert it's own tag and function - combination into a hash table provided by mod_include. While mod_include - parses an SSI file, when it encounters a tag in the file, it does a - hash lookup to find the function that implements that tag, and passes - all of the relevant data to the function. That function is then - responsible for processing the tag and handing the remaining data back - to mod_include for further processing. - [Paul J. Reder ] - - *) Get rid of ap_new_apr_connection(). ap_new_connection() now has - fewer parameters: the local and remote socket addresses were removed - from the parameter list because all required information is available - via the APR socket. [Jeff Trawick] - - *) 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 ced2c73298..0000000000
--- a/INSTALL
+++ /dev/null
@@ -1,466 +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 2.0 HTTP server
-  =====================================
-
-  1. Overview for the impatient
-     --------------------------
-
-     $ ./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.
-
-     NOTE: if you are building from a copy of the Apache CVS
-           repository, rather than a release distribution, then you
-	   must use the "buildconf" script before running configure.
-
-     NOTE: If you are building on FreeBSD, you should add the argument
-           --with-mpm=prefork to the configure line.  The Apache Group
-           has discovered that threads do not work well with Apache
-           on FreeBSD.  For that reason, we disable threads by default
-           on FreeBSD, and you need to build the prefork MPM.  If you wish
-           to try to make threads work on FreeBSD, they can be re-enabled
-           by using --enable-threads
-
-  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  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 the `configure' script this is no harm.  Of
-        course, you still can build and install Apache 2.0. 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 ./configure.
-
-     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 apr_dso_open()/apr_dso_sym() calls. These calls
-        are not available under all operating systems therefore you
-        cannot use the DSO mechanism on all platforms. Apache relies
-        on autoconf to detect the ability to use DSOs, and libtool to
-        determine how to build DSOs. If your platform is supported by
-        libtool, and we can find DSO system calls, then DSOs should
-        work out-of-the-box. 
-
-        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 manually or at least make sure a Perl 5
-        interpreter is installed from which Apache can guess the options.
-
-
-     If you are building from a copy of the CVS repository, rather
-     than a release distribution, then you will need these additional
-     tools:
-
-     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.
-
-
-  3. Configuring the source tree
-     ---------------------------
-
-     Setup:
-
-     If you have downloading the Apache 2.0 from the CVS, rather than
-     a release distribution, then you will need to prepare the source
-     tree for configuration and compilation. 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" CFLAGS="-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=...]        [TARGET=...]
-       [CPPFLAGS=...]  [NOTEST_CPPFLAGS=...]
-       [CFLAGS=...]    [NOTEST_CFLAGS=...]
-       [CXXFLAGS=...]  [NOTEST_CXXFLAGS=...]
-       [LDFLAGS=...]   [NOTEST_LDFLAGS=...]
-       [LIBS=...]      [NOTEST_LIBS=...]
-       [INCLUDES=...]  [SHLIB_PATH=...] 
-
-       ./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]
-			     [--server-gid=GID]
-
-                             [--enable-maintainter-mode]
-                             [--enable-debug]
-
-     Use the CC, CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LIBS, INCLUDES,
-     SHLIB_PATH and TARGET environment variables to override or expand the
-     corresponding default entries as determined by configure.
-
-     Use NOTEST_CPPFLAGS, NOTEST_CFLAGS, NOTEST_CXXFLAGS, NOTEST_LDFLAGS,
-     and NOTEST_LIBS to add entries that should only be used during
-     the actual build and compilation of Apache, such as -Werror.
-
-     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, --iconsdir=DIR,
-     --htdocsdir=DIR, --cgidir=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/bin,
-     libexecdir=EPREFIX/modules, mandir=PREFIX/man,
-     sysconfdir=PREFIX/conf, datadir=PREFIX, iconsdir=PREFIX/icons,
-     htdocsdir=PREFIX/htdocs, cgidir=PREFIX/cgi-bin,
-     includedir=PREFIX/include, localstatedir=PREFIX,
-     runtimedir=PREFIX/logs, logfiledir=PREFIX/logs and
-     proxycachedir=PREFIX/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-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 and Authentication
-      (+) 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_usertrack .... Logging of user click-trails via HTTP Cookies
-
-     Content Management
-      (-) mod_dav .......... WebDAV (RFC 2518) support for Apache
-      (-) mod_dav_fs ....... mod_dav backend to managing filesystem content
-
-     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 ..... Multi-process(dynamic) Multi-threaded(static) 
-                             Unix MPM
-          prefork .......... Preforking 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.
-
-     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 --quiet option to disable all configuration verbose
-     messages.
- 
-
-  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/conf/ 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/conf/.
- 
-        $ vi PREFIX/conf/httpd.conf
- 
-     Have a look at the Apache manual under docs/manual/ or
-     http://httpd.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://httpd.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://httpd.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://httpd.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://www.apache.org/foundation/mailinglists.html
-
-     Thanks for running Apache httpd.
-
-                                          The Apache Group
-                                          http://www.apache.org/
diff --git a/InstallBin.dsp b/InstallBin.dsp
deleted file mode 100644
index 8d5abc9eff..0000000000
--- a/InstallBin.dsp
+++ /dev/null
@@ -1,109 +0,0 @@
-# Microsoft Developer Studio Project File - Name="InstallBin" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.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 AllowPerConfigDependencies 0
-# 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 "\Apache2.0\bin\Apache.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="\Apache2" SHORT=R LONG=Release _install"
-# PROP Rebuild_Opt ""
-# PROP Target_File "\Apache2\bin\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 "\Apache2.0\bin\Apache.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="\Apache2" SHORT=D LONG=Debug _install"
-# PROP Rebuild_Opt ""
-# PROP Target_File "\Apache2\bin\Apache.exe"
-# PROP Bsc_Name ""
-# 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=.\os\win32\BaseAddr.ref
-# End Source File
-# Begin Source File
-
-SOURCE=.\CHANGES
-# 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
-# Begin Source File
-
-SOURCE=..\STATUS
-# End Source File
-# End Target
-# End Project
diff --git a/KEYS b/KEYS
deleted file mode 100644
index 28e727bc61..0000000000
--- a/KEYS
+++ /dev/null
@@ -1,722 +0,0 @@
-This file contains the PGP keys of various Apache developers.
-Please don't use them for email unless you have to. Their main
-purpose is code signing.
-
-Apache users: pgp < KEYS
-Apache developers: pgp -kxa <your name> and append it to this file.
-
-
-Type Bits/KeyID    Date       User ID
-pub  1024/2719AF35 1995/05/13 Ben Laurie <ben@algroup.co.uk>
-                              Ben Laurie <ben@gonzo.ben.algroup.co.uk>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.3ia
-
-mQCNAi+0jQEAAAEEAK7oX0FeNncaHfa1v+V7SMUviAm8qB8orWG0zvja4ZtSrHVg
-/PMwppUh44t5ERA9lltRBdHu30+YSh8a1dYt1XOD83nknzj9rhtpFAPqyywlLVhN
-VY3PVLyMbULw27aEAGc+StFqrDoUQ0+j9QU/YH/IyVN9rBaJyhsIDEUnGa81AAUR
-tB5CZW4gTGF1cmllIDxiZW5AYWxncm91cC5jby51az6JARUDBRAyb2Doc3AsNzyk
-Yh0BARa6CACUBnsP9Vb+T/PvNYKVQBIODz+90tz5GozWwCVfPVSaRd8Dz+oF1sFs
-YCz/KuxqBhL5PkiCuSMfOVlPA5nirjoktMF/af5saZqhPr5rvr67Z1OzZnVDvWe4
-DhFrn8EoLrY5YNJhUwfINnZqyKaQu8TW6p4caLkTCW0KM+4ztTe74xRG9NeE+K0+
-0RMpAF3jEY36LGRjq6miazt2bVZQDTl6CuWE+gAaFlX2ojV7e1xdxVvpBIEc34MP
-g9ORJ0evx1QilMt1VyGcS/pe4IQgjdJqjU/4fzqFZkT2nntQMbV9kQyNe2+qfqP7
-giTryIanmBAfd3oOCTsRz2VKPfdhCqCRiQB1AwUQMRdzEEyr2GZv4ALJAQEuhAL6
-A8I84BR+87uNAHD0ZJkTM73WdyMEGvAKBvrZK/g0VLYj0NtgkSuRJfrXnGkuh27I
-ZrjfL952Q/mXgMtHhJHJ9YfenGFWSEDHnolNzKOzTQJpE01IZ3nWv7ezA9N1LZVC
-iQCVAgUQMROrdRsIDEUnGa81AQEUNgQAlvyjt534RDQd2AYGoZriaFzjaL7dTCRH
-4b1zxuWBNWf3pI4W0iwU02Q5rEWEmY5DLl6/ie+vcQKOWSqXVgnM/s6EARdKEN56
-d6PzkwszgfEybDYrcAxReJcTCcV8ItJer/iqpBLgtaxyUpI77NvKcDGHp6BgYpnv
-1lNkH0FISK+JAJUDBRAwtzlWdGx7qH+PTVkBARFWA/99NTCMihlOZS7LmHDVic/q
-H1K1DVdMcv0iL39+7Pq4+AA/ET8dWIgcjaIreSqAZTpjwU1pMPaWgecDD1rEMCYX
-R+JoofLJ24BLcSlpXJ/gWMifYNxqdDeMRkw/aW/kaXQJWIz+oDYNuOyi5VvB6faF
-6Lm7P5cw1mX0I5rYc3woh7QoQmVuIExhdXJpZSA8YmVuQGdvbnpvLmJlbi5hbGdy
-b3VwLmNvLnVrPokAlQIFEDEXgCUbCAxFJxmvNQEBiL8D/3MLjfHGvuByqP1VFQrF
-QeMNd2aIQuC7ys3lkDvrLkkPJQANua0/MdDaZk6F5pCGcTmmmaJOjcOcCheD7FU5
-w9zxkQGR3Swr3opFHSr/CkEl83jRy3oq1MFydWoGajQjIr/c23X8zr+XntPyO6VX
-q5He4RrTiXeAEFBzz+J+R+EQ
-=zh1u
------END PGP PUBLIC KEY BLOCK-----
-
-
-Type Bits/KeyID    Date       User ID
-pub  1024/A99F75DD 1997/01/24 Rodent of Unusual Size <Ken.Coar@Golux.Com>
-                              Rodent of Unusual Size <coar@Apache.Org>
-                              Rodent of Unusual Size <Coar@Raleigh.IBM.Com>
-                              Rodent of Unusual Size <Coar@DECUS.Org>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.3a
-
-mQCNAzLpIyUAAAEEAN9KC8CxTeozPYJjsnhFpJ14d4Hhf2M6OTgqPQFRHOswM/3j
-B7IW0s+HwVyQ5/SjIlo+8ur9X7yaj1FS2GQmKD1x9LKeHRAoosBIs33okRtoeDRy
-ufTaTyQTwLklxClWm3JEef4xZioun1mtWbpz0yVEOCSZcRvtnJrNPMCpn3XdAAUR
-tCtSb2RlbnQgb2YgVW51c3VhbCBTaXplIDxLZW4uQ29hckBHb2x1eC5Db20+iQCV
-AwUQNiiZ2JrNPMCpn3XdAQGlgwP+JLlZvNV/fJ2azKIwjibDa4n2LUDxa7ofKboU
-QL+D7FD24zQcmzmkBQm/BL/FSUtxZasJkvdVbU98N3G4h3C4AyErfQOFcrepyGAB
-M88onQ1DbQ6tiUA3gw9gIB+2l1C5R8wBOtlwoRJM4GFvjjtRp+KaQqvN3f+lLMMt
-hKYB70m0KFJvZGVudCBvZiBVbnVzdWFsIFNpemUgPGNvYXJAQXBhY2hlLk9yZz6J
-AJUDBRA2KJmIms08wKmfdd0BAT3yBADEDHAn++77n7bLA/u9QYM2LBQHnXdw5Is8
-YGHpHcNZVDA8CtRTOdub8rhe9qgsid/jEry0hT9Sygfx/ry5ntjmF12ltnxBDPdZ
-uU2DaHaIh/zBUAv0hyaQeAXEYiV9J75GrDkTj5Jrrnd623uyIRoMZPKYb+oqsZ4H
-jIe/w+CDfrQtUm9kZW50IG9mIFVudXN1YWwgU2l6ZSA8Q29hckBSYWxlaWdoLklC
-TS5Db20+iQCVAwUQNiiiaZrNPMCpn3XdAQFnMwP/cX21KHwg6ID7NoGzEKxsfZE/
-dEgRGHFp5T6vznI9fO9WZZ2HmISWjEjri5zAAmXvQG2nWEYFVcF1oWph/ndLgLws
-PfIsZiPXpj1LD7oon5PEXvJlkFfpHDqiG4xOORbbGWBcv1sqkx6djkpfyXLoMD36
-5YazFuKurHpWPwAQRJK0J1JvZGVudCBvZiBVbnVzdWFsIFNpemUgPENvYXJAREVD
-VVMuT3JnPg==
-=kWdi
------END PGP PUBLIC KEY BLOCK-----
-
-Type Bits/KeyID    Date       User ID
-pub   768/A0BB71C1 1997/06/03 Jim Jagielski <jim@jaguNET.com>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.3
-
-mQBtAzOUkNMAAAEDANZdTUJQPwrFI9526Qf+DEWL8dXgfhWW8o6CzewdcCoHYEpu
-9CiOMD3f9bgo1VozOPceGzCu/9FF2hMLUvVsTAZkzC3rre5TtPo/vOf5HJ+ac9M7
-aqxW+gRu2/90oLtxwQAFEbQfSmltIEphZ2llbHNraSA8amltQGphZ3VORVQuY29t
-PokAdQMFEDOUkNRu2/90oLtxwQEB8iEC/i9Qo55TlT8bRpcqeM3lzNDqzU9cqKRf
-9X8pGJIVE5m2JPm99qPLs8RPeepLChi8ZZ+2hSfb7ldQhvVLgNqQqLpsjGtJjJOU
-C+MrKDeSk2WAicg6Uo0FWCsEHxrssw139A==
-=pwim
------END PGP PUBLIC KEY BLOCK-----
-
-Type Bits KeyID      Created    Expires    Algorithm       Use
-sec  1024 0x08C975E5 1999-04-14 ---------- DSS             Sign & Encrypt
-sub  2048 0x4CCDB430 1999-04-14 ---------- Diffie-Hellman
-uid  Jim Jagielski <jim@apache.org>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: PGPfreeware 5.5.3i
-
-mQGiBDcUl9QRBADl5tF8kOD0uddlnl9qsaG70/hwujGTsSXATnqoLseTsWORoVXf
-oBklokEAGmT2+Cl8XIXZ31Wh+GaJ3CTbEv8Ok1vapOt+ltPgOKzZEB4uP25EbhC2
-LWf+lUoafcd2Xi0KBV4fqXqEEuDGP1TAdZ6k7NVqgpjvbJ5TdqL0LrWOOwCg/0b4
-+/p/avQr+uZRU2rdmYu/b/0D/2LnjcEqUjsslh2e9m0OgAu+gnYAmQH6Dbnp+iKl
-jffWPChwIMFZd/7FnGOzYDzoqnzTFyA4VE5PHWL61V2lpHJWB21K9D6rbEcx0iYB
-AHHxZQEmxSBU6PmGnbF+2P7vC0Jz9gZ5dCbjtGboYxd00/XQlZwCs8jHueTpSfx9
-n7dYBACFpW+v2pSlG0ReiS6Ult3gaGWiw81D0nFVvCp5BlxgQDymyF1MS6FbCj/g
-FGILosMhlsIHTFaC0DD0LSXyN1rm0ykPvi+vULIlKNJwW7fCi+33j1Azx+zfMNeO
-T5vqAfF6cvsZ6qPb9CcYvU4jEKvkovA1U3jMFehqcGkTV5sfvbQeSmltIEphZ2ll
-bHNraSA8amltQGFwYWNoZS5vcmc+iQBLBBARAgALBQI3FJfUBAsDAgEACgkQizpg
-HwjJdeU/8ACg3mtYerA7QN/8Okp2IgGr+ge4yKgAn09RX5UR8DyZ1/Q8OFasE6T6
-Tg2UuQINBDcUl9UQCAD2Qle3CH8IF3KiutapQvMF6PlTETlPtvFuuUs4INoBp1aj
-FOmPQFXz0AfGy0OplK33TGSGSfgMg71l6RfUodNQ+PVZX9x2Uk89PY3bzpnhV5JZ
-zf24rnRPxfx2vIPFRzBhznzJZv8V+bv9kV7HAarTW56NoKVyOtQa8L9GAFgr5fSI
-/VhOSdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY7288kjwEPwpVsYjY67VYy4XTjT
-NP18F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy1obEAxnIByl6ypUM2Zafq9AK
-UJsCRtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpMgs7AAICCACEhzcRGEc3y3/4YNaG
-89FmtIRpFU5zoaZxxDrmUiS1HdhqFykv8ozaTyjfImCuhq8i6DG15oGudxPma7Ey
-sCcA/qmQEBVrXFK2DYTFW3UnPyqiE822plo0d45u1csKzPvGpHYVGC4HOEKCghRy
-/54nH0fsKV3VSlIXAhRG3LIstzAtslrSYELW1Lov53GK+YZpRDJTbLAxjIYB8kEY
-hiQYzHm/cbBeRpjG9BpoBQh54dNOj22CU8HC4KvZSnDcLAzmDyrQFXFfffvJtQ7+
-HH2iIWKMFOjpRHh2ZK6uhJb03Yo/v+admKs1HSEFdV5VJUCkqymhKT0OiWnXmNHq
-QUfliQBGBBgRAgAGBQI3FJfVAAoJEIs6YB8IyXXlME4AniogMeV3YLNf6C1Y2+k8
-F3rt0S/OAKDHF+wfxLDzCxsoQbwesIUAKgb7Hg==
-=mrXV
------END PGP PUBLIC KEY BLOCK-----
-
-Type Bits/KeyID    Date       User ID
-pub  2048/DD919C31 1996/12/24 sameer@c2.net
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.3ia
-
-mQENAzK/QZIAAAEIALrsEjuGlt6wkHy8fx2wPSkH7paAqJHDCbO1W/GMVs41BsH1
-xpyBi9lOtUXHsDC8Obx/TES4/xVPSsFKPQLa9Q/OsxjXmEPBvQ5PZdOXJ5zmRMI1
-1cfUp2s8w6i+IS68IWRKdPMshGWFGar1YUPM1UpVME7U+uGD3wgdC4DrVJHzS5Eh
-gEDyQ9FPb+8CpsRO3AvUPzsZGG8Iy/9GiLzmaJG34zZ5fv5X7sr89xiWJ21ehk+X
-ePO9kvq+nzfOCCK6a3GZD4g3KJX/Pm3oKeaXeL8WSCCPzpNbtRJk3ofeN7Zm1K0L
-yChPiyui+OO063/WASv52bxUIlmzbX82a92RnDEABRG0DXNhbWVlckBjMi5uZXSJ
-ARUDBRAyv0GTbX82a92RnDEBAfqVB/9GSzADIVqY0faFOLN6+E3qqg3hPRLBvjgC
-5cvTlwT7W64zI+aiSZuN+xAXq+3lnKtmzn45F3hD7gBxRPJbSKsObn2zU4UcqW/o
-qoiYEnO9EhoBomwPUbVy8C00CWvDLfeF4L5r+2oXgilTsCojSaWJX0QoPCwRQao1
-YwZ6CqAA78vdbBNkmA0WrPsVqwd3ijgFapcX671AqiT+pDbvK646I6uGPXJzN3ZU
-vFuDim9D2uNk9CfvPhKGscr4qqP40TnNn5fjSsmrFyFxYsdwo7I4TFpnsEPOw226
-GU+TR7zdwnByP72AxPEBJ/F22LwNyreuph+fRpWCnCf+9gVW9Heh
-=jS5Z
------END PGP PUBLIC KEY BLOCK-----
-
- ===========================
-Rob Hartill <robh@imdb.com>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.2
-
-mQCNAzG6VfMAAAEEAOvtvphFG/D02vGLENBl5OVPgEJgP9E1xhUgKTZnJstv30kD
-h1IqeIBkEAy5bpKapCbvvxukyQErhB0efTi2v5yTAlz5pVjgWM5Sa8CyTXJmXPHH
-EuOfy1DqaiQSmZ6KWX0ygw3gKDZMiNMf06UURLLYtRlGKSYY3WVj2u2UCmS9AAUR
-tB5Sb2JlcnQgSGFydGlsbCA8cm9iaEBpbWRiLmNvbT6JAJUDBRAx5eIAZWPa7ZQK
-ZL0BAU2XBACXfopMzC8kW3KEqq+N9W9fkGNgy//8XqQ77FmfPQPbO4X7Zn3cyO46
-MxvPP+92zSyN3dyj/xWZYoRLwll+ync9d4KUFwKw45DALAvz1CKHMOpQPD7dIWdE
-9poJQrcbKeOqLcGZTu/hY90gWBUZ++9umR8X8lyh/WEgcUolfgYHew==
-=upYh
------END PGP PUBLIC KEY BLOCK-----
-
-Type Bits/KeyID    Date       User ID
-pub  1024/631B5749 1996/06/21 Randy Terbush <randy@zyzzyva.com>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.3
-
-mQCNAzHLBS8AAAEEANGFXb9o0NPVfVjSLvQh1j3fN6cMeVNA5BGUJ6HZGP/NDxTE
-i8hwejJqakkU4ux/g6Kqckrx3h8WR7OXZZ+R8CsA0bg9Sr42ndEQCUISgArg+lXZ
-gRUniARPPA7tamTSq8v1mnxqy9s26Ht2rAG2D6IiK/7v0JlezKirDeBjG1dJAAUR
-tCFSYW5keSBUZXJidXNoIDxyYW5keUB6eXp6eXZhLmNvbT6JAJUDBRAxywUwqKsN
-4GMbV0kBAegnA/sH63WyfwMFmn3nWe8T/5IXO/QkMYoMGLS1i7IxMY9O8BVvKQM+
-oxEcJdFAG7zPZkpgKzTBxmExz5hMZ9hwJ42XhrslWoP7JVvADJcdthrUAYW9W+jx
-GcDYAW3qW5DpKsQchfvXq9QOBDxP+Kbbe2B8xGEyGUhLkacISFTrIhhQSg==
-=8P8s
------END PGP PUBLIC KEY BLOCK-----
-
-Type Bits/KeyID    Date       User ID
-pub  1024/49A563D9 1997/02/24 Mark Cox <mark@awe.com>
-                              Mark Cox <mcox@c2.net>
-                              Mark Cox <mark@ukweb.com>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.3ia
-
-mQCNAzMRY/IAAAEEAOloTOU0f4w7FDRMM6kA/6XazXxJ/HH8dsmb6E7RuYfVlXsd
-kCwxUBOkyW+AYhkHbYUwnB5qBoFUyLrbLGuwKHW1KnAwgbeZLTH5nqQLpA0RLGVZ
-v3tzImKUdyyxBphZWC4IeEgUbl9cc+piOsEJ8QzF7gnqwWo/Ku6tTP1JpWPZAAUR
-tBdNYXJrIENveCA8bWFya0Bhd2UuY29tPokAlQMFEDQvYTHurUz9SaVj2QEB/hMD
-/ix6pAa+4ZgFQNRAc7fC+I4uGWvXoI8N8wtgiJi//8Kc1vjtvTylLPKVBDsy1ihs
-bVOjD3NUEkH95TNI3QhVeCwJPl2e3GgFl253hj8Jai9snHj75pXjQXq0NxQ/JRSr
-EAqrFM7+yRLPs7zDwsMoc2Ox5emq4joVa3syZUEwW7LxtBZNYXJrIENveCA8bWNv
-eEBjMi5uZXQ+iQCVAwUQNHKlBO6tTP1JpWPZAQEA8QP9HSjVMLohfOVO0tHcLRDB
-eDfnRnBxgTeF7P2u8qB+eOeLqBzHNmE/gROWuZXOpkxeCqT0GG3oXqmSEmVOtDsJ
-K92sKvtTdJOAGq95UQI3t1Ix6iNHkVJfo11RkJyU2iL6XFR1953nS33xKGdbU6v7
-5KVCu3JTe1kDEDOyMVDdRmW0GU1hcmsgQ294IDxtYXJrQHVrd2ViLmNvbT6JAJUD
-BRAzEWPy7q1M/UmlY9kBAfN5A/43SdANs/NZ6ouyxAvKEWSPDnNkHI3rSPynbn7o
-kSrtFeCQ3Vwe0B0fkszBEAZ9zbnx/s/1LKnriUfyzhdZhJfkZfxgDwy6s6smagYW
-smz/LFaeDzG3Ej20VSe6ghseqcPscJL06PUg13LJC4LFlgYcCDEeGl81Nm37fe0x
-IUhlNA==
-=k8vP
------END PGP PUBLIC KEY BLOCK-----
-
-Type Bits/KeyID    Date       User ID
-pub  1024/2F90A69D 1997/02/24 Paul Sutton <paul@ukweb.com>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.3ia
-
-mQCNAzMRsB0AAAEEAKj2XYYEGcZhT69x4gskQ3xz+KMTLn7gKSqqcyyeinJ0ZjLl
-6AJjb1/68nGsF+IIY+IJS+5smq8do1qpC3UZcmw423Sg8F71GeqDO4HZXOAOieVy
-rpVs6S5TaXlJOcrC7zZCx+iql97+xJFjUGkkS7j/jIkx1AajzMNkSr0vkKadAAUR
-tBxQYXVsIFN1dHRvbiA8cGF1bEB1a3dlYi5jb20+iQCVAwUQMxGwHcNkSr0vkKad
-AQGrigP9F43zbiOigYel+JCMiB0HK/UdqSrf3xWxHIKWKNhQNjhnyeF+jKQwFld6
-7KQYsqZIpHsWLWmSk0AmKQOUIw+DxclDxBL2dT4p+CjgTgIAcbvPpahWkBAw/E+c
-EGTiYbe+Y3sHJhhP+d0TOLmsETG9tpi7gFZ6FfNcWPxFMdxGrf4=
-=0jQW
------END PGP PUBLIC KEY BLOCK-----
-
-Type bits/keyID    Date       User ID
-pub  1024/BA20321D 1997/06/05 Chuck Murcko <chuck@topsail.org>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.2
-
-mQCNAzOW7moAAAEEAMYZlNOxWCjLR/PosadbG+xsrB2unid2LiYoakTFiDIBaZjx
-bu6hNmVZPYfKOXQcqrCu0EY3uVLP/L89bST5pfIZOzz8GTm33zrETgfzpXYyFdbX
-eZ5vc6aa3+7zmI7h/aU567P9ruB2C/RBLl1A59wmPRRVvjEIAkI4bAO6IDIdAAUR
-tCBDaHVjayBNdXJja28gPGNodWNrQHRvcHNhaWwub3JnPg==
-=vUdL
------END PGP PUBLIC KEY BLOCK-----
-
-Type Bits/KeyID    Date       User ID
-pub  1024/26BB437D 1997/04/28 Ralf S. Engelschall <rse@engelschall.com>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.3ia
-
-mQCNAzNko/QAAAEEANZ2kpN/oMkz4tqzxvKPZws/XwsD0Y+E5/y7P2DIw4uHS/4N
-syQbgkdrZhPBlXDv68DQioHXWsb904qyr7iZB1LC5ItK9MgqlK+Z2mvPqsGbHM8J
-+oYib8kf2zJ6HvrYrP7NYB0tN9YYum2ICtx+hIi6aKGXdB1ATA5erwYmu0N9AAUR
-tClSYWxmIFMuIEVuZ2Vsc2NoYWxsIDxyc2VAZW5nZWxzY2hhbGwuY29tPokAlQMF
-EDNko/QOXq8GJrtDfQEBKVoD/2K/+4pcwhxok+FkuLwC5Pnuh/1oeOYHiKYwx0Z3
-p09RLvDtNldr6VD+aL9JltxdPTARzZ8M50UqoF9jMr25GifheFYhilww41OVZA3e
-cLXlLgda1+t0vWs3Eg/i2b0arQQDaIq7PeRdjdEDgwnG4xBaqaAqfgxwOXJ+LPWF
-hiXZ
-=K7lL
------END PGP PUBLIC KEY BLOCK-----
-
-Type bits/keyID    Date       User ID
-pub  1024/45B91DF1 1996/03/02 Doug MacEachern <dougm@osf.org>      
-                                                            
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.2
-
-mQCNAzE4lesAAAEEAKJYS1vL2iB3owwiZdCxp3JyvSNaC7h1p2jQXcJvY10gqyZm
-VffDwFoSvJM1JdCx3o1mb3JpZ2OTV4SrDDkzcSpTXelgyh7k9O3HB7oG6pHTML9g
-Dq9ZKydShMIvIJos7KuLWoM/eeeejtkv7r/gWsGHAyKbT8fs3r7nlmxFuR3xAAUX
-tB9Eb3VnIE1hY0VhY2hlcm4gPGRvdWdtQG9zZi5vcmc+
-=yaR9
------END PGP PUBLIC KEY BLOCK-----
-
-Type Bits/KeyID    Date       User ID
-pub  1023/163751F5 1997/08/18 Dean Gaudet <dgaudet@arctic.org>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.3a
-
-mQCNAzP30QgAAAED/1k8hPKsJj8Il/TfhP1JIRGwnXuzfQ/etv+MZJMzeNeKa8OX
-Kw0d4e1S/KdJ+AZwWQp3ZMDoX2ghZ79X4DDDLEAc/Fmy0Gg8t89CP+xJk7b4EHjk
-F7HX69BRJp3On4aRTXRND3WviqEmn5ppzbBkTenF9WWudLRbqrc4NnoWN1H1AAUR
-tCBEZWFuIEdhdWRldCA8ZGdhdWRldEBhcmN0aWMub3JnPokAlQMFEDP30Qm3ODZ6
-FjdR9QEB9VQD/0+zumFj1zzYZ1+bS9Az36gijDUb8rlEVf/lBShx4VEvha8fsRRy
-vkwnmJyupYvGtrSIYAwB0VK+GZPZa7XfZvUCM83AZY9vGpE0LwW2Vcz9kWZdJ0t+
-B7zJElmBUrmj9aW6ICmSNbOBwVo1Y7hg6lPSFFMOOECFpT1WuTXXYpNA
-=KWcF
------END PGP PUBLIC KEY BLOCK-----
-
-
-Type bits/keyID    Date       User ID
-pub  1024/EE65E321 1998/10/22 Martin Kraemer <martin@apache.org>
-sig       BB1D9F6D             ct magazine CERTIFICATE <pgpCA@ct.heise.de>
-sig       E2449019             Martin Kraemer <Martin.Kraemer@Mch.SNI.De>
-sig       EE65E321             Martin Kraemer <martin@apache.org>
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.2
-
-mQCNAzYvawcAAAEEAO/lLOQVYsUS+l7yan+Rzr0ehfWRqlgeNsV4DQ0xTuQewD9K
-5lm7ujRwutxlNaf5dXjE24mlsiRN8KDp+fKwm7Wtqv490xmhzS/6y8ekwB02P4fi
-/JJNX1PbLS0cL6+bz2dFqLDhh03Ovz3G16Y9he5mrJ2PNOWa9Dfj9F/uZeMhAAUR
-tCJNYXJ0aW4gS3JhZW1lciA8bWFydGluQGFwYWNoZS5vcmc+iQCVAwUQNkcAbUS4
-3da7HZ9tAQFUnAP+PrKa3YFKp9XTrANmORex4kOyNpM1adS8zM6bTcHyIkH4WitB
-b2nRbqOdOuSwbh655aSStluIxY66CValeL+6E7MCEqQ/UlzzMVmdbMyWSYwDlkV3
-gQkg3vE6bgFlWlLLr2HnkllY3ISEChDWh8x7fRKLy+8ZBGW89ZXOGkhIb9mJAJUD
-BRA2L2ueKwLDReJEkBkBAbeGBACKM1FCmQC583/IHyw7rDlvnsZKeKvdbbLGSnmJ
-NWOyf4VgkC8OCKmwPnWLOOIK44/JsT2Yonih2r+04FBqYo6SsMgBqOBJqKktHvtx
-bD3VfUUkkV8kZ4ituecWTx0zj1Oa0QiCiv8HHvdsmQB0mj07mWQz1CamXPSwHYn+
-t+fJOIkAlQMFEDYva2c34/Rf7mXjIQEBcNQEAOrt4+o2LwcCiJp3bOF9WZMirpMQ
-QJISqXBnom3r2eB+k1a/Jig1sePSzPxneW9EgWIrWg0EfK+u2kMgvTJynDUux9zL
-4qnECmZT+ESEm+P8rPKeecOfUHgDjQlTUCneOX5p0TbdvJm+TcJVjXjoVrYv6hZg
-InYw+jlvF5e/sdI8
-=03LU
------END PGP PUBLIC KEY BLOCK-----
-
-
-Type Bits/KeyID    Date       User ID
-pub  1024/EC140B81 1997/04/10 Dirk-Willem van Gulik <dirkx@webweaving.org>
-                              Dirk-Willem van Gulik <Dirk.vanGulik@jrc.it>
-                              Dirk-Willem van Gulik <dirkx@webweaving.nl>
-                              Dirk-Willem van Gulik <dirkx@dds.nl>
-                              Dirk-Willem van Gulik <dirkx@bigfoot.com>
-                              Dirk-Willem van Gulik <dirkx@technologist.com>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.3i
-
-mQCNAzNNOsMAAAEEAJmwazRhNJB4mQkvp0rrxLkeOAxR9fGBXgJNa6HHdLv7YHwx
-mwMorHYDCAMypO1yuznNTaMVT1z3cS+yqhOkTVxwNI1mxW6Zts1kOJB9pWuU33sk
-sUuCkLHXMgyvP9cms6gcYgB5g3UP6M/aQ4T017+Gk/7crlH87DGmPZbsFAuBAAUR
-tCxEaXJrLVdpbGxlbSB2YW4gR3VsaWsgPGRpcmt4QHdlYndlYXZpbmcub3JnPokA
-lQMFEDRZ5+0xpj2W7BQLgQEB/KAD/1xniFNLHp+jxIVrEL6HcI06QZUYPvRuarWq
-3aI2gdeXej59Ry96MOo2MU3MsuQ+wW+6gEJAuyCp2jyYfzF/8winNcFWc738s/hX
-fRYCJe4bvtMcnhBV7GAlTgyw00fcrnaJaQ811+QwKnZvXXWb+QuoXC4ddTon25w4
-XHLjtDZHtCxEaXJrLVdpbGxlbSB2YW4gR3VsaWsgPERpcmsudmFuR3VsaWtAanJj
-Lml0PokAlQMFEDNNOsMxpj2W7BQLgQEBzW8EAItAEaeuIzPIVlKOk1LnHlYc4FyW
-aiNJC2+rRmftYu2bIp/JFuXu3xC0U0byyHu0p+Y1pcAnt2YrqmYUfM0d2cx1b4+L
-8RQR4SGKhq9jWKS3icfKoyMnGiD2CeI8/Xx8V6b8Xg0QqsdlS0kz//qGCDWMz0vi
-oxzasVEvFjqAse03tCtEaXJrLVdpbGxlbSB2YW4gR3VsaWsgPGRpcmt4QHdlYndl
-YXZpbmcubmw+iQCVAwUQNFnn1DGmPZbsFAuBAQE0vAP/aOb/rXsE256tpi0+CRp6
-cd9b1oBmw894UK+Cf4DeNHWehPWJog4y0eNFUcAMdLIdubDzc6Kfxw5QyJt2EAXr
-05XuJ2DJdG24S/aPzGq+6VzL7Nq7pylXuhrACTgeesaceEpUd/NeOCOyzNR7i8qM
-zbGFtU7fH1ipfJjN6fXLo5K0JERpcmstV2lsbGVtIHZhbiBHdWxpayA8ZGlya3hA
-ZGRzLm5sPokAlQMFEDRZ58Expj2W7BQLgQEBGRwD/jdUjCJXFcAbjx3Y2pWUkR7C
-hwJTohM2TvhFp80Ffbhh1xT961XGuHL5l41fRAIg9FEHjQKNVfXeisLH68Qh73cF
-5xuNE6c1x1VSqfDLl9fXZ6TA35qt0G599T67jmVai4F/LjHWDI1O6UvPRuZE3O7m
-eRaCfbPLAJ1ztFujtS3btClEaXJrLVdpbGxlbSB2YW4gR3VsaWsgPGRpcmt4QGJp
-Z2Zvb3QuY29tPokAlQMFEDRZ56Qxpj2W7BQLgQEBvOED/1LhhPP5OkeCCEMVnmyZ
-jZexzv6XOH2I5qH0iuozsI987sSK+zfv8O0wEBwjUOQqBuzlvjKImYQ/oqR89egQ
-AinPc4z1b3kgeGyqrmtea6ScmpKufcWUBbhH0qsXF41eU3ArKY4kB9znV+/PacCe
-VrOD8roFaxIDZ2nW9FS0mriOtC5EaXJrLVdpbGxlbSB2YW4gR3VsaWsgPGRpcmt4
-QHRlY2hub2xvZ2lzdC5jb20+iQCVAwUQNFnnjTGmPZbsFAuBAQEaHwP/Q2Rs6MIu
-z8all/xildFOPfRAX73InwBeInr1O4UU4l6yWRvuLkg+m6O8eJSHo21SNZBCu9gM
-FoQsd0jVOitUr8+w2WkypBlJo5wl1nCw/1sLU4AxtBb0jyADvJzxFCeje/FkxEvs
-6Y3eLxpJRBylbg6KFOsmSY46DyGc49B6cZo=
-=xUw/
------END PGP PUBLIC KEY BLOCK-----
-
-Type Bits KeyID      Created    Expires    Algorithm       Use
-sec+ 1024 0xF08E012A 1998-02-19 ---------- DSS             Sign & Encrypt
-sub  2048 0xD8F8125A 1998-02-19 ---------- Diffie-Hellman
-uid  Dean Gaudet <dgaudet@arctic.org>
-uid  Dean Gaudet <dgaudet-djg20@arctic.org>
-uid  Dean Gaudet <dgaudet@apache.org>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: PGPfreeware 5.0i for non-commercial use
-
-mQGiBDTsCJkRBADJmDUiJL0xUaxg0yw7+VqqFUL6sjWxZeZ7kQZs4dyN3R1ilBUG
-KmOXE6qSfb6Pi0qEmgCz1K7g1KaglMRrpANY4h1CjziEVmTH5s3ocxe77w2uaou1
-gHJERIqQuC4/z0DwFqq61ZVf5dUQTD8OmfOwG4pFs51Si9WS03ueVEFQFwCg/9Z2
-j6UzCLyUABpWeV1v4m0w82kEAK96GyKDcT20TymKJnMKuwya+ZwqrULH3Sdi2Mwi
-1GOH7aomG2fK4D2yxWx5xTiYhmYNnRoopgu/Kv5a4x43tOKS3zeADMnHIw9dMSn9
-4Kba8vfKbZnlOgt9veV+iWZv7N2aS2z7w/i53Y6LAlV1hAIMvGJ3zLfmShZs0LDI
-Ya18A/wNcdJazUk9mLGIoycCYOk5YhWL9sCaCBdmdfDPu++rLnqROSWkmfYkOTt+
-pG9SPnvv3XrX/SEwM8gYfpbZwrFDJFI9W63lc9hdSosFD+8xiRl6h2gKRwWvc1Ry
-xIt3+gUrZxovNxBOv98BoSf/j3lkldU+ZjDGlCplRHSndxlN/bQgRGVhbiBHYXVk
-ZXQgPGRnYXVkZXRAYXJjdGljLm9yZz6JAEsEEBECAAsFAjTsCJkECwMBAgAKCRB9
-bb/R8I4BKqqzAKDc/4H9iOXJxVE0yCEHeTQ2gAHfhgCg7VSq7eNhiJhBgblQav/R
-XOhaHj20JkRlYW4gR2F1ZGV0IDxkZ2F1ZGV0LWRqZzIwQGFyY3RpYy5vcmc+iQBL
-BBARAgALBQI07AjSBAsDAQIACgkQfW2/0fCOASoWOACfb+8OVvy6FCqN2MxdCqp6
-gffNbYgAoOxlTa4NjCUUO9dfLFFYpDfGrRy7tCBEZWFuIEdhdWRldCA8ZGdhdWRl
-dEBhcGFjaGUub3JnPokASwQQEQIACwUCNOwI/gQLAwECAAoJEH1tv9HwjgEqiC8A
-oJDu1HTuGOfChFSJJ31XvV8tnlo5AKCFceck4veIMP8pDC0f5UBGGC3mZLkCDQQ0
-7AiZEAgA9kJXtwh/CBdyorrWqULzBej5UxE5T7bxbrlLOCDaAadWoxTpj0BV89AH
-xstDqZSt90xkhkn4DIO9ZekX1KHTUPj1WV/cdlJPPT2N286Z4VeSWc39uK50T8X8
-dryDxUcwYc58yWb/Ffm7/ZFexwGq01uejaClcjrUGvC/RgBYK+X0iP1YTknbzSC0
-neSRBzZrM2w4DUUdD3yIsxx8Wy2O9vPJI8BD8KVbGI2Ou1WMuF040zT9fBdXQ6Md
-GGzeMyEstSr/POGxKUAYEY18hKcKctaGxAMZyAcpesqVDNmWn6vQClCbAkbTCD1m
-pF1Bn5x8vYlLIhkmuquiXsNV6TILOwACAggAhb3cBmR67H4+9Rj4FeTwJ8kflX6I
-pp2AeXXZiffiPVBv5cGzGn2RkGPAZqbp2AkrCb4TrJH//1GPdR8VmPeEGsm6u0uT
-0M404l/4IW1FFQ4JBpTENPn4NYBHkKBNkPcls/ip0lSjlmLGVQVOtDOaFD7n44xV
-hT4WpptCripg/5kymDmK9c8hv6rPUvNoVrDdWR4//MCvNAZvGq2bZGdFTyd5Tn6D
-AmwbvL/UwgiDnm95qBBfCZtmGkkFaoOePtBevWFaviFZM2pErPRcjY8A/1cZsycj
-JPMFYqBKGDIk76ulDSjU0Q8dqhCEDf0o2oQEg6msjDtetVFEDw9yJe0AGIkAPwMF
-GDTsCJl9bb/R8I4BKhECBKgAoNRtRaRMdYNwajSO7056eKazCGSDAKDShamaRjAe
-ThQ1KefmJKyzfcosZQ==
-=25Cv
------END PGP PUBLIC KEY BLOCK-----
-
-
-Type Bits/KeyID    Date       User ID
-pub   999/F88341D9 1994/11/08 Lars Eilebrecht <sfx@unix-ag.org>
-                              Lars Eilebrecht <Lars.Eilebrecht@unix-ag.org>
-                              Lars `SFX' Eilebrecht <SFX@unix-ag.uni-siegen.de>
-                              Lars `SFX' Eilebrecht <SFX@appl2.hrz.uni-siegen.de>
-                              Lars `SFX' Eilebrecht <SFX@appl1.hrz.uni-siegen.de>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.3a
-
-mQCKAi6+wOsAAAED53PJgrIYS7iHbZn0ycrnzS03fwvwsDpoAVouoqqBSVNoVXH+
-lL+8HzX/fADvNyk1lYi5kTiYR2meKB1p0qpvj4bQ8ZEmcBemhV0FbESJ4CxIgy6V
-euxOD3v9gauyf1u4lkfyLIsCepuJqpkH+aOviE9VhTcE/D6Pt/L4g0HZAAURtCFM
-YXJzIEVpbGVicmVjaHQgPHNmeEB1bml4LWFnLm9yZz6JAJUDBRA2KRwZms08wKmf
-dd0BASoSA/9ZwyAWilXJNMWsV0KfyUeHZ7CsFA9/KQixLtpSH8ij4raLasr6rurc
-Sckrd+OiQKPQG0/TSXSAEP7suatV6XTTLEFHJbmqchTZXMSapwxFWGLxdG+buCiO
-uVxbpop4ZoKz2xb+GtdeyeDr+//gFL+wbEqlZMXfvwgzBCxcOM/tZYkAkgMFEDPN
-Dtg+j7fy+INB2QEBxpcD527wocmN2jHxCkmImID+YMVF8g1Rij3CEy+oLAZiiNWS
-Rxj2lWTHhsVZXtzF53+AD79rJqrFhZUCx+W6vG46uLMuu3/VpnEfq2QsD0d6zIUv
-SDFIxsy/s4knyvgfMeXczHmb7vjGbGsyP9mqjAyN7MUcqgBBANH4HX9CSRN8tC1M
-YXJzIEVpbGVicmVjaHQgPExhcnMuRWlsZWJyZWNodEB1bml4LWFnLm9yZz6JAJID
-BRAzzQwFPo+38viDQdkBAa31A+dPvsRw1zWvyMDp2aQwqIawIi2wiFl56lYfpkwW
-WjsdftuK0HHe+gek0aJ1vLwJFlrivroEukF1JaK3kS/ob2u/TNIZ4MKWjfhbkJW4
-0Y7gCKCUJPzh6hDw1nYfc4N9XKnwubiRVdW2ig1HVoKZUN9Ad034m30jMHEzqXbO
-4LQxTGFycyBgU0ZYJyBFaWxlYnJlY2h0IDxTRlhAdW5peC1hZy51bmktc2llZ2Vu
-LmRlPokAdQMFEDMR9XVLXCU0Hmjw3QEBftADALeK5boLfjNzxZ7g1VPHw6k6QwSU
-ESwiPJCmGTIT5f941YhHqohgwN5kGR9XDxWCCJAqQfFvbxhiZv0zu4HvQ7FYLVLO
-2zwZrVvOfR259jvGDFpPqRBq1ccxTNXuvf2a44kAlQIFEDD5Hn++gkWXZmzJrQEB
-WVYD/R4XFxImsJxzpaykt8Hl4kpQNWYWHd5ae81QFla/vfIplBqeVWr299pUbO1x
-Bt4EFPi5aya8CGwXs8uRsHKn3u711jfTri1mKpiMBWt149BsUk5lFCnE9gVo5UxY
-cpM2vb1I5DKeo/8/DuYz1FQhXwOxGqBqIr+ggQ1fN7Q0v5qziQEVAwUQMSxVdPCJ
-hGMAVxgRAQFafAf+OZxiZqpgeA3iMZzbOr17v4YjL/J4N3phrcy8ssh0rmTBbNHW
-OfRR0yzGlAXespCSLzBnSQMph2MXc3Al51LK4z487iAQxpu5k/ZKrg5ahZI7X5ok
-viTcRjmXkpbbXp+sMs6J3ZOOjxO1tWytSXW5/3lKwbjzaURlbUbBA9QQSGAYPnsw
-Z+CPKRNuUsk2EI3y4DWVjuabOcCeNy4TLfB9UIY81oXfXOyT+i2FwZ0f1befeZuu
-PICGQIxlEFi3Hd3hDEAgNJ8Hu9C6XACnYieT7dVYtlYH14UTk6/CLKkbWNhd/I5S
-QMPbijKK2zU5U3vPcolA1UalSBckftDQ2iTmmYkAlQMFEDD5QYseKXCPGoSZUQEB
-yFYD/jqPx2u8D1aQzKHvZqS9PUYSsPMTgn10FR/tp2c9Ch60f+BQ96fOUCzmRt94
-Iq1iMZsJ0oTyLLf6wf/Mdb1LhvsGf7rXFATh25OUpPx1qPUWstSToHSn0+Zf8e1B
-0p6PJ96duI6rimoc8NKppOwSmRvqAD3ATCKpMiOSwWe9+mBZiQBVAwUQMPl9Sgk0
-Yuy5gjk9AQEX2AIAlCphj4JI/yvodYIlpC2MPOs+hfTvaMPVhSCZZ0EVfZgTZpLQ
-XQDiUolYBvTHJnjBZyXZozln/df4MBHQgKWwmIkAVQIFEDD5RPk+NMzsOfhZGwEB
-5EoCAINMQWZZn+12r2nFScCScf5TaKpm+Y6MfEsvVg0trveEJ74ibbFDo8ABZ2g6
-FgzfDxAMbxNsUQaMrhh0TaSC9EyJAJUCBRAw+O6OHdm2eHD917EBAfj1A/4/cYEE
-a7jN8+ptmxZKsfZ0xOP2dxsPnicDT4VR16MHN6rkVrto782XSiRx3ZUsd9RjUmfH
-ZA3mHoJIGo6JRFVOeyjg3LEASSSfZr4YFkhutnf0lDlJOeEKhqvIw/dSO7MDwdLx
-hOqAFv9UzAlpOm4GLx9p1N61xDl1dIYEnY9cOIkAlQIFEDD5QnyFat0badac6QEB
-CCMEAKV60AedWZyXWokcwWIbW/PLgNTCh8JL1vijXGnBvT2PuA0L7/rCXPhbb20A
-rrq+P6xbGFxi42iWieeU2T5zN5IlPObT6cPeRWJkxPnaSf8ZD33Y1almcuhhYMUc
-7lkL7yqSo1J8TRVCSxjQ4W0+QDUFIEvrigb5Scd7zYHGOqoSiQBVAgUQMPjN2pva
-UYPwhBsRAQGNhQH/Z6IlBI4hdGb8teelMgY2kf3Iq08NByyygJAI48HqTe0cKIW6
-BPcBkJqMooJtRJTX6Rkt8fRKe/IPGeHGqyW3eIkA7gMFEDDhUR6K3WTWEs11KQEB
-TnkGwQEgJMk8SHR+2iBmOJQ2x+kv4LVmPp8hdaKCBdfvJDmrSpuEgrBWFI9PDpSw
-F7NWLPqESPnWo5dd8YeynzYz3aCiIXAOUB0rG8tujF1dSn/kFUCMqgqvbPOU3sSv
-6tVlECIAh67GTNHn61IIhLM0KG4v9elo0Lk/SpWwRRPJZW/ltQBApjtR+juFOiq6
-86+eE9kKBCImCIthBeE/cf6JfwuS4+1ui+MmkkqrnO8+07bdjbkWTSzTL3l12v/t
-M2p8Fwqps41y+3nIEOzq7Isf4zBjfw2ZKeXbEXq0M0xhcnMgYFNGWCcgRWlsZWJy
-ZWNodCA8U0ZYQGFwcGwyLmhyei51bmktc2llZ2VuLmRlPokAlQIFEDD5Hv6+gkWX
-ZmzJrQEBD9QD/iIIvOUqyKRBWjHgJD7zoskxDQH/YVhJu59zoCEOJGwXFPLlT3ce
-meMCaVLa5XvoDnLYWZ/bfI5nFd9vF9GwwbmP8/x39Z3N2xKfJpD8eH5inu5AwtIs
-kfXjmcZhSfDgv2XpAaFigz3wIBt+XbkPRxJJxfqD5oJ1ys0qNe0U6jjyiQEVAwUQ
-MSxVrvCJhGMAVxgRAQHLVgf/cW6FlzmOeIvJ/3yB7vhSOlpivnY00iKnzzCpWLOa
-saC4NPazhqNIewBa01KSuamIicYkzXk8MeaTq5EaQfJyA+NtdWSm/3/ivKWoO4Ka
-qJbVPnxaDnB2KBH+2mq0BJ4rS4i2jVZuopbtMAHV+lQUHaVH826YaFPa+425A/H+
-Oaqn2EdkL80fpIJsACsudYPDGCKS3zcMjspVK1cXqNRDzIOZ8I/XtyNEJpw1yRGf
-t4jrn4lj9jU4y0v6sFOt6jpuvAmyRN/pebwjYJw1Ye697MMkn0nEafH55Et+XfdB
-OYNm3Sb/J2g8j2JVVhN6JKuFYyM1kvK13Rky3SiLPUzD94kAlQIFEDD5QqqFat0b
-adac6QEB6HsD/RooPR6pFnSisCerTlPhSvDI2gl2HUMFw0CZJ5JKVlj5GFDZp5jl
-0yhgCFCweFuE7RUgMOkvGeEoEPZeyipacsrVIcO26aCQyerLTQd6JTgOuCEeEvkj
-BwiqOrVNSEPM5TWPzQc7Q7IDtKTsCT+xNGtO6Pi2+ArZaodZTtp4tXkCiQBVAgUQ
-MPjOC5vaUYPwhBsRAQHdVAH/eIgCk6fo3/Mvxu7IESdDLM/ozh14yvZz6FvC/VKt
-Sp51goqsV5jI9wKANIjonLeO7GJubjO+lqHvsEVsGQ+wpIkA7gMFEDDhUjOK3WTW
-Es11KQEBgTUGwQGH8Ic7zNaUlRmYm5J8R375iP8CrJ/xILbET69VsR2aDG2MA2z8
-NBBkV1ARrAC2YWa9sO91yCyf3NAI6I1oqtbv/09Im/s0bTu66dWrqRAiuTB3Ou+g
-HJ0fc85gTWcBd9/xS/mNlZb1/ZXjkBaYdl0Bzm72c3+HqZjHzT3nlxVY5HCi15J4
-iDgCuCPzeo1r8QgGmsbP7fD+0Hka7tlXb87WxPZt+nkjGS9xmLrNHw5/vJpcN4+f
-zevzhTQD8IcsUr0QcZUH9jZpm6xWpibPF5z7FzXTorguf+W0M0xhcnMgYFNGWCcg
-RWlsZWJyZWNodCA8U0ZYQGFwcGwxLmhyei51bmktc2llZ2VuLmRlPokAlQIFEDD5
-Htq+gkWXZmzJrQEBjswD/1Nwm7yoV6sj7qTiKaW9S3DQD3LKXtweiDdYF0lp961I
-WkuyBur4aYBNROQK82zFQqKNKfsm+FXu+N6AYQ2zEUJEUkT9RQgmsrfU1q067Zoo
-+dck5T2zuH+/kqmF9t28Gv4jjxVTit6C92NEhciutNO48kK32BT2mgX2w7tds6G4
-iQEVAwUQMSxVvPCJhGMAVxgRAQFUKgf/Y4Djeo18+ZAfr0BKl14P29dKK3p8OLcn
-qXh6juBfTRiWnFJtrQfGH9w3pQvpi2RRuDZTTQzhO4eOq2g5gy9MytU1htLRVpVw
-BnmmjLRWz0WGqr4y4ZULbg3ha5NsfBppdgHKk5Y+BptvIL/37ZBkztkiBXfs0Zbc
-3fZR4bSU1xDOE+HS0BofOxubqfZrCZvAjMCC5NJ4R13H8xnYg6NKQCAqOfeCOVWk
-Gnc/BK7VArMXjC8o/9nQDzY2fRPINPnCb4f/4PunwOrEza6zLxXfgNraQJ19boPb
-/o9DBlvNOWkq9gSmVnTEkqrEMtiXd31KAU/LVCRH/70mx7XZkF5/N4kAVQMFEDD5
-fY4JNGLsuYI5PQEBW0kB/0s9AqawHqJ/0rO9jsMhk3vuHNgwVF4DoKTL5EDIORET
-ccAf4UZVJo+JzmjYxc1f2RkwkMkk/N9afKZmcNSYzteJAFUCBRAw+UUZPjTM7Dn4
-WRsBAah7AgCIWR/HNt+V20bDueCO9mhwGirq5E7TJU+C9xT+3BeZXmyy/AR7tWJd
-KnC6laGDLnMko3CWr/XRKD+rC050nNsriQCVAgUQMPju3R3Ztnhw/dexAQF0awP/
-cXwIBaEAj4D/ShzMna3NQ/EM4aTniAHdVIH4d6Uh2RwDCoYt6HwEP11xfBwI6bDW
-lQhdUgDzGOXmOxKxv/Xti4viHOwO1KqjRtHOyDf4hI/ou2p0bntXMZ5yVv0WakyW
-7kYd7KxTbYd/CTKe8HB+8wkj8h1pb31JJoXzWsgmwXiJAJUCBRAw+ULYhWrdG2nW
-nOkBAQUwA/9AUqFQsXW9kMi5RooITiQbRynunPh2aqadVnuLZoAhxp16c+EQYpc4
-Qi6jLPBVemHdS4PW8vJegF1pJtDZ4VfLNwwkIxj7Y0hU8A4BcHUIfFdOER7SwbW/
-i7QTU8u3vNHfmgIodv19D7rFxEzqqPxMHRpIs8/IOG9L3zc3kV8rnYkAVQIFEDD4
-ziyb2lGD8IQbEQEBg6kCANj9mr20gcYRZ4eDfnuTSkSvtjvKox0EtM+UnAAgihxU
-q5vNCZDEeohZSZBR/p2pktcSu+cdk5bBFHtzkaNTt82JAFUCBRAv0u2cmTVOo2j9
-/00BAdubAgCcmQl3gvdeQuA2zSmqHNrCEXdmjIIltOWc8WFCPJjDt6c2cBdmuwoO
-YknWWGDMKXvTlh6lPgIVx3fhlhobxxFKiQCVAgUQL9M+R0axifvg3qptAQF7tAP7
-B78y93gaojDMC8NwfiNKh7l5cBh0ONA+W1g3O7YLE5W7Z/fOg4H3pOujnqU7H3Ns
-ChmDxtBKQIIiZXpnNg4Nt3F765t8EPrMmjjQJ4a6+8CHfmXmfNSWqPMdjgJW4ykM
-nUasGhgF1Z8flNNkfH5gfW9Gr8UcClgKqa5xvkhC5cyJAFUDBRAv0zvKQwZ3Rx/t
-AzsBAVs0Af91cEjH3oZPIaydSZxPUjF1SE3p93NnY6A3mKZR1vkewG6sRqVa4MO4
-lw8w8AU7ge2rvwupF3weF1Z9DG2bauGmiQCVAgUQL9M4SuXLhgyrRKDJAQH/vQQA
-jGM370MwcIfmtQ9e/0j0nztQwQ18dXMA+dMyNHiGrc+JC71u5zjxwmO7R1Vv7ZSA
-af9PslF/118wS6fFg9BP+LO5T4D44wMJTfiMMv30Q4Sfxn9DX9N3iYzL1PTHmlCO
-fCQQqvC451XbcXECqmqWHEqII8//4w/h9yrl/5F/uXmJAFUCBRAv0lcf/ZhK+bLW
-8KUBAc/rAf9rmJ56O40QVD803+bU1zSiSE1x+FURt+ceAsozqo9taFoRIGXTa8Mp
-swStyALnJKpyDkGEnTfRdARVQtcEzYJniQBVAgUQL9JDvxEZCRz6lM9/AQG2xwH+
-IQAJZEvldNHzeikez18Txy12EnJ9k+za2rjPVnlX7+teIY3VNO1homUgwqjoOHpZ
-kdGgdOdmufOglT3Rqrk5FYkAlQIFEC/Rt+1JSaYsE52Q4QEBzUYEAMonc3UFNjGo
-n8F/omc0PPA3rfH2IS6G31FN6fRarW1Pwk7CWlx3wgHm6gO9xfV5lDjBJ+lVmbmL
-z/1MZhg646eFRbugtBYbOXwE6zmNrKBhchVueVONzwWPIA8BZtR2Lw6CikAOhKgl
-4ndg8PO8UUg8gh0VUKGTPDK0MKR7ZCpGiQBVAgUQL9IXPnmMGAx7t12JAQGpIAH/
-Zrl16ULw3/gl7T11EbnbA9T3LjXuD4TG3IGeEV3z1wbRp227yN12a3PbavEKJj1m
-fWrZaT89Xt1smYBaIwX4aokAlQIFEC8YGepIX6svI9kr4wEBnO0D/1R4HlUM43CU
-jxdinzcijOJxRNe7ieXpp7xNn9SuJotDVeCLDRFSpmF2EFb0KDyoX2bY18xPT9sW
-tIMYv4XigSBwfuR+Sp+J1CLdP+zzmIZbZBc+3G5xM6nipvaKl1DkhSlLqedW4dmg
-1rKgCOXYKHdzHUcaneNE4rkoWlVwG5rhiQCVAgUQLs1+vx4pcI8ahJlRAQHwXAP8
-CKLDWFLJ7Fc3JZ0MnuPxW79M9nRQwL2TI/Vd4lCUSiDOUdEvjU45MLmLgU+4OZNP
-eXaBSLkN4z8PUkxGEEvSeCFE7u04VNq1GJ2aC+fHVFzuWbp0LsezqDSnm6xvBxz4
-0yEaZnkXu3+66kXZV/E4BNIkCaB5V2qXxrBIg0D10iCJAJQCBRAux7auD0cvWzTX
-TcEBATNVA/jU+bTUqnlZdrf6KgCv+hDOs6VO538cExQNsBl7x82Djbp8Q5t21YEV
-8LiFN1imuLYqHXqDEHt7qtroNaBYXgnR24QjI3urel+kYMibZWxGrq382C2apRea
-EDmQ1qtEzP+kXexaawAzKMo8VKWMnXjQYBLZohuUqfciE9A7OQF1iQBFAgUQLr7F
-rZXTi1FmcalVAQFOLQF/WCuTfcsEc7z1WK5BMQltCgnNvuz0himNP2FxPl4g5rq3
-u8i03dqPbuVwfrxSzy+m
-=tg0D
------END PGP PUBLIC KEY BLOCK-----
-
-
-Type Bits/KeyID    Date       User ID
-pub  1024/28AA55C5 2000/03/02 Daniel Lopez Ridruejo <ridruejo@apache.org>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.2
-
-mQCNAzi+5mgAAAEEAKRyfbHaGoNuWwHVSa/5mRbWdhDTkR26z3Uwq4KdCZ2Wp+b0
-VF4Tfh6d4IoK2jXKBUlUfq+v7FYzSzYdPCmwB9L9cHlaU/ItfcWD2G7rIHyO/lGn
-VXK/BGUPoOhT2yeO8tf6oe81hmN5VzqqhG/SWEkwlJASRX3ApyanqCooqlXFAAUR
-tCtEYW5pZWwgTG9wZXogUmlkcnVlam8gPHJpZHJ1ZWpvQGFwYWNoZS5vcmc+iQCV
-AwUQOMAjHyanqCooqlXFAQF9swQAnVrUersSbO/SrT+nnwgRPL/xRMjGCQe93gUe
-JPcOOYU2be1tFGynJl842SIDPTHcJVg1hHReO93K4jvQKsbmT5zrzIlQ7hVB2u48
-WNcgsIKWIxcGaMp4+qsDOhN7Fh7vIEZdRRYhL7YcGKZ2WnXOZnGsKSD8VZenycwQ
-cAA4xkA=
-=3hIM
------END PGP PUBLIC KEY BLOCK-----  
-
-Type Bits KeyID      Created    Expires    Algorithm       Use
-sec+ 2048 0xC808A7BF 2000-03-09 ---------- RSA             Sign & Encrypt
-uid  rbb@apache.org
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: PGPfreeware 5.0i for non-commercial use
-
-mQENAzjHNiMAAAEIAK+iTnKRHymuUYmRRe6JlH3oN4GfpakM6CITpS0aM/piJBX8
-MNgcCUK2tz8MSCqAlfF+2r0hGRMSQ+UpXqLXcJaCkGIvXtlKmxCcCX6R+LDCnzoa
-QvOar3+rKFFJyiauyV7VPucZZhFKesReG6o53uoOAd0jyzcV9TdpAIn4Xl8W617T
-L98GdODY9jK0zfgGo2bSgPpo2YswlDCGbYzRX6bfEGmAbP4t4UnP1ikVCE3NTIyz
-gT4kywMb5AT1Tm3FbwTx7rXc/nL20t22VTJMjyCxqPrOTs91PxdXyTAQUKY82x+U
-ZgW39f6aKrJHDEJtxOyym+B5NpYgeP5QQsgIp78ABRG0DnJiYkBhcGFjaGUub3Jn
-iQEVAwUQOMc2I3j+UELICKe/AQE4yAgAkNXkalNn8Xi+v3BFCmHLlB7PKlItzlS2
-PnMcTJPgzO8w+PyXc5lzS3dnqLEBoCwRazEZh8ncVbeBJz1LjQU67gvCBqyFl+3n
-r+Z8k6cJYw1AzSK9FLAgOEtG8IdE+jsPq39xORpu6Dhsuln++G1xaK6fePeAEgR3
-qH7gog/SFCa9QXQd85wsGRlQlmMwe/HDyoRd/iHg3X7mr4yB+zYkxYKDD+TKlSqq
-V23n0H4n3oTI10PfaB8LDYVuPiQvIRn08XKUv0Att1KPH6iJTIJ/KRbZyGb2J+1r
-RO1nBGw+qaOAw4wUQXOpJyXVUeanIt1tSe8Gczlf/uxJZdCNSpgeqIkAPwMFEDjH
-OY/9b4jGIdCnGxECdl8AnAvSwMQ2v2ryh2NLL4FgfVLCjb40AJoDu0jaEqUinZnp
-oMBmjFgtsDYp+w==
-=5ByY
------END PGP PUBLIC KEY BLOCK-----
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: 2.6.2
-
-mQCNAzjJAagAAAEEAKkko/H+E4+c7OXgiNfBCwlU/PrxPovDS3/JCKuILnflbNtC
-Lxbqvf7LccZ4LoiHOKd3+G4V8BgaTndqADx4crEsS0BpNrJdshPmXajzkdQeo6jN
-nts6QJ8/mlL4Q+s2/8dnleCrgDkzP4DpAIRGK9OARE/TKmUFUonO2YYGoUwFAAUR
-tA5yYmJAYXBhY2hlLm9yZw==
-=dGNO
------END PGP PUBLIC KEY BLOCK-----
-
-
-Type Bits KeyID      Created    Expires    Algorithm       Use
-sec+ 1024 0x00ADEBF5 2000-01-25 ---------- RSA             Sign & Encrypt 
-uid  Marc Slemko <marcs@znep.com>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: PGPfreeware 5.0i for non-commercial use
-
-mQCNAziM6n8AAAEEAODTLW2h2homp9NCjlsNdQQQACaUgrEm0sO0Lr1BVSp35fFQ
-a6XtrIxQXwcvBqM0py1ea2zcmYqnv6vY+7i6sBnxiNNugH3ShBnOYeCaO6AzQNaN
-2OvLkB7+1AoDmbU4a/+APtLrhzYzUj4DmwSmr7wTwdO06PsdM1Qv/g4Arev1AAUR
-tBxNYXJjIFNsZW1rbyA8bWFyY3NAem5lcC5jb20+iQCVAwUQOIzqf1Qv/g4Arev1
-AQFTZgP/Q+/pcNsCncKr4x39f/N5zXine0zQaKY46ek+PCUrhDm5N8cFTyijE7V0
-huRDVENAFkwtznz/H7BN0vtMRlvUQJOPFa2UaN8zIbcMIzSbiNEx5nvfFeT/Gr52
-GtnrQ+BvczfaauJ0Zw4p5uq6na/+0iyEf17d4qrhIBftlO3Ti+M=
-=+laC
------END PGP PUBLIC KEY BLOCK-----
-
-
-Type bits      keyID      Date       User ID
-RSA  1024      0x62C48B29 1996/01/22 *** DEFAULT SIGNING KEY ***
-                                     Ask Bjoern Hansen <ask@netcetera.dk>
-                                     Ask Bjoern Hansen <ask@plys.net>
-                                     Ask Bjoern Hansen <ask@perl.org>
-                                     Ask Bjoern Hansen <ask@apache.org>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: PGP 6.5.1
-
-mQCNAjEC6XcAAAEEALdrW5rH+2XOKX2zAPQmgomvHGADJedG4Dxf3Ci3HpGmKazV
-Uoo/f7Vf21ldvBBYC2CMpJU5uiMstNdrJ8Rx0KDBH2pLXsfE4XvVm8cGLbHcJycj
-cZsYl4yppOufL/76kmpP7q0Jni/pXrkYg2mLG3lCN3JoZqX9tvkoKP1ixIspAAUR
-tCRBc2sgQmpvZXJuIEhhbnNlbiA8YXNrQG5ldGNldGVyYS5kaz6JAJUDBRA1eczx
-+Sgo/WLEiykBAZIjA/4+uCJi5WD0p3EFzOnmkZRxf8egjQlFdBDVR7sixVToZCze
-oZZ9EVianFbwv8XU0McA7FLSUala0FIxRtmOs8/yN96rhBqJnYfLxu3b/ZRpBf4Z
-UExXQbussUX7AsPUmFim9Xp8mTy7xDEpcfiBnGY9Dtx+nmSvyLO38W5VvKP1qYkA
-PwMFEDV7CdYJPTjw/8ByixECHSsAoKUySg0ht56Rjsct6ViXjWfVEF1xAKCldK5x
-LXMjefgsiuW3n5seRVogQokARgQQEQIABgUCNgEYdgAKCRBoqAGJariS5S72AJ9N
-JsXpts88tCq7uZiirWlL54vTUwCg4A2urEUCEPuSz5deMyMX4lpjN5GJAJUDBRA5
-Ix6ndTAZgHu8twkBAZDHA/0fiaJSxGAxIdgYQY1KqYJGWg/E7Gwn87kZyiRHKUaJ
-gP4IA4PVnh0rMtTTo+CWyzcqMPjRAZNDW4ECWymrqqNrYgqy/NrcN4h7LZC5wmnW
-hXF3HdgAgxIn7m2YQOLluNqIrhVKga5G9/xytZLsF15qZbvjyX4mqToOsRqAtUBI
-ALQgQXNrIEJqb2VybiBIYW5zZW4gPGFza0BwbHlzLm5ldD6JAJUDBRAz6gMS+Sgo
-/WLEiykBAd9fA/9YdBn26x/7DE0by/Zzelfxu8o4AgZOV0AuWqZJebXKjeFmkJ0B
-lZRaC+NUcvpXOcANP6berJknvAMjNfTD1wi89XUVlbisDSW3UMR7Op8EpYjqLTo5
-u+KmyS+ehhQjA3somcJc8fBdnGJZ17cKWEbzJK+oJBvnzpjtgtvw6/oH/okAlQMF
-EDV5zQX5KCj9YsSLKQEBbk0EAJ+CwSbR4QQ2pgyXV7U4P4+1xSXa8U6IuI7AX9Fm
-LNlDu7a8DnJt8trZxjBcEMZcfoSNmbjIzMotzl0vvtDpqYgKfJ5Dd3eUTRCDYYS7
-8DoYcuB0cunBoGijkHS/2IkucAZGgcnNjPdhm7EnDJ/4F5VR9ZByqXiAIhZ746bs
-Z+nrtCBBc2sgQmpvZXJuIEhhbnNlbiA8YXNrQHBlcmwub3JnPokAlQMFEDkjD+v5
-KCj9YsSLKQEBEK0EAJBYAopnB9/dun1G0t+TKWVwGQUi56sWd5bwLypHklf/fy2V
-QPjCz9QoI0L/jAguBrqCfwtlIHRHMwzvvNWLRtuA8oiTDl4w2gO2vjy7V3Y4qneA
-3U5CYRT/ekvK42d+aHA6yMeHSPlNEQg09Idmee5Lub7kV8ejjtRZ8s3jcZ0utCJB
-c2sgQmpvZXJuIEhhbnNlbiA8YXNrQGFwYWNoZS5vcmc+iQCVAwUQOSMQB/koKP1i
-xIspAQGtCwP9FFWCZN2540lomDAY6tXt7Q3AhP/CkAec5i/lsv21sUl09jlZQnr/
-Kc8hL1lPOuAlLFGqso3zL7KMVlrOIng+R/E5fcYpE60QhhIoHdvlxFKTJ5GZq7DG
-stCrR34q2A4OWtoC7tF0Uu+Ew2ontVgvqsrgq4qt0h3yh/kABp/8mRw=
-=GGxP
------END PGP PUBLIC KEY BLOCK-----
-
-
-Type bits      keyID      Date       User ID
-RSA  2048      0x10FDE075 2000/10/09 *** DEFAULT SIGNING KEY ***
-                                     William A. Rowe, Jr. <wrowe@rowe-clan.net>
-                                     wrowe@apache.org
-                                     wrowe@lnd.com
-                                     wrowe@covalent.net
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: PGP 6.5.8
-
-mQENAznhOVsAAAEIAKuVs0grRRD6sNsgkr78WHvgpxf7ExaKI/bWEtS7eiFwJ+JE
-qP/ceM/zpot1wzUyNAVC+wiOJaj8CXyFrrmsjRM6zO5hRE/Hkf4me4ZviDP2lJTH
-suoTIcmSRdY6q3dIFQJVWPeDU2JhjAE313R/U6G/uJ9yVK86YPEC/b5Wr1XIDwDR
-GE9X58tZgMTDftYM/1wxeQNNF9kyFQky/45H/iXOirj52RI+gchkZfgRbfTSbF8r
-zSvs+JTHJBiSv4SpcPMq/ZTsxju6BIxb+PVaRVthIGcgRrgSgjPyTQYuPzcw0Zi3
-W3zfhlXCYngtumV9AM1uv5teiKlP9xOoeRD94HUABRG0KldpbGxpYW0gQS4gUm93
-ZSwgSnIuIDx3cm93ZUByb3dlLWNsYW4ubmV0PokBFQMFEDnhOVv3E6h5EP3gdQEB
-jLMH+QF/daZ3aqh2/EtFuIOMNUQw+sF4mxgp7HQvhvwgfbOzT3uczqgtLlVd/a4r
-cPd6LxD4j7HdNXCJaOn3ANgaZkqUyNOMyS5Z3Fiyjq8o1t4lFcFo6Vk5Y24G78On
-Z19Dvw/KayiYFcVVoEJX9WssFmq6VwKJyx68pg2tMfDKiCOG2tZ+LWZnsQd60ceB
-p3MyKKAHMQQu3B2mo0xm603JeobTxBydxrJ7b9LXYAcqcm7CdJ3ELutUQr7oQu/b
-cDhnphdlEjqZqWDQ6I06lxU9MSxdO1hpM0bShzmXZwKXClDP3w0+2DG/Udy2Qj/6
-F7RUNmUkBfiC5HQEb8seFF18pja0EHdyb3dlQGFwYWNoZS5vcmeJARUDBRA54Twh
-9xOoeRD94HUBAR68CACL2MB+LvmGljFOSeJXp+jnHsW117bORlnicyjbi8ySIRA5
-xIa/z8isBgVY6tQ9EHA9M8f0DNxIiWtb2UBgSoo6ez/VC9rpp1TcQn/9BjXXPNpP
-cASn+uC50giwhR4aKwmAY5tLPWU605/oAd012F9HoZXVIouHmGuxTYaL/FW85Quf
-2+FcZ7jZX7w550I/031SDEAiC+PGIgUL+Px5kkHl2CGVyS0yz9m+ixTrIXjjLNy+
-Tm1/bkxIkaWeQhO44Gfd/1FOhaRcONGOxNdl+EWNg3/ZkacJKzWIke4TtRa+ovip
-yMjeTNotxPjJVa7C8LXgnktqDh8pbCJpBDs7xUZxtA13cm93ZUBsbmQuY29tiQEV
-AwUQOeE8RPcTqHkQ/eB1AQHjrgf/dtXuLwcUz3unBUeRJwScX03q1UpLVRlap/9N
-D1WI5WdtRCBdgBv/KNM5yD1wcVHBgv60Yv6xfm57J3+D9azw/MDBKXeltTDgUM1c
-0N9w2OWuAwWpLSsCtOrxGbiW0wkyx+9U11YK+EsK40xSxlJzBwdcZzOuty2y/35y
-y6TmNUbO/XU1LLkm5AoGJwOHV8B5c04VhkqcHNHRMMG3TTs3oLP70ldHtn5OhyQd
-rZ3zmLJsrzx05S6HGonKv/yOFpdwsdqLq7hduNTf5zU1zFNdnpvRtXE7tuNbYqXZ
-V180pYUIaKismO9qkaWINR3gNfBpiIxNm3ilhOBr+yKpTVNZaLQSd3Jvd2VAY292
-YWxlbnQubmV0iQEVAwUQOeE+rPcTqHkQ/eB1AQFpfgf/T23qlkH//oxtKHZPeZyo
-bAy4jury203tMp+2uvcUJ3WrAOZ4ci17nIB0WwQSNpHd0YMEx37jrpqrx1cgfUQW
-5bf9zPY2go9mCvqBEXkxeaG/uLBoifxdAlxT5jBI7CycI5rGmu3nq9ZfdtmxM9Xz
-JzOJX8Y0b+nM4BMtG1B5P0fAHryS4wSEHZNbEX/twp8aE4bK9+9sWQxJESfcgAVQ
-mYNNTI9ibexdCcWLlu0kCjmOs1CG/jAjxPMgkYQ3IXhVuwKE+agRQOv2LCUgC+tB
-dH7qif8zXKR4td/wEgwcxzCJCril5zmVZhhsRMPC2Hf3f9bAMGTUM568+aKglxGg
-RQ==
-=0+H3
------END PGP PUBLIC KEY BLOCK-----
-
-Type bits      keyID      Date       User ID
-RSA  2048      0xB96CD0C7 2001/01/04 *** DEFAULT SIGNING KEY ***
-                                     Bill Stoddard <bill@wstoddard.com>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: PGP 6.5.8
-
-mQENAzpT47cAAAEIALLL4JXm/9vHTouYSWrdDvAvNNxa6UwOZ1Sp6urCgGtuRLz3
-ysFFY4hlfIhSUvMdBuLMY5X73Tzg0+LpzCBuvRHasSUWO/5UMlTdS4LnI6oIS+7T
-Nc//iwPQaH+P3CU2QScftyI0kS6kxr49Ejf4UZrJwMXsgvk+oDzRIdx1X8F4A5oW
-oAUl2njrqVodbO9nPifBPlooHg84Cm3r1xgMK8OPPSEiVnmypmwTXE0fMsxAmW/6
-AqPf6x54tKmAyFY6UWM1bX/XhjVlwUu0Ax7ndBTKgw2ZCZA3TY3GQTPNbiK7eOpr
-PUYN69EIKwtyFZHDSalkVpaZB44/nZygsbls0McABRG0IkJpbGwgU3RvZGRhcmQg
-PGJpbGxAd3N0b2RkYXJkLmNvbT6JARUDBRA6U+O3nZygsbls0McBAazZCACW0+ss
-3zAcpJNVI8rBZGwRSCEHW+NVRCQvrT4WiXQmb0fcTMJD8WD7kkMrYxaDuRzx4Iqr
-nwdTqzc0MieM8j0lqa7zaoncxYFh/iLeeZKvK1988UIrVmFDslRQpnzeSXLjUWnF
-1JYsS9+sYt8NBJGSIGXALji8QwcjpjRagzNjyO9YEs3TkGqdNslTQo1LJ2ZNIH6T
-aIWoTdnoU9WUUldsSQEbYB6JNNP67eiFTRZZnKradoQ0PVBXtYZAw1zOp5y/xPH+
-72vhKLk7+Tt3zaV/SmoB52ssE7AXazdQtHfH3N5XXtZJvjIIf/Y/Svw+OaJ2nD3n
-Jn3b7QtvWvkY2geD
-=0D9G
------END PGP PUBLIC KEY BLOCK-----
-
-
-Type bits      keyID      Date       User ID
-RSA  2048      0x423FF2F1 2001/03/16 *** DEFAULT SIGNING KEY ***
-                                     Paul J. Reder <rederpj@raleigh.ibm.com>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: PGP 6.5.8
-
-mQENAzqyerAAAAEIAMPeottLIzgSNklzro66gEnshbRLeb8MRwlivgOMxl5MgDpx
-sH44MPaYKaB1owFQdVSSA+k8ARrxSbki46mQvK53+t1yUeVtaPu85GBta4Q2paXJ
-+2/JVB83Qt8ZdkR7bA3Rxet+Poye4wqZcNQW271FS+sUkTvhAF6nb+5nWFNyKkTe
-ApG9eudukksFd4Uh6ekMjpOX0HPUXoyzf7CmwSERZIny+qwK0dkKkr6qKvZZOEXu
-wjnFgQoqcj242usLpGUfrGZCDQsOheGmaWH+RxrmccOqqqfmjo/EoHNjmEvfRSDP
-Mviq9p574VRsKdt3smkyo63DcaguX/FV7EI/8vEABRG0J1BhdWwgSi4gUmVkZXIg
-PHJlZGVycGpAcmFsZWlnaC5pYm0uY29tPokBFQMFEDqyerBf8VXsQj/y8QEBX5AH
-/iGMf93L2+1NP2MHZzuggQrcRcf7fkOdVRfx0GcMUFuet4G/0Qg/NKy24J2xMVLI
-E03//bn99c47BmGWlSrsuKM3nHXDtLHfmX9ajWB2x5TGLsQqCubfvGyxviFKyUKr
-tVLrvOmfiOGZkbRjD1r1mjNKWONKgUcjgFmSqsZPnZsclNjOMnqENVwOtSS14r0K
-YMquMP/sk7xDNZlRVUPEVn2TlLSBJp0NiAzwzbafbszX6xHLRJzE23hCGjl0ZnX+
-zkBusLpUGkuRkK6phJO6pg0E41D5QRnts3pHaDQ4EI6jEnWwlIsavrHh0mAw6ocf
-oO+6PlKrPkqjgRSHYewLqnU=
-=WB/Q
------END PGP PUBLIC KEY BLOCK-----
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 2395e3927a..0000000000
--- a/LICENSE
+++ /dev/null
@@ -1,58 +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.
- */
-
diff --git a/Makefile.in b/Makefile.in
deleted file mode 100644
index 59673a0cc5..0000000000
--- a/Makefile.in
+++ /dev/null
@@ -1,118 +0,0 @@
-
-SUBDIRS = srclib os server modules support
-
-PROGRAM_NAME         = $(progname)
-PROGRAM_SOURCES      = modules.c
-PROGRAM_LDADD        = $(EXTRA_LDFLAGS) $(HTTPD_LDFLAGS) \
-                       $(PROGRAM_DEPENDENCIES) $(EXTRA_LIBS)
-PROGRAM_DEPENDENCIES = \
-  $(BUILTIN_LIBS) \
-  $(MPM_LIB) \
-  server/libmain.la \
-  os/$(OS_DIR)/libos.la \
-  $(AP_LIBS)
-
-PROGRAMS        = $(PROGRAM_NAME)
-targets         = $(PROGRAMS) $(shared_build) $(other_targets)
-phony_targets   = $(srcdir)/buildmark.c
-install_targets = install-conf install-htdocs install-icons install-other \
-	install-cgi install-include install-suexec
-DISTCLEAN_TARGETS  = include/ap_config_auto.h include/ap_config_path.h \
-	modules.c libtool
-EXTRACLEAN_TARGETS = configure include/ap_config_auto.h.in \
-	generated_lists
-
-include $(top_srcdir)/build/rules.mk
-include $(top_srcdir)/build/program.mk
-
-install-conf:
-	@echo Installing configuration files
-	@test -d $(sysconfdir) || $(MKINSTALLDIRS) $(sysconfdir)
-	@cd docs/conf; \
-	for i in mime.types magic; do \
-		$(INSTALL_DATA) $$i $(sysconfdir); \
-	done; \
-	for i in *-std*; do \
-		sed -e 's#@@ServerRoot@@#$(prefix)#g' \
-		    -e 's#@@Port@@#$(PORT)#g' \
-			< $$i > $(sysconfdir)/$$i; \
-		chmod 0644 $(sysconfdir)/$$i; \
-		file=`echo $$i|sed s/-std//`; \
-		if [ "$$file" = "httpd.conf" ]; then \
-			file=`echo $$file|sed s/.*.conf/$(PROGRAM_NAME).conf/`; \
-		fi; \
-		if test "$$file" != "$$i" && test ! -f $(sysconfdir)/$$file; then \
-			$(INSTALL_DATA) $(sysconfdir)/$$i $(sysconfdir)/$$file; \
-		fi; \
-	done
-
-htdocs-srcdir = docs/docroot
-
-docs::
-	mkdir -p ./docs/api
-	srclib/apr/build/scandoc.pl -i./build/default.pl -p./docs/api/ ./include/*.h
-
-dox::
-	$(HOME)/software/unpacked/doxygen-1.2.5/bin/doxygen docs/doxygen.conf
-
-install-htdocs:
-	@echo Installing HTML documents
-	@test -d $(htdocsdir) || $(MKINSTALLDIRS) $(htdocsdir)
-	@test -d $(htdocs-srcdir) && (cd $(htdocs-srcdir) && cp -rp * $(htdocsdir))
-	@test -d $(htdocsdir)/manual || $(MKINSTALLDIRS) $(htdocsdir)/manual
-	@test -d docs/manual && (cd docs/manual && cp -rp * $(htdocsdir)/manual)
-	@(cd $(htdocsdir) && find . -name "CVS" -print | xargs rm -rf {} \;)
-
-install-icons:
-	@echo Installing icons
-	@test -d $(iconsdir) || $(MKINSTALLDIRS) $(iconsdir)
-	@(cd docs/icons && cp -rp * $(iconsdir))
-	@(cd $(iconsdir) && find . -name "CVS" -print | xargs rm -rf {} \;)
-
-install-cgi:
-	@echo Installing CGIs
-	@test -d $(cgidir) || $(MKINSTALLDIRS) $(cgidir)
-	@(cd docs/cgi-examples && cp -rp * $(cgidir))
-	@(cd $(cgidir) && find . -name "CVS" -print | xargs rm -rf {} \;)
-
-install-other:
-	@test -d $(logfiledir) || $(MKINSTALLDIRS) $(logfiledir)
-	@for ext in dll x; do \
-		file=apachecore.$$ext; \
-		if test -f $$file; then \
-			cp -p $$file $(bindir); \
-		fi; \
-	done; \
-	file=httpd.dll; \
-	if test -f $$file; then \
-		cp -p $$file $(bindir); \
-	fi;
-
-install-include:
-	@echo Installing header files
-	@test -d $(includedir)     || $(MKINSTALLDIRS) $(includedir)
-	@cp -p include/*.h $(srcdir)/include/*.h $(includedir)
-	@cp -p $(srcdir)/os/$(OS_DIR)/os.h $(includedir)
-	@if test -f $(srcdir)/os/$(OS_DIR)/os-inline.c; then \
-            cp -p $(srcdir)/os/$(OS_DIR)/os-inline.c $(includedir); \
-        fi;
-	@cp -p $(srcdir)/server/mpm/$(MPM_NAME)/*.h $(includedir)
-	@cp -p $(srcdir)/modules/dav/main/mod_dav.h $(includedir)
-	@cp -p $(srcdir)/modules/filters/mod_include.h $(includedir)
-	@cp -p $(srcdir)/srclib/pcre/*.h $(includedir)
-	@cp -p $(srcdir)/srclib/apr/include/*.h $(includedir)
-	@cp -p $(srcdir)/srclib/apr-util/include/*.h $(includedir)
-	@cp -p $(srcdir)/os/$(OS_DIR)/*.h $(includedir)
-	@chmod 644 $(includedir)/*.h
-
-install-suexec:
-	@if test -f $(builddir)/support/suexec; then \
-            test -d $(sbindir) || $(MKINSTALLDIRS) $(sbindir); \
-            cp -p $(srcdir)/support/suexec $(sbindir); \
-            chmod 4755 $(sbindir)/suexec; \
-	fi
-
-suexec:
-	cd support && make suexec
-
-include $(top_srcdir)/os/os2/core.mk
diff --git a/Makefile.win b/Makefile.win
deleted file mode 100644
index 0b44267bf7..0000000000
--- a/Makefile.win
+++ /dev/null
@@ -1,226 +0,0 @@
-# Makefile for Windows NT and Windows 95/98/2000
-
-# 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 \Apache2.0. 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"
-# Also be aware that certain awk's will not accept backslahed names,
-# so the server root should be given in forward slashes (quoted),
-# preferably with the drive designation!
-
-!IF "$(INSTDIR)" == ""
-INSTDIR=\Apache2
-!MESSAGE Using default install directory $(INSTDIR)
-!ENDIF 
-
-!IFNDEF MAKEOPT
-# Only default the behavior if MAKEOPT= is omitted
-!IF "$(MAKE)" == "NMAKE"
-# Microsoft NMake options
-MAKEOPT=-nologo
-!ELSEIF "($MAKE)" == "make"
-# Borland make options?  Not really supported (yet)
-MAKEOPT=-s -N
-!ENDIF
-!ENDIF
-
-default:        _apacher
-
-_apacher: 
-	$(MAKE) $(MAKEOPT) -f Makefile.win SHORT=R LONG=Release _build
-
-_apached: 
-	$(MAKE) $(MAKEOPT) -f Makefile.win SHORT=D LONG=Debug   _build
-
-installr: 
-	$(MAKE) $(MAKEOPT) -f Makefile.win SHORT=R LONG=Release _build _install
-
-installd: 
-	$(MAKE) $(MAKEOPT) -f Makefile.win SHORT=D LONG=Debug   _build _install
-
-_cleanr:  
-	$(MAKE) $(MAKEOPT) -f Makefile.win SHORT=R LONG=Release CTARGET=CLEAN _build
-
-_cleand:  
-	$(MAKE) $(MAKEOPT) -f Makefile.win SHORT=D LONG=Debug   CTARGET=CLEAN _build
-
-clean:
-	$(MAKE) $(MAKEOPT) -f Makefile.win SHORT=R LONG=Release CTARGET=CLEAN _build
-	$(MAKE) $(MAKEOPT) -f Makefile.win SHORT=D LONG=Debug   CTARGET=CLEAN _build
-
-_build:
-	echo Building Win32 $(LONG) targets ($(SHORT) suffixes)
-	cd srclib\apr
-	 $(MAKE) $(MAKEOPT) -f apr.mak CFG="apr - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	 $(MAKE) $(MAKEOPT) -f libapr.mak CFG="libapr - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	cd ..\..
-	cd srclib\apr-util\xml\expat\lib
-	 $(MAKE) $(MAKEOPT) -f xml.mak CFG="xml - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-        cd ..\..\..
-	 $(MAKE) $(MAKEOPT) -f aprutil.mak CFG="aprutil - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	 $(MAKE) $(MAKEOPT) -f libaprutil.mak CFG="libaprutil - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	cd ..\..
-	cd srclib\pcre
-	 $(MAKE) $(MAKEOPT) -f dftables.mak CFG="dftables - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	 $(MAKE) $(MAKEOPT) -f pcre.mak CFG="pcre - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	 $(MAKE) $(MAKEOPT) -f pcreposix.mak CFG="pcreposix - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	cd ..\..
-	cd server
-	 $(MAKE) $(MAKEOPT) -f gen_uri_delims.mak CFG="gen_uri_delims - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	 $(MAKE) $(MAKEOPT) -f gen_test_char.mak CFG="gen_test_char - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	cd ..
-	 -del $(LONG)\buildmark.obj
-	 $(MAKE) $(MAKEOPT) -f libhttpd.mak CFG="libhttpd - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	 $(MAKE) $(MAKEOPT) -f Apache.mak CFG="Apache - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	cd modules\aaa
-	 $(MAKE) $(MAKEOPT) -f mod_auth_anon.mak CFG="mod_auth_anon - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-         $(MAKE) $(MAKEOPT) -f mod_auth_dbm.mak CFG="mod_auth_dbm - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	 $(MAKE) $(MAKEOPT) -f mod_auth_digest.mak CFG="mod_auth_digest - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	cd ..\..
-	cd modules\cache
-	 $(MAKE) $(MAKEOPT) -f mod_file_cache.mak CFG="mod_file_cache - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	cd ..\..
-	cd modules\dav\main
-	 $(MAKE) $(MAKEOPT) -f mod_dav.mak CFG="mod_dav - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	cd ..\..\..
-	cd modules\dav\fs
-	 $(MAKE) $(MAKEOPT) -f mod_dav_fs.mak CFG="mod_dav_fs - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	cd ..\..\..
-	cd modules\generators
-         $(MAKE) $(MAKEOPT) -f mod_info.mak CFG"=mod_info - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-         $(MAKE) $(MAKEOPT) -f mod_status.mak CFG="mod_status - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	cd ..\..
-	cd modules\mappers
-         $(MAKE) $(MAKEOPT) -f mod_rewrite.mak CFG="mod_rewrite - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	 $(MAKE) $(MAKEOPT) -f mod_speling.mak CFG="mod_speling - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	cd ..\..
-	cd modules\metadata
-	 $(MAKE) $(MAKEOPT) -f mod_cern_meta.mak CFG="mod_cern_meta - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	 $(MAKE) $(MAKEOPT) -f mod_expires.mak CFG="mod_expires - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	 $(MAKE) $(MAKEOPT) -f mod_headers.mak CFG="mod_headers - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	 $(MAKE) $(MAKEOPT) -f mod_usertrack.mak CFG="mod_usertrack - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	cd ..\..
-#	cd modules\proxy
-#        $(MAKE) $(MAKEOPT) -f mod_proxy.mak CFG="mod_proxy - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-#       cd ..\..
-	cd support
-         $(MAKE) $(MAKEOPT) -f ab.mak CFG="ab - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-         $(MAKE) $(MAKEOPT) -f htpasswd.mak CFG="htpasswd - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-         $(MAKE) $(MAKEOPT) -f htdigest.mak CFG="htdigest - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	 $(MAKE) $(MAKEOPT) -f logresolve.mak CFG="logresolve - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	 $(MAKE) $(MAKEOPT) -f rotatelogs.mak CFG="rotatelogs - Win32 $(LONG)" RECURSE=0 $(CTARGET)
-	cd ..
-
-_install:
-	-mkdir "$(INSTDIR)"
-	-mkdir "$(INSTDIR)\bin"
-	-mkdir "$(INSTDIR)\cgi-bin"
-	-mkdir "$(INSTDIR)\conf"
-	-mkdir "$(INSTDIR)\htdocs"
-	-mkdir "$(INSTDIR)\htdocs\manual"
-	-mkdir "$(INSTDIR)\icons"
-	-mkdir "$(INSTDIR)\include"
-	-mkdir "$(INSTDIR)\include\xml"
-	-mkdir "$(INSTDIR)\include\pcre"
-	-mkdir "$(INSTDIR)\lib"
-	-mkdir "$(INSTDIR)\libexec"
-	-mkdir "$(INSTDIR)\logs"
-	-mkdir "$(INSTDIR)\modules"
-#	-mkdir "$(INSTDIR)\proxy"
-	copy $(LONG)\Apache.exe "$(INSTDIR)\bin"
-	copy $(LONG)\libhttpd.dll "$(INSTDIR)\bin"
-	copy srclib\apr\$(LONG)\libapr.dll "$(INSTDIR)\bin"
-        copy srclib\apr-util\$(LONG)\libaprutil.dll "$(INSTDIR)\bin"
-        copy modules\aaa\$(LONG)\mod_auth_anon.so "$(INSTDIR)\modules"
-	copy modules\aaa\$(LONG)\mod_auth_dbm.so "$(INSTDIR)\modules"
-	copy modules\aaa\$(LONG)\mod_auth_digest.so "$(INSTDIR)\modules"
-	copy modules\cache\$(LONG)\mod_file_cache.so "$(INSTDIR)\modules"
-        copy modules\dav\fs\$(LONG)\mod_dav_fs.so "$(INSTDIR)\modules"
-        copy modules\dav\main\$(LONG)\mod_dav.so "$(INSTDIR)\modules"
-        copy modules\generators\$(LONG)\mod_info.so "$(INSTDIR)\modules"
-        copy modules\generators\$(LONG)\mod_status.so "$(INSTDIR)\modules"
-        copy modules\mappers\$(LONG)\mod_rewrite.so "$(INSTDIR)\modules"
-	copy modules\mappers\$(LONG)\mod_speling.so "$(INSTDIR)\modules"
-	copy modules\metadata\$(LONG)\mod_cern_meta.so "$(INSTDIR)\modules"
-	copy modules\metadata\$(LONG)\mod_expires.so "$(INSTDIR)\modules"
-	copy modules\metadata\$(LONG)\mod_headers.so "$(INSTDIR)\modules"
-	copy modules\metadata\$(LONG)\mod_usertrack.so "$(INSTDIR)\modules"
-#       copy modules\proxy\$(LONG)\mod_proxy.so "$(INSTDIR)\modules"
-        copy support\$(LONG)\ab.exe "$(INSTDIR)\bin"
-        copy support\$(LONG)\htpasswd.exe "$(INSTDIR)\bin"
-	copy support\$(LONG)\htdigest.exe "$(INSTDIR)\bin"
-	copy support\$(LONG)\logresolve.exe "$(INSTDIR)\bin"
-	copy support\$(LONG)\rotatelogs.exe "$(INSTDIR)\bin"
-        copy docs\cgi-examples\printenv "$(INSTDIR)\cgi-bin\printenv.pl"
-        xcopy docs\docroot "$(INSTDIR)\htdocs" /d < <<
-A
-<<
-        xcopy docs\manual "$(INSTDIR)\htdocs\manual" /s /d < <<
-A
-<<
-	xcopy include\*.h "$(INSTDIR)\include" /d < <<
-A
-<<
-	xcopy srclib\apr\include\*.h "$(INSTDIR)\include" /d < <<
-A
-<<
-	xcopy srclib\apr-util\include\*.h "$(INSTDIR)\include" /d < <<
-A
-<<
-	xcopy srclib\pcre\*.h "$(INSTDIR)\include\pcre" /d < <<
-A
-<<
-        xcopy docs\icons "$(INSTDIR)\icons" /s /d < <<
-A
-<<
-	copy srclib\apr\Lib$(SHORT)\apr.lib "$(INSTDIR)\lib"
-	copy srclib\apr-util\Lib$(SHORT)\aprutil.lib "$(INSTDIR)\lib"
-	copy srclib\pcre\Lib$(SHORT)\pcre.lib "$(INSTDIR)\lib"
-	copy srclib\pcre\Lib$(SHORT)\pcreposix.lib "$(INSTDIR)\lib"
-	copy srclib\apr\$(LONG)\libapr.lib "$(INSTDIR)\libexec"
-	copy srclib\apr\$(LONG)\libapr.exp "$(INSTDIR)\libexec"
-	copy srclib\apr-util\$(LONG)\libaprutil.lib "$(INSTDIR)\libexec"
-	copy srclib\apr-util\$(LONG)\libaprutil.exp "$(INSTDIR)\libexec"
-	copy $(LONG)\libhttpd.exp "$(INSTDIR)\libexec"
-	copy $(LONG)\libhttpd.lib "$(INSTDIR)\libexec"
-	copy modules\dav\main\$(LONG)\mod_dav.exp "$(INSTDIR)\libexec"
-	copy modules\dav\main\$(LONG)\mod_dav.lib "$(INSTDIR)\libexec"
-	copy docs\conf\magic "$(INSTDIR)\conf\magic.default"
-        if not exist "$(INSTDIR)\conf\magic" \
-            copy "$(INSTDIR)\conf\magic.default" "$(INSTDIR)\conf\magic"
-        copy docs\conf\mime.types "$(INSTDIR)\conf\mime.types.default"
-        if not exist "$(INSTDIR)\conf\mime.types" \
-            copy "$(INSTDIR)\conf\mime.types.default" "$(INSTDIR)\conf\mime.types"
-	awk -f <<script.awk "docs\conf\httpd-win.conf" "$(INSTDIR)\conf\httpd.default.conf" "$(INSTDIR)"
-    BEGIN { 
-        srcfl = ARGV[1];
-        dstfl = ARGV[2];
-        serverroot = ARGV[3];
-        gsub( /\\/, "/", serverroot );
-        while ( ( getline < srcfl ) > 0 ) {
-            gsub( /@@ServerRoot@@/, serverroot );
-            print $$0 > dstfl;
-        }
-    }
-<<
-	if not exist "$(INSTDIR)\conf\httpd.conf" \
-            copy "$(INSTDIR)\conf\httpd.default.conf" "$(INSTDIR)\conf\httpd.conf"
-	awk -f <<script.awk "support\dbmmanage.in" >"$(INSTDIR)\bin\dbmmanage.pl"
-    { if ( $$0 ~ /^BEGIN { @AnyDBM_File::/ ) {
-          sub( /ISA = qw\(.*\)/, "ISA = qw(SDBM_File)" ); 
-      }
-      if ( $$0 !~ /^#!@perlbin@/ )
-          print $$0;
-    }
-<<
diff --git a/README b/README
deleted file mode 100644
index 8c24e63a1d..0000000000
--- a/README
+++ /dev/null
@@ -1,75 +0,0 @@
-
-                                 Apache
-                             Version 2.0 (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 create
-  Apache's autoconf script, you will need libtool 1.3.3 or higher, and
-  autoconf 2.13 or newer.  Those tools will not be required if you are just
-  using a package downloaded from apache.org, they are only required for
-  developers.
-
-  To configure Apache 2.0 run the following commands.
-
-  ./buildconf  (not required unless you are a developer)
-  ./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 by Philip Hazel and copyrighted by 
-  the University of Cambridge.  Please see the file called 
-  srclib/pcre/COPYING. 
-
-  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/STATUS b/STATUS
deleted file mode 100644
index ddb72a272f..0000000000
--- a/STATUS
+++ /dev/null
@@ -1,848 +0,0 @@
-APACHE 2.0 STATUS:						-*-text-*-
-Last modified at [$Date: 2001/05/04 18:49:28 $]
-
-Release:
-
-    2.0.17  : rolled April 17, 2001
-    2.0.16  : rolled April 4, 2001
-    2.0.15  : rolled March 21, 2001
-    2.0.14  : rolled March 7, 2001
-    2.0a9   : released December 12, 2000
-    2.0a8   : released November 20, 2000
-    2.0a7   : released October 8, 2000
-    2.0a6   : released August 18, 2000
-    2.0a5   : released August 4, 2000
-    2.0a4   : released June 7, 2000
-    2.0a3   : released April 28, 2000
-    2.0a2   : released March 31, 2000
-    2.0a1   : released March 10, 2000
-
-DAEDALUS 2.0 PROBLEMS:
-
-    * mod_cgid and suexec have a problem co-existing.  suexec sees a null
-      command string sometimes.
-
-    * core dump from 20010422
-
-      /usr/local/apache2b/corefiles/httpd.core.3
-      #0  0x806724c in check_hostalias (r=0x81fd03c) at vhost.c:891
-      #1  0x8067489 in ap_update_vhost_from_headers (r=0x81fd03c) at vhost.c:978
-      #2  0x806fa92 in ap_read_request (conn=0x81450fc) at protocol.c:946
-      #3  0x805a168 in ap_process_http_connection (c=0x81450fc) at http_core.c:274
-      #4  0x806bc60 in ap_run_process_connection (c=0x81450fc) at connection.c:82
-      #5  0x806be84 in ap_process_connection (c=0x81450fc) at connection.c:216
-      #6  0x805fbba in child_main (child_num_arg=65) at prefork.c:807
-      #7  0x805fd20 in make_child (s=0x80c64fc, slot=65) at prefork.c:880
-      #8  0x805ffec in perform_idle_server_maintenance () at prefork.c:1021
-      #9  0x80603d1 in ap_mpm_run (_pconf=0x80c600c, plog=0x80f300c, s=0x80c64fc) at prefork.c:1191
-      #10 0x80660cd in main (argc=1, argv=0xbfbffdac) at main.c:425
-      #11 0x8059bf9 in _start () 
-
-      The input data (received in one read from TCP layer):
-
-      GET /images/apache_sub.gif HTTP/1.1
-      Accept: */*
-      Referer: http://search.apache.org/index.cgi
-      Accept-Language: en-us
-      Accept-Encoding: gzip, deflate
-      If-Modified-Since: Sat, 02 Dec 1995 21:26:28 GMT
-      If-None-Match: "29e60e-17c3-66972900"
-      User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90)
-      Host: www.apache.org
-      Connection: Keep-Alive
-
-    * core dump from 20010418
-
-      /usr/local/apache2b/corefiles/httpd.core.2
-      #0  0x2813a3c8 in kill () from /usr/lib/libc.so.4
-      #1  0x2817609e in abort () from /usr/lib/libc.so.4
-      #2  0x8065299 in ap_log_assert (szExp=0x80aaa60 "total_bytes_left > 0 && tmplen > 0", szFile=0x80aa2aa "core.c", nLine=2555)
-          at log.c:562
-      #3  0x8075227 in sendfile_it_all (c=0x81470fc, fd=0x814759c, hdtr=0xbfbff670, file_offset=1929216, file_bytes_left=261949, 
-          total_bytes_left=261949, flags=0) at core.c:2555
-      #4  0x80761e2 in core_output_filter (f=0x814737c, b=0x814764c) at core.c:3172
-      #5  0x806d227 in ap_pass_brigade (next=0x814737c, bb=0x81e80fc) at util_filter.c:240
-      #6  0x805e696 in check_pipeline_flush (r=0x820803c) at http_request.c:388
-      #7  0x805e707 in ap_process_request (r=0x820803c) at http_request.c:432
-      #8  0x805a1a9 in ap_process_http_connection (c=0x81470fc) at http_core.c:280
-      #9  0x806bc60 in ap_run_process_connection (c=0x81470fc) at connection.c:82
-      #10 0x806be84 in ap_process_connection (c=0x81470fc) at connection.c:216
-      #11 0x805fbba in child_main (child_num_arg=272) at prefork.c:807
-      #12 0x805fd20 in make_child (s=0x80c64fc, slot=272) at prefork.c:880
-      #13 0x805ffec in perform_idle_server_maintenance () at prefork.c:1021
-      #14 0x80603d1 in ap_mpm_run (_pconf=0x80c600c, plog=0x80f300c, s=0x80c64fc) at prefork.c:1191
-      #15 0x80660cd in main (argc=1, argv=0xbfbffadc) at main.c:425
-      #16 0x8059bf9 in _start ()
-
-      The input data (received in one read from TCP layer):
-
-      GET /log4j/jakarta-log4j-1.1b2.zip HTTP/1.0
-      Via: 1.0 MDRPRXY01, 1.0 NS2
-      Connection: Keep-Alive
-      User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)
-      Host: jakarta.apache.org
-      Accept: application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, image/gif, image/x-xbitmap, image/jpeg,
-      image/pjpeg, */*
-      Accept-Language: en-us,tscii;q=0.5
-      Referer: http://jakarta.apache.org/log4j/docs/download.html
-      Accept-Encoding: gzip, deflate
-
-      The confusion was because apr_sendfile() returned APR_SUCCESS
-      but zero bytes sent.  Presumably the FreeBSD kernel sendfile()
-      did the same thing (not 100% sure).
-
-RELEASE SHOWSTOPPERS:
-
-    WARNING: ALWAYS check srclib/apr/STATUS and srclib/apr-util/STATUS
-
-    * threaded + cgid: "apachectl graceful" followed by "apachectl
-      restart" results in all processes but cgid going away; parent
-      died referencing other-child registration structures
-
-      a couple of solutions/work-arounds for this problem:
-
-      1) disable APR_HAS_OTHER_CHILD support
-      2) teach APR to clean up other-child registrations when the 
-         associated pool goes away (see 
-         Message-Id:
-	 <200104262241.SAA04468@adsl-77-241-65.rdu.bellsouth.net> for
-	 a patch.
-
-    * There is a bug in how we sort some hooks, at least the pre-config
-      hook.  The first time we call the hooks, they are in the correct 
-      order, but the second time, we don't sort them correctly.  Currently,
-      the modules/http/config.m4 file has been renamed to 
-      modules/http/config2.m4 to work around this problem, it should moved
-      back when this is fixed.    rbb
-
-    * Root all file systems with <Directory /> for WIN32/OS2/NW permissions 
-        Status: patch brought forward from 1.3.14
-                WIN32 and OS2 need review [William Rowe, Brian Harvard]
-
-    * Win32: Get Apache working on Windows 95/98. The following work
-	(at least) needs to be done:
-	- winnt MPM: Fix 95/98 code paths in the winnt MPM. There is some NT
-	specific code that is still not in NT only code paths
-	- IOL binds to APR sendfile, implemented with TransmitFile, which 
-        is not available on 95/98.
-        - Document warning that OSR2 is required (for Crypt functions, in
-        rand.c, at least.)
-
-    * Win32: Test access logging with multiple threads. Will the 
-	native file I/O calls serialize automagically like the 
-	CRT calls or do we need to add region locking each time 
-	we access the logs?
-	Status: 
-
-    * Win32: Complete the revamp the service environment and relocation
-        into the WinNT MPM.  Changes ServerRoot service registry 
-        parameter into ConfigArgs for multiple service startup parameters.
-        Problems to fix in the revamp: -k shutdown/restart are broken, 
-        signals are not being acknowledged.  Close window and shutdown 
-        also seem out of sorts.
-        OtherBill is working on this and will finish over the weekend.
-
-    * We need a thread-safe resolver, at least on Unix.
-        Status: The best known candidate would be something from
-	BIND v9.
-        Status: Greg asks, "why? doesn't gethostbyname_r() handle this?"
-
-    * The AddInputFilter and AddOutputFilter directives do not allow the
-      administrator to remove or reorder filters.  Once a filter is added
-      in a container, it is present in any subcontainers.  It can only be
-      added to the filter chain after any filters specified in enclosing
-      containers.
-
-    * remove the --disable-shared from the subdir config of APR(UTIL)
-      before the final release. (in fact, it might even be nice to
-      allow for Apache config/build against an already-installed
-      APR(UTIL))
-      Note: we need to do a "make install" for APR(UTIL) so the shared
-            libraries can be installed properly. We could also use that
-            point to install include files (rather than have Apache
-	    know everything that needs to be installed from the
-	    sub-packages). The original impetus for doing the
-	    disable-shared was because the shared lib wasn't getting
-	    installed and a "make clean" in aprutil would make Apache
-	    fail to load.
-
-    * users who want to install third-party modules into the Apache
-      source tree (for static linking) need to have autoconf and
-      libtool installed. This is because the module needs to have its
-      config.m4 incorporated into ./configure, which means "buildconf"
-      must be run.
-      Note: This is in part because we have removed the "extra" directory.
-            In the Apache-2.0 repository, this directory had a config.m4
-            file that allowed people to add external modules by
-            specifying --with-module on the configure line.
-
-    * ap_vrprintf() needs to handle more than 4K
-        Status: Greg volunteers
-
-    * mod_dir should normally redirect ALL directory requests which do
-      not include a trailing slash on the URI. However, if a "notes"
-      flag is set (say, via BrowserMatch), this behavior will be
-      disabled for non-GET requests.
-        Status: Greg volunteers
-        MsgId: <20010227104646.E2297@lyra.org>
-        MsgId: <3A9C0097.9C83F07C@Golux.Com>
-
-    * Usability: Sanitize the MPM config directives.  MaxClients in 
-      the threaded MPM is totally misleading now as it has little to
-      do with limiting the number of clients (it limits the number
-      of child processes). Bill proposed nomenclature change to
-      something like "StartWorkers, MaxWorkers, etc." that could 
-      apply to most all the MPMs (with some notable exceptions).
-      Bill would be happy with changing MaxClients to MaxServers
-      to make it agree with the operation of the StartServers
-      directive.
-
-    * A design problem with the scoreboard can cause the threaded 
-      MPM to get in a state where it will no longer serve requests.
-      When MaxRequestsPerChild is hit, a threaded process will begin
-      allowing it's idle worker threads to exit. The child process
-      may have one (or a few) threads serving really long responses
-      over slow client connections, which will prevent the child
-      process from exiting. The problem is that the
-      perform_idle_server_maintenance code will NOT start a new
-      process to replace the dying child process until the dying child 
-      has exited because the new child needs to use the old childs
-      space in the scoreboard. The scoreboard and
-      perform_idle_server_maintenance need to be redesigned.
-      Status: Several proposals discussed on new-httpd (April 16, 2001)
-      
-
-RELEASE NON-SHOWSTOPPERS BUT WOULD BE REAL NICE TO WRAP THESE UP:
-
-    * Performance: Get SINGLE_LISTENER_UNSERIALIZED_ACCEPT
-      optimization working again. Bill would like to see this
-      working for the threaded MPM, then prefork.
-
-    * mod_tls is very specific to OpenSSL. Make the API calls
-      more generic to support other encryption libraries.
-
-    * Performance & Debug: Eliminate most (and perhaps all) of the 
-      malloc/calloc/frees in the bucket brigade code.  Need some 
-      light weight memory management functions that allow freeing 
-      memory (putting it back into a memory pool) when it is no 
-      longer needed. Enabling simple debugging features like guard
-      bands, double free detection, etc. would be cool but certainly
-      not a hard requirement.
-
-    * Eliminate unnecessary creation of pipes in mod_cgid
-
-    * the autoconf setup should be fixed to default to using the 
-      "Apache" layout from config.layout, and each variable settable
-      in a layout should be overridable on the command line.  Plus,
-      what we do right now just doesn't seem to fully fit into how autoconf
-      works, eg. AC_PREFIX_DEFAULT issues.
-        Message-ID: <Pine.BSF.4.20.0104031557420.20876-100000@alive.znep.com>
-
-    * mod_status ExtendedStatus SS (seconds since last request) is
-      bogus because of an uninitialized field in the scoreboard.
-        Status: Cliff is working on this
-
-    * All of our MPMs should use APR for threads/processes.  This 
-      will allow us to error out if a threaded MPM is chosen on a
-      platform that doesn't support threads.
-
-    * Combine log_child and piped_log_spawn. Clean up http_log.c.
-      Common logging API.
-
-    * Document mod_file_cache.
-
-    * OS/2: Make mod_status work for spmt_os2 MPM.
-
-    * Win32: Win9x console window still won't play nice with the
-        close window, logoff and shutdown scenarios.
-        Status: OtherBill will move the patch forward from 1.3.15, once we 
-        get our other Win9x issues solved.
-
-    * Win32: Add a simple hold console open patch (wait for close or
-        the ESC key, with a nice message) if the server died a bad 
-        death (non-zero exit code) in console mode.
-        Status: OtherBill is bringing forward same ugly hack from 1.3.13
-
-    * 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.
-
-    * Win32: Migrate the MPM over to use APR thread/process calls. This
-      would eliminate some code in the Win32 branch that essentially
-      duplicates what is in APR.
-
-    * There are still a number of places in the code where we are
-      losing error status (i.e. throwing away the error returned by a
-      system call and replacing it with a generic error code)
-
-    * Win32: Implement reliable piped logs on Windows
-
-    * Mass vhosting version of suEXEC.
-
-    * All DBMs suffer from confusion in support/dbmmanage (perl script) since 
-        the dbmmanage employs the first-matched dbm format.  This is not
-        necessarily the library that Apache was built with.  Aught to
-        rewrite dbmmanage upon installation to bin/ with the proper library 
-        for predictable mod_auth_db/dbm administration.
-
-    * use apu_dbm in mod_auth_dbm
-        Status: Greg +1 (low-priority volunteer)
-
-    * Integrate mod_dav.
-        Some additional items remaining:
-	- case_preserved_filename stuff
-	    (use the new canonical name stuff?)
-	- find a new home for ap_text(_header)
-	- is it possible to remove the DAV: namespace stuff from util_xml?
-
-    * ap_core_translate() and its use by mod_mmap_static and mod_file_cache
-      are a bit wonky.  The function should probably be exposed as a utility 
-      function (such as ap_translate_url2fs() or ap_validate_fs_url() or 
-      something).  Another approach would be a new hook phase after
-      "translate" which would allow the module to munge what the
-      translation has decided to do.
-        Status: Greg +1 (volunteers), Ryan +1
-
-    * Explore use of a post-config hook for the code in http_main.c which
-      calls ap_fixup_virutal_hosts(), ap_fini_vhost_config(), and
-      ap_sort_hooks()  [to reduce the logic in main()]
-
-    * read the config tree just once, and process N times (as necessary)
-
-    * (possibly) use UUIDs in mod_unique_id and/or mod_usertrack
-
-    * (possibly) port the bug fix for PR 6942 (segv when LoadModule is put
-      into a VirtualHost container) to 2.0.
-
-    * the LTFLAGS = -export-dynamic in the config.m4 is wrong. it is getting
-      added multiple times during the config process. The -export-dynamic
-      should probably move into build/special.mk (the make file used for
-      building Apache modules).
-
-    * shift stuff to mod_core.h
-
-    * APR-ize resolver stuff in mod_unique_id (Jeff volunteers)
-
-    * callers of ap_run_create_request() should check the return value
-      for failure (Doug volunteers)
-
-PRs that have been suspended forever waiting for someone to
-put them into 'the next release':
-
-    * PR#76: general
-      missing call to "setlocale();"
-	Status: 
-
-    * PR#78: mod_include
-      Additional status for XBitHack directive
-	Status: 
-
-    * PR#161: mod_dir
-      Questionable performace of mod_dir() with negotiation
-	Status: 
-
-    * PR#362: mod_proxy
-      Mod_proxy doesn't allow change of error pages
-	Status: 
-
-    * PR#370: mod_env
-      Modified PATH environemnt variable is not passed, instead
-      system's is used
-	Status: 
-
-    * PR#440: mod_proxy
-      Proxy doesn't deliver documents if not connected
-	Status: 
-
-    * PR#534: mod_proxy
-      proxy converts ~name to %7Ename when name starts with a dot (.)
-	Status: 
-
-    * PR#537: mod_access
-      mod_access syntax allows hosts that should be restricted
-	Status: 
-
-    * PR#557: mod_auth-any
-      ~UserHome directories are not honored in absolute pathname
-      requests (.htaccess)
-	Status: 
-
-    * PR#573: mod_log-any
-      More LogFormat directives
-	Status: 
-
-    * PR#612: mod_proxy
-      Proxy FTP Authentication Fails
-	Status: 
-
-    * PR#623: mod_include
-      A smarter "Last Modified" value for SSI documents (see PR number 600)
-	Status: 
-
-    * PR#628: config
-      Request of "Options SymLinksIfGroupMatch"
-	Status: 
-
-    * PR#697: mod_include
-      A security tweak I've been using for a few years for SSI
-	Status: 
-
-    * PR#700: mod_proxy
-      Proxy doesn't do links right for OpenVMS files through ftp:
-	Status: 
-
-    * PR#759: mod_imap
-      imap should read <MAP><AREA>*</MAP> too!
-	Status: 
-
-    * PR#793: general
-      RLimitCPU and RLimitMEM don't apply to all children like they should
-	Status: 
-
-    * PR#921: suexec
-      Uses cwd before filling it in, doesn't use syslog
-	Status: 
-
-    * PR#922: config
-      it is useful to allow specifiction that root-owned symlinks
-      should always be followed
-	Status: 
-
-    * PR#980: mod_proxy
-      Controlling Access to Remote Proxies would be nice...
-	Status: 
-
-    * PR#994: mod_proxy
-      Adding authentication "on the fly" through the proxy module
-	Status: 
-
-    * PR#1004: apache-api
-      request_config field in request_rec is moderately bogus
-	Status: 
-
-    * PR#1028: other
-      DoS attacks involving memory consumption
-	Status: 
-
-    * PR#1050: mod_log-any
-      Logging of virtual server to error_log as well
-	Status: 
-
-    * PR#1085: mod_proxy
-      ProxyRemote make a dead cycle.
-	Status: 
-
-    * PR#1117: mod_auth-any
-      Using NIS passwd.byname dbm files with AuthDBMUserFile
-	Status: 
-
-    * PR#1120: suexec
-      suexec does not parse arguments to #exec cmd
-	Status: 
-
-    * PR#1145: mod_include
-      Allow for Last-Modified: without resorting to XBitHack
-	Status: 
-
-    * PR#1156: config
-      insufficent AllowOverrides granularity for autoindexing
-	Status: 
-
-    * PR#1158: apache-api
-      improvements to child spawning API
-	Status: 
-
-    * PR#1166: mod_proxy
-      ``nph-'' not honored (no buffering) for ProxyRemote mapping
-	Status: 
-
-    * PR#1176: mod_cgi
-      Apache cannot handle continuation line in headers
-	Status: 
-
-    * PR#1191: general
-      setlogin() is not called, causing problems with e.g. identd
-	Status: 
-
-    * PR#1204: general
-      regerror() exists, use it
-	Status: 
-
-    * PR#1233: apache-api
-      there is no way to keep per-connection per-module state
-	Status: 
-
-    * PR#1263: mod_dir
-      Add frame-safe anchor attribute to mod_autoindex links
-	Status: 
-
-    * PR#1268: suexec
-      CGI scripts running as Apache user: security (suexec etc.)
-	Status: 
-
-    * PR#1285: suexec
-      Error messages could be easier to spot in cgi.log file for suexec.c
-	Status: 
-
-    * PR#1287: mod_access
-      add allow,deny/deny,allow warning to mod_access
-	Status: 
-
-    * PR#1290: mod_proxy
-      Need to know "hit-rate" on proxy cache
-	Status: 
-
-    * PR#1358: mod_log-any
-      Selective url-encode of log fields (or maybe a pseudo
-      log_rewrite module?)
-	Status: 
-
-    * PR#1383: mod_headers
-      I make mod_headers to modify request headers as well as
-      response ones.
-	Status: 
-
-    * PR#1532: mod_proxy
-      Proxy transfer logging
-	Status: 
-
-    * PR#1547: mod_proxy
-      No HTTP_X_FORWARDED_FOR set...
-	Status: 
-
-    * PR#1567: mod_proxy
-      ProxyRemote proxy requests fail authentication by firewall
-	Status: 
-
-    * PR#1574: mod_autoindex
-      ReadmeName and HeaderName don't allow for server-parsed html.
-	Status: 
-
-    * PR#1582: mod_rewrite
-      mod_rewrite forms REQUEST_URI different than mod_cgi does
-	Status: 
-
-    * PR#1677: mod_headers
-      mod_headers should allow mod_log_config-style formats in
-      header values
-	Status: 
-
-    * PR#1702: mod_proxy
-      mod_proxy to support persistent conns?
-	Status: 
-
-    * PR#1803: mod_include
-      patches to mod_include to allow for file tests
-	Status: 
-
-    * PR#1809: mod_auth-any
-      Suggestion for improving authentication modules and core source
-      code, problem with 401 and ErrorDocument
-	Status: 
-
-    * PR#1855: mod_autoindex
-      More Control over autoindex layout
-	Status: 
-
-    * PR#1878: mod_proxy
-      listing of proxy cache content
-	Status: 
-
-    * PR#1905: suexec
-      Allow modules to set user:group for execution.
-	Status: 
-
-    * PR#2024: apache-api
-      adding auth_why to conn_rec
-	Status: 
-
-    * PR#2073: mod_log-any
-      pipelined connections are not logged correctly
-	Status: 
-
-    * PR#2074: mod_rewrite
-      mod_rewrite doesn't pass Proxy Throughput on internal subrequests
-	Status: 
-
-    * PR#2113: config
-      HTTP Server Rebuild Line Needs Changing for the better
-	Status: 
-
-    * PR#2138: mod_status
-      mod_status always displays 256 possible connection slots
-	Status: 
-
-    * PR#2221: documentation
-      Make online documentation search link back to my installation
-	Status: 
-
-    * PR#2284: general
-      Can not POST to ErrorDocument - Apache/1.3b6
-	Status: 
-
-    * PR#2314: mod_proxy
-      patterns in ProxyRemote
-	Status: 
-
-    * PR#2343: mod_status
-      Status module averages are for entire uptime
-	Status: 
-
-    * PR#2360: suexec
-      suexec for general access of user content?
-	Status: 
-
-    * PR#2396: general
-      Proposal for TimeZone directive
-	Status: 
-
-    * PR#2415: mod_info
-      /server-info doesn't check for the virtual host to list the info
-	Status: 
-
-    * PR#2421: config
-      problem specifying ndbm library for build ?with autoconfigure
-	Status: 
-
-    * PR#2431: general
-      A small addition to rotatelogs.c to improve program functionality.
-	Status: 
-
-    * PR#2446: config
-      AllowOverride FileInfo is too coarse
-	Status: 
-
-    * PR#2460: mod_cgi
-      TimeOut applies to output of CGI scripts
-	Status: 
-
-    * PR#2512: mod_access
-      <IfDenied> directive wanted
-	Status: 
-
-    * PR#2573: suexec
-      CGI's for general use still have to be run as another user
-      with suExec
-	Status: 
-
-    * PR#2648: general
-      Cache file names in Proxy module
-	Status: 
-
-    * PR#2760: config
-      [PATCH] User/Group for <Directory> and <Location> i.e. not only
-      in global and <Virtual>.
-	Status: 
-
-    * PR#2763: general
-      mailto tags and bundling bug report script
-	Status: 
-
-    * PR#2772: mod_log-any
-      more % escapes
-	Status: 
-
-    * PR#2785: os-aix
-      Support for System Resource Controller
-	Status: 
-
-    * PR#2793: protocol
-      When will Apache support P3P? Any Plans?
-	Status: 
-
-    * PR#2873: config
-      Feedback/Comment on APACI
-	Status: 
-
-    * PR#2889: general
-      Inclusion of RPM spec file in CVS/distributions
-	Status: 
-
-    * PR#2906: general
-      Propose that Apache recommend $UNIQUE_ID for all "session id"
-      algorithms
-	Status: 
-
-    * PR#2907: config
-      suggestion: power up your Include directive :)
-	Status: 
-
-    * PR#3018: general
-      cannot limit some HTTP methods
-	Status: 
-
-    * PR#3026: mod_autoindex
-      No way to change ReadmeName/HeaderName suffixes.
-	Status: 
-
-    * PR#3143: apache-api
-      No module specific data hook for per-connection data
-	Status: 
-
-    * PR#3181: config
-      Configuration file in Japanese
-	Status: 
-
-    * PR#3191: mod_negotiation
-      no way to set global quality-of-source (qs) coneg values
-      with multiviews
-	Status: 
-
-    * PR#3430: mod_negotiation
-      Enhancement: MultiViews, Multi-Language Documents
-	Status: 
-
-    * PR#3568: mod_proxy
-      Accessing URL through proxy server corrupts data.
-	Status: 
-
-    * PR#3594: os-windows
-      Please add an Apache icon to the systray instead of a DOS window
-	Status: 
-
-    * PR#3605: mod_proxy
-      Some anonymous FTP URLs ask for authentication
-	Status: 
-
-    * PR#3654: mod_autoindex
-      BORDER=0 makes Icons look nicer (FancyIndexing)
-	Status: 
-
-    * PR#3677: general
-      New ErrorDocumentMatch directive
-	Status: 
-
-    * PR#4180: os-windows
-      Alternative for win95 users
-	Status: 
-
-    * PR#4241: config
-      Need to be able to override shebang line to make CGI scripts
-      more portable.
-	Status: 
-
-    * PR#4244: config
-      "Files" and "FilesMatch" regexp does not recognize bang as
-      negation operator
-	Status: 
-
-    * PR#4448: mod_log-any
-      Please allow CGI env variables (QUERY_STRING, ...) to be logged
-      with %{}e
-	Status: 
-
-    * PR#4459: mod_include
-      Suggestion for better handling of Last-modified headers
-	Status: 
-
-    * PR#4490: mod_cgi
-      mod_cgi prevents handling of OPTIONS requests
-	Status: 
-
-    * PR#4520: mod_autoindex
-      mod_autoindex does not generate Last-Modified response headers
-	Status: 
-
-    * PR#4658: os-windows
-      The output of CGI scripts appears in the window that apache
-      is running in
-	Status: 
-
-    * PR#5713: os-windows
-      [PATCH] install as service with domain account
-	Status: 
-
-    * PR#5993: general
-      AllowOverride should have a 'CheckNone' and 'AllowNone' argument
-      instead of only 'None'
-	Status: 
-
-    * PR#6347: mod_mime
-      MIME types for MNG and JNG files need adding to mime.types and
-      the mime.types and magic files
-	Status: Waiting for IANA types to be defined
-
-Other bugs that need fixing:
-
-    * MaxRequestsPerChild measures connections, not requests.
-        Until someone has a better way, we'll probably just rename it
-        "MaxConnectionsPerChild".
-    
-    * 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.
-
-    * SIGSEGV on Linux (glibc 2.1.2) isn't caught properly by a
-      sigwaiting thread. We need to work around this, perhaps unless
-      there is hope soon for a fixed glibc.
-
-    * orig_ct in the byterange/multipart handling may not be
-      needed. Apache 1.3 just never stashed "multipart" into
-      r->content_type. We should probably follow suit since the
-      byterange stuff doesn't want the rest of the code to see the
-      multipart content-type; the other code should still think it is
-      dealing with the <orig_ct> stuff.
-        Status: Greg volunteers to investigate (esp. since he was most 
-                likely the one to break it :-)
-
-Other features that need writing:
-
-    * Finish infrastructure in core for async MPMs
-        Status: post 2.0
-
-    * TODO in source -- just do an egrep on "TODO" and see what's there
-
-Documentation that needs writing:
-    * Mod_status docs are needed.
-
-    * The concept of MPMs, especially if we ship more than one MPM for a
-      given platform
-
-    * New directives in the various MPMs and appropriate links from
-	obsolete directives in core.html to the MPM documentation.
-
-    * Revise manual/stopping.html and the last part of
-	manual/misc/perf-tuning.html to take account of the MPMs.
-
-    * API documentation
-        Status: Ben Laurie has written some hooks documentation
-        (apache-2.0/htdocs/hooks.html)
-
-    * Changes since 1.3.9 can be more easily seen in the commitlog file
-         dev.apache.org:/home/cvs/CVSROOT/commitlogs/apache-2.0
-      which includes some of Roy's comments when the changes were
-      committed in rough change-sets by purpose.  Note that the commitlog
-      does not show the contents of new files until later.
-
-Available Patches:
-
-   * Jon Travis's <jtravis@covalent.net> patch to deal with thread-safe
-     issues with inet_ntoa.  See message <20001201163220.A12827@covalent.net>
-	Status:  This is being set aside until the IPv6 work is finished
-		 so that we know exactly what is required.
-
-   * Martin Sojka <msojka@gmx.de>'s patch to add error reporting for failed 
-     htpasswd actions due to a full /tmp volume (other programs may have
-     similar problems?)
-        PR: 6475
-        Status:
-
-   * 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
- 
-   * Jim Winstead's <jimw@trainedmonkey.com> patch to add CookieDomain and 
-     other small mod_usertrack features
-
-   * Dan Rench's <drench@xnet.com> patch to add allow the errmsg and timefmt 
-     of SSI's to be modified in the config file.  Patch is available in 
-     PR6193
-
-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 4fc5ec396a..0000000000
--- a/acinclude.m4
+++ /dev/null
@@ -1,351 +0,0 @@
-
-dnl APACHE_SUBST(VARIABLE)
-dnl Makes VARIABLE available in generated files
-dnl (do not use @variable@ in Makefiles, but $(variable))
-AC_DEFUN(APACHE_SUBST,[
-  APACHE_VAR_SUBST="$APACHE_VAR_SUBST $1"
-  AC_SUBST($1)
-])
-
-dnl APACHE_FAST_OUTPUT(FILENAME)
-dnl Perform substitutions on FILENAME (Makefiles only)
-AC_DEFUN(APACHE_FAST_OUTPUT,[
-  APACHE_FAST_OUTPUT_FILES="$APACHE_FAST_OUTPUT_FILES $1"
-])
-
-dnl APACHE_MKDIR_P_CHECK
-dnl checks whether mkdir -p works
-AC_DEFUN(APACHE_MKDIR_P_CHECK,[
-  AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
-    test -d conftestdir && rm -rf conftestdir
-    mkdir -p conftestdir/somedir >/dev/null 2>&1
-    if test -d conftestdir/somedir; then
-      ac_cv_mkdir_p=yes
-    else
-      ac_cv_mkdir_p=no
-    fi
-    rm -rf conftestdir
-  ])
-])
-
-dnl APACHE_GEN_CONFIG_VARS
-dnl Creates config_vars.mk
-AC_DEFUN(APACHE_GEN_CONFIG_VARS,[
-  APACHE_SUBST(abs_srcdir)
-  APACHE_SUBST(bindir)
-  APACHE_SUBST(sbindir)
-  APACHE_SUBST(cgidir)
-  APACHE_SUBST(logfiledir)
-  APACHE_SUBST(exec_prefix)
-  APACHE_SUBST(datadir)
-  APACHE_SUBST(localstatedir)
-  APACHE_SUBST(libexecdir)
-  APACHE_SUBST(htdocsdir)
-  APACHE_SUBST(includedir)
-  APACHE_SUBST(iconsdir)
-  APACHE_SUBST(sysconfdir)
-  APACHE_SUBST(other_targets)
-  APACHE_SUBST(progname)
-  APACHE_SUBST(prefix)
-  APACHE_SUBST(AWK)
-  APACHE_SUBST(CC)
-  APACHE_SUBST(CXX)
-  APACHE_SUBST(CPPFLAGS)
-  APACHE_SUBST(CFLAGS)
-  APACHE_SUBST(CXXFLAGS)
-  APACHE_SUBST(LTFLAGS)
-  APACHE_SUBST(LDFLAGS)
-  APACHE_SUBST(SH_LDFLAGS)
-  APACHE_SUBST(HTTPD_LDFLAGS)
-  APACHE_SUBST(LIBS)
-  APACHE_SUBST(DEFS)
-  APACHE_SUBST(INCLUDES)
-  APACHE_SUBST(NOTEST_CPPFLAGS)
-  APACHE_SUBST(NOTEST_CFLAGS)
-  APACHE_SUBST(NOTEST_CXXFLAGS)
-  APACHE_SUBST(NOTEST_LDFLAGS)
-  APACHE_SUBST(NOTEST_LIBS)
-  APACHE_SUBST(EXTRA_CPPFLAGS)
-  APACHE_SUBST(EXTRA_CFLAGS)
-  APACHE_SUBST(EXTRA_CXXFLAGS)
-  APACHE_SUBST(EXTRA_LDFLAGS)
-  APACHE_SUBST(EXTRA_LIBS)
-  APACHE_SUBST(EXTRA_INCLUDES)
-  APACHE_SUBST(LIBTOOL)
-  APACHE_SUBST(SHELL)
-  APACHE_SUBST(MODULE_DIRS)
-  APACHE_SUBST(PORT)
-  APACHE_SUBST(CORE_IMPLIB_FILE)
-  APACHE_SUBST(CORE_IMPLIB)
-  APACHE_SUBST(SH_LIBTOOL)
-  APACHE_SUBST(MK_IMPLIB)
-  APACHE_SUBST(INSTALL_PROG_FLAGS)
-
-  abs_srcdir="`(cd $srcdir && pwd)`"
-
-  APACHE_MKDIR_P_CHECK
-  echo creating config_vars.mk
-  > config_vars.mk
-  for i in $APACHE_VAR_SUBST; do
-    eval echo "$i = \$$i" >> config_vars.mk
-  done
-])
-
-dnl APACHE_GEN_MAKEFILES
-dnl Creates Makefiles
-AC_DEFUN(APACHE_GEN_MAKEFILES,[
-  $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $BSD_MAKEFILE $APACHE_FAST_OUTPUT_FILES
-])
-
-AC_DEFUN(APACHE_LIBTOOL_SILENT,[
-  LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent'
-])
-
-    
-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 APACHE_TYPE_RLIM_T
-dnl
-dnl If rlim_t is not defined, define it to int
-dnl
-AC_DEFUN(APACHE_TYPE_RLIM_T, [
-  AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [
-    AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-], [rlim_t spoon;], [
-      ac_cv_type_rlim_t=yes
-    ],[ac_cv_type_rlim_t=no
-    ])
-  ])
-  if test "$ac_cv_type_rlim_t" = "no" ; then
-      AC_DEFINE(rlim_t, int,
-          [Define to 'int' if <sys/resource.h> doesn't define it for us])
-  fi
-])
-
-dnl APACHE_MODPATH_INIT(modpath)
-AC_DEFUN(APACHE_MODPATH_INIT,[
-  current_dir=$1
-  modpath_current=modules/$1
-  modpath_static=
-  modpath_shared=
-  test -d $1 || $srcdir/build/mkdir.sh $modpath_current
-  > $modpath_current/modules.mk
-])dnl
-dnl
-AC_DEFUN(APACHE_MODPATH_FINISH,[
-  echo "DISTCLEAN_TARGETS = modules.mk" >> $modpath_current/modules.mk
-  echo "static = $modpath_static" >> $modpath_current/modules.mk
-  echo "shared = $modpath_shared" >> $modpath_current/modules.mk
-  if test ! -z "$modpath_static" -o ! -z "$modpath_shared"; then
-    MODULE_DIRS="$MODULE_DIRS $current_dir"
-  fi
-  APACHE_FAST_OUTPUT($modpath_current/Makefile)
-])dnl
-dnl
-dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
-AC_DEFUN(APACHE_MODPATH_ADD,[
-  if test -z "$3"; then
-    objects="mod_$1.lo"
-  else
-    objects="$3"
-  fi
-
-  if test -z "$module_standalone"; then
-    if test -z "$2"; then
-      libname="mod_$1.la"
-      BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
-      modpath_static="$modpath_static $libname"
-      cat >>$modpath_current/modules.mk<<EOF
-$libname: $objects
-	\$(MOD_LINK) $objects
-EOF
-    else
-      apache_need_shared=yes
-      libname="mod_$1.la"
-      shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
-      modpath_shared="$modpath_shared $libname"
-      cat >>$modpath_current/modules.mk<<EOF
-$libname: $shobjects
-	\$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
-EOF
-    fi
-  fi
-])dnl
-
-dnl
-dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
-dnl
-dnl default is one of:
-dnl   yes  -- enabled by default. user must explicitly disable.
-dnl   no   -- disabled under default, most, all. user must explicitly enable.
-dnl   most -- disabled by default. enabled explicitly or with most or all.
-dnl   ""   -- disabled under default, most. enabled explicitly or with all.
-dnl
-dnl basically: yes/no is a hard setting. "most" means follow the "most"
-dnl            setting. otherwise, fall under the "all" setting.
-dnl            explicit yes/no always overrides.
-dnl
-AC_DEFUN(APACHE_MODULE,[
-  AC_MSG_CHECKING(whether to enable mod_$1)
-  define([optname],[  --]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
-  AC_ARG_ENABLE(translit($1,_,-),optname() substr([                         ],len(optname()))$2,,enable_$1=ifelse($5,,maybe-all,$5))
-  undefine([optname])dnl
-  _apmod_extra_msg=""
-  if test "$enable_$1" = "most"; then
-    if test "$module_selection" = "most" -o "$module_selection" = "all"; then
-      enable_$1=$module_default
-      _apmod_extra_msg=" ($module_selection)"
-    else
-      enable_$1=no
-    fi
-  elif test "$enable_$1" = "maybe-all"; then
-    if test "$module_selection" = "all"; then
-      enable_$1=$module_default
-      _apmod_extra_msg=" (all)"
-    else
-      enable_$1=no
-    fi
-  fi
-  AC_MSG_RESULT($enable_$1$_apmod_extra_msg)
-  if test "$enable_$1" != "no"; then
-    case "$enable_$1" in
-    shared*)
-      enable_$1=`echo $ac_n $enable_$1$ac_c|sed 's/shared,*//'`
-      sharedobjs=yes
-      shared=yes;;
-    *)
-      MODLIST="$MODLIST ifelse($4,,$1,$4)"
-      if test "$1" = "so"; then
-          sharedobjs=yes
-      fi
-      shared="";;
-    esac
-    ifelse([$6],,:,[$6])
-    APACHE_MODPATH_ADD($1, $shared, $3)
-  fi
-])dnl
-dnl
-dnl APACHE_LAYOUT(configlayout, layoutname)
-AC_DEFUN(APACHE_LAYOUT,[
-  if test ! -f $srcdir/config.layout; then
-    echo "** Error: Layout file $srcdir/config.layout not found"
-    echo "** Error: Cannot use undefined layout '$LAYOUT'"
-    exit 1
-  fi
-  pldconf=./config.pld
-  changequote({,})
-  sed -e "1,/[ 	]*<[lL]ayout[ 	]*$2[ 	]*>[ 	]*/d" \
-      -e '/[ 	]*<\/Layout>[ 	]*/,$d' \
-      -e "s/^[ 	]*//g" \
-      -e "s/:[ 	]*/=\'/g" \
-      -e "s/[ 	]*$/'/g" \
-      $1 > $pldconf
-  layout_name=$2
-  . $pldconf
-  rm $pldconf
-  for var in prefix exec_prefix bindir sbindir libexecdir mandir \
-             sysconfdir datadir iconsdir htdocsdir cgidir includedir \
-             localstatedir runtimedir logfiledir proxycachedir; do
-    eval "val=\"\$$var\""
-    case $val in
-      *+)
-        val=`echo $val | sed -e 's;\+$;;'`
-        eval "$var=\"\$val\""
-        autosuffix=yes
-        ;;
-      *)
-        autosuffix=no
-        ;;
-    esac
-    val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
-    val=`echo $val | sed -e 's:$\([a-z_]*\):$(\1):g'`
-    if test "$autosuffix" = "yes"; then
-      if echo $val | grep apache >/dev/null; then
-        addtarget=no
-      else
-        addtarget=yes
-      fi
-      if test "$addtarget" = "yes"; then
-        val="$val/apache"
-      fi
-    fi
-    eval "$var='$val'"
-  done
-  changequote([,])
-])dnl
-dnl
-dnl APACHE_ENABLE_LAYOUT
-dnl
-AC_DEFUN(APACHE_ENABLE_LAYOUT,[
-AC_ARG_ENABLE(layout,
-[  --enable-layout=LAYOUT],[
-  LAYOUT=$enableval
-])
-
-if test -z "$LAYOUT"; then
-  # XXX FIXME: this isn't a complete list of things that have to be set to 
-  # create the Apache layout in config.layout, and it really should just
-  # use what is specified in config.layout instead of duping it.
-  htdocsdir='$(prefix)/htdocs'
-  iconsdir='$(prefix)/icons'
-  cgidir='$(prefix)/cgi-bin'
-  logfiledir='$(prefix)/logs'
-  sysconfdir='${prefix}/conf'
-  libexecdir='${prefix}/modules'
-  layout_name=Apache
-else 
-  APACHE_LAYOUT($srcdir/config.layout, $LAYOUT)
-fi
-
-AC_MSG_CHECKING(for chosen layout)
-AC_MSG_RESULT($layout_name)
-])
-
-dnl
-dnl APACHE_ENABLE_MODULES
-dnl
-AC_DEFUN(APACHE_ENABLE_MODULES,[
-  module_selection=default
-  module_default=yes
-
-  AC_ARG_ENABLE(modules,
-  [  --enable-modules=MODULE-LIST],[
-    for i in $enableval; do
-      if test "$i" = "all" -o "$i" = "most"; then
-        module_selection=$i
-      else
-        eval "enable_$i=yes"
-      fi
-    done
-  ])
-  
-  AC_ARG_ENABLE(mods-shared,
-  [  --enable-mods-shared=MODULE-LIST],[
-    for i in $enableval; do
-      if test "$i" = "all" -o "$i" = "most"; then
-        module_selection=$i
-        module_default=shared
-      else
-        i=`echo $i | sed 's/-/_/g'`
-    	eval "enable_$i=shared"
-      fi
-    done
-  ])
-])
-
-AC_DEFUN(APACHE_REQUIRE_CXX,[
-  if test -z "$apache_cxx_done"; then
-    AC_PROG_CXX
-    AC_PROG_CXXCPP
-    apache_cxx_done=yes
-  fi
-])
diff --git a/build/binbuild.sh b/build/binbuild.sh
deleted file mode 100755
index 36192c3afa..0000000000
--- a/build/binbuild.sh
+++ /dev/null
@@ -1,296 +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
-
-OS=`./config.guess`
-CONFIGPARAM="--with-layout=BinaryDistribution --prefix=`pwd`/bindist"
-APDIR=`pwd`
-APDIR=`basename $APDIR`
-VER=`echo $APDIR |sed s/httpd-//`
-TAR="`srclib/apr/build/PrintPath tar`"
-GTAR="`srclib/apr/build/PrintPath gtar`"
-GZIP="`srclib/apr/build/PrintPath gzip`"
-
-if [ x$1 != x ]; then
-  USER=$1
-else
-  USER="`build/buildinfo.sh -n %u@%h%d`"
-fi
-
-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 2.0 source distribution and re-execute the script"
-  echo "'./build/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 2.0 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 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 image successfully created..."
-
-./bindist/bin/httpd -v
-
-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 ../httpd-$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 "lmkdir()" && \
-  echo "{" && \
-  echo "  path=\"\"" && \
-  echo "  dirs=\`echo \$1 | sed -e 's%/% %g'\`" && \
-  echo "  mode=\$2" && \
-  echo " " && \
-  echo "  set -- \${dirs}" && \
-  echo " " && \
-  echo "  for d in \${dirs}" && \
-  echo "  do" && \
-  echo "    path=\"\${path}/\$d\"" && \
-  echo "    if test ! -d \"\${path}\" ; then" && \
-  echo "      mkdir \${path}" && \
-  echo "      if test \$? -ne 0 ; then" && \
-  echo "        echo \"Failed to create directory: \${path}\"" && \
-  echo "        exit 1" && \
-  echo "      fi" && \
-  echo "      chmod \${mode} \${path}" && \
-  echo "    fi" && \
-  echo "  done" && \
-  echo "}" && \
-  echo " " && \
-  echo "lcopy()" && \
-  echo "{" && \
-  echo "  from=\$1" && \
-  echo "  to=\$2" && \
-  echo "  dmode=\$3" && \
-  echo "  fmode=\$4" && \
-  echo " " && \
-  echo "  test -d \${to} || lmkdir \${to} \${dmode}" && \
-  echo "  (cd \${from} && tar -cf - *) | (cd \${to} && tar -xf -)" && \
-  echo " " && \
-  echo "  if test \"X\${fmode}\" != X ; then" && \
-  echo "    find \${to} -type f -print | xargs chmod \${fmode}" && \
-  echo "  fi" && \
-  echo "  if test \"X\${dmode}\" != X ; then" && \
-  echo "    find \${to} -type d -print | xargs chmod \${dmode}" && \
-  echo "  fi" && \
-  echo "}" && \
-  echo " " && \
-  echo "##" && \
-  echo "##  determine path to (optional) Perl interpreter" && \
-  echo "##" && \
-  echo "PERL=no-perl5-on-this-system" && \
-  echo "perls='perl5 perl'" && \
-  echo "path=\`echo \$PATH | sed -e 's/:/ /g'\`" && \
-  echo " " && \
-  echo "for dir in \${path} ;  do" && \
-  echo "  for pperl in \${perls} ; do" && \
-  echo "    if test -f \"\${dir}/\${pperl}\" ; then" && \
-  echo "      if \`\${dir}/\${pperl} -v | grep 'version 5\.' >/dev/null 2>&1\` ; then" && \
-  echo "        PERL=\"\${dir}/\${pperl}\"" && \
-  echo "        break" && \
-  echo "      fi" && \
-  echo "    fi" && \
-  echo "  done" && \
-  echo "done" && \
-  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 "lmkdir \$SR 755" && \
-  echo "lmkdir \$SR/proxy 750" && \
-  echo "lmkdir \$SR/logs 750" && \
-  echo "lcopy bindist/man \$SR/man 755 644" && \
-  echo "lcopy bindist/modules \$SR/modules 750 644" && \
-  echo "lcopy bindist/include \$SR/include 755 644" && \
-  echo "lcopy bindist/icons \$SR/icons 755 644" && \
-  echo "lcopy bindist/cgi-bin \$SR/cgi-bin 750 750" && \
-  echo "lcopy bindist/bin \$SR/bin 750 750" && \
-  echo "if [ -d \$SR/conf ]" && \
-  echo "then" && \
-  echo "  echo \"[Preserving existing configuration files.]\"" && \
-  echo "  cp bindist/conf/*.default \$SR/conf/" && \
-  echo "else" && \
-  echo "  lcopy bindist/conf \$SR/conf 750 640" && \
-  echo "fi" && \
-  echo "if [ -d \$SR/htdocs ]" && \
-  echo "then" && \
-  echo "  echo \"[Preserving existing htdocs directory.]\"" && \
-  echo "else" && \
-  echo "  lcopy bindist/htdocs \$SR/htdocs 755 644" && \
-  echo "fi" && \
-  echo " " && \
-  echo "sed -e \"s;^#!/.*;#!\$PERL;\" -e \"s;\@prefix\@;\$SR;\" -e \"s;\@sbindir\@;\$SR/bin;\" \\" && \
-  echo "	-e \"s;\@libexecdir\@;\$SR/libexec;\" -e \"s;\@includedir\@;\$SR/include;\" \\" && \
-  echo "	-e \"s;\@sysconfdir\@;\$SR/conf;\" bindist/bin/apxs > \$SR/bin/apxs" && \
-  echo "sed -e \"s;^#!/.*;#!\$PERL;\" bindist/bin/dbmmanage > \$SR/bin/dbmmanage" && \
-  echo "sed -e \"s%/usr/local/apache%\$SR%\" \$SR/conf/httpd-std.conf > \$SR/conf/httpd.conf" && \
-  echo "sed -e \"s%PIDFILE=%PIDFILE=\$SR/%\" -e \"s%HTTPD=%HTTPD=\\\"\$SR/%\" -e \"s%httpd\$%httpd -d \$SR -R \$SR/libexec\\\"%\" 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 should first check the (initially        |\"" && \
-  echo "echo \" | created or preserved) configuration files:             |\"" && \
-  echo "echo \" |                                                        |\"" && \
-  echo "echo \" |   \$SR/conf/httpd.conf\"" && \
-  echo "echo \" |                                                        |\"" && \
-  echo "echo \" | You should then 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%\"proxy%\"/usr/local/apache/proxy%" \
-    -e "s%^ServerAdmin.*%ServerAdmin you@your.address%" \
-    -e "s%#ServerName.*%#ServerName localhost%" \
-    -e "s%Port 8080%Port 80%" \
-    bindist/conf/httpd-std.conf > 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 [ "x$GTAR" != "x" ]
-  then
-    $GTAR -zcf ../httpd-$VER-$OS.tar.gz -C .. httpd-$VER
-  else
-    if [ "x$TAR" != "x" ]
-    then
-      case "x$OS" in
-        x*390*) $TAR -cfU ../httpd-$VER-$OS.tar -C .. httpd-$VER;;
-	    *) (cd .. && $TAR -cf httpd-$VER-$OS.tar httpd-$VER);;
-      esac
-      if [ "x$GZIP" != "x" ]
-      then
-        $GZIP ../httpd-$VER-$OS.tar
-      fi
-    else
-      echo "ERROR: Could not find a 'tar' program!"
-      echo "       Please execute the following commands manually:"
-      echo "         tar -cf ../httpd-$VER-$OS.tar ."
-      echo "         gzip ../httpd-$VER-$OS.tar"
-    fi
-  fi
-
-  if [ -f ../httpd-$VER-$OS.tar.gz ] && [ -f ../httpd-$VER-$OS.README ]
-  then
-    echo "Ready."
-    echo "You can find the binary archive (httpd-$VER-$OS.tar.gz)"
-    echo "and the readme file (httpd-$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 576f99eb7f..0000000000
--- a/build/bsd_makefile
+++ /dev/null
@@ -1,71 +0,0 @@
-#! /bin/sh
-# ====================================================================
-# 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/>.
-#
-# 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/bsd_makefile.XXXXXX 2>/dev/null` || tmpfile="tmp.$$"
-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 a44571f9ee..0000000000
--- a/build/build-modules-c.awk
+++ /dev/null
@@ -1,56 +0,0 @@
-BEGIN {
-    RS = " "
-    modules[n++] = "core"
-    pmodules[pn++] = "core"
-} 
-{
-    modules[n] = $1;
-    pmodules[pn] = $1;
-    gsub("\n","",modules[n]);
-    gsub("\n","",pmodules[pn]);
-    ++n;
-    ++pn;
-} 
-END {
-    print "/*"
-    print " * modules.c --- automatically generated by Apache"
-    print " * configuration script.  DO NOT HAND EDIT!!!!!"
-    print " */"
-    print ""
-    print "#include \"ap_config.h\""
-    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/buildexports.awk b/build/buildexports.awk
deleted file mode 100644
index 7856b46d34..0000000000
--- a/build/buildexports.awk
+++ /dev/null
@@ -1,3 +0,0 @@
-/^(APR?_|!?defined)/     { print "#if", $0 }
-/^\t*apr?_/ { print "const void *ap_hack_" $1 " = (const void *)" $1 ";" }
-/^\/(APR?_|!?defined)/   { print "#endif /*", substr($0,2), "*/" }
diff --git a/build/buildexports.sh b/build/buildexports.sh
deleted file mode 100755
index cbf87802d4..0000000000
--- a/build/buildexports.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#! /bin/sh
-
-if test -z "$1"; then
-    echo "USAGE: $0 HTTPD-DIRECTORY"
-    echo ""
-    echo "for example: $0 .."
-    exit 1
-fi
-
-echo "/* THIS FILE WAS AUTOGENERATED BY $0"
-echo " * This is an ugly hack that needs to be here, so that libtool will"
-echo " * link all of the APR functions into server regardless of whether"
-echo " * the base server uses them."
-echo " */"
-echo ""
-echo "#define CORE_PRIVATE"
-
-cur_dir="`pwd`"
-for dir in $1/srclib/apr/include $1/srclib/apr-util/include $1/include
-do
-    cd $dir
-    for file in *.h; do
-        echo "#include \"$file\""
-    done
-    cd "$cur_dir"
-done
-
-echo ""
-echo "const void *ap_ugly_hack = NULL;"
-echo ""
-
-# convert export files (on STDIN) into a series of declarations
-my_dir="`dirname $0`"
-awk -f "$my_dir/buildexports.awk"
diff --git a/build/buildinfo.sh b/build/buildinfo.sh
deleted file mode 100755
index 5c2a72d6b3..0000000000
--- 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 425dc80268..0000000000
--- a/build/config-stubs
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-
-#
-# Find all config files (config*.m4) and map them into lines with the
-# form: NUM? '0' ' ' PATH
-#
-# For example:
-#
-#  50 ./modules/generators/config5.m4
-#  0 ./modules/aaa/config.m4
-#  10 ./example/config1.m4
-#
-# These lines are sorted, then the first field is removed. Thus, we
-# have a set of paths sorted on the config-number (if present). All
-# config files without a number are sorted before those with a number.
-#
-
-configfiles=`find . -name "config*.m4" | \
-	sed 's#\(.*/config\)\(.*\).m4#\20 \1\2.m4#' | \
-	sort | \
-	sed 's#.* ##'`
-
-for configfile in $configfiles; do
-    if [ -r $configfile ]; then
-        echo "sinclude($configfile)"
-    fi
-done
diff --git a/build/default.pl b/build/default.pl
deleted file mode 100644
index 4a73b77821..0000000000
--- 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 ab4824f573..0000000000 --- a/build/fastgen.sh +++ /dev/null @@ -1,112 +0,0 @@ -#! /bin/sh -# ==================================================================== -# 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 provided by Sascha Schumann. -# - -srcdir=$1 -shift - -mkdir_p=$1 -shift - -bsd_makefile=$1 -shift - -top_srcdir=`(cd $srcdir; pwd)` -top_builddir=`pwd` - -if test "$mkdir_p" = "yes"; then - mkdir_p="mkdir -p" -else - mkdir_p="$top_srcdir/build/mkdir.sh" -fi - -if test "$bsd_makefile" = "yes"; then - (cd $top_srcdir; ./build/bsd_makefile) - - for makefile in $@; do - echo "creating $makefile" - dir=`echo $makefile|sed 's%/*[^/][^/]*$%%'` - $mkdir_p "$dir/" - - cat - $top_srcdir/$makefile.in <$makefile -top_srcdir = $top_srcdir -top_builddir = $top_builddir -srcdir = $top_srcdir/$dir -builddir = $top_builddir/$dir -VPATH = $top_srcdir/$dir -EOF - - test -z "$dir" && dir="." - touch $dir/.deps - done -else - for makefile in $@; do - echo "creating $makefile" - dir=`echo $makefile|sed 's%/*[^/][^/]*$%%'` - $mkdir_p "$dir/" - - cat - $top_srcdir/$makefile.in <$makefile -top_srcdir = $top_srcdir -top_builddir = $top_builddir -srcdir = $top_srcdir/$dir -builddir = $top_builddir/$dir -VPATH = $top_srcdir/$dir -EOF - - test -z "$dir" && dir="." - touch $dir/.deps - done -fi diff --git a/build/fixwin32mak.pl b/build/fixwin32mak.pl deleted file mode 100644 index 756f0a735c..0000000000 --- a/build/fixwin32mak.pl +++ /dev/null @@ -1,47 +0,0 @@ -# -# fixwin32mak.pl ::: Apache/Win32 maintanace program -# -# This program, launched from the build/ directory, replaces all nasty absoulute paths -# in the win32 .mak files with the appropriate relative root. -# -# Run this program prior to committing or packaging any newly exported make files. - -use Cwd; -use IO::File; -use File::Find; - -chdir '..'; -$root = cwd; -$root =~ s|.:(.*)|cd "$1|; -$root =~ s|/|\\\\|g; -find(\&fixcwd, '.'); - -sub fixcwd { - if (m|.mak$|) { - $repl = $File::Find::dir; - $repl =~ s|^./||; - $repl =~ s|[^\./]+|..|g; - $repl =~ s|/|\\|; - $oname = $_; - $tname = '.#' . $_; - $verchg = 0; - $srcfl = new IO::File $_, "r" || die; - $dstfl = new IO::File $tname, "w" || die; - while ($src = <$srcfl>) { - if ($src =~ s|^(\s*)$root|$1cd "$repl|) { - $verchg = -1; - } - print $dstfl $src; - } - undef $srcfl; - undef $dstfl; - if ($verchg) { - unlink $oname || die; - rename $tname, $oname || die; - print "Corrected absolute paths within " . $oname . " in " . $File::Find::dir . "\n"; - } - else { - unlink $tname; - } - } -} diff --git a/build/httpd_roll_release b/build/httpd_roll_release deleted file mode 100755 index 5303a6a874..0000000000 --- a/build/httpd_roll_release +++ /dev/null @@ -1,110 +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 - -# 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 "Tagging 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.sh b/build/install.sh deleted file mode 100755 index 9a8821fa29..0000000000 --- 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/library.mk b/build/library.mk deleted file mode 100644 index 7335c45dc2..0000000000 --- a/build/library.mk +++ /dev/null @@ -1,60 +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 provided by Sascha Schumann. -# - -LTLIBRARY_OBJECTS = $(LTLIBRARY_SOURCES:.c=.lo) $(LTLIBRARY_OBJECTS_X) - -$(LTLIBRARY_NAME): $(LTLIBRARY_OBJECTS) $(LTLIBRARY_DEPENDENCIES) - $(LINK) $(LTLIBRARY_LDFLAGS) $(LTLIBRARY_OBJECTS) $(LTLIBRARY_LIBADD) diff --git a/build/ltlib.mk b/build/ltlib.mk deleted file mode 100644 index 9b89d9c309..0000000000 --- a/build/ltlib.mk +++ /dev/null @@ -1,61 +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 provided by Sascha Schumann. -# - -targets = $(LTLIBRARY_NAME) - -include $(top_srcdir)/build/rules.mk -include $(top_srcdir)/build/library.mk - diff --git a/build/mkdep.perl b/build/mkdep.perl deleted file mode 100644 index a9f1a67d0b..0000000000 --- a/build/mkdep.perl +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/perl -# -# $Id: mkdep.perl,v 1.2 2000/03/19 13:25:33 bjh 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 () - { - s/\\\\/\//g; - 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 4cd33c5671..0000000000 --- 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/program.mk b/build/program.mk deleted file mode 100644 index 862304a6da..0000000000 --- a/build/program.mk +++ /dev/null @@ -1,60 +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 provided by Sascha Schumann. -# - -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 b/build/rules.mk deleted file mode 100644 index 367d2256ce..0000000000 --- a/build/rules.mk +++ /dev/null @@ -1,248 +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 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_CPPFLAGS = $(DEFS) $(EXTRA_CPPFLAGS) $(NOTEST_CPPFLAGS) $(CPPFLAGS) -ALL_CFLAGS = $(EXTRA_CFLAGS) $(NOTEST_CFLAGS) $(CFLAGS) -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_CPPFLAGS) $(ALL_CFLAGS) $(ALL_INCLUDES) -CXX_COMPILE = $(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(ALL_INCLUDES) - -SH_COMPILE = $(SH_LIBTOOL) --mode=compile $(COMPILE) -c $< && touch $@ -SH_CXX_COMPILE = $(SH_LIBTOOL) --mode=compile $(CXX_COMPILE) -c $< && touch $@ - -LT_COMPILE = $(LIBTOOL) --mode=compile $(COMPILE) -c $< && touch $@ -LT_CXX_COMPILE = $(LIBTOOL) --mode=compile $(CXX_COMPILE) -c $< && touch $@ - -# Link-related commands - -LINK = $(LIBTOOL) --mode=link $(COMPILE) $(LTFLAGS) $(ALL_LDFLAGS) -o $@ -SH_LINK = $(SH_LIBTOOL) --mode=link $(COMPILE) $(LTFLAGS) $(ALL_LDFLAGS) $(SH_LDFLAGS) $(CORE_IMPLIB) -o $@ -MOD_LINK = $(LIBTOOL) --mode=link $(COMPILE) -module $(LTFLAGS) $(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) - -# Suffixes - -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 $@ - - -all: all-recursive -shared-modules: shared-modules-recursive -install: install-recursive - - -# Makes an import library from a def file -.def.la: - $(LIBTOOL) --mode=compile $(MK_IMPLIB) -o $@ $< - - -# if we are doing a distclean, we actually want to hit every -# directory that has ever been configured. To do this, we just do a quick -# find for all the leftover Makefiles, and then run make distclean in those -# directories. -# Exception: Skip APR directories (other than the base APR directory), -# because APR knows how to do these tasks better than we do. -distclean-recursive clean-recursive depend-recursive all-recursive install-recursive: - @otarget=`echo $@|sed s/-recursive//`; \ - list='$(SUBDIRS)'; for i in $$list; do \ - target="$$otarget"; \ - echo "Making $$target in $$i"; \ - if test "$$i" = "."; then \ - ok=yes; \ - target="$$target-p"; \ - fi; \ - (cd $$i && $(MAKE) $$target) || exit 1; \ - done; \ - if test "$$otarget" = "all" && test -z '$(targets)'; then ok=yes; fi;\ - if test "$$ok" != "yes"; then $(MAKE) "$$otarget-p" || exit 1; fi; \ - if test "$$otarget" = "distclean" ; then\ - for d in `find . -name Makefile`; do \ - i=`dirname "$$d"`; \ - target="$$otarget"; \ - in_apr=`echo $$i|sed 's%^.*apr/.*$$%ignore_apr_subdirs%'`; \ - in_apr=`echo $$in_apr|sed 's%^.*apr-util/.*$$%ignore_apr_subdirs%'`; \ - if test "x$$in_apr" != "xignore_apr_subdirs"; then \ - echo "Making $$target in $$i"; \ - if test "$$i" = "."; then \ - ok=yes; \ - target="$$target-p"; \ - fi; \ - (cd $$i && $(MAKE) $$target) || exit 1; \ - fi; \ - done; \ - fi - -shared-modules-recursive: - @if test `pwd` = "$(top_builddir)"; then \ - $(PRE_SHARED_CMDS) ; \ - fi; \ - list='$(SUBDIRS)'; for i in $$list; do \ - target="shared-modules"; \ - if test "$$i" = "."; then \ - ok = yes; \ - target="shared-modules-p"; \ - 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 modules: $(shared_targets)"; \ - if test -z '$(shared_targets)'; then ok=yes; fi; \ - if test "$$ok" != "yes"; then \ - $(MAKE) "shared-modules-p" || exit 1; \ - fi; \ - fi; \ - fi; \ - if test `pwd` = "$(top_builddir)"; then \ - $(POST_SHARED_CMDS) ; \ - fi - -all-p: $(targets) -shared-modules-p: $(shared_targets) - -install-p: $(targets) $(shared_targets) $(install_targets) - @if test -n '$(PROGRAMS)'; then \ - test -d $(bindir) || $(MKINSTALLDIRS) $(bindir); \ - for i in $(PROGRAMS) ""; do \ - if test "x$$i" != "x"; then \ - $(INSTALL_PROGRAM) $$i $(bindir); \ - fi; \ - done; \ - fi - -distclean-p depend-p clean-p: - -depend: depend-recursive - if test "`echo $(srcdir)/*.c`" != "$(srcdir)'/*.c'"; then \ - gcc -MM $(ALL_CPPFLAGS) $(ALL_INCLUDES) $(srcdir)/*.c | sed 's/\.o:/.lo:/' > $(builddir)/.deps || true; \ - fi -# test "`echo *.c`" = '*.c' || perl $(top_srcdir)/build/mkdep.perl $(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) *.c > .deps - -clean: clean-recursive clean-x - -clean-x: - rm -f $(targets) *.slo *.lo *.la *.o *.obj $(CLEAN_TARGETS) - rm -rf .libs - -distclean: distclean-recursive clean-x - rm -f config.cache config.log config.status config_vars.mk \ - stamp-h Makefile shlibtool .deps $(DISTCLEAN_TARGETS) - -extraclean: distclean - rm -f $(EXTRACLEAN_TARGETS) - -include $(builddir)/.deps - -.PHONY: all-recursive clean-recursive install-recursive \ -$(install_targets) install all clean depend depend-recursive shared \ -distclean-recursive distclean clean-x all-p install-p distclean-p \ -depend-p clean-p $(phony_targets) diff --git a/build/special.mk b/build/special.mk deleted file mode 100644 index ef0b47ee0a..0000000000 --- a/build/special.mk +++ /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 -# . -# -# The build environment was provided by Sascha Schumann. -# - -all: all-recursive - -include $(builddir)/modules.mk -targets = $(static) -shared_targets = $(shared) -install_targets = install-modules - -install-modules: - @shared='$(shared)'; \ - builtin='$(BUILTIN_LIBS)'; \ - has_mod_so=`echo $$builtin|sed 's/^.*mod_so.*$$/has_mod_so/'`; \ - if [ "x$$has_mod_so" = "xhas_mod_so" ]; then \ - $(MKINSTALLDIRS) $(libexecdir); \ - for i in $$shared; do \ - $(SH_LIBTOOL) --mode=install cp $$i $(libexecdir); \ - done; \ - fi - -include $(top_srcdir)/build/rules.mk - diff --git a/build/sysv_makefile b/build/sysv_makefile deleted file mode 100755 index 2c7033a074..0000000000 --- a/build/sysv_makefile +++ /dev/null @@ -1,71 +0,0 @@ -#! /bin/sh -# ==================================================================== -# 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 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 2>/dev/null` || tmpfile="tmp.$$" -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/buildconf b/buildconf deleted file mode 100755 index 19fa1b45e4..0000000000 --- a/buildconf +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/sh -# ==================================================================== -# 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 -# . -# - -# buildconf: Build the support scripts needed to compile from a -# checked-out version of the source code. - -# -# Check to be sure that we have the srclib dependencies checked-out -# -if [ ! -d srclib/apr -o ! -f srclib/apr/build/apr_common.m4 ]; then - echo "" - echo "You don't have a srclib/apr/ subdirectory. Please get one:" - echo "" - echo " cd srclib" - echo " cvs -d :pserver:anoncvs@apache.org:/home/cvspublic login" - echo " (password 'anoncvs')" - echo " cvs -d :pserver:anoncvs@apache.org:/home/cvspublic co apr" - echo "" - exit 1 -fi -if [ ! -d srclib/apr-util -o ! -f srclib/apr-util/Makefile.in ]; then - echo "" - echo "You don't have a srclib/apr-util/ subdirectory. Please get one:" - echo "" - echo " cd srclib" - echo " cvs -d :pserver:anoncvs@apache.org:/home/cvspublic login" - echo " (password 'anoncvs')" - echo " cvs -d :pserver:anoncvs@apache.org:/home/cvspublic co apr-util" - echo "" - exit 1 -fi - -# These are temporary until Roy finishes the other build changes -# -touch .deps -rm -f aclocal.m4 -rm -f generated_lists - -case "`uname`" in -*BSD/OS*) - ./build/bsd_makefile;; -esac -# -# end temporary stuff - -apr_configure="srclib/apr/configure" -aprutil_configure="srclib/apr-util/configure" -pcre_configure="srclib/pcre/configure" -config_h_in="include/ap_config_auto.h.in" - -cross_compile_warning="warning: AC_TRY_RUN called without default to allow cross compiling" - -echo rebuilding $apr_configure -(cd srclib/apr && ./buildconf) || { - echo "./buildconf failed for apr" - exit 1 -} - -echo rebuilding $aprutil_configure -(cd srclib/apr-util && ./buildconf.sh) || { - echo "./buildconf.sh failed for apr-util" - exit 1 -} - -echo rebuilding $pcre_configure -(cd srclib/pcre && autoconf) - -echo rebuilding $config_h_in -rm -f $config_h_in -autoheader 2>&1 | grep -v "$cross_compile_warning" - -echo rebuilding configure -rm -f config.cache -autoconf 2>&1 | grep -v "$cross_compile_warning" - -exit 0 diff --git a/config.layout b/config.layout deleted file mode 100644 index 4a55254dea..0000000000 --- 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/apache2 - exec_prefix: $prefix - bindir: $exec_prefix/bin - sbindir: $exec_prefix/bin - libexecdir: $exec_prefix/modules - 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 ca39b87768..0000000000 --- a/configure.in +++ /dev/null @@ -1,368 +0,0 @@ -dnl -dnl Autoconf configuration for Apache httpd -dnl -dnl Use ./buildconf to produce a configure script -dnl - -AC_PREREQ(2.13) -AC_INIT(ABOUT_APACHE) - -AC_CONFIG_HEADER(include/ap_config_auto.h) -AC_CONFIG_AUX_DIR(srclib/apr/build) - -dnl # -dnl # Include our own M4 macros along with those for APR and libtool -dnl # -sinclude(srclib/apr/build/apr_common.m4) -sinclude(srclib/apr/build/apr_network.m4) -sinclude(srclib/apr/build/apr_threads.m4) -sinclude(srclib/apr/build/apr_hints.m4) -sinclude(srclib/apr/build/libtool.m4) -sinclude(hints.m4) -sinclude(acinclude.m4) - -dnl Save user-defined environment settings for later restoration -dnl -APR_SAVE_THE_ENVIRONMENT(CPPFLAGS) -APR_SAVE_THE_ENVIRONMENT(CFLAGS) -APR_SAVE_THE_ENVIRONMENT(CXXFLAGS) -APR_SAVE_THE_ENVIRONMENT(LDFLAGS) -APR_SAVE_THE_ENVIRONMENT(LIBS) -APR_SAVE_THE_ENVIRONMENT(INCLUDES) - -dnl Generate ./config.nice for reproducing runs of configure -dnl -APR_CONFIG_NICE(config.nice) - -nl=' -' -dnl ## Run configure for packages Apache uses - -echo $ac_n "${nl}Configuring Apache Portable Runtime library ...${nl}" - -APR_SUBDIR_CONFIG(srclib/apr, "$apache_apr_flags --disable-shared") - -echo $ac_n "${nl}Configuring Apache Portable Runtime Utility library...${nl}" - -APR_SUBDIR_CONFIG(srclib/apr-util, "--with-apr=../apr --disable-shared") - -echo $ac_n "${nl}Configuring PCRE regular expression library ...${nl}" - -APR_SUBDIR_CONFIG(srclib/pcre) - -echo $ac_n "${nl}Configuring Apache httpd ...${nl}" - -echo $ac_n "obtaining flag settings from the sub-configures...${nl}" -. ./srclib/apr/APRVARS - -dnl Now that we have APR's EXTRA_flags in our environment, move them over -dnl to the normal variables to avoid duplications and use them for testing. -dnl We ignore EXTRA_INCLUDES because our own includes will encompass them. -dnl -APR_ADDTO(CFLAGS, $EXTRA_CFLAGS) -APR_ADDTO(CPPFLAGS, $EXTRA_CPPFLAGS) -APR_ADDTO(LDFLAGS, $EXTRA_LDFLAGS) -APR_ADDTO(LIBS, $EXTRA_LIBS) -EXTRA_CFLAGS= -EXTRA_CPPFLAGS= -EXTRA_LDFLAGS= -EXTRA_LIBS= -EXTRA_INCLUDES= - -dnl XXX we can't just use AC_PREFIX_DEFAULT because that isn't subbed in -dnl by configure until it is too late. Is that how it should be or not? -dnl Something seems broken here. -AC_PREFIX_DEFAULT(/usr/local/apache2) -test "$prefix" = "NONE" && prefix='/usr/local/apache2' -test "$exec_prefix" = "NONE" && exec_prefix='${prefix}' - -dnl Absolute source/build directory -abs_srcdir=`(cd $srcdir && pwd)` -abs_builddir=`pwd` - -dnl If the source dir is not equal to the build dir, -dnl then we are running in VPATH mode. - -if test "$abs_builddir" != "$abs_srcdir"; then - USE_VPATH=1 - APR_ADDTO(INCLUDES, [-I. -I\$(srcdir) -I\$(top_builddir)/os/\$(OS_DIR) -I\$(top_srcdir)/os/\$(OS_DIR) -I\$(top_builddir)/server/mpm/\$(MPM_NAME) -I\$(top_srcdir)/server/mpm/\$(MPM_NAME) -I\$(top_builddir)/modules/http -I\$(top_srcdir)/modules/http -I\$(top_builddir)/include -I\$(top_srcdir)/include -I\$(top_builddir)/srclib/apr/include -I\$(top_srcdir)/srclib/apr/include -I\$(top_builddir)/srclib/apr-util/include -I\$(top_srcdir)/srclib/apr-util/include]) -else - APR_ADDTO(INCLUDES, [-I. -I\$(top_srcdir)/os/\$(OS_DIR) -I\$(top_srcdir)/server/mpm/\$(MPM_NAME) -I\$(top_srcdir)/modules/http -I\$(top_srcdir)/include -I\$(top_srcdir)/srclib/apr/include -I\$(top_srcdir)/srclib/apr-util/include]) -fi - -AC_CANONICAL_SYSTEM - -case "$host_alias" in - *os2*) - # Use a custom made libtool replacement - echo "using aplibtool" - LIBTOOL="$abs_srcdir/srclib/apr/build/aplibtool" - SH_LIBTOOL="$LIBTOOL --shared --export-all" - CORE_IMPLIB_FILE="ApacheCoreOS2.la" - CORE_IMPLIB="$abs_srcdir/server/$CORE_IMPLIB_FILE" - MK_IMPLIB="emximp" - other_targets="$other_targets os2core" - ;; - *) - SH_LIBTOOL='$(SHELL) $(top_builddir)/shlibtool --silent' - ;; -esac - -dnl -dnl ## Preload our OS configuration -APR_PRELOAD -APACHE_PRELOAD - -dnl -dnl Process command line arguments. This is done early in the process so the -dnl user can get feedback quickly in case of an error. -dnl -dnl ### need to move some of the arguments "up here" - -dnl ## Check for programs - -AC_PATH_PROG(RM, rm) -AC_PROG_AWK -AC_PROG_CC -AC_PROG_CPP -AC_PROG_INSTALL -AC_PROG_LN_S -AC_CHECK_TOOL(RANLIB, ranlib, true) -dnl AC_PATH_PROG(PERL_PATH, perl) - -dnl various OS checks that apparently set required flags -AC_AIX -AC_ISC_POSIX -AC_MINIX - -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) - -dnl Regarding standard header files: AC_HEADER_STDC doesn't set symbols -dnl HAVE_STRING_H, HAVE_STDLIB_H, etc., so those are checked for -dnl explicitly so that the normal HAVE_xxx_H symbol is defined. - -AC_HEADER_STDC -AC_CHECK_HEADERS( \ -string.h \ -limits.h \ -unistd.h \ -sys/socket.h \ -pwd.h \ -grp.h \ -strings.h -) -AC_HEADER_SYS_WAIT - -dnl ## Check for typedefs, structures, and compiler characteristics. - -AC_C_CONST - -dnl ## Check for library functions - -dnl See Comment #Spoon - -AC_CHECK_FUNCS( \ -initgroups \ -) - -AC_CHECK_LIB(nsl, gethostbyname) -AC_CHECK_LIB(nsl, gethostname) -AC_CHECK_LIB(socket, socket) - -AC_ARG_WITH(port,[ --with-port=PORT Port on which to listen (default is 80)], - [if test "$withval" = "yes"; then AC_MSG_ERROR('option --with-port requires a value (the TCP port number)'); else PORT="$withval"; fi], - [PORT=80]) - -AC_ARG_ENABLE(debug,[ --enable-debug Turn on debugging and compile time warnings], - [APR_ADDTO(CFLAGS,-g) - if test "$GCC" = "yes"; then - APR_ADDTO(CFLAGS,-Wall) - fi -])dnl - -AC_ARG_ENABLE(maintainer-mode,[ --enable-maintainer-mode Turn on debugging and compile time warnings], - [APR_ADDTO(CFLAGS,-g) - if test "$GCC" = "yes"; then - APR_ADDTO(CFLAGS,[-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DAP_DEBUG]) - fi -])dnl - -APACHE_ENABLE_LAYOUT -APACHE_ENABLE_MODULES - -dnl reading config stubs -esyscmd(./build/config-stubs .) - -APACHE_SUBST(progname) -APACHE_SUBST(MPM_LIB) -APACHE_SUBST(OS) -APACHE_SUBST(OS_DIR) -APACHE_SUBST(BUILTIN_LIBS) - -AM_DISABLE_SHARED -if test -z "$LIBTOOL"; then - AM_PROG_LIBTOOL - APACHE_LIBTOOL_SILENT -fi - -PRE_SHARED_CMDS='echo ""' -POST_SHARED_CMDS='echo ""' - -if test "$apache_need_shared" = "yes"; then - $SHELL $ac_aux_dir/ltconfig --output=shlibtool --disable-static --srcdir=$ac_aux_dir --cache-file=./config.cache $ac_aux_dir/ltmain.sh - case $PLATFORM in - *-ibm-aix*) - HTTPD_LDFLAGS="$HTTPD_LDFLAGS -Wl,-bE:$abs_srcdir/support/httpd.exp" - SH_LDFLAGS="$SH_LDFLAGS -Wl,-bI:$abs_srcdir/support/httpd.exp" - ;; - *beos) - SH_LDFLAGS='$(top_builddir)/_APP_' - PRE_SHARED_CMDS='ln -s $(top_builddir)/httpd $(top_builddir)/_APP_' - POST_SHARED_CMDS='rm $(top_builddir)/_APP_' - ;; - *os390) - APR_ADDTO(CFLAGS, [-Wc,DLL,EXPORTALL]) - ;; - esac - shared_build="shared-modules" -fi - -APACHE_SUBST(PRE_SHARED_CMDS) -APACHE_SUBST(POST_SHARED_CMDS) -APACHE_SUBST(shared_build) - -AC_ARG_WITH(program-name, -[ --with-program-name alternate executable name],[ - progname="$withval" ], [ - progname="httpd"] ) - -# SuExec parameters -AC_ARG_WITH(suexec-caller, -[ --with-suexec-caller User allowed to call SuExec],[ - AC_DEFINE_UNQUOTED(AP_HTTPD_USER, "$withval", [User allowed to call SuExec] ) ] ) - -AC_ARG_WITH(suexec-userdir, -[ --with-suexec-userdir User subdirectory],[ - AC_DEFINE_UNQUOTED(AP_USERDIR_SUFFIX, "$withval", [User subdirectory] ) ] ) - -AC_ARG_WITH(suexec-docroot, -[ --with-suexec-docroot SuExec root directory],[ - AC_DEFINE_UNQUOTED(AP_DOC_ROOT, "$withval", [SuExec root directory] ) ] ) - -AC_ARG_WITH(suexec-uidmin, -[ --with-suexec-uidmin Minimal allowed UID],[ - AC_DEFINE_UNQUOTED(AP_UID_MIN, $withval, [Minimum allowed UID] ) ] ) - -AC_ARG_WITH(suexec-gidmin, -[ --with-suexec-gidmin Minimal allowed GID],[ - AC_DEFINE_UNQUOTED(AP_GID_MIN, $withval, [Minimum allowed GID] ) ] ) - -AC_ARG_WITH(suexec-logfile, -[ --with-suexec-logfile Set the logfile],[ - AC_DEFINE_UNQUOTED(AP_LOG_EXEC, "$withval", [SuExec log file] ) ] ) - -AC_ARG_WITH(suexec-safepath, -[ --with-suexec-safepath Set the safepath],[ - AC_DEFINE_UNQUOTED(AP_SAFE_PATH, "$withval", [safe shell path for SuExec] ) ] ) - -AC_ARG_WITH(suexec-umask, -[ --with-suexec-umask umask for suexec'd process],[ - AC_DEFINE_UNQUOTED(AP_SUEXEC_UMASK, 0$withval, [umask for suexec'd process] ) ] ) - -dnl AP_LIB_DIRS specifies the additional libs from srclib/ that we need -dnl AP_LIBS specifies the actual libraries. note we have some required libs. -AP_LIBS="srclib/pcre/libpcre.la srclib/apr-util/libaprutil.la $AP_LIBS" - -dnl APR should go after the other libs, so the right symbols can be picked up -AP_LIBS="$AP_LIBS srclib/apr/libapr.la" -APACHE_SUBST(AP_LIB_DIRS) -APACHE_SUBST(AP_LIBS) - -AC_DEFINE(AP_USING_AUTOCONF, 1, - [Using autoconf to configure Apache]) - -if test "$SINGLE_LISTEN_UNSERIALIZED_ACCEPT" = "1"; then - AC_DEFINE(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, 1, - [This platform doesn't suffer from the thundering herd problem]) -fi - -dnl check for endianness -if test "$cross_compiling" = "no"; then - AC_C_BIGENDIAN -else - AC_DEFINE(AP_UNKNOWN_BYTE_ORDER,1, - [byte order is unknown due to cross-compilation]) -fi - -APACHE_FAST_OUTPUT(Makefile modules/Makefile srclib/Makefile) -APACHE_FAST_OUTPUT(os/beos/Makefile os/os2/Makefile os/Makefile) -APACHE_FAST_OUTPUT(os/unix/Makefile server/Makefile) -APACHE_FAST_OUTPUT(support/Makefile srclib/pcre/Makefile) -for i in $AP_LIB_DIRS; do - APACHE_FAST_OUTPUT(srclib/$i/Makefile) -done - -if test -d ./test; then - APACHE_FAST_OUTPUT(test/Makefile) -fi - -dnl get the exported vars from APRUTIL -. ./srclib/apr-util/export_vars.sh -APR_ADDTO(LIBS, $APRUTIL_EXPORT_LIBS) -AP_LIBS="$AP_LIBS $LIBTOOL_LIBS" - -dnl ## Finalize the variables -echo $ac_n "${nl}Restore user-defined environment settings...${nl}" - -APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, EXTRA_) -APR_RESTORE_THE_ENVIRONMENT(CFLAGS, EXTRA_) -APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, EXTRA_) -APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, EXTRA_) -APR_RESTORE_THE_ENVIRONMENT(LIBS, EXTRA_) -APR_RESTORE_THE_ENVIRONMENT(INCLUDES, EXTRA_) - -echo $ac_n "${nl}Construct makefiles and header files...${nl}" - -APACHE_GEN_CONFIG_VARS - -dnl ## Build modules.c -rm -f modules.c -echo $MODLIST | $AWK -f $srcdir/build/build-modules-c.awk > modules.c - -AC_DEFINE_UNQUOTED(HTTPD_ROOT, "$prefix", - [Root directory of the Apache install area]) -AC_DEFINE_UNQUOTED(SERVER_CONFIG_FILE, "conf/$progname.conf", - [Location of the config file, relative to the Apache root directory]) -AC_DEFINE_UNQUOTED(APACHE_MPM_DIR, "$MPM_DIR", - [Location of the source for the current MPM]) - -perlbin=`$ac_aux_dir/PrintPath perl` -if test "x$perlbin" = "x"; then - perlbin="/replace/with/path/to/perl/interpreter" -fi -AC_SUBST(perlbin) - -dnl If we are running on BSD/OS, we need to use the BSD .include syntax. - -BSD_MAKEFILE=no -case "$host_alias" in -*bsdi*) - # Check whether they've installed GNU make - if make --version > /dev/null 2>&1; then - true - else - BSD_MAKEFILE=yes - fi - ;; -esac - -AC_OUTPUT($APACHE_OUTPUT_FILES support/apxs support/apachectl support/dbmmanage support/log_server_status support/logresolve.pl support/phf_abuse_log.cgi support/split-logfile,,[ - APACHE_GEN_MAKEFILES -]) - diff --git a/docs/STATUS b/docs/STATUS deleted file mode 100644 index 4f793e822e..0000000000 --- a/docs/STATUS +++ /dev/null @@ -1,107 +0,0 @@ -Apache HTTP Server 2.0 Documentation Status File. -Last modified: $Date: 2001/04/27 11:42:11 $ - -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 - We appear to have people working on translation into the following - languages. These may just be the 'it worked' page, but if so - the authors of those should perhaps be contacted to help do the - rest.. :-) Note that this list is NOT identical to that for the - 1.3 documentation project..! - - - Catalan (.ca) - - Czech [?] (.cz) - - German (.de) - - Danish (.dk) - - ? (.ee) - - Greek (.el) - - Spanish (.es) - - Estonian (.et) - - French (.fr) - - Hebrew (.he.iso8859-8) - - Italian (.it) - - Japanese (.ja.iso2022-jp, .ja.jis) - - Korean (.kr.iso2022-kr, .kt.iso-kr) - - ? (.ltz) - - ? (.lu) - - Dutch (.nl) - - Norwegian (.no) - - Polish (.po.iso-pl) - - Portuguese (.pt) - - Portuguese [Brasilian] (.pt-br) - - Russian (.ru.cp-1251, .ru.cp866, .ru.iso-ru, .ru.koi8-r, .ru.ucs[248]) - - Swedish (.se) - - Twi (.tw, .tw.big5) - (is that supposed to be Chinese/Taiwanese? Because if so, it is using - the code reserved for Twi..) diff --git a/docs/cgi-examples/printenv b/docs/cgi-examples/printenv deleted file mode 100644 index 207074361a..0000000000 --- a/docs/cgi-examples/printenv +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/local/bin/perl -## -## printenv -- demo CGI program which just prints its environment -## - -print "Content-type: text/plain\n\n"; -foreach $var (sort(keys(%ENV))) { - $val = $ENV{$var}; - $val =~ s|\n|\\n|g; - $val =~ s|"|\\"|g; - print "${var}=\"${val}\"\n"; -} - diff --git a/docs/cgi-examples/test-cgi b/docs/cgi-examples/test-cgi deleted file mode 100644 index a85631e3aa..0000000000 --- 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 aa707699df..0000000000 --- a/docs/conf/highperformance-std.conf +++ /dev/null @@ -1,69 +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 3 -MinSpareThreads 5 -MaxSpareThreads 10 -ThreadsPerChild 25 - - -# 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 - - - # The server can be made to avoid following symbolic links, - # to make security simpler. However, this takes extra CPU time, - # so we will just let it follow symlinks. - Options FollowSymLinks - - # Don't check for .htaccess files in each directory - they slow - # things down - AllowOverride None - - # 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-std.conf b/docs/conf/httpd-std.conf deleted file mode 100644 index bd1559ff39..0000000000 --- a/docs/conf/httpd-std.conf +++ /dev/null @@ -1,941 +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. -# -# 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". -# - -### 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. -# - -# -# ServerRoot: The top of the directory tree under which the server's -# configuration, error, and log files are kept. -# -# NOTE! If you intend to place this on an NFS (or otherwise network) -# mounted filesystem then please read the LockFile documentation -# (available at ); -# you will save yourself a lot of trouble. -# -# Do NOT add a slash at the end of the directory path. -# -ServerRoot "@@ServerRoot@@" - -# -# 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. -# -#LockFile logs/accept.lock - -# -# 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_runtime_status - - -# -# 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 recommend 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 - -## -## Server-Pool Size Regulation (MPM specific) -## - -# prefork MPM -# StartServers ......... number of server processes to start -# MinSpareServers ...... minimum number of server processes which are kept spare -# MaxSpareServers ...... maximum number of server processes which are kept spare -# MaxClients ........... maximum number of server processes allowed to start -# MaxRequestsPerChild .. maximum number of requests a server process serves - -StartServers 5 -MinSpareServers 5 -MaxSpareServers 10 -MaxClients 20 -MaxRequestsPerChild 0 - - -# pthread MPM -# StartServers ......... initial number of server processes to start -# MaxClients ........... maximum number of server processes allowed to start -# MinSpareThreads ...... minimum number of worker threads which are kept spare -# MaxSpareThreads ...... maximum number of worker threads which are kept spare -# ThreadsPerChild ...... constant number of worker threads in each server process -# MaxRequestsPerChild .. maximum number of requests a server process serves - -StartServers 3 -MaxClients 8 -MinSpareThreads 5 -MaxSpareThreads 10 -ThreadsPerChild 25 -MaxRequestsPerChild 0 - - -# perchild MPM -# NumServers ........... constant number of server processes -# StartThreads ......... initial number of worker threads in each server process -# MinSpareThreads ...... minimum number of worker threads which are kept spare -# MaxSpareThreads ...... maximum number of worker threads which are kept spare -# MaxThreadsPerChild ... maximum number of worker threads in each server process -# MaxRequestsPerChild .. maximum number of connections per server process (then it dies) - -NumServers 5 -StartThreads 5 -MinSpareThreads 5 -MaxSpareThreads 10 -MaxThreadsPerChild 20 -MaxRequestsPerChild 0 - - -# -# 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 - -# -# 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 `httpd -l' for the list of already -# built-in (statically linked and thus always available) modules in your httpd -# binary. -# -# Note: The order is which modules are loaded is important. Don't change -# the order below without expert advice. -# -# Example: -# LoadModule foo_module modules/mod_foo.so - -### 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. For -# ports < 1023, you will need httpd to be run as root initially. -# -Port @@Port@@ - -# -# If you wish httpd to run as a different user or group, you must run -# httpd as root initially and it will switch. -# -# User/Group: The name (or #number) of the user/group to run httpd as. -# . On SCO (ODT 3) use "User nouser" and "Group nogroup". -# . On HPUX you may not be able to use shared memory as nobody, and the -# suggested workaround is to create a user www and use that user. -# NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET) -# when the value of (unsigned)Group is above 60000; -# don't use Group #-1 on these systems! -# -User nobody -Group #-1 - -# -# 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 MultiViews - -# -# 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. -# -UserDir public_html - -# -# Control access to UserDir directories. The following is an example -# for a site where these directories are restricted to read-only. -# -# -# AllowOverride FileInfo AuthConfig Limit -# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec -# -# Order allow,deny -# Allow from all -# -# -# Order deny,allow -# Deny from all -# -# - -# -# 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. -# -# Also, folks tend to use names such as .htpasswd for password -# files, so this will protect those as well. -# - - 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/" - - - Options Indexes MultiViews - AllowOverride None - Order allow,deny - Allow from all - - -# -# 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/" - - -# -# Additional to mod_cgid.c settings, mod_cgid has Scriptsock -# for setting UNIX socket for communicating with cgid. -# -#Scriptsock logs/cgisock - - -# -# "@@ServerRoot@@/cgi-bin" should be changed to whatever your ScriptAliased -# CGI directory exists, if you have that configured. -# - - AllowOverride None - Options None - Order allow,deny - Allow from all - - -# -# 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. -# VersionSort is whether files containing version numbers should be -# compared in the natural way, so that `apache-1.3.9.tar' is placed before -# `apache-1.3.12.tar'. -IndexOptions FancyIndexing VersionSort - -# -# 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 customization directives above. -# -AddEncoding x-compress Z -AddEncoding x-gzip gz tgz - -# -# DefaultLanguage and 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 the user can understand. -# -# Specify a default language. This means that all data -# going out without a specific language tag (see below) will -# be marked with this one. You probably do NOT want to set -# this unless you are sure it is correct for all cases. -# -# * It is generally better to not mark a page as -# * being a certain language than marking it with the wrong -# * language! -# -# DefaultLanguage nl -# -# Note 1: 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. -# -# Note 2: The example entries below illustrate that in -# some cases the two character 'Language' abbreviation is not -# identical to the two character 'Country' code for its country, -# E.g. 'Danmark/dk' versus 'Danish/da'. -# -# Note 3: In the case of 'ltz' we violate the RFC by using a three char -# specifier. There is 'work in progress' to fix this and get -# the reference data for rfc1766 cleaned up. -# -# Danish (da) - Dutch (nl) - English (en) - Estonian (et) -# French (fr) - German (de) - Greek-Modern (el) -# Italian (it) - Norwegian (no) - Korean (kr) -# Portugese (pt) - Luxembourgeois* (ltz) -# Spanish (es) - Swedish (sv) - Catalan (ca) - Czech(cz) -# Polish (pl) - Brazilian Portuguese (pt-br) - Japanese (ja) -# Russian (ru) -# -AddLanguage da .dk -AddLanguage nl .nl -AddLanguage en .en -AddLanguage et .et -AddLanguage fr .fr -AddLanguage de .de -AddLanguage el .el -AddLanguage it .it -AddLanguage ja .ja -AddLanguage pl .po -AddLanguage kr .kr -AddLanguage pt .pt -AddLanguage no .no -AddLanguage pt-br .pt-br -AddLanguage ltz .ltz -AddLanguage ca .ca -AddLanguage es .es -AddLanguage sv .se -AddLanguage cz .cz -AddLanguage ru .ru -AddLanguage tw .tw -AddLanguage zh-tw .tw - -# 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. We have -# more or less alphabetized them here. You probably want to change this. -# -LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ltz ca es sv tw - - -# Specify a default charset for all pages sent out. This is -# always a good idea and opens the door for future internationalisation -# of your web site, should you ever want it. Specifying it as -# a default does little harm; as the standard dictates that a page -# is in iso-8859-1 (latin1) unless specified otherwise i.e. you -# are merely stating the obvious. There are also some security -# reasons in browsers, related to javascript and URL parsing -# which encourage you to always set a default char set. -# -AddDefaultCharset ISO-8859-1 - -# -# Commonly used filename extensions to character sets. You probably -# want to avoid clashes with the language extensions, unless you -# are good at carefully testing your setup after each change. -# See ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets for -# the official list of charset names and their respective RFCs -# -AddCharset ISO-8859-1 .iso8859-1 .latin1 -AddCharset ISO-8859-2 .iso8859-2 .latin2 .cen -AddCharset ISO-8859-3 .iso8859-3 .latin3 -AddCharset ISO-8859-4 .iso8859-4 .latin4 -AddCharset ISO-8859-5 .iso8859-5 .latin5 .cyr .iso-ru -AddCharset ISO-8859-6 .iso8859-6 .latin6 .arb -AddCharset ISO-8859-7 .iso8859-7 .latin7 .grk -AddCharset ISO-8859-8 .iso8859-8 .latin8 .heb -AddCharset ISO-8859-9 .iso8859-9 .latin9 .trk -AddCharset ISO-2022-JP .iso2022-jp .jis -AddCharset ISO-2022-KR .iso2022-kr .kis -AddCharset ISO-2022-CN .iso2022-cn .cis -AddCharset Big5 .Big5 .big5 -# For russian, more than one charset is used (depends on client, mostly): -AddCharset WINDOWS-1251 .cp-1251 .win-1251 -AddCharset CP866 .cp866 -AddCharset KOI8-r .koi8-r .koi8-ru -AddCharset KOI8-ru .koi8-uk .ua -AddCharset ISO-10646-UCS-2 .ucs2 -AddCharset ISO-10646-UCS-4 .ucs4 -AddCharset UTF-8 .utf8 - -# The set below does not map to a specific (iso) standard -# but works on a fairly wide range of browsers. Note that -# capitalization actually matters (it should not, but it -# does for some browsers). -# -# See ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets -# for a list of sorts. But browsers support few. -# -AddCharset GB2312 .gb2312 .gb -AddCharset utf-7 .utf7 -AddCharset utf-8 .utf8 -AddCharset big5 .big5 .b5 -AddCharset EUC-TW .euc-tw -AddCharset EUC-JP .euc-jp -AddCharset EUC-KR .euc-kr -AddCharset shift_jis .sjis - -# 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 - see -# http://www.php.net) will typically use: -# -#AddType application/x-httpd-php3 .php3 -#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 -# -# -# SetOutputFilter INCLUDES -# - -# -# 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." -# -# 2) local redirects -#ErrorDocument 404 /missing.html -# to redirect to local URL /missing.html -#ErrorDocument 404 "/cgi-bin/missing_handlder.pl" -# i.e. any string which starts with a '/' and has -# no spaces. -# 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 -# i.e. any string whichis a valid URL. -# N.B.: Many of the environment variables associated with the original -# request will *not* be available to such a script. -# -# 4) borderline case -#ErrorDocument 402 "http://some.other_server.com/info.html is the place to look" -# treated as case '1' as it has spaces and thus is not a valid URL -# -# The following directives modify normal HTTP response behavior. -# The first directive disables keepalive for Netscape 2.x and browsers that -# spoof it. There are known problems with these browser implementations. -# 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 lines to -# enable the proxy server: -# -# -#ProxyRequests On -# -# -# Order deny,allow -# Deny from all -# Allow from .your_domain.com -# - -# -# 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 - -# -# End of proxy directives. - -### Section 3: Virtual Hosts -# -# VirtualHost: If you want to maintain multiple domains/hostnames on your -# machine you can setup VirtualHost containers for them. Most configurations -# use only name-based virtual hosts so the server doesn't need to worry about -# IP addresses. This is indicated by the asterisks in the directives below. -# -# 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. - -# -# Use name-based virtual hosting. -# -#NameVirtualHost * - -# -# VirtualHost example: -# Almost any Apache directive may go into a VirtualHost container. -# The first VirtualHost section is used for requests without a known -# server name. -# -# -# ServerAdmin webmaster@dummy-host.example.com -# DocumentRoot /www/docs/dummy-host.example.com -# ServerName dummy-host.example.com -# ErrorLog logs/dummy-host.example.com-error_log -# CustomLog logs/dummy-host.example.com-access_log common -# diff --git a/docs/conf/httpd-win.conf b/docs/conf/httpd-win.conf deleted file mode 100644 index 4058d86d27..0000000000 --- a/docs/conf/httpd-win.conf +++ /dev/null @@ -1,851 +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. -# -# 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. -# - -# -# 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 - -# -# 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 250 - -# -# 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 - -# -# 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 auth_anon_module modules/mod_auth_anon.so -#LoadModule auth_dbm_module modules/mod_auth_dbm.so -#LoadModule auth_digest_module modules/mod_auth_digest.so -#LoadModule cern_meta_module modules/mod_cern_meta.so -#LoadModule dav_module modules/mod_dav.so -#LoadModule dav_fs_module modules/mod_dav_fs.so -#LoadModule expires_module modules/mod_expires.so -#LoadModule file_cache_module modules/mod_file_cache.so -#LoadModule headers_module modules/mod_headers.so -#LoadModule info_module modules/mod_info.so -#LoadModule proxy_module modules/mod_proxy.so -#LoadModule rewrite_module modules/mod_rewrite.so -#LoadModule speling_module modules/mod_speling.so -#LoadModule status_module modules/mod_status.so -#LoadModule usertrack_module modules/mod_usertrack.so - -### 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. e.g. admin@your-domain.com -# -#ServerAdmin @@ServerAdmin@@ - -# -# 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). -# -# 127.0.0.1 is the TCP/IP local loop-back address. Your machine -# always knows itself by this address. If you machine is connected to -# a network, you should change this to be your machine's 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 @@ServerName@@ - -# -# 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 MultiViews - -# -# 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 1: 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. -# -# Note 2: The example entries below illustrate that in quite -# some cases the two character 'Language' abbreviation is not -# identical to the two character 'Country' code for its country, -# E.g. 'Danmark/dk' versus 'Danish/da'. -# -# Note 3: In the case of 'ltz' we violate the RFC by using a three char -# specifier. But there is 'work in progress' to fix this and get -# the reference data for rfc1766 cleaned up. -# -# Danish (da) - Dutch (nl) - English (en) - Estonian (et) -# French (fr) - German (de) - Greek-Modern (el) -# Italian (it) - Norwegian (no) - Korean (kr) -# Portugese (pt) - Luxembourgeois* (ltz) -# Spanish (es) - Swedish (sv) - Catalan (ca) - Czech(cz) -# Polish (pl) - Brazilian Portuguese (pt-br) - Japanese (ja) -# Russian (ru) -# -AddLanguage da .dk -AddLanguage nl .nl -AddLanguage en .en -AddLanguage et .et -AddLanguage fr .fr -AddLanguage de .de -AddLanguage el .el -AddLanguage it .it -AddLanguage ja .ja -AddLanguage pl .po -AddLanguage kr .kr -AddLanguage pt .pt -AddLanguage no .no -AddLanguage pt-br .pt-br -AddLanguage ltz .ltz -AddLanguage ca .ca -AddLanguage es .es -AddLanguage sv .se -AddLanguage cz .cz -AddLanguage ru .ru -AddLanguage tw .tw -AddLanguage zh-tw .tw - -# 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. We have -# more or less alphabetized them here. You probably want to change this. -# -LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw - -# Specify a default charset for all pages sent out. This is -# always a good idea and opens the door for future internationalisation -# of your web site, should you ever want it. Specifying it as -# a default does little harm; as the standard dictates that a page -# is in iso-8859-1 (latin1) unless specified otherwise i.e. you -# are merely stating the obvious. There are also some security -# reasons in browsers, related to javascript and URL parsing -# which encourage you to always set a default char set. -# -AddDefaultCharset ISO-8859-1 - -# -# Commonly used filename extensions to character sets. You probably -# want to avoid clashes with the language extensions, unless you -# are good at carefully testing your setup after each change. -# See ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets for -# the official list of charset names and their respective RFCs -# -AddCharset ISO-8859-1 .iso8859-1 .latin1 -AddCharset ISO-8859-2 .iso8859-2 .latin2 .cen -AddCharset ISO-8859-3 .iso8859-3 .latin3 -AddCharset ISO-8859-4 .iso8859-4 .latin4 -AddCharset ISO-8859-5 .iso8859-5 .latin5 .cyr .iso-ru -AddCharset ISO-8859-6 .iso8859-6 .latin6 .arb -AddCharset ISO-8859-7 .iso8859-7 .latin7 .grk -AddCharset ISO-8859-8 .iso8859-8 .latin8 .heb -AddCharset ISO-8859-9 .iso8859-9 .latin9 .trk -AddCharset ISO-2022-JP .iso2022-jp .jis -AddCharset ISO-2022-KR .iso2022-kr .kis -AddCharset ISO-2022-CN .iso2022-cn .cis -AddCharset Big5 .Big5 .big5 -# For russian, more than one charset is used (depends on client, mostly): -AddCharset WINDOWS-1251 .cp-1251 .win-1251 -AddCharset CP866 .cp866 -AddCharset KOI8-r .koi8-r .koi8-ru -AddCharset KOI8-ru .koi8-uk .ua -AddCharset ISO-10646-UCS-2 .ucs2 -AddCharset ISO-10646-UCS-4 .ucs4 -AddCharset UTF-8 .utf8 - -# The set below does not map to a specific (iso) standard -# but works on a fairly wide range of browsers. Note that -# capitalization actually matters (it should not, but it -# does for some browsers). -# -# See ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets -# for a list of sorts. But browsers support few. -# -AddCharset GB2312 .gb2312 .gb -AddCharset utf-7 .utf7 -AddCharset utf-8 .utf8 -AddCharset big5 .big5 .b5 -AddCharset EUC-TW .euc-tw -AddCharset EUC-JP .euc-jp -AddCharset EUC-KR .euc-kr -AddCharset shift_jis .sjis - -# -# 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." -# -# 2) local redirects -#ErrorDocument 404 /missing.html -# to redirect to local URL /missing.html -#ErrorDocument 404 "/cgi-bin/missing_handlder.pl" -# i.e. any string which starts with a '/' and has -# no spaces. -# 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 -# i.e. any string whichis a valid URL. -# N.B.: Many of the environment variables associated with the original -# request will *not* be available to such a script. -# -# 4) borderline case -#ErrorDocument 402 "http://some.other_server.com/info.html is the place to look" -# treated as case '1' as it has spaces and thus is not a valid URL -# -# 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 ".@@DomainName@@" to match your domain to enable. -# -# -# SetHandler server-status -# Order deny,allow -# Deny from all -# Allow from .@@DomainName@@ -# - -# -# 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 .@@DomainName@@ -# - -# -# 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. Most configurations -# use only name-based virtual hosts so the server doesn't need to worry about -# IP addresses. This is indicated by the asterisks in the directives below. -# -# 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. - -# -# Use name-based virtual hosting. -# -#NameVirtualHost * - -# -# VirtualHost example: -# Almost any Apache directive may go into a VirtualHost container. -# The first VirtualHost section is used for requests without a known -# server name. -# -# -# ServerAdmin webmaster@dummy-host.example.com -# DocumentRoot /www/docs/dummy-host.example.com -# ServerName dummy-host.example.com -# ErrorLog logs/dummy-host.example.com-error_log -# CustomLog logs/dummy-host.example.com-access_log common -# diff --git a/docs/conf/magic b/docs/conf/magic deleted file mode 100644 index 885b793aec..0000000000 --- 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 630fc8fc03..0000000000 --- a/docs/conf/mime.types +++ /dev/null @@ -1,428 +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/batch-SMTP -application/cals-1840 -application/commonground -application/cybercash -application/dca-rft -application/dec-dx -application/eshop -application/http -application/hyperstudio -application/iges -application/index -application/index.cmd -application/index.obj -application/index.response -application/index.vnd -application/iotp -application/ipp -application/mac-binhex40 hqx -application/mac-compactpro cpt -application/macwriteii -application/marc -application/mathematica -application/mathematica-old -application/msword doc -application/news-message-id -application/news-transmission -application/ocsp-request -application/ocsp-response -application/octet-stream bin dms lha lzh exe class so dll -application/oda oda -application/pdf pdf -application/pgp-encrypted -application/pgp-keys -application/pgp-signature -application/pkcs10 -application/pkcs7-mime -application/pkcs7-signature -application/pkix-cert -application/pkix-crl -application/pkixcmp -application/postscript ai eps ps -application/prs.alvestrand.titrax-sheet -application/prs.cww -application/prs.nprend -application/remote-printing -application/riscos -application/sdp -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.accpac.simply.aso -application/vnd.accpac.simply.imp -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.bmi -application/vnd.canon-cpdl -application/vnd.canon-lips -application/vnd.claymore -application/vnd.commerce-battelle -application/vnd.commonspace -application/vnd.comsocaller -application/vnd.contact.cmsg -application/vnd.cosmocaller -application/vnd.cups-postscript -application/vnd.cups-raster -application/vnd.cups-raw -application/vnd.ctc-posml -application/vnd.cybank -application/vnd.dna -application/vnd.dpgraph -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.esf -application/vnd.epson.msf -application/vnd.epson.quickanime -application/vnd.epson.salt -application/vnd.epson.ssf -application/vnd.ericsson.quickcall -application/vnd.eudora.data -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.ddd -application/vnd.fujixerox.docuworks -application/vnd.fujixerox.docuworks.binder -application/vnd.fut-misnet -application/vnd.grafeq -application/vnd.groove-account -application/vnd.groove-identity-message -application/vnd.groove-injector -application/vnd.groove-tool-message -application/vnd.groove-tool-template -application/vnd.groove-vcard -application/vnd.hp-HPGL -application/vnd.hp-PCL -application/vnd.hp-PCLXL -application/vnd.hp-hpid -application/vnd.hp-hps -application/vnd.httphone -application/vnd.hzn-3d-crossword -application/vnd.ibm.MiniPay -application/vnd.ibm.modcap -application/vnd.informix-visionary -application/vnd.intercon.formnet -application/vnd.intertrust.digibox -application/vnd.intertrust.nncp -application/vnd.intu.qbo -application/vnd.intu.qfx -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-notes -application/vnd.lotus-organizer -application/vnd.lotus-screencam -application/vnd.lotus-wordpro -application/vnd.mcd -application/vnd.mediastation.cdkey -application/vnd.meridian-slingshot -application/vnd.mif mif -application/vnd.minisoft-hp3000-save -application/vnd.mitsubishi.misty-guard.trustweb -application/vnd.mobius.daf -application/vnd.mobius.dis -application/vnd.mobius.msl -application/vnd.mobius.plc -application/vnd.mobius.txf -application/vnd.motorola.flexsuite -application/vnd.motorola.flexsuite.adsi -application/vnd.motorola.flexsuite.fis -application/vnd.motorola.flexsuite.gotap -application/vnd.motorola.flexsuite.kmr -application/vnd.motorola.flexsuite.ttc -application/vnd.motorola.flexsuite.wem -application/vnd.mozilla.xul+xml -application/vnd.ms-artgalry -application/vnd.ms-asf -application/vnd.ms-excel xls -application/vnd.ms-lrm -application/vnd.ms-powerpoint ppt -application/vnd.ms-project -application/vnd.ms-tnef -application/vnd.ms-works -application/vnd.msign -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.pg.format -application/vnd.pg.osasli -application/vnd.powerbuilder6 -application/vnd.powerbuilder6-s -application/vnd.powerbuilder7 -application/vnd.powerbuilder7-s -application/vnd.powerbuilder75 -application/vnd.powerbuilder75-s -application/vnd.previewsystems.box -application/vnd.publishare-delta-tree -application/vnd.rapid -application/vnd.s3sms -application/vnd.seemail -application/vnd.shana.informed.formdata -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.triscape.mxs -application/vnd.trueapp -application/vnd.truedoc -application/vnd.ufdl -application/vnd.uplanet.alert -application/vnd.uplanet.alert-wbxml -application/vnd.uplanet.bearer-choi-wbxml -application/vnd.uplanet.bearer-choice -application/vnd.uplanet.cacheop -application/vnd.uplanet.cacheop-wbxml -application/vnd.uplanet.channel -application/vnd.uplanet.channel-wbxml -application/vnd.uplanet.list -application/vnd.uplanet.list-wbxml -application/vnd.uplanet.listcmd -application/vnd.uplanet.listcmd-wbxml -application/vnd.uplanet.signal -application/vnd.vcx -application/vnd.vectorworks -application/vnd.visio -application/vnd.wap.sic -application/vnd.wap.slc -application/vnd.wap.wbxml wbxml -application/vnd.wap.wmlc wmlc -application/vnd.wap.wmlscriptc wmlsc -application/vnd.webturbo -application/vnd.wrq-hp3000-labelled -application/vnd.wt.stf -application/vnd.xara -application/vnd.xfdl -application/vnd.yellowriver-custom-menu -application/whoispp-query -application/whoispp-response -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/l16 -audio/midi mid midi kar -audio/mpeg mpga mp2 mp3 -audio/prs.sid -audio/telephone-event -audio/tone -audio/vnd.cns.anp1 -audio/vnd.cns.inf1 -audio/vnd.digital-winds -audio/vnd.everad.plj -audio/vnd.lucent.voice -audio/vnd.nortel.vbk -audio/vnd.nuera.ecelp4800 -audio/vnd.nuera.ecelp7470 -audio/vnd.octel.sbc -audio/vnd.qcelp -audio/vnd.rhetorex.32kadpcm -audio/vnd.vmx.cvsd -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 -chemical/x-xyz 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/prs.pti -image/tiff tiff tif -image/vnd.cns.inf2 -image/vnd.dwg -image/vnd.dxf -image/vnd.fastbidsheet -image/vnd.fpx -image/vnd.fst -image/vnd.fujixerox.edmics-mmr -image/vnd.fujixerox.edmics-rlc -image/vnd.mix -image/vnd.net-fpx -image/vnd.svf -image/vnd.wap.wbmp wbmp -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 -message/s-http -model/iges igs iges -model/mesh msh mesh silo -model/vnd.dwf -model/vnd.flatland.3dml -model/vnd.gdl -model/vnd.gs-gdl -model/vnd.gtw -model/vnd.mts -model/vnd.vtu -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/calendar -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/t140 -text/uri-list -text/vnd.DMClientScript -text/vnd.IPTC.NITF -text/vnd.IPTC.NewsML -text/vnd.abc -text/vnd.curl -text/vnd.flatland.3dml -text/vnd.fly -text/vnd.fmi.flexstor -text/vnd.in3d.3dml -text/vnd.in3d.spot -text/vnd.latex-z -text/vnd.motorola.reflex -text/vnd.ms-mediapackage -text/vnd.wap.si -text/vnd.wap.sl -text/vnd.wap.wml wml -text/vnd.wap.wmlscript wmls -text/x-setext etx -text/xml xml -video/mpeg mpeg mpg mpe -video/pointer -video/quicktime qt mov -video/vnd.fvt -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/README.rus b/docs/docroot/README.rus deleted file mode 100644 index b33f25657d..0000000000 --- a/docs/docroot/README.rus +++ /dev/null @@ -1,18 +0,0 @@ -Apache test page, russian translation by Pavel Polischouk -Different russian encodings provided: - - Name iconv's codepage - -+index.html.dos - CP-866 aka ibm866; used by DOS and OS/2. -*index.html.iso - ISO-8859-5 -*index.html.koi - KOI8-R; used by UNIX flavours and Mac. - index.html.ucs2 - UCS-2 aka UNICODE aka UNICODEBIG aka UTF-16 - index.html.ucs4 - UCS-4 -*index.html.utf8 - UTF-8 -*index.html.win - CP-1251 aka windows-1251 aka MS-CYRILLIC; used by Windows - -* - supported by Netscape 4.72. -+ - Netscape is supposed to support this encoding, but fails to -read this page on Linux. Should be OK on systems like DOS and OS/2 where this -encoding is the default. -Does anyone need the UCS-2 and UCS-4? \ No newline at end of file diff --git a/docs/docroot/apache_pb.gif b/docs/docroot/apache_pb.gif deleted file mode 100644 index 3a1c139fc4247ec7e770fdaab961fb3692c953fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2326 zcmeH``#aS60)Ri?F~*GRoWb@r$c#H_jN6u#)66_>GY!UILM{ophO`}&oUt=FmBNTY z$`ICVA7j^+h#i;OQDc-ga!qS+8Gc0FW4f z)Bt1yAj_Q32!U{ zRIo-qQptb-t7{uBm(~px;>}n!KArWR1^>`Cf~is&A3~v0s8aF}M#nn9GGt0d7v`yb z*>S>eMWL(I627?MNllQ7BkqHq)M=1k z=&Ky&zXVh2hPE6DHG1$Mj#+!@W<|fAeonA2iB#Un#%N(&&W1dtI~9BfQ#)e2X=lF^XcGT}q=AoZ{H^5&_C+Pv zN&hQZTYONvvH2qVcG~jIh^yqZXMG0jauI~J<^%?yjPC{pb>Ylqd7Qgl5*ph^Ulf=T ztUu|ceZK)dM=IDKg~q~CZoH&Cb~-~Z=;&lvYG{6Kc>2z^;Sv327g?kssFZ=dw}0cH zdw$mEtN!A<`J8^&z3 zt~SwiD6S8)Rjrr!Kx<)&vBl1-$xbOvcBi~nxrDC!TBPace;L%k*DDqrZ4t4XvN(& zu%4H=wkn0>)>bWw*7qy^XgxfL8hEr{3=!aT@x^9eDj^ytk&Chl$kO(lBLUN|dQ6Gs zqR_gQC$$$-23%rt``_I(>C3A7dOXT9Z$frk_k~-Ys+P;@AA_2Pg%%8=^ZRrL+?~|f zW&~d`K5oo!G0s}dw|gtsI8gBY`D(2K(S?RiMa{{iIhO(d)G0SJjuwocN&dl=)Ns$! zkAoL^`msv}wXFIo9^Egsd~xDITuw=a{)ty}PeNiaZ{?=q1Ff-;&+#A?LvlJm+3a2z z0EU`idSaEFK|F|qEq^5hpn?C2d=DQ+H3YkO^OBqUex<5bLo z9(N*aTe0*iA?|UPIVvKLCc?9Ag1I16-HvOfbsA#dH4-dk3 zhnz>*3E(FdLU+yVpuPUsliM=aeNjZUS*@XX3Z53T6iR8-2uO=XFwVs0@AhefEv8q zeI*^7gje{cZVN8?oK%ZT=2#U=<_Ih7M^R~)Ja%@QBEHt-Nj+won-qIvXTfK$!wnkr z2MQ*#TaAN%Ohqz*uQYER7$<|Jgd}A|ZL~mb$%8Fh^ z{1s=ft;T@}n?u#1Sd8|0dAq@XlaA<)Sy)vu-xZB|?3vPJ`3#PxQkI=}-aLquKdtW{ zRsg5o;PBjI;EgPh^zTEWZ?enGho=a|_a2#rB5>8_lJExo!OHH@#L?0Fsk3g9+0-%#kV)Kf zB;Lm)WsWj{mw{t4P$v62PSD1Gl%MytKqmW{WF7!lXrYR@A&Wof$BRdoD9^7)O~QCHc4FgyAz zQb5%gl_(rvaK8#TJvXRH!;vTpQg6AUnl4lLD1^g@2VkU(Xd}+G!}4q7PCruL1BX}~ zn%__Cf`!@Yjtibl_yC1_JNf5WLZ~uEo}|U%%z!2`dPMaki^@Z$BlXRQ{^KxsS~ae) zlwumx%n1G|s&RGhWp|Kj#+in3D(6)e()iEl@-u8Sff7w(OQTZm=d_qe&#{a{0Hkpk zd3~jNVEi=K*pl@q!mG~imPQW~M;_q~)~slH^x7<>ZG&wgt{Mx3+)=cdqA(vy`RlC) zIa*5ndx=y3oI55zDs1qBzgl%3gaA!mB^0?eSac9tJUbBD_wNb6B z5Y=BHl$rboqrsa_)1K0b*Ru01Ndlku0|=$W(vd?6ibRQfCat`Zll~Odu|H!`~`V*Sk|_A2T>nj+?l04FK{py$X_NM2MU^ zWo{S{Ncox!*mgVc48Zb(k+K{_TbKyQNKADLN2y@=1Vm1I~mNk5D z0iKr^7kpn^lf_&*IqSSRGsYu%Oy?I-qsO3~~?Q_Y?Qgd!o4AT` zy#1OX<>B~LkBO+T67llGwN(;& z5cY>(Zs+x+8pmeJ=iqm(J?@D}N*qJXB((gy?3S^wzj)_?JM7fN$+1NN(P%I zS?H@FlXx)=8PJ!)DAZ9?{^XKI;lu_;0(DV)hi3^Uw=U+|La!AGBb3?#anaR(o^+!0 zO_G^9!r;2w`>KGj@WLY11a3&f;w}@@<9zj%hZ;llPw}u9bsa9xTP+=u+U^*tFu1eP z(O)e2*~l>0&>;a*4`SKgFV|YWxZ2D@vrk(&Z?BLezWxE4HihSVm?9^^m~}+nk*)I~ z`l{hwue2?A09j?xgz`wEfw;2wJJ-!fT-D2h9HjbKr)JhmOkJwsLN?ke@WY$Jz~7RL zvxtcil-2^b1@O$hdY82q-^;atbN=&?En!s{X17r`(*;WL-K$NAdxP&ex&I>0 z`DR`5&>M_^3+EgRE{6M1!cRPMn`YaFz$-kwOTo&xcT&bmNkd?< z%iFaAq?u9ya(M|B{sG9PuVpEwiuLx;nx+?4pFY<^!F>~$Tz7h!y!pL&AMyK-=hvT) XqiYh{4~%{)S#O;4Fm;B(z`p+hpbw|G diff --git a/docs/docroot/apache_pb2_ani.gif b/docs/docroot/apache_pb2_ani.gif deleted file mode 100644 index fc41c03610c1f56d4e2ce3c9750cbe27e5d96886..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2160 zcmY*ac~lek8vSLPNl4fs38BD95LA|eQiRezLqIAX)EpmFz$Zaj$|mvz5f@^>D61Hw z0tOUBfk1+S-~x&SL~C3SM3!QOXpu#$q^Jl_P2Pa#lysIef84qE`|kbbeDjl^ue--q z90ma$VD4B%r@H`6NJvOH(8R^XB_$;Z1cDNvsi>%E*=W$xa;LNNPG3dm(7vIeTEW=b z$uU96B+yK*&70g9K3T%n0J;W*Ye0zxRbkUL0-)(cFSJI6A0+jVXo3#O+Zj1 zNPa}jndq7e@vm z%UKo4E?(^-jvl||cBj)>DrrnGhyny+R!-SPJmufdn#`T0c?8|79Wgxx)B3-yi2rW& z>p}&k{9s#O(5If<;%ARm>6wvjl?Ov5X{)hNHU`(K-v~u>knQMx7DKT>oO7E3a3_?S`)65Tg-T4pZ( z3DN<;pLH?02Mdi9=CInI2=TI8TcEnM%==JQjGA-C(6{OF&_NeI#&@sGE0CM~c-I5w#?rjvV$Cn)}x4_9-eO^a7ghYm?CQv)A7BAVS`Z-{#R)Sz61^o1`wj^qI<=nfK#iyh*|qVvEGBOsiO)ZY|7`j)ulDklXZ)e=@-Y1>4<(x$U0Gcz)^n9- z;0!uQZDfj%f!EKekB!ocZCzPyr6xbf+i_EOnG%wzP0e_Dp3~m(op2X+o2P5eNNE5) z;b-yT4`)-Vxw2Yjk>|S6a$Hr?&8E>B=~Q+*eoM+ktd8zTjQtOW?}MWu6H0R&WEYUA ztm~kD8sBN|vuq-;_6x!2NYVP>JC%Xzx3@PHxUzFu7_0V!0~lJK*{ztH(qy}Ai` z^Pg9WD^D%yST-rMi-;U+nelbT5LC__HttYJ*J~ZYTgIPt`Zh9EJLO&72$(XNd49C> zN?++Nw>ur~bY=+Lzk16Z8J7;=sZJ@@k44D)=2 z!OHDk>D0Ov_s^emds@-3C}vOnnlxSKrl74J8TZGmT{%wu)SI%86OxAN=0B9JmY$CG zKB}=Z&2Pm!@D$pAl1c5B1H5*1%_Y{QtN0Rk$2vo||N2eE!i7Ohx|0PziTHUCQa`6R z9lIaG=@wpo|M>f+7Dq@*E`{vEu-7a2+(!Cfci!~Bj5_pbey6%Hu8Dl^E_g$r+0c2P z0G8pGi(u;~2G&#M0Sl$;bcrv9GUz_A4+ogKJ|l32UKDUFi$mFl-*(%}Xdo`_=L3Ya1-npB~|tkM=t|3B1_0%uEQ21F|4W1Sol|gPS1I#-HQ96|C=h5Q!1S^{rq1F(0%;(a#jEW zfB_C&&SXTm-v$wlXY>4s3-|+o2hcpO6E=0kDopfpcJZPGxEqBD0E^NgrCpAkC|H1c zQE2W21QMb;GEyiUgSF6sc_M_O`iRhmHJfIWSZ-g_yp4ffPMdZJ_ZUJleOyfNHx#z(&2@S$Iz7E`4{xi`G#AItUyU@aig}AF;wB}7)a - - - 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 b/docs/docroot/index.html.cz deleted file mode 100644 index e0cd2ba610..0000000000 --- a/docs/docroot/index.html.cz +++ /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 0aff1c6520..0000000000 --- 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 cbe8aade05..0000000000 --- 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 7d8bc9c8d1..0000000000 --- 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 75c8737e82..0000000000 --- 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 dc4c5182e5..0000000000 --- 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 6f501db5b6..0000000000 --- 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 99f2ce6b15..0000000000 --- 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 7ae7d0e9e0..0000000000 --- a/docs/docroot/index.html.fr +++ /dev/null @@ -1,47 +0,0 @@ - - - - - Page de test de l'installation d'Apache - - - - - -

    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.

    - -
    - -

    Vous voyez cette page au lieu du site attendu ?

    - -

    Vous voyez cette page parce que l'administrateur du site a modifié -la configuration de ce serveur Web. Veuillez contacter -l'administrateur du site concerné. La Fondation -Apache (Apache Software Foundation), qui produit le logiciel Apache -utilisé par ce site, n'a rien à voir avec la maintenance de ce -site et ne peut intervenir sur sa configuration.

    - -
    - -

    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 7006856ecb..0000000000 --- a/docs/docroot/index.html.he.iso8859-8 +++ /dev/null @@ -1,54 +0,0 @@ - - - - - Apache-ä úøù úð÷úäì ïåéñð óã - - - - -
    -

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


    - -

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

    -

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


    - -

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

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

    -
    - - diff --git a/docs/docroot/index.html.it b/docs/docroot/index.html.it deleted file mode 100644 index 1f72892e7a..0000000000 --- a/docs/docroot/index.html.it +++ /dev/null @@ -1,39 +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 dfbb2fde47..0000000000 --- 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.ja.jis b/docs/docroot/index.html.ja.jis deleted file mode 100644 index 6eae0a1ac4..0000000000 --- a/docs/docroot/index.html.ja.jis +++ /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.kr.iso-kr b/docs/docroot/index.html.kr.iso-kr deleted file mode 100644 index bd0901a0c6..0000000000 --- a/docs/docroot/index.html.kr.iso-kr +++ /dev/null @@ -1,40 +0,0 @@ - - - - - ¾ÆÆÄÄ¡ ¼³Ä¡¸¦ À§ÇÑ Å×½ºÆ®ÆäÀÌÁö - - - - - -

    -ÇöÀçÈ­¸éÀÌ Àß º¸À̽Ŵٸé ÀÌ ½Ã½ºÅÛ¿¡ Apache À¥¼­¹ö ¼ÒÇÁÆ®¿þ¾îÀÇ ¼³Ä¡°¡ ¼º°øÀûÀ¸·Î ³¡³µ´Ù´Â°É ÀǹÌÇÕ´Ï´Ù. ¿©·¯ºÐÀº ¾Æ¸¶ °ð ÀÌ ÆäÀÌÁö¸¦ Áö¿ì°í µð·ºÅ丮¿¡ »õ·Î¿î ³»¿ëÀ» Ãß°¡ÇÒ °ÍÀÔ´Ï´Ù. - -


    - -

    ¿©·¯ºÐÀÌ ¿¹»óÇÑ À¥½ÎÀÌÆ® ´ë½Å ÀÌ È­¸éÀÌ º¸ÀԴϱî?

    - -

    -½ÎÀÌÆ® °ü¸®ÀÚ°¡ À¥ ¼­¹öÀÇ ¼³Á¤ÆÄÀÏÀ» º¯°æÇ߱⠶§¹®¿¡ ÀÌ ÆäÀÌÁö°¡ º¸ÀÌ´Â °Í ÀÔ´Ï´Ù. -Áú¹®»çÇ×Àº °¢ ¼­¹ö°ü¸® Ã¥ÀÓÀÚ¿¡°Ô ¹®ÀÇÇϽñ⠹ٶø´Ï´Ù. Apache Software FoundationÀº Çö ½ÎÀÌÆ®ÀÇ °ü¸®ÀÚ°¡ »ç¿ëÁßÀÎ À¥¼­¹ö¸¦ ¸¸µç ´Üü -ÀÏ »Ó ½ÎÀÌÆ®ÀÇ °ü¸®¹æ¹ýÀ̳ª ¼³Á¤¹®Á¦¿¡ °üÇÑ µµ¿òÀ» µå¸± ¼ö ¾ø½À´Ï´Ù. - -


    - - -

    -¾ÆÆÄÄ¡ ¹®¼­´Â ÀÌ ¹èÆ÷ÆÇ¿¡ Æ÷ÇԵǾî ÀÖ½À´Ï´Ù. - -

    -¾Æ·¡¿¡ ÀÖ´Â Apache À̹ÌÁö¸¦ »ç¿ëÇÏ´Â°Ç ¿©·¯ºÐÀÇ ÀÚÀ¯ÀÔ´Ï´Ù. ¾ÆÆÄÄ¡¸¦ »ç¿ëÇØ Áּż­ °¨»çÇÕ´Ï´Ù! - -

    - - diff --git a/docs/docroot/index.html.kr.iso2022-kr b/docs/docroot/index.html.kr.iso2022-kr deleted file mode 100644 index 7fe5f9b7c1..0000000000 --- a/docs/docroot/index.html.kr.iso2022-kr +++ /dev/null @@ -1,40 +0,0 @@ - - - - - ¾ÆÆÄÄ¡ ¼³Ä¡¸¦ À§ÇÑ Å×½ºÆ®ÆäÀÌÁö - - - - - -

    -ÇöÀçÈ­¸éÀÌ Àß º¸À̽Ŵٸé ÀÌ ½Ã½ºÅÛ¿¡ Apache À¥¼­¹ö ¼ÒÇÁÆ®¿þ¾îÀÇ ¼³Ä¡°¡ ¼º°øÀûÀ¸·Î ³¡³µ´Ù´Â°É ÀǹÌÇÕ´Ï´Ù. ¿©·¯ºÐÀº ¾Æ¸¶ °ð ÀÌ ÆäÀÌÁö¸¦ Áö¿ì°í µð·ºÅ丮¿¡ »õ·Î¿î ³»¿ëÀ» Ãß°¡ÇÒ °ÍÀÔ´Ï´Ù. - -


    - -

    ¿©·¯ºÐÀÌ ¿¹»óÇÑ À¥½ÎÀÌÆ® ´ë½Å ÀÌ È­¸éÀÌ º¸ÀԴϱî?

    - -

    -½ÎÀÌÆ® °ü¸®ÀÚ°¡ À¥ ¼­¹öÀÇ ¼³Á¤ÆÄÀÏÀ» º¯°æÇ߱⠶§¹®¿¡ ÀÌ ÆäÀÌÁö°¡ º¸ÀÌ´Â °Í ÀÔ´Ï´Ù. -Áú¹®»çÇ×Àº °¢ ¼­¹ö°ü¸® Ã¥ÀÓÀÚ¿¡°Ô ¹®ÀÇÇϽñ⠹ٶø´Ï´Ù. Apache Software FoundationÀº Çö ½ÎÀÌÆ®ÀÇ °ü¸®ÀÚ°¡ »ç¿ëÁßÀÎ À¥¼­¹ö¸¦ ¸¸µç ´Üü -ÀÏ »Ó ½ÎÀÌÆ®ÀÇ °ü¸®¹æ¹ýÀ̳ª ¼³Á¤¹®Á¦¿¡ °üÇÑ µµ¿òÀ» µå¸± ¼ö ¾ø½À´Ï´Ù. - -


    - - -

    -¾ÆÆÄÄ¡ ¹®¼­´Â ÀÌ ¹èÆ÷ÆÇ¿¡ Æ÷ÇԵǾî ÀÖ½À´Ï´Ù. - -

    -¾Æ·¡¿¡ ÀÖ´Â Apache À̹ÌÁö¸¦ »ç¿ëÇÏ´Â°Ç ¿©·¯ºÐÀÇ ÀÚÀ¯ÀÔ´Ï´Ù. ¾ÆÆÄÄ¡¸¦ »ç¿ëÇØ Áּż­ °¨»çÇÕ´Ï´Ù! - -

    - - diff --git a/docs/docroot/index.html.ltz b/docs/docroot/index.html.ltz deleted file mode 100644 index 3217d641bb..0000000000 --- a/docs/docroot/index.html.ltz +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - Test Page for Apache Installation on Web Site - - - - -
    -

    -Et huet geklappt! Den Apache Web Server as op dëser 'Web Site' installeiert!

    -Wann Dir die heiten Sait gesit, dann hun d'Proprietairen vun dëser 'domain' -elo just d'Apache Web server software -mat succés installeiert. Sie mussen allerdengs nach des Decksait -remplaceieren oder awer de Server op eng aner Sait mat dem richtigen contenu -em-dirigeieren. -
    -
    -
    Wann Dir die heiten Sait anstell vun der site die Dir erwârt -hut gesitt, da contacteiert wannechglift den administrator vun dem betraffener -site. (Versicht én email no <Webmaster@domain> ze -schecken.) Obwuel den heiten site Apache software benotzt, as et -ball secher datt keng Verbindung mat der Apache Group existeiert, also scheckt -wannechglift keng email iwert desen site oder sein contenu zu den Apache -Autoren. Falls Dir dëst awer macht, get ären message  ignoreiert.
    - -
    -

    D'Apache documentation ass dëser Ausgab -beigefücht. -

    Dem Webmaster vun dem heitenen site steht et zou dest Bild ob engem -Apache-powered Web server ze presenteieren. Merci dat Dir Apache benotzt! -

    - - - diff --git a/docs/docroot/index.html.lu b/docs/docroot/index.html.lu deleted file mode 100644 index f98c855752..0000000000 --- a/docs/docroot/index.html.lu +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - Test Page for Apache Installation on Web Site - - - - -
    -

    -Et huet geklappt! Den Apache Web Server as op dëser 'Web Site' installeiert!

    -Wann Dir die heiten Sait gesit, dann hun d'Proprietairen vun dëser 'domain' -elo just d'Apache Web server software -mat succés installeiert. Sie mussen allerdengs nach des Decksait -remplaceieren oder awer de Server op eng aner Sait mat dem richtigen contenu -em-dirigeieren. -
    -
    -
    Wann Dir die heiten Sait anstell vun der site die Dir erwârt -hut gesitt, da contacteiert wannechglift den administrator vun dem betraffener -site. (Versicht én email no <Webmaster@domain> ze -schecken.) Obwuel den heiten site Apache software benotzt, as et -ball secher datt keng Verbindung mat der Apache Group existeiert, also scheckt -wannechglift keng email iwert desen site oder sein contenu zu den Apache -Autoren. Falls Dir dëst awer macht, get ären message  ignoreiert.
    - -
    -

    D'Apache documentation ass dëser Ausgab -beigefücht. -

    Dem Webmaster vun dem heitenen site steht et zou dest Bild ob engem -Apache-powered Web server ze presenteieren. Merci dat Dir Apache benotzt! -

    - - - diff --git a/docs/docroot/index.html.nl b/docs/docroot/index.html.nl deleted file mode 100644 index fdd7ff9312..0000000000 --- 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.no b/docs/docroot/index.html.no deleted file mode 100644 index d7553bce6d..0000000000 --- a/docs/docroot/index.html.no +++ /dev/null @@ -1,48 +0,0 @@ - - - - Testside Apache-installasjon - - - -

    - Det gikk bra! Apache er nå installert på denne maskinen! -

    -

    - Hvis du kan se denne siden har den eller de som driver dette nettstedet - installert Apache Web server. - Nå må denne testsiden erstattes med virkelig innhold. -

    -
    -
    - Hvis du hadde ventet å se en annen side enn denne bør du - ta kontakt med den som har ansvaret for nettstedet. - (Prøv å sende e-post til <webmaster@domene>.) - Selv om dette nettstedet kjøres på Apache, har det ingen annen - tilknytning til Apache-gruppen som har utviklet programvaren. - Vennligst ikke send post angående dette nettstedet eller dets - innhold til Apache-gruppens programmerere. I så fall vil din henvendelse - bli ignorert. -
    -
    -

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

    -

    - Logoen under kan benyttes på en hvilken som helst maskin som kjører Apache. - Takk for at du benytter Apache! -

    -
    - -
    - - diff --git a/docs/docroot/index.html.po.iso-pl b/docs/docroot/index.html.po.iso-pl deleted file mode 100644 index 8b030bd651..0000000000 --- a/docs/docroot/index.html.po.iso-pl +++ /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 dbeb5ed0be..0000000000 --- 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 009e2a137a..0000000000 --- a/docs/docroot/index.html.pt-br +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - Página teste para a instalação do Apache no -Web Site - - - - - -
    -

    -Funcionou! O Apache Web Server foi instalado corretamente neste Web Site!

    -Se você está vendo esta página, isso quer dizer que o software -Apache -Web server foi instalado com sucesso. Agora, basta adicionar o conteúdo -ao diretório raiz e substituir esta página temporaria, ou apontar o servidor -para o seu conteúdo real. -
    -
    -
    -
    -

    -Está vendo esta página em vez do site que esperava?

    -Esta página está sendo carregada, pois o administrador modificou as -configurações -deste servidor. Por favor, contacte o administrador do site para esclarecimentos. -(Tente enviar um e-mail para <Webmaster@dominio>.) A Apache -Server Foundation, que desenvolveu o software (web server) utilizado pelo -administrador, não tem nenhuma responsabilidade sobre a manutenção desta -página e não poderá ajudar a resolução de problemas de -configuração.
    - -
    -

    O Apache documentation foi incluído -com esta distribuição. -

    O Webmaster deste site é livre para utilizar a imagem abaixo num web -server utilizando 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 e9c51afb6b..0000000000 --- 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 a191a74757..0000000000 --- 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 ef25c8012a..0000000000 --- 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 db6ee830ed..0000000000 --- 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.ucs2 b/docs/docroot/index.html.ru.ucs2 deleted file mode 100644 index 4d22a70a05b03b2cc5d5efc6afb3f6bd10153acf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3134 zcmb`K+fN%;5XR@>Jn@#QeQgX;t5k}KF&H-X+IVre34+z6RjWo(WiU6DTOB7M{pBv^`b_!SD_ey9f!Ep`$ z5Nh;mh)-oGf8*JueYPf=I<9@_dWY=(l1H+H%*oWAxW#wR_sfy(hVxxuV}QT1)#|jIPak@tc;uUO?%K8;@p)?**1P=9xBUih{=x4no*o`3TN~IY*?aqoy-Q25Ij|2< zp4;!X!Xxi~_3uOWZ}99MN)<_cR``~e6}-JBHzj!1(Xwtov3`$NisvKI^t`$sX5vw8 zhIn&ot*{hoAq!if6{?{Ux>oYHHtS|c!cL&Bq2n}B#8nRoRx&jAuyBEvl&B_jdW{$H zu#D^z^f$smc*XiP@=bf;HZo`p*H!oT#O>A4{G3%SY{HxIyB~h$y$N@X=p?%ZC56(m zG8z;38t}yk#3c=nOV@*9%W{p6^OoHIh)|(sjM0?txCO6Yu~gtncz8xV#*eUYZ0C-} zEBFVFnP;{$@rXx#b^{KkHHb^QpC8#zu%vx;*QC7U3Lm`N!gs{lP{qPG;ehWq$`rp< zGPlNOi;O9&1$~3eRKl)yoW7g$&tjlr3*l+_9v@P?P@fLS(V54gS)!h;g9}X#J8 z0x`>;k#lwn-o7x3SGBN0T~+zEzfmo;&!Vlzv?$5b!gKJofK-~EklX9Nx{-Obmc@i6AC3QnKkxSTwfz}*%K{;w&on`=$EwQ=xons z2alBDHXL;%TC9?A#IC9#-|!L-R0C;K1v>mHf^q+K$ed>8-Dq|W$j5KCZ?Bm;d!Fwa zHUGi!@DBPP%p{>HQAS<%gv#7FRtF<3Rju;4C$TU_Le>5A*??Edj1W`7XGN-hp7!*> zHhmIYFqvAunz0+oM5c;O%ZVb)ZKE|JGV?jK;knH`H|l3)FeO7T;4e^FfhWZ;WwFre znRY8qs?_e&yCH@{P!k zL2?H2x}G!PC`OSXMK5B9NIVWjC4_D{ztEsbm*O4xfLn2|c^=y6syjX=y_@M1I6)_J zRkU=`sY$BbL|VoBVB7aw=x(E37}lAh8IIpGy;ib!bm|${`9lAy!xxw^x12{eOu!!W zc*?6L>a`;GJ{df+huth*a#MAy*~XD*1u`+0M^ zGm9NZSe(17Xo@KBs`K*rQ#h0nO-H2tJQ+>9xieWc)f`q==mwy!)-2Z@K2 z*^6^`)oYRxRh%BNui>c4q$YJXwIu5|1}6PDwtIC)}eS}fwF z?j4D|=RNlKJn!WN_?MphlL67>&l585A{a;{XEw^`2i*xARSh zX$GHsIH~%o?sD!@w`XRv*~hcl?0E2Na5uOf+z%cHyTNZk3;qb4-wtjCEpY!J*a@8d z8PIRRMsOlHHSjR&>A-!R@yVvO1yA#FCg&%EH-i?C-wU>bJHfqxU*}daICqaz`4We7 zygm(H2*keXbM=lMTR7HT%f7&doRGtTYzxY+GkKB=GJgefhU?$KCjn09g5pl6_}bIG z7EEhGrv>tPkY3p?dygV(FDJzhcX|3KXaRff#39e}Td}c+I~nJAoe8EnZTT)7l$)v# z-)tApFS0)$TpsJytXqNDuLQoIC+Kd{1+ND`1aA#g?!L=+?Js6eU#xN__buRu&sy2A=fkSc0tPwJX2!N+vOOndsv` z$B{qw@L_LSgR<2kkHdfQEyhKlCOA(y{ujG+D*xiB`Kos2iCS(4(>bcPJAt?6+Z*U(Z&{B7>7Bm6l>OO&ygP4O&z%{oJN>$OfP7|V z@0oCzXKr`h=q%-(P3=Ex4u~Z^Gd~s_ed4pfeYt3X9#TVnaU-aDIM*+*8+fyN4*bng zFmu@=W1Y?zchw_$hwiFf{kah&Up-geq}lDgZUw#8(yxV%Yv z^GS{R{F0y8>bbU#8uj_1R&>-Q`uli%nQyh#3-0J%9P(8cGX!t4IN&2MY)<>etdfKL z4t4p#q01GYvbBgz`O#POlCvd0e69raN)9)2@Y2H$Ldd0l6u+sh^fRT-~!NucdP#dtBtN=HPDj@xT1mU;4QP-v{}< zm}TzwzjacBWq*q`wr8&f8$k=c4aol(oDbr+--(6H)Q>**X6^*uh&{hk8C>LYob9W3 z&U+pzr{b;rS3c;qoRh8mRc`7oYwsC3WlO%~xoTR!&!x8*GSi%zUFogm-vm?MvD4q} zGvb|}h+Q$rY0J9KU&-KrZ*slt&FT&M>EUim4~b1&&a0=r2l4Z36|?@>9D1v>k}r11 z@l!civK$gP6Z?1^bY)8b7w}~4Q>SY zgNMO(uosv?=3;W+WgcWTpZvy>A@6T5`p&B^xZ|oGxGi$mvg(_oWA9$# zM-amzsNR&sW2#3mr&+-1e%}2q>!0)TKNSEwJppGvE)-lU^{pC~c))|^R3Rf_+7H%h~HM=y?SGbp>wGE>qXqEN1W5CnSCt#qtTHcGfZrw z4*ULYVn>c9Jqo1%D1X^^8T`qOJas|wHoXLrO5s<|R z#Iia3@ab;)w~hIczc2fYyPOpd`D$6o^D*LDwbNw|TTl7GLmk$|Yu4g{6FE7@rD~D= zfjyy4WRC}ODb}rkoss)~KmGk)$7P!P%EhSbfgIv{*(=wx_r~r7-j@Adpzh-G7QHwB zhql1)=+!{Y;;+BK?X0_jl|Ap2onHdyJAt^_VDCn-5wu_{&@b15vR8M-!CPI&Q{Pwb UljZMjV17If*qPq1&XIoqFYUaV5&!@I diff --git a/docs/docroot/index.html.ru.utf8 b/docs/docroot/index.html.ru.utf8 deleted file mode 100644 index fc6694f616..0000000000 --- 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.se b/docs/docroot/index.html.se deleted file mode 100644 index 377307f53d..0000000000 --- a/docs/docroot/index.html.se +++ /dev/null @@ -1,43 +0,0 @@ - - - - Testsida för Apache-installationen - - - -

    - Det fungerade! Apache är installerad på denna maskin! -

    -

    - Om du kan se denna sida så har ägaren till denna maskin installerat - webbserverprogramvaran Apache.
    - Denne måste nu placera webbsidor i detta bibliotek och ändra på denna sida, eller - peka servern mot ett annat bibliotek. -

    -
    -
    - Om du förväntat dig att se något helt annat här än denna sida, kontakta - vänligen administratören för den webbserver du försöker komma i kontakt med. - (Försök att skicka ett brev till <webmaster@domain>.) - Apache Software Foundation har inget med denna webbplats att göra, så det är ingen idé - att skicka mail till författarna av Apache rörande denna webbplats. -
    -
    -

    - Apache-dokumentationen är inkluderad i denna distribution. -

    -

    - Administratören av denna webbplats får gärna använda följande bild till en webbplats som använder Apache.
    - Tack för att ni använder Apache! -

    -
    - -
    - - diff --git a/docs/docroot/index.html.tw b/docs/docroot/index.html.tw deleted file mode 100644 index 1ca02124a7..0000000000 --- a/docs/docroot/index.html.tw +++ /dev/null @@ -1,46 +0,0 @@ - - - - ¦w¸Ë Apache ªº´ú¸Õºô­¶ - - - - - -

    -¦pªG§A¥i¥H¬Ý¨£¦¹­¶¡A³oªí¥Ü§Aªº -Apache Web Server -¤w¸g¦w¸Ë¦¨¥\¡C -§A¥i¥H¼W¥[¤º®e¨ì³o­Ó¥Ø¿ý¡A©Î§â³o­Óºô­¶´«±¼¡C

    - -


    - -

    ¨S¦³¬Ý¨ì§A·Q¬Ýªººô¯¸¶Ü ?

    - -

    -³o­Óºô­¶¤§©Ò¥H·|¦b³oùØ¡A¨º¬O¦]¬°ºô¯¸ºÞ²zªÌ¤w¸g§ó§ï³o­Óºô¯¸ªº³]©w¡C -­Y¦³°ÝÃD, ½Ð»P ºûÅ@³o­Ó¦øªA¾¹ªº¤H­ûÁpµ¸¡C -Apache ³nÅé°òª÷·|¡A¤]´N¬O¶}µo³o®M³nÅ骺³æ¦ì¡A»P¦¹ºô¯¸¨ÃµL¥ô¦óÃö«Y¡A -¦Ó¥B¤]µLªkÀ°§A¸Ñ¨M³]©w¤Wªº°ÝÃD¡C - -


    - -

    -Apache ªº -¤å¥ó -¤w¸g¥]§t¦b¸Óª©¥»¤¤¡C - -

    -§A¥i¥H¦b¨Ï¥Î Apache ªººô¯¸¦øªA¾¹¤W¡A¦Û¥Ñªº¨Ï¥Î¤U­±¤§¹Ï¥Ü¡A -·PÁ±z¨Ï¥Î Apache¡I -

    -

    - - - diff --git a/docs/docroot/index.html.tw.Big5 b/docs/docroot/index.html.tw.Big5 deleted file mode 100644 index ec9d8744c1..0000000000 --- a/docs/docroot/index.html.tw.Big5 +++ /dev/null @@ -1,46 +0,0 @@ - - - - ¦w¸Ë Apache ªº´ú¸Õºô­¶ - - - - - -

    -¦pªG§A¥i¥H¬Ý¨£¦¹­¶¡A³oªí¥Ü§Aªº -Apache Web Server -¤w¸g¦w¸Ë¦¨¥\¡C -§A¥i¥H¼W¥[¤º®e¨ì³o­Ó¥Ø¿ý¡A©Î§â³o­Óºô­¶´«±¼¡C

    - -


    - -

    ¨S¦³¬Ý¨ì§A·Q¬Ýªººô¯¸¶Ü ?

    - -

    -³o­Óºô­¶¤§©Ò¥H·|¦b³oùØ¡A¨º¬O¦]¬°ºô¯¸ºÞ²zªÌ¤w¸g§ó§ï³o­Óºô¯¸ªº³]©w¡C -­Y¦³°ÝÃD, ½Ð»P ºûÅ@³o­Ó¦øªA¾¹ªº¤H­ûÁpµ¸¡C -Apache ³nÅé°òª÷·|¡A¤]´N¬O¶}µo³o®M³nÅ骺³æ¦ì¡A»P¦¹ºô¯¸¨ÃµL¥ô¦óÃö«Y¡A -¦Ó¥B¤]µLªkÀ°§A¸Ñ¨M³]©w¤Wªº°ÝÃD¡C - -


    - -

    -Apache ªº -¤å¥ó -¤w¸g¥]§t¦b¸Óª©¥»¤¤¡C - -

    -§A¥i¥H¦b¨Ï¥Î Apache ªººô¯¸¦øªA¾¹¤W¡A¦Û¥Ñªº¨Ï¥Î¤U­±¤§¹Ï¥Ü¡A -·PÁ±z¨Ï¥Î Apache¡I -

    -

    - - - diff --git a/docs/doxygen.conf b/docs/doxygen.conf deleted file mode 100644 index ff55bc59bf..0000000000 --- a/docs/doxygen.conf +++ /dev/null @@ -1,21 +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= -# not sure why this doesn't work as EXPAND_AS_DEFINED, it should! -PREDEFINED=APR_DECLARE(x)=x APR_DECLARE_NONSTD(x)=x \ - AP_DECLARE_HOOK(ret,name,args)="ret name args" AP_DECLARE(x)=x \ - AP_DECLARE_NONSTD(x)=x - -OPTIMIZE_OUTPUT_FOR_C=YES - -FULL_PATH_NAMES=YES -# some autoconf guru needs to make configure set this correctly... -STRIP_FROM_PATH=/usr/home/ben/work/httpd-2.0 diff --git a/docs/icons/README b/docs/icons/README deleted file mode 100644 index 74b2970b9e..0000000000 --- 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 GIT binary patch literal 0 HcmV?d00001 literal 246 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIn&tKm;nhW{__jT$ShV!EGkg|Qki)QB^jv- z1*J(jnaK(%`MHUid3p-osbxS3kJ9vv)M6clY!ENQAvLo^FF8L~MXnDYZz! z(9+VBLGdRGBLf2?gAT|RknIf2nHIbDd^F&3SUp#HU#9hW!Rw()J9@9Pc4|E2W2srx z@ZjD%n_KH1+_viO4gW0IG)3`1D5IB^&A~|*Z0siQ)e*Jc?U}v(RZqm-rsn%xldEMP i9?8v^arV~QxusXc{Vzw0+BY`Y83|alcZ6{=SOWlx{aaiB diff --git a/docs/icons/alert.black.gif b/docs/icons/alert.black.gif deleted file mode 100644 index eaecd2172a091ee2994c73f33e784e336b23b58b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 242 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIn&tKm;nhW{__jT$ShV!EGkg|Qki)QB^jv- z1*J(jnaK(%`MHUid3p-osbxS3kJ9vv)M6clY!ENQAvLo^FF8L~MXnDYZz! z(9+VBLGdRGBLf2?gAT|RknIf2sTRBTd^F&3SUp#HU#9hW!Eiwp#*PQqrY@^+(mQa9 zIq>=_)6J=N(?l8rJU#@b9ZU?|#8k#|TH+FuDboTL$LCUaCvA&aeP+vAqk{>XuXw(F ebwjlD^Y4XGxPKmyi?175+0@L8L7oO3fUlDhC^y*iC%Jku8u-*YC%bA zZc=KIf}y3QDTCrq7DfgJW(FOg=?oy-8JM#&cJ29GAmOljuG+p#>+^!)qA83W53Y$i zRmV;6*!V8-#*VCuOa*@qH0ND;#mM2YBw&+P*rb-FJO^IOEcFdnw_3sy#i%{~=Eb~? osgHMN$4+)vHJp`EcP`!U`GY!UILM{ophO`}&oUt=FmBNTY z$`ICVA7j^+h#i;OQDc-ga!qS+8Gc0FW4f z)Bt1yAj_Q32!U{ zRIo-qQptb-t7{uBm(~px;>}n!KArWR1^>`Cf~is&A3~v0s8aF}M#nn9GGt0d7v`yb z*>S>eMWL(I627?MNllQ7BkqHq)M=1k z=&Ky&zXVh2hPE6DHG1$Mj#+!@W<|fAeonA2iB#Un#%N(&&W1dtI~9BfQ#)e2X=lF^XcGT}q=AoZ{H^5&_C+Pv zN&hQZTYONvvH2qVcG~jIh^yqZXMG0jauI~J<^%?yjPC{pb>Ylqd7Qgl5*ph^Ulf=T ztUu|ceZK)dM=IDKg~q~CZoH&Cb~-~Z=;&lvYG{6Kc>2z^;Sv327g?kssFZ=dw}0cH zdw$mEtN!A<`J8^&z3 zt~SwiD6S8)Rjrr!Kx<)&vBl1-$xbOvcBi~nxrDC!TBPace;L%k*DDqrZ4t4XvN(& zu%4H=wkn0>)>bWw*7qy^XgxfL8hEr{3=!aT@x^9eDj^ytk&Chl$kO(lBLUN|dQ6Gs zqR_gQC$$$-23%rt``_I(>C3A7dOXT9Z$frk_k~-Ys+P;@AA_2Pg%%8=^ZRrL+?~|f zW&~d`K5oo!G0s}dw|gtsI8gBY`D(2K(S?RiMa{{iIhO(d)G0SJjuwocN&dl=)Ns$! zkAoL^`msv}wXFIo9^Egsd~xDITuw=a{)ty}PeNiaZ{?=q1Ff-;&+#A?LvlJm+3a2z z0EU`idSaEFK|F|qEq^5hpn?C2d=DQ+H3YkO^OBqUex<5bLo z9(N*aTe0*iA?|UPIVvKLCc?9Ag1I16-HvOfbsA#dH4-dk3 zhnz>*3E(FdLU+yVpuPUsliM=aeNjZUS*@XX3Z53T6iR8-2uO=XFwVs0@AhefEv8q zeI*^7gje{cZVN8?oK%ZT=2#U=<_Ih7M^R~)Ja%@QBEHt-Nj+won-qIvXTfK$!wnkr z2MQ*#TaAN%Ohqz*uQYER7$<|Jgd}A|ZL~mb$%8Fh^ z{1s=ft;T@}n?u#1Sd8|0dAq@XlaA<)Sy)vu-xZB|?3vPJ`3#PxQkI=}-aLquKdtW{ zRsg5o;PBjI;EgPh^zTEWZ?enGho=a|_a2#rB5>8_lJExo!OHH@#L?0Fsk3g9+0-%#kV)Kf zB;Lm)WsWj{mw{t4P$v62PSD1Gl%MytKqmW{WF7!lXrYR@A&Wof$BRdoD9^7)O~QCHc4FgyAz zQb5%gl_(rvaK8#TJvXRH!;vTpQg6AUnl4lLD1^g@2VkU(Xd}+G!}4q7PCruL1BX}~ zn%__Cf`!@Yjtibl_yC1_JNf5WLZ~uEo}|U%%z!2`dPMaki^@Z$BlXRQ{^KxsS~ae) zlwumx%n1G|s&RGhWp|Kj#+in3D(6)e()iEl@-u8Sff7w(OQTZm=d_qe&#{a{0Hkpk zd3~jNVEi=K*pl@q!mG~imPQW~M;_q~)~slH^x7<>ZG&wgt{Mx3+)=cdqA(vy`RlC) zIa*5ndx=y3oI55zDs1qBzgl%3gaA!mB^0?eSac9tJUbBD_wNb6B z5Y=BHl$rboqrsa_)1K0b*Ru01Ndlku0|=$W(vd?6ibRQfCat`Zll~Odu|H!`~`V*Sk|_A2T>nj+?l04FK{py$X_NM2MU^ zWo{S{Ncox!*mgVc48Zb(k+K{_TbKyQNKADLN2y@=1Vm1I~mNk5D z0iKr^7kpn^lf_&*IqSSRGsYu%Oy?I-qsO3~~?Q_Y?Qgd!o4AT` zy#1OX<>B~LkBO+T67llGwN(;& z5cY>(Zs+x+8pmeJ=iqm(J?@D}N*qJXB((gy?3S^wzj)_?JM7fN$+1NN(P%I zS?H@FlXx)=8PJ!)DAZ9?{^XKI;lu_;0(DV)hi3^Uw=U+|La!AGBb3?#anaR(o^+!0 zO_G^9!r;2w`>KGj@WLY11a3&f;w}@@<9zj%hZ;llPw}u9bsa9xTP+=u+U^*tFu1eP z(O)e2*~l>0&>;a*4`SKgFV|YWxZ2D@vrk(&Z?BLezWxE4HihSVm?9^^m~}+nk*)I~ z`l{hwue2?A09j?xgz`wEfw;2wJJ-!fT-D2h9HjbKr)JhmOkJwsLN?ke@WY$Jz~7RL zvxtcil-2^b1@O$hdY82q-^;atbN=&?En!s{X17r`(*;WL-K$NAdxP&ex&I>0 z`DR`5&>M_^3+EgRE{6M1!cRPMn`YaFz$-kwOTo&xcT&bmNkd?< z%iFaAq?u9ya(M|B{sG9PuVpEwiuLx;nx+?4pFY<^!F>~$Tz7h!y!pL&AMyK-=hvT) XqiYh{4~%{)S#O;4Fm;B(z`p+hpbw|G diff --git a/docs/icons/apache_pb2_ani.gif b/docs/icons/apache_pb2_ani.gif deleted file mode 100644 index fc41c03610c1f56d4e2ce3c9750cbe27e5d96886..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2160 zcmY*ac~lek8vSLPNl4fs38BD95LA|eQiRezLqIAX)EpmFz$Zaj$|mvz5f@^>D61Hw z0tOUBfk1+S-~x&SL~C3SM3!QOXpu#$q^Jl_P2Pa#lysIef84qE`|kbbeDjl^ue--q z90ma$VD4B%r@H`6NJvOH(8R^XB_$;Z1cDNvsi>%E*=W$xa;LNNPG3dm(7vIeTEW=b z$uU96B+yK*&70g9K3T%n0J;W*Ye0zxRbkUL0-)(cFSJI6A0+jVXo3#O+Zj1 zNPa}jndq7e@vm z%UKo4E?(^-jvl||cBj)>DrrnGhyny+R!-SPJmufdn#`T0c?8|79Wgxx)B3-yi2rW& z>p}&k{9s#O(5If<;%ARm>6wvjl?Ov5X{)hNHU`(K-v~u>knQMx7DKT>oO7E3a3_?S`)65Tg-T4pZ( z3DN<;pLH?02Mdi9=CInI2=TI8TcEnM%==JQjGA-C(6{OF&_NeI#&@sGE0CM~c-I5w#?rjvV$Cn)}x4_9-eO^a7ghYm?CQv)A7BAVS`Z-{#R)Sz61^o1`wj^qI<=nfK#iyh*|qVvEGBOsiO)ZY|7`j)ulDklXZ)e=@-Y1>4<(x$U0Gcz)^n9- z;0!uQZDfj%f!EKekB!ocZCzPyr6xbf+i_EOnG%wzP0e_Dp3~m(op2X+o2P5eNNE5) z;b-yT4`)-Vxw2Yjk>|S6a$Hr?&8E>B=~Q+*eoM+ktd8zTjQtOW?}MWu6H0R&WEYUA ztm~kD8sBN|vuq-;_6x!2NYVP>JC%Xzx3@PHxUzFu7_0V!0~lJK*{ztH(qy}Ai` z^Pg9WD^D%yST-rMi-;U+nelbT5LC__HttYJ*J~ZYTgIPt`Zh9EJLO&72$(XNd49C> zN?++Nw>ur~bY=+Lzk16Z8J7;=sZJ@@k44D)=2 z!OHDk>D0Ov_s^emds@-3C}vOnnlxSKrl74J8TZGmT{%wu)SI%86OxAN=0B9JmY$CG zKB}=Z&2Pm!@D$pAl1c5B1H5*1%_Y{QtN0Rk$2vo||N2eE!i7Ohx|0PziTHUCQa`6R z9lIaG=@wpo|M>f+7Dq@*E`{vEu-7a2+(!Cfci!~Bj5_pbey6%Hu8Dl^E_g$r+0c2P z0G8pGi(u;~2G&#M0Sl$;bcrv9GUz_A4+ogKJ|l32UKDUFi$mFl-*(%}Xdo`_=L3Ya1-npB~|tkM=t|3B1_0%uEQ21F|4W1Sol|gPS1I#-HQ96|C=h5Q!1S^{rq1F(0%;(a#jEW zfB_C&&SXTm-v$wlXY>4s3-|+o2hcpO6E=0kDopfpcJZPGxEqBD0E^NgrCpAkC|H1c zQE2W21QMb;GEyiUgSF6sc_M_O`iRhmHJfIWSZ-g_yp4ffPMdZJ_ZUJleOyfNHx#z(&2@S$Iz7E`4{xi`G#AItUyU@aig}AF;wB}7)a8 zTBKlTX=%!!_>+Z^fq{`h2V@1vb_Ql|iCuU8DGPkc5-<+lz3AMXubFeq{lvP)Ggp6^Q($uOC~PM5!3Knu5hd8zzVA-2Z^g;lkQyz{qtht`EC{l FYXAcbPG|rC diff --git a/docs/icons/ball.gray.gif b/docs/icons/ball.gray.gif deleted file mode 100644 index eb84268c4ccf0146e661f51e63fc7d958d39111f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 233 zcmZ?wbhEHb6k!l!c+9}?|Ns9pKy>EJ?%lg*&YaoN(UF#x78)9AY;4Sc4JiKe3(3eV zR!A%=Q2NWsw3(v(5*CkrD310#bD$U2a#7+72kPI#`~Yw`N*?)jcGYB&?6 zl*5^v5@j;O_zpaf^Qf7s_EE`__xyKmPTmvoe(9bH{5w=PbF!#4X}t_l`&F_3!G;Q* IP6h^R09S}j761SM diff --git a/docs/icons/ball.red.gif b/docs/icons/ball.red.gif deleted file mode 100644 index a8425cb574b1e4250b8cd35656432245cf4b51c8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 205 zcmZ?wbhEHb6k!l!IK;s49|&g7{BLZ0=KudR1_V(2=NFQZS*(y)RH6W+GV>HlGEx-^ zN|SOjlND0(a}zW3^c1{P%YYIdrRf=|#X1VvAYO(;YG#REa(=FkLU3w9NosCVYLSAW zrKKr@;!hSv1_ovZ9grm;+ZmW0EOy=bXK>1Mb*$?2=q7RLtBj2b0*O~xQ!1DFD^5{O pJnUyaTmRk(8|hQW8HD_tlL9-OLb*IseTr8`t-rA*Y$5}LH2|rsMHm18 diff --git a/docs/icons/binary.gif b/docs/icons/binary.gif deleted file mode 100644 index 9a15cbae04ccda7ee515f0e56360afc5a0dba7a5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 246 zcmZ?wbhEHb6k!l!IK;s4|Ns9pKy>EJ%$YNdjg1*#K=GenNJeI{LSj*g0+7ngQz*$u zRVXM;%E?StNXgGl%*@kM@J=lQN_do}XQUSEC}e|p84jtLC3?yExjG8LsRbpexk;%- z3Wk=JrVNTdSr{1@7#VaxR)B10V9xZ|wdbROfWzv!D*Gb21Y#8#gjW{Ev9DOlxiI_H z)^#HHvm9UiDQlh^nDJt>gl6-T1rM0J@~%VW#e jit!gMUf+_g-~76GhV}Y)-JD*HO`g_*&g~t+oD9|gOVnOa diff --git a/docs/icons/binhex.gif b/docs/icons/binhex.gif deleted file mode 100644 index 62d0363108d2585b7574f1eafa0749ae48e15f5b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 246 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIWsLS&DhwO0R|NR`GsU;7Aqtcl_&tI%shpX zj8uh!(xjZsWQCOc+{Da0Jq7R7GN6P8 zTBKlTX=%!!_>+Z^fq{`h2V@1vb_V85k6n8{8VES7o~yDia@YFk=4>QQyf+b%kUIiE6v`j kq<41P{%f~vu3nm((IxdxXZmdxm!@WCGePSPUrq*V0OwX&D*ylh diff --git a/docs/icons/blank.gif b/docs/icons/blank.gif deleted file mode 100644 index 0ccf01e1983e40365a9ab9f373b6fc497c8603cd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 148 zcmZ?wbhEHb6k!l!SjfQe|Ns9p|Nk?9f#N^Ekc`Y?g~Xx~1t67~r%;lSs!&jxl#`jP zkdmL9n3<=i;GJ3ql<+7`&qyuSQOE}IG8|GfOZ1ZSb9EGgQwvH`bCXhw6bvmbO&Jt_ pvM@3*Ff!-Xz$Dz$zw-23{>5{)-0I$ZZ_jW3Hcv(dYXE)}F?;|3 diff --git a/docs/icons/bomb.gif b/docs/icons/bomb.gif deleted file mode 100644 index 270fdb1c064a678acb8764f49dfab1e4930a437c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 308 zcmZ?wbhEHb6k!l!c+9}?9|+DEp8*nQ&g|a3d*;lU9UUEMX=$OMp~l9>3>ZN1pI=Bu zX0bwIQHcVO%FI(J$w*ZwC{4=AOjbzA&rQtC(^K$HEdxq;l%{8-7V9WvgLoMZshK5u z$@#fD3c;xbC8@bdsYMEgmX@Xria%Kx85o!tbU=22T*biBZ*bCc`Hl#c1H12gmgUBI zw%rtC;M!28($IJJckPX3ES?w2x?Bo89EJ%$YNdjg1**8Z)FBGcYhH{__jT$ShV!EGkg| zQki)QB^jv-1*J(jnaK(%`MHUid3p-osbxS3kJ9vv)M6clY!ENQAvLo^FF8L~MXnDYZz!(9+VBLGdRGBLf2?gAUMi29WIx%y|;K?))=oQ+_D9Ws|kbwV3Cb!G;~l zr6S87EaNL&_a?hVeW3t@!}Ye?nKK^#j99avpyTG(I#$(nk_Jvoof)on^{`p)&3!-P v58tszhQ3zU#BLwgx4CO~=RuzOzlQVSzZ;^Bd|G^1EJ%$YNdjg1**8Z)FBGcYhH{__jT$ShV!EGkg| zQki)QB^jv-1*J(jnaK(%`MHUid3p-osbxS3kJ9vv)M6clY!ENQAvLo^FF8L~MXnDYZz!(9+VBLGdRGBLf2?gAUMi29WIx%=I3-_IxxDa9BN8WnZTCdBN+UN;`V5 zvvyudlx5MGf7Niu+lB8<68M>}CwT0+Sa%>{VugiRTa(75mo;unPcK^%`XY`u`0=&t zU!@MXG|VX05I^^VF*R2EaBhQ*t$*G8!m22pl=_-R+Zy(Sw)W(nhPLXS$-P|O(_IV& Nt>?_0!_UcJ4FEU+X8-^I diff --git a/docs/icons/broken.gif b/docs/icons/broken.gif deleted file mode 100644 index 9f8cbe9f7604077bbd3a2bc8bc3a5bb5f569b838..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 247 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIn&tKm;nhW{__jT$ShV!EGkg|Qki)QB^jv- z1*J(jnaK(%`MHUid3p-osbxS3kJ9vv)M6clY!ENQAvLo^FF8L~MXnDYZz! z(9+VBLGdRGBLf2?gAT|RknIf2Sr)tYd^F&3SUp#HU#9hW!Rw()J9@9Pc4`>z_|O^T zk}LelhjUMZx0Uz%<6KNN%O7PlP1)n6a$s{L_l_mk)%DU^kLsajo diff --git a/docs/icons/burst.gif b/docs/icons/burst.gif deleted file mode 100644 index fbdcf575f78a5ebbd3eeac5bbd9f963962ab664f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 235 zcmZ?wbhEHb6k!l!IK;s49|+DEpZWiPW*S3UTAH!3F#{MV{__jT$ShV!EGkg|Qki)Q zB^jv-1*J(jnaK(%`MHUid3p-osbxS3kJ9vv)M6clY!ENQAvLo^FF8L~MXn zDYZz!(9+VBLGdRGBLf2ygAT}iknIf2aT>es{4+SUl4tW3o}3LYCJ5%-`ZlvqY)y_i zON{zvlk8Qc_r#nUUz;+oS7*8wAfNp1ThKa>J&QI6cbF|deBP(?&CiC}j@vi=I#{!y ctx@66$5l65-@mTg36FLd3o%#&030@6>Hq)$ diff --git a/docs/icons/c.gif b/docs/icons/c.gif deleted file mode 100644 index 7555b6c164fc1b4fd61b082d8077fa9d91df56f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 242 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIn&tKm;nhW{__jT$ShV!EGkg|Qki)QB^jv- z1*J(jnaK(%`MHUid3p-osbxS3kJ9vv)M6clY!ENQAvLo^FF8L~MXnDYZz! z(9+VBLGdRGBLf2?gAT|RknIf2sTRBTd^F&3SUp#HU#9hWL3V*Bp^eh6>z=a~rmo~; z@m;PwF+98fv}{9yhQgnc16&t10u@Ug6@{;Ldlgz{Obt2`rF%DR+wn(!`wtpSjoH_A d@zm!TvfmF~E%;F4@aA{Bxj;^{Ha{nWH2?tDSDF9- diff --git a/docs/icons/comp.blue.gif b/docs/icons/comp.blue.gif deleted file mode 100644 index f8d76a8c23f018497587e3f99b1ca6de51b3f31c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 251 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIWz6d|FpC;V`F26w3!SH42u8!LNYRo6%va| z6o6D_oCMz{sEjG@SutI|Fl`#I8I43{F+7+RH9?U^n~B&57a> z9SY`avJ)3cpWb!+X3wWT_Y&^C>j_NskYN&^eSY~d0}D@y<%x+OBE#9DLr=Z++8Ul6 x7HBJQ=EA9jH5MFGT$gJ@mp5m{0_#-#wxuc*35QMb=U457e-D7YXCOLU#$QD diff --git a/docs/icons/comp.gray.gif b/docs/icons/comp.gray.gif deleted file mode 100644 index 7664cd03649021707e088ea934495978fb0d2656..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 246 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIWz6de`8}~1{hHM=NFQZS*(y)RH6W+GV>Hl zGEx-^N|SOjlND0(a}zW3^c1{P%YYIdrRf=|#X1VvAYO(;YG#REa(=FkLU3w9NosCV zYLSAWrKKr@;!hSv1_nk39gr0u+ZmWMC3fBUXK*TF)m~Py1H0L0ZcY^U=uj|Uqn)@& z`t+`&H+w$)xtDP7U5{X*hYXYW?DNZyDNHgr!s_U-Hfnv#g)JxEX01=i4l~r{ICH)$ lVU2;d{qukWdt+~JZ}<_zu;TaoO4H0{QT5pN7)DM8YXGT7UX1_% diff --git a/docs/icons/compressed.gif b/docs/icons/compressed.gif deleted file mode 100644 index 39e732739f562920d69e21b9d5f766103225471e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1038 zcmbu8%S)7D6vm%!Ft{kRtWAqgQ<5~hoFu0y(5j?VVxWbZa?#}6Rb z^C4&mE(8ey7I`1M2JeEG;9*JiK{cogDnVhj&IhN#x!@!?SgZIT8pH*WAfQr!56}P? zAOQ@hO=)Venboj4_SAdly?75B%ShF$^D16p6ihnx&Uq)^!Jt?x>cx2xFCZgZJ=DW_ zhzF;Vnqq_|C9#;}U}{sET5N_bWHFyp6;;@N9LvZ#b)pWoE-9E4ry?rg_Jm@s!YM?- z_2>sN*-bmRKOwjwsVPQiQnHjB987IWQw!#tr5W>yb1);hAICBhaRU0vbxFabgE-Jf zI!yz}#c~?WZD}R_ASSzM2bs7qHzYO12+dAnk%NP&O=;MPteR=YeBi}sB=_T3Mgsdd z%-8tdmW)qmHpf@7+Sq7wJ@(F8V>|2!@rI@pL)%Sa4ik>0`8n`PG>cNN~PuHj#2TU&K?b$PjISFN2mlgUm*z2muv zKiQEemq|xslYK+k{%BxyxHmh}7Dc}w4}4S#{SXahUj#9ESDbc zOOHnflF24it!!Ke)S!Xtuzwj6iq1sMV&VMamBiM~1Dk->?y_AKLvKGkd3CL_zUO(} z{{Gh4ox9inc{4lTIae9-XIHj->p*v3PgZ}I-!Gd(0R3W>2Z59 z@wZv>Co5WRejm!z{yeqNojm@2_0WZ-{JG+hhh&B-mUxe ZEb;5(orN8>^?I=Ddd=ePr!Oz#=sza7#nJ!( diff --git a/docs/icons/continued.gif b/docs/icons/continued.gif deleted file mode 100644 index b0ffb7e0cc026c1e0c383a17044f5aabcf4b5d91..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 214 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIWsLS&DhwO0R|NR`GsU;7Aqtcl_&tI%shpX zj8uh!(xjZsWQCOc+{Da0Jq7R7GN6P8 zTBKlTX=%!!_>+Z^fq{`h2V@1vb_QloiCuU88JzN5z4yk{OJ&c!6gd(UCY?Un$r?Nn?=Lqvv3P#w6Kw&mW_iT|AE}uhs$W)G1T8yg@&WtvAFs%+oyn@vrAN+!2FgA&7LgdM$msG{jgj*VKw;b&W_&MNEp LeCV-eWUvMRho4eP diff --git a/docs/icons/down.gif b/docs/icons/down.gif deleted file mode 100644 index a354c871cd0b1871aea54b437a9fcd88608b6945..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 163 zcmZ?wbhEHb6k!l!SjfQe|Ns9p|Nk?9f#N^Ekc`Y?g~Xx~1t67~r%;lSs!&jxl#`jP zkdmL9n3<=i;GJ3ql<+7`&qyuSQOE}IG8|GfOZ1ZSb9EGgQwvH`bCXhw6bvmbO&Jt_ zvM@3*Ff!-Xz@*gEzw-23{>5`lI=eR?ORw&$xvkW+XnDYZz! z(9+VBLGdRGBLf2?gAT|RknIf2i59!|d^F&3SUp#HpXaXk2Sl>&JZ}wUn<}Oew2Ebh zy5WrhZnywi7`v{UmEc1RMWQW;i796*RD-1HnCY( abURyR&WU;9JD3;O#qV)F(-6+dU=09`UszZG diff --git a/docs/icons/f.gif b/docs/icons/f.gif deleted file mode 100644 index fbe353c28223f727deb5144a964b67aa52081e42..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 236 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIn&tKm;nhW{__jT$ShV!EGkg|Qki)QB^jv- z1*J(jnaK(%`MHUid3p-osbxS3kJ9vv)M6clY!ENQAvLo^FF8L~MXnDYZz! z(9+VBLGdRGBLf2?gAT|RknIf2@fN%Gd^F&3SUp#HU#9hW!Rw()I|5y1O%gw{Qrk-4 za}Co**45@VTn>y2mrF4=IdgU;Y~koUdn&jyIjm;NN)0XFePuTmPrrRp@1UjePH&g! XquWjAXkF)P`eAc{t#G$ICxbNr*wRvL diff --git a/docs/icons/folder.gif b/docs/icons/folder.gif deleted file mode 100644 index 48264601ae0655bbb5b5539e54ab9c4c52c0ca96..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 225 zcmZ?wbhEHb6k!l!IK;s49|+FOJoEqm%rs*lV1NO|e|{kunZ*i;MI{PADl<=^BqLR! zpfo8bGg%=eKQ}QmPfx)+wG1fXQJS8STCAgx4dP`uq-K`rCFkerCyg@&WtvAFs%+oyn@vrAN+!2FgA&7LgdM$msG{jgj*VKw;b&W_&MNEp LeCV-eWUvMRho4eP diff --git a/docs/icons/folder.open.gif b/docs/icons/folder.open.gif deleted file mode 100644 index 30979cb52855157110d56344ce09ff29ad726585..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 242 zcmZ?wbhEHblx7fPIK;s49|+FOJoEqm?%lg*rWpeP0~jd&^9#wyELKP?Dp3GZnRyB& z8L0{drAaxN$qFg?xrv#1dJ5jDWk3m!()5hfVjYES5HG_aHM2x7IX_oNAvm?5BsDiF zwMfCx($bVc@h1x-0|OI-4#<3v?F`JR8oTcNGdShBI#=y=&2-5G4yn89^Q6URrb|x} zc)e?b^5WuCck>TOH!hekVIgPfp~Qt9URLv4mOfysiDC|%v8Jjt&35m)a4xxmqX+dL h7rU*#p8HYSdByGb-X0k#`er{rBo}PktY8g<%qclAuwOB_X8^p_SNX;zKOU}>LQ3y^g zC`rvtN-a__w6rv3Q2fcl$iTqNpaV3W0c1M^bDG7jJO2z$dEVUl?ms=DL1^Wsd78 zTBKlTX=%!!_>+Z^fq{`h2V@1vb_QlYiCuU8wX}SU+2eAh_5B^k_ROg-0w+{X^b?$Q zKX`{e+d0=|9tjPPcd_Mu)Ml%7PAUBP*kHbKD+5<3&kBD{#@jg@+pgRzznQIiy36?2 ILXnDYZz! z(9+VBLGdRGBLf2?gAT|RknIf20T#RVd^F&3SUp#HU#9hW!Rw()J9@9Pc4`>z_|O^T zk}LelhjUMZx0Uz%<6KNNmX9Z{SfkK*HucgE9k$hhnp--1%Xa$c7hcewUAg{5?%98; H3=Gx)qghVl diff --git a/docs/icons/generic.red.gif b/docs/icons/generic.red.gif deleted file mode 100644 index 94743981d931466fd6403a80dc4d1425b744822e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 220 zcmZ?wbhEHb6k!l!IK;s49|&g7{GXO~=KudR1_oneV+Jr#{O1>vky)&eSX80_q%!jq zN-|Ov3QCi5GLscj@^ce2^Yj$FQ_Fx79;N9Ssl_@9*&tqqLuzJ;UUGh}jzVy1K}l+E zQfiTcp{1oMgW^vXMg|6E1|5+3Aln(3{XKT=`CK62xLURGi22&%H?LKSN;oNN&RD)A zj7{+T9dF5syeno$->jSG&*;OMYO`?t3LV4QtJ8%g=XgyGN!I7?Roi$yd81>RNCW@e KDqbH325SH#15FnI diff --git a/docs/icons/generic.sec.gif b/docs/icons/generic.sec.gif deleted file mode 100644 index 88d5240c3c3ee7aba7e51be6e49516277cd2c024..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 249 zcmZ?wbhEHb6k!l!IK;s49|(+%&;0*CbLPx61_oneV+Jr#{O1>vky)&eSX80_q%!jq zN-|Ov3QCi5GLscj@^ce2^Yj$FQ_Fx79;N9Ssl_@9*&tqqLuzJ;UUGh}jzVy1K}l+E zQfiTcp{1oMgW^vXMg|5Z1|5+3Aln(3b0VTHIq;y*eT9 pbHuxO``>OATea-a%QUllYxjTS@>KR}wi0z>>0oj07UpEI1^}8@T=4(^ diff --git a/docs/icons/hand.right.gif b/docs/icons/hand.right.gif deleted file mode 100644 index 5cdbc7206da8856227e36b9d8f1fe5668e162607..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 217 zcmZ?wbhEHb6k!l!IK;s49|+FOJoEqm%rs*LB%t`uFC-(gSRt{fL;*-;<|&k9q$(7Y zCgo%%E2QM-CT8a8DR`%r0VO<2(=$?wbriBeybOob%o4ri{9GM{;M9VW)ZC=hA_YTB zOH&5LpDc_F3``6 z1P@2d%A8Z(d*Iop;+0_slQ(LVa73?qy!_*&UOA1|IbCl>b_(7P3tlzje1;bjgEav1 C5>Ye& diff --git a/docs/icons/hand.up.gif b/docs/icons/hand.up.gif deleted file mode 100644 index 85a5d683177b439d3bd52a5fbe4f4b88e6b36a51..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 223 zcmZ?wbhEHb6k!l!IK;s49|+FOJoEqm%rs*LB%t`uFC-(gSRt{fL;*-;<|&k9q$(7Y zCgo%%E2QM-CT8a8DR`%r0VO<2(=$?wbriBeybOob%o4ri{9GM{;M9VW)ZC=hA_YTB zOH&5LpDc_F3``6slVT^wp$^;wzNj zocQ$p=uWvS+vn$eP!`KQ9AC&Oq&a`zGo|*%R}=iZ3~#^S+H|7K?YGc(Np|IEzH%$YO0yStg0 z|CyPYnPxMYW&ntYh-S?HW@gN0W@ctHnPvb0RaI3pGcy30%mA4)0A`s0W-|aYW&i*H z000000000000000A^uKOXlZjGVRCdJX>%ZHZXk4MWgu{MVr*$+AY^ZCVQFqIAWLO- zX>K4$b!TX0b1WchWp-(9Xh3CYbS`6WZ7d*DWpH$5ZDM6|ATc>PH2@*`1OWg51^_Go z0002s0Sp2F1^=KSj$~<`XsWJk>%MR-&vb3yc&_h!@BhG{a7Zi~kI1BQ$!t2G(5Q4u zt=2Z94c57Jbq!xrSezYad1i2Vl`geKT`f9=ebeIhcKwyc$G&!dYcqgkSA#%-MR_EJ zbY5(ce3FzZifTQ2m_Le|mzyY`jYOh`k2s}nVOo2vOmdj8t*~ISaDH2Wa&@$Wxw&et zaItv0vw_03Yrtj4nY6aX!MDTJx6W+Pz;VRQjk~p}!n}Ud+}`9@(X!gs(&;wmd!S3L z!_cGCXWWkSp0UcT1>ENDp1@Ou_~rBGgPB2j0ng~G#*l?WbG{62B1jJsMo_%=Ed+Sz zBSU8MDF2eYgHKg`4SU=Sq&9D1xIlGG`8y;2=ty2+-&Wr1sp| z+*p&)L!mrrx{P;qE30!7D_W(xwO&_&{k)0{yOM2Ii3Qo>JQ%8~Lbr5L*(ICO;i{?@ z_kvA3w_^)}KT4SJ(V0TC+XE?^m?+L z6!wPC#e7FIzNGl)+46zyJRL1}NZw1QuxEfe0q3 z;QxXQHt67k5Jo8BgcMe2;f4KGpy7rbZumrpAZqwwh#g{RA`B#!=tPPfeh9#eFveH` z02Qnlgof zW;df2035)|0XgbeB>-Q2Rc4k-Sc#*PY$D;NnsA;O;{?UP8mALmk_adjf)XmKm75k}C73-@+NhMQRIq`o ztHP+}tF*$JgqxRUS}U!63h5~nUsV^Zi(nR8sH@19ha#bhqM59%ksi5#qRPH7C;uzV z4jV0uxfYOZGEa1xB6kav8$q>~4WMoT=*kePm|BoYZKKo{s%We?POC+^<+jVhwW#vj zFTMbD`=Y?p_Ufs>d@K;A0})Wb@ErpHFaV|#Ox%K-JPNEa3LN9;F~J9Kpf3RYetZJJ zgC3kR!3MiL@DyA|q=d-{0FVI06hOsc zS~9_E=DTzWxMJ$9)`5z!CAdkL%x}aRZf#Kk7hjyG+DwaTEYgzD7D8nrR z%Xe@4V$6B_ZORB^r`d$r3q*i+cdxYVb;gE|5bE4uPo1=^fgjMF#q0B@7uW% zZVFv-=C5>-_`I(;?s(6xR{oUNL*ofK>T=tAx~VkU&AR6=vI4c!rIXBe;Us7J`w{g< zzxeF5lf5{`xm!=X(MUf(grMgd@4XO4o?Lp;qYGaA=E;)|qw~Wf5q-U-LeC+u%jKCd z(NQ|e{M1nMU;2m_HA$h*a3PZx0{!>DvdxcL3*b)ecE<(EQIL0F;@MFk01+KYm=qBOS;l2CKPYajusCb|WR(1beV-JQI)LKe30 zRT2D@6fWnx6B6N6>36Rj6;~lLf$U(+YfCvO5 z!X{ZRpP^2Ylth>%O@+x!@@tc2Tcmn4?J zdh?s$45v89NzQVb^PK2Rr#jck&UU)D6TRqDBI=rl7XMT)dAFlv~7g4Cg7 z(T++{I)qs^w4{d#g)Ig$(|3^ODD5bYX;gs?*W`3C;_0bR%K;X&B!!@d>CHfd!kKRf zHKZtU2|QR6!^t=`7)ZSiQDU-FZZOhVB*@8i_q1qD}C!6l~NeO5+|*FsL5x*x>t~*^{|KSC}S2QSeWcpqlmTa zM7B{3u|(FOYJtmN;p)-CF0QhZb&O9;yHS&@X0*ymOkU#>oU@X|t*n)(T%Gb+wyIS! zdS%Q*(JGhRp47OZWUXgaJBHpib*Hjr4QYk*Q=HVaHvg!oZd`~_+sP1hAHjkyVE-`F zt@_3@-OWZZHj)tORx32=^^SS_%2}wm7rTjAk4q1Vp8b{@u!c9x;SPKF!ypc^h(}D~jj?D*7&ljPuoRI*~1b`_& z`N=Xwq@A41s1O>t%K)}ctg;B^ddx4yI=1qTNky&&h-r*Y)>Nh9%w`!jKs6O5-;C3A zWh^f)&Utps$2xW4)EqE%xTAn_Wz-iBP~M#+<5~HxHA|u9WBf`Ygd1c zp0h0EBmo3)&-Z%81fMOT> zOEqSYl+m;RHS2g}s$O-gU7cjJi3w$slysb-?L}7T`rEqZGy!cmV{Qw3P{uYkvPr$> z+8J4Da_ZLw=H2QHFs_oTVjQFI4R1GYduH;(HMj@9>typ0)n$A(z|Wm-b&tA2R+8B3 z$W(40ZeZT@&VaoUX7N?KdEePKq?5JGK}-{z;IG1)r{6tTG&TI#52w(nwnPDQ9j)T| z#`py^zHxI4@#4~MHNO{l;~bH^4vxc`4XLY9Y`L@}Qb6l)Fup56TDKlruIc|P=< z)0@#f@AoBN)n^(b(RPDQI=Gh}NM@nBhkpii${}uKoK^jCH|+G*HO{!ak6Y&l;5)zk zPT)HDi0sJ%L!wjt1|+uSI=&Bw*m>xGy#aVt=4H$*y{X!urAYjPcMvThgC5e(h0D7L}B( z@oJyDm$yCn2VDO8*uOmQ4di>YO|bKAM-%AzzGLCb9@68tclj$FePmjP+8c4RP!2CoNwwBlen zFnjj5e9&`hN~SNF=YJ-6f_j#ML8xsrNP|iUXf+5E=i(}jS0f%Ga!FVZ4g*G7xFuZJ zG&&d{8F+uwCwW%Lgk|V-Rg!XPb7vx$b%2J3@{@&KIEPx;H*F{&q=ZV9bV_L zrL=fJkcWCGh~Hy5$N~j~h)RYC9{Tpcsmx zIEtiLil%sqsF;eXxQeXUivOL^*`2#qcEQOXgH-I$FpWgUh?RM6E`I)P_J6;`XjkGs%SvEd7Nc2iUp5;P@V zo6!wTb&z_%4$e12#bJ=y)fYBZRWQ*D{&-9CH4bAnkrY$xALUmS& z63HFGCPNHbEclt9pO$!0HlinrKN|`}ly)-#5Ti00qyDu432>u0dZQ6mC^Ob@>$W2y zN={ywCVOLR;}%6hN(wW&qyb>0(37K3ngC8(HdOX&n@C6_Cw88f zMp^oVuE79I8lz~sr1u!5Zi=HVw*k0!rATlofAelLGc;J3K4udKT3UEtdPPpNJYpJ1 zO{Z{X8V>=$0F2tGjGCql;5Rn^4lk=(A7OKNKs>SM|xOzrp z3WrD9s`m)1u{x`lQK?OOt4tcHr0|B2sHwOUgt#*SpK5cXDz1!kE{h{QXM(DKWO0WE zM6OB*(0Z*5AgxE?rW+umigK;=>Mm(BKUG+#xbrnT7O>!YD;*exLUOQbsIVmpVN<#- zsA`5|c!gyXulm|x)@rdbIULD(%N%ZXeQCo9GUAqhM^$b$angwL9@I*YMz3bi%+ zME`xbhe?nt6Y#4WptYZ}ojL%ZhiZfz^mZ`&v@8w<-F#eT#ykOSXxiri+@oXu7(pTey=ExN*3-TR6L0Vuu4Nh8J48F&hJX zYr2WxsK6V%X;U`ATfFn?y51#A4SNHNh_zAXv6+OtJPW;)B)xagiHTS?F9x>Li@nQ> zQx6-VuXKqAO1@uYzRAj->bt(|+rIAmzVI8r@;kruTfg>uzxbQK`n$jU+rR$%zyAOn zzydtL1YE!de832tzzV#;3d~qyrdisEQ0y3v+zXHYRKe+(!J?I$BQ;+d+!3EZjiq22 z*VvqPb-^P{k00{}?GhgRR7>b61(+4X!-)*^7@P@JcsLAI9SM<88JZWlJ07W8cO_Lp z9Kt^Q8fj@W8>t;hTwMcMlMM-yw~>$;5yhQ(6HRQ8Ch1is5s>;w#m)6oRg9TeHB~Xi zRfsUe54^<~wZx?9eoVoZhQL{-30{@iSd#EqedU;m$zObI$8%g$by>(;xl~i>$870W zK&e!6C72_z7R&XN@kIuOxfjj%$2#d+;Z?^|0m*gj$6?8vGg()I`Ic&Fm;Z1HoCU>| z^`*)bESF4)Rg3k>Gl3Pi99i}?%YYe}yoH;FT*~4I8J=0oEdk0N0moWF%qB(0UpdHN zSzM4A%A-{ft8B`E?92U>%l0VDza^B`yippZ%a}aLy?m6^T+V_y&EjlYANiPiEKs&7 zT}8Z`+{MaL0nfg9#;(c36M4^93DCm~8n=0y-M|xFT+o_{mA2d&5i!IHEf)-(6u?1~ z5&g^)J({T5&y!Hh0(s0AtzXVD!4O=HH$%fg2|XW7lsEj2?pRAZDjgUs!7PEamM~aq zgH$tZ!Q_~o3&y}e9n?ZS)I?p>Mt#&sozzOb)HKs#PM|+ftv~Tu0sr6Xp7oTp5+Wim zlw(J>pIJ))U>(+CJpltSw6XH7OZL6rv;kqwoPp9IVT7e!ZJ}Q+)^<(SWu0Vbjbwnb z)7}BrZr#)+vek0^Wg1$ic750ClGk$v0DBFg6|w=08rY$50ER{YXqUc!7$R|fyM}$( zy_(o#z1WORI*+|(Aj-19vZ$2(6t9PNu(|=bvm%~C*q#k(&yu*J-PZflwUV~iFIo>w z>ely)trlh3k0;#F`mGqqBAwmXN~YOAFaf&_*x`GGjt#U7YG!GQuCKt_we;Gru%_4g ztxbB;wN0U|TBt)n-PH}&`t#e`U2g2{N`t$x_dTP=E!>gn*Z-M--1J9ai(0$^VBY(! z!@gqGTpgyn3j^-`-URSAXFcEa-QX`U-16$EgT>mcJxkO(Ew7Dl6}#M%qqf_KM1NCc zx~tm|9@hM`Eql$ZM!=@z-K5g(N;Imv{_O%XrUj4ZyA2Vq25!Aj)hf^Zxupx_J@DWy z{^C0nCTBA9Rx(ra*ux3IQ?gc_#;+g9m)M7_HUA8N(1WXR$PJTsDj=M+D zq&8mTt9#(*s^9pHfpO-pXq%=(Zk^+MhEYxgY5v}8K1FRlxRK}x~j^iYbF;R;I za$CMlOMPhm>7YL0qVBRs5UERA<5nK4YHD$h+vSIG=|hw0NAQ7v4yI0<>$+a(ZFlHO zP9CN{*)oi;HIBN*UUxFS2+BSIvz`R6W2(1KhIRev)K0qD-Rt2l;EaCW%TeW$J>2+2&v;F8V-!` zP2Mw~y>N&nwky{#?7gL|(UpLHK@O6N)~@x84P zB8jDHiIe#C0pB3`4c?e*gD?ANYbl z_=I2hhJW~opZI}4jTBVEChWuu6~T{Bn;UG>5d4LG5FR^z%cSM_@yK72-@&2ZUk^;2 zi%|N_Ow#|A!>fNd&nU;BZ=9(=oiI#bub@+F?87GI#%UaoxnGd>cvLB@#Fsf&Pj#5V zMaba7`=FK38Y%p;`I$y_{IB`YegXVqJXEWR#wvZuz0Ab%92nlu$E+Ftk#NXRY5vbh zl{<;d26f5koL`R-|3u0DZmG$^DVCw+(f{;i6zts2AYg2UNN#6Yo+xRyqw2OZO^@*H zu5kM5axEzIiCDSR5jRsRhfduJ$U{<}R%ebmr8ckLS~K~(MP=fzu*(FZ+v%!!O|<=b z-*db!C7#jw*pi*xmYa_nA6y_Hp`TsP)L`M=BA{87lqy%UZ0YhP%$PD~(yVFoCeEBXck=A% z^C!@tLWdG9YV;^lG!>RIZORm*)2K_KN_9%L>eHl7ur|fG<15&K3b|&rSOEaqv}(^* zxOi4AT()lE#s$#UEZwzswGMfk*X~}68x9-@yMyqCyAl27m5cW;;J_3a(|xOWBIUZ0 zF++}g`6I({ne}d#IJj_x)T&bhIGva?WXq5L`uz-XblTb#aii5exwq5axkHM*-P!lV z9T65VZ@!@Q3fl+Y?jT*-c!BKN3mk~t`#0JN;>S;5EPeX%wcslV5b)r=@ZlcI>`pJ= zG~(sXnYTuKz8`hf#rGX&+y7}dL2DHxwjgW(OkiLE3o58!gLz5FphT9r_ud0&T}UBE zJIn>yhoOy<-+uhL_8&a~LYG#F1wx2mSPedCV2v4emg8c*aR?uDUxg^*Y!-r*+zR^b z7vyU?zIXzRN9qV+0SKbyoQatD^&pp3R*7YW063Qxm`+x}0Gep3Rc1y~*4LSs&1ETx zYf6r}B5Yp)u;-p^Vz=D|fnLyEoD0lZ2yc8AdZ-(IEudg@&n*hunQ1bh=%j7B2_B}M z%9$LBDfU+wi|+&orKij>+QwOc?s-6X9a?q>*%#!SXRN0?=5BR zu+<8CkzwhwTJ4R++RF@L_2TIys`85aP`2U?YVHNuYB2CvwjwMjygC}%>z*9$x*&ZG zGYMA2f*Ceqr#BYRF+_E)rrM}Y_V^;7&oYc2pARQ|fCUTh`$TOC>s&6noEZvVyNNk< zvk-|gOY|McawamBBhTw>k|{nHZM@aKOptj9M^J$UHD3*&yq+Rm^sMc22<(1i({O57 zBzr6*UQ9RrbjhJE`R~g9x~=i6gqc^eHhANG9*hg=)>C#Of zNcTf^N}aN_>Hiq5Z2NA5h5#Sx5ec2@d+kmjP|J?{12vyLh9 z$yaYGpQpQDbIsUKiz}oj@Cv$5sTQIBN8l$O8gaHeCR|aGVyo)s+SIj_{1gl z&<6g3TmSaHs6B#+kw{?_V-&qu#xAyiEK#Y*8poK%InuF?cDy4V^Qgx?^0AM8{39R( zDab(*vXF*6Bq9^3$VD=;k&b*MBqJ%wNm8a5RA+fy%c6C`auXV(jl8A!)8OGSqp)98xBy1(QgMuE&?go4(C0MkIg54r0u|}VhBwCv&}t@apxrF!KJ#IOg#Kco_Cjbd zEB^t}fR19K!7PSF4~h&+kdzDKv}P!%5ejj}fD^}b20PXO3Pfz98#0xGN}*xXG2pZl zm&gZCS8CFE@-wKY$mvgSSPfTf0;T|QDpG3-k1^rPW@)v^**9&)AY*ltQqyv8)Bir}kATl!b9niU;_-K!Vm7-0PRtqkyM+a))%E+ zEkIg}h+`U}}^@l7D4fj}73Lo5$+$i{Z%QjSUIN zB{t2FeY`^l`)PX~&To@V^JIB~LBBUfr9<*UM&a!4SQ~!C$Z*Gm7 z^ZemRfBDXS{xhKYN#Kvcanp~}7y&{pYEd(qGXY~+ski)SIy+j-R;IL=EloyGUpaHM zmbEr-t!MU$XVjt=50urZ=(hP6(KdbbtG(>$O{==nxQ?lV>(%U7Kl`B3=Jd*ZJ?d2V z$Zshjck0Ad*5(Y_P+bg zZgpFG;P9rCylXvcg9{tK+9q|l)l6(|JImjY1~{?>9&mK0TjS1dcfmgnau_;@(DwFT zzLzm<+ff|P{`UB)Ieu=8V;bGkrui3P^YBo&oNrGmHw$x}aad28=>HyO^^`{*a%vOY z-8qL1p`&i-o|F0K1Wvi8hu&$e%RJd#S2{cl9%(dI=*%AEH;jvo^l`_T?evQI+mqgQ zrqfv#{^~EXv92YH>pkl;pF6YLRCK`~T_delIMi-FnJE^riql~{5FHOSITtz0mFM#1 zfn51&{|?)4E2EItXn3%*xao;McuYy(dDDZC^&EaZ>|-zc+0(xEw!b~@bFcf|^S<}K z|2^=7FZ|&Xzxc*KKJt^V{N*#h`Oben^rJ8R=~KV@*1taXv)_A=K9iz>b!Ksni8N_y zPyGH{rtHjL&Lc!NukVZ}G-v3`i`t@`?0jxv^FQ48^B=pDtN*M1C078}T^is6LtxZb zsS#RT6lguvMxmYp>Hw%iAOkJ9UIb$Rkd|lpm0LNLZ&B4Q)==Tp5?Y}V3IZA?p-G+L7RD7N zJRuXFl^N>Q5w2nV9Tq{&;aRbtIq~6QX_OS=As3cmBD|Gp8N(pHVROY{B>-YqIpR-2 zVlOOWAmrc=9-wR?U}#z3Ygtt%ves?wlQ!(2I#5cHW0^vSn;A`pDLE%C(tRm4M zB4(YSDOQ(dIg=s$6)o~0b$uT&E|+o%AXc#z{Mp|)pwlv@#Gy!+c4e3U`BpT>mM}U* zo9LpD*#ZHEp!R(uIEJG*jw3miqdA@?$oO$dhMW0olZ z1fXO_X4g<+L$|bKnz@*f6(w{nkN?kq=ecSX3t3(E(*pUgS$=R!qjC zOUlVp9$r?~!^e$YRpt+`YybkRKw(5#)p?j)o{yDrr3858SDsc)9@O;6iR9rN;&qV{Q^+=69OKXx(kKrX|W~PY^rdKkndfQtTMr;Zs zk3q?)*`{o60ByF~UfPy$vJbVLMcUY$=e6FPZD;8b=K{6mVK~}!VhfXa+toFkfkmg< zsbqCZWrDOM zj7fPm6nLHh&czFvego#}DxbiKZTYo)Otu zXoZqbh92jCrd@&>4|GBbU3TMwT4#?{fJ+k5hL-4za_5nLXOfbckhWw?-e^hoC}&iF z0^HA&dFXvI<-L5^qX?;$5-5@$W_~WIl8Wg9B~Xi=5Z^UiVhm_{y5~lqXt;D~dyZ+0 z!suF3sF})Uhwf+Iv8kKBDT#3eV-yBl)~TK5sf>E(qR!h~z8RL{%$l0ozD25Y5vqSV zsi1})qvENFiejg7D5UynpWW~;VtE4Oy5 zw|*{8lNa`1Fz!PpM4~vjLqN=l`$cRrPS!5Eq8##~L7n2pE}##R z;HsEHVriB;g%rqs6cmVG6$S$aN+SwhpaiCD3|807x}Yl#mdduG3u<7@!sO42EX)!u zGOC{@EMZjTqA${H$1)fNdF|4&;%srk z7_wB-R+QETVjcG2R)K9e4dT;QZ6k2)N_{OXN<$<#);6_mGWKm%;np7lE;b2n781$d zLha$I6=12YiYT@$UL-a0{Agn_3QsDExVlQ%Ua5---^e#%IAI3T(NnFeLN$fQi*GcT^rA}k= zzAyZGQE$cKF={M}(f_Zz_OJi`F8~Ly01q$$7q9^zaP__8d|`$0Deyd!#R69aRJ>U~ z`ecE@;~m+jP23{}tI(5GFrWGt2v??q$wonnutavmWn_o2j!+Z2elk7Q>kk|1b&QF_P%@+3>(-Z$1x?IjNjvXBCg=ER)faOd1R4axMd>ZhrA%s7f#&h=777 z0Bt}R1F|bCvuj#0HLG(7GnqRp=UA#rI+N8MMa!t@P_htbb3b>r3Cv1R^9>Lgbt02AV!yOvt6Y}Jbd)wUTzBb%7B(C| zHkCESU?`d;=QbuQ>0f`flgzVo$O>e)(T5FnLQ~H%vs`1hP<<{pB+n`AkajBHGgRC* z58QHog0@#jhhT5%Q7%BZgtv5iaF2y`Ry+6n*w0!6-EfmY45hXx_ysS^3VM5RT`Q!5 zaR209=eC!5+hue`g*Yi;$To+58-YJ6Yv<#{wYLEjYD>CyYj0|G+j1rEcA0j!TUV-O zL%14CI0=_(gdezFf;bYdaA$|nRK)3|hWL1^>07gSeVDx1=>ChF56IVpqcog%Q5PdSxWxs_izmS?$^Z#kEDxtD)A zn1{KTk2#r_xtX6iny0y%uQ{8yxtqUv{GM;7)uO)g7Qqsu!`|ySG^{VKFCXNq!cLNj z3_AOQVf(5?_tDecR>S!Upc^VWB>@x*qT*-i0m)+Q$7%u6E|pu|EIWN{(So}B-v5H} z?rf!xY|kFz3|5u`in=0p?O~Bss8^sR?QH9+dJXb}=dNuVHr3=#E$qhCAN&E{_5l;l zBCH#G>2|N>3L(~(ZT$iTD=hEv`XT3jIu{_~A?EGs0{i5$l@N*`Uv00p*A%ipqOZ^H z72@FdZf+)S5-2G9BrdzIUoEe{6jNcYwxl_#%ERpZLXQ2)|54U!y=YUVT4V7GGjSB-7`Ncp z+ylS`kUc`cN=pt3Vch-M^HJKXJ?pT&dYkdvv$b~!emw*V-9L=o-#r|~inkyPtYpC7 z>k)Mva^1ZJ;oHv~&(X^1$s+F=w=n+WLk#4jlio`{D#^U_kQX-%fTGX>aYF+xV|hg#!}NYLw{REbL#EqT{V*t#5}(5Uq82CwV?Dp z@$3BoWB`LFk^r$;Uq|UxK0l03aOa~L`fJnN_rCRGf1vyp-*-RjhyP0k*9PmrvNA*xy%}x zhXb_hy?DKgOy;IdtJmzddsLVlU!swF={m}M3*=o})bpoAv@v%GfHs)ZB=sZ(MTNDf z!WGsf76x^8Hc9yj8hQsuT1qOqk_S`N=ZDG?=<}*lSahg3yEU~76XkoAt9$u{*>zTi z8?3wxYU*6NtoqW^8sixpTg2?L=W~0F+GO=e{tFH&o;g;0aNNlZAOBbPY&sD=*YgdZ z9f*&JDA_AZA6abPrkK~^S%LU|M`=AbtrqsEMI?)3cwI7i^Xe*S_<1L;Z` z!79BBMw+;gn7U17YQnULGiQl9a^~=acT!)-n>uHmL@6>Hq+U#`5FNAu6EQLiAWAHX zHS5keheUYXmd}Wur&>Q91({T7l_)I9k%cPtK-FUq-$aX6g%|o3ror)DT{k| b@W92JKaW1W`t|JFyMGTqzWn*9LI40ePu4mb diff --git a/docs/icons/image1.gif b/docs/icons/image1.gif deleted file mode 100644 index 01e442bfa92332ec1c6f6a3a1310a41da8be5cb4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 274 zcmZ?wbhEHb6k!l!c+9}?9|+DE|4&Oh1EkNKnF$1G493RB3^;(|KfjQS%wmPaq7nrl zm6@kdl98%VP@0sJnXHhKpPQJOr>EeZS_YKxC{52uE!I)U2Jtc+QZq~RlJj$Q6oOL= zN>X!^Qi~J}EiFwM6o0ZXGB7YR=zwelxr%`$x8Q`Q<}TB46{|}Ro;FH4vD|TwVqCRu z(oHG-o-GnG^BH|*TNeaW6tnVAVoo@j5?96H;J7r$On>@QlgzzoTd%A$K6Qt0Rl^Fa tT+{HAkBVmGwl?ql^5gHGE#Ge!M>NIeRkegTICnX-n>O`N&=O>@1_0HcVjBPe diff --git a/docs/icons/image2.gif b/docs/icons/image2.gif deleted file mode 100644 index 751faeea3644ec77fc2758b18522443c86e11e88..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 309 zcmZ?wbhEHb6k!l!c+9}?9|(+%&;0*?=FFLyGiRm&0Rw}vu`$EUGYm708H|BE6rlLe zFC-(gSRt{fL;*-;<|&k9q$(7YCgo%%E2QM-CT8a8DR`%r0VO<2(=$?wbriBeybOob z%o4ri{9GM{;M9VW)ZC=hA_YTBOH&5LpDc_F3``6AFlZ-6WvSM=7VP{@&>xS8Bwhc1-A7qQa*6llSbi$3t0`pjwvYB~D2%9p5teUK9 z!JHj-nw2N%{)ee19sAhWn7?J+(8*}hLs;X|rU4J$iGeWf`wdw5G*d!uZZa9_W^ ocG{GwRjPF}8>Y#Xb1hynfA)0M4)%aGYyBN0JvVI*5@fIj0DN?8ZvX%Q diff --git a/docs/icons/image3.gif b/docs/icons/image3.gif deleted file mode 100644 index 4f30484ff64db93ee44ed0a9ad7ee2ddee74b3ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 286 zcmZ?wbhEHb6k!l!c+9}?9|(+%&;0*CbLPx61_oneV}_Y$7-kwX7z24&fZ{*Dkc`Y? zg~Xx~1t67~r%;lSs!&jxl#`jPkdmL9n3<=i;GJ3ql<+7`&qyuSQOE}IG8|GfOZ1ZS zb9EGgQwvH`bCXhw6bvmbO&Jt_vM@3*Ffr(WYy-K9fu(Z83D4y_B18`CzVBL=8|T?3 z8Cj-fRpz22to2}(%Yyfw7ys+~3he!($l^D4LHYfmjv4i)2j@WJuw z(xQEj48%`M?cSeKc2$dA;a$a_s7`|)|JgXI)5;nenzd@X8XG%`OT79!SOcd{3$T;) Lm^~+0kii-Nb17t& diff --git a/docs/icons/index.gif b/docs/icons/index.gif deleted file mode 100644 index 162478fb3a7f690884b1527488a27a9d34ab497b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 268 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIWz6de`8}~1{hHM=NFQZS*(y)RH6W+GV>Hl zGEx-^N|SOjlND0(a}zW3^c1{P%YYIdrRf=|#X1VvAYO(;YG#REa(=FkLU3w9NosCV zYLSAWrKKr@;!hSv1_nk39gr0u+ZmYaJ$CK+XdvLQdala8OzZQ4*F%+d^j>G}%y8WC zp)<%eSG-8|P1Cu@LU&KQy{J}XRik+(=tTM=GYuMB5h}jym8(tr{ zTHty08q@pqX@{qpFA8HkpSQf;)z`l$D#)_MC9vJG&E2N2-g4rU9X0k#`er{rBo}PktY8g<%qclAuwOB_X8^p_SNX;zKOU}>LQ3y^g zC`rvtN-a__w6rv3Q2fcl$iTqNpaZfI}mo*BX ubMM=^lVvk>^@~}aS-AV^f3&VBD9tXZudR+|59;m-w3jTH=pio1U=0AHb6^Gl diff --git a/docs/icons/left.gif b/docs/icons/left.gif deleted file mode 100644 index 279e6710d4961d7644ea2e3e39e6afd300147aa8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 172 zcmZ?wbhEHb6k!l!SjfQe|Ns9p|Nk?9f#N^Ekc`Y?g~Xx~1t67~r%;lSs!&jxl#`jP zkdmL9n3<=i;GJ3ql<+7`&qyuSQOE}IG8|GfOZ1ZSb9EGgQwvH`bCXhw6bvmbO&Jt_ zvM@3*Ff!-Xz@**Nzw-3iM{+%$5nXSNI_AHs_0#Z5ammWC>ec*qNb!1QNo>>3 NI{94w6cGjnYXFzvI#mDw diff --git a/docs/icons/link.gif b/docs/icons/link.gif deleted file mode 100644 index c5b6889a76d72a1f052d2885a725e7065344ee9b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 249 zcmZ?wbhEHb6k!l!IK;s49|(+%&;0*CbLPx61_oneV+Jr#{O1>vky)&eSX80_q%!jq zN-|Ov3QCi5GLscj@^ce2^Yj$FQ_Fx79;N9Ssl_@9*&tqqLuzJ;UUGh}jzVy1K}l+E zQfiTcp{1oMgW^vXMg|5Z1|5+3Aln(3b0T)_`4k}HuzIfQzD(=$g4aWpcJy9n?OYMK z<3neVTdwpcAKpI=-d5i4k8cuSl8s+i>=HJ`A>=Y=gWs~oHDEJ%$YOO($b8LjTyi|@tVo`|#kjl(c zD9K1wC@4+J$xK#A$0Aq je4J*Rr#@1aJXdjR@wJsoZ!aBYW^HV0ZfO+YWUvMRZ1!36 diff --git a/docs/icons/p.gif b/docs/icons/p.gif deleted file mode 100644 index 7b917b4e91e8004d40241f2c031016f3cb414caa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 237 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIn&tKm;nhW{__jT$ShV!EGkg|Qki)QB^jv- z1*J(jnaK(%`MHUid3p-osbxS3kJ9vv)M6clY!ENQAvLo^FF8L~MXnDYZz! z(9+VBLGdRGBLf2?gAT|RknIf22^PEdd^F&3SUp#HU#9hWLHC{`p^eh6ea~4tRaf(| z_%3JAe*U`SyKG~C!;gtpQxXFgX({TuJQm*75*apCqqytJp{nC4Q*X#X Y_^R}pPJ1}};XQE`%{%V$b23;10Di_)fB*mh diff --git a/docs/icons/patch.gif b/docs/icons/patch.gif deleted file mode 100644 index 39bc90e7953103a7fb4d6dbbd3efcfc1cc8de759..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 251 zcmZ?wbhEHb6k!l!IK;s49|+RY&iwyBbLPx61_oneV+Jr#{O1>vky)&eSX80_q%!jq zN-|Ov3QCi5GLscj@^ce2^Yj$FQ_Fx79;N9Ssl_@9*&tqqLuzJ;UUGh}jzVy1K}l+E zQfiTcp{1oMgW^vXMg|5Z1|5+3Aln(3^CEWb`4k}HuzIfQzD(=$g4aWpcJy9n?OYMK z<3neVTdwpcAKpI=-eOD+8f(7P$v8QjjESn*)KFqotJLnbYDxf$LnDLk)v8Bb)9>m( q*HL9Yo3!quRNC&zr)@sV$^5d;vQo}swQXy+(HAuD>9yx%um%8r)mtS1 diff --git a/docs/icons/pdf.gif b/docs/icons/pdf.gif deleted file mode 100644 index c88fd777c4b2a85b930eb4a6b68440c88536289a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 249 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIn&tKm;nhW{__jT$ShV!EGkg|Qki)QB^jv- z1*J(jnaK(%`MHUid3p-osbxS3kJ9vv)M6clY!ENQAvLo^FF8L~MXnDYZz! z(9+VBLGdRGBLf2?gAT|RknIf2ITpM2d^F&3SUp#HpXaXk2Sl>&JZ}wU>twhgl(8#J z&4;IaU+5wAJaJ`3 kwKt!oQbM;s-=_PA@BRCyb&avi?yYTZ7J^Yx{G1Hd067U;U;qFB diff --git a/docs/icons/pie0.gif b/docs/icons/pie0.gif deleted file mode 100644 index 6f7a0ae7a703000c365896477c32f9f1434d14ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 188 zcmZ?wbhEHb6k!l!SjfQe|Ns9p|Nk?9f#N^Ekc`Y?g~Xx~1t67~r%;lSs!&jxl#`jP zkdmL9n3<=i;GJ3ql<+7`&qyuSQOE}IG8|GfOZ1ZSb9EGgQwvH`bCXhw6bvmbO&Jt_ zvM@3*Ff!-Xz+~Oizw-23{>3JXu0=Fn+uq4rbVj_b$!S{Jq*b>ox4e@+uPSrG fY~A@idsi_sTAZ5D!6YVVJJJ1GWyGRRCI)K&$B{!c diff --git a/docs/icons/pie1.gif b/docs/icons/pie1.gif deleted file mode 100644 index 03aa6be71eb2efded05e937f1ad79549ca2d56bd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 198 zcmZ?wbhEHb6k!l!SjfQe|Ns9p|Nk?9f#N^Ekc`Y?g~Xx~1t67~r%;lSs!&jxl#`jP zkdmL9n3<=i;GJ3ql<+7`&qyuSQOE}IG8|GfOZ1ZSb9EGgQwvH`bCXhw6bvmbO&Jt_ zvM@3*Ff!-Xz~tJ~zw-23{>3JXu0=3z*v`4OaPFr@>FpEKG8&zNm_A7^cehR7 q{3odT-{ZSYE(_O7ykRZyxV`aZjoH-0n$0tdUlfJ#w+AvXSOWl+b4fP< diff --git a/docs/icons/pie2.gif b/docs/icons/pie2.gif deleted file mode 100644 index b04c5e090868dbcea50043700d52179ba99e89a4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 198 zcmZ?wbhEHb6k!l!SjfQe|Ns9p|Nk?9f#N^Ekc`Y?g~Xx~1t67~r%;lSs!&jxl#`jP zkdmL9n3<=i;GJ3ql<+7`&qyuSQOE}IG8|GfOZ1ZSb9EGgQwvH`bCXhw6bvmbO&Jt_ zvM@3*Ff!-Xz~tJ~zw-23{>3JXu0=3z*v`4OaPFtZ*%}klI+l54ZqwVk=`G`N qqqzCzcVC|^a=f79z@jnzl=39bRIB-cn#w!p?CVf&?+9dIum%8pzDGL% diff --git a/docs/icons/pie3.gif b/docs/icons/pie3.gif deleted file mode 100644 index 4db9d023eda78f499c5e5efb7d6739d0d450652d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 191 zcmZ?wbhEHb6k!l!SjfQe|Ns9p|Nk?9f#N^Ekc`Y?g~Xx~1t67~r%;lSs!&jxl#`jP zkdmL9n3<=i;GJ3ql<+7`&qyuSQOE}IG8|GfOZ1ZSb9EGgQwvH`bCXhw6bvmbO&Jt_ zvM@3*Ff!-Xz+~6czw-23{>3JXu0=3z*v`4OaPFtZ*%}klI+l54ZqwVk=`G`N iqqzCzcW*N`uLwVHCM7ial+@(%Il4wxJnexD4AuaG3PW-L diff --git a/docs/icons/pie4.gif b/docs/icons/pie4.gif deleted file mode 100644 index 93471fdd885b4e54a6ebcfb68fa98626f3d43d75..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 193 zcmZ?wbhEHb6k!l!SjfQe|Ns9p|Nk?9f#N^Ekc`Y?g~Xx~1t67~r%;lSs!&jxl#`jP zkdmL9n3<=i;GJ3ql<+7`&qyuSQOE}IG8|GfOZ1ZSb9EGgQwvH`bCXhw6bvmbO&Jt_ zvM@3*Ff!-Xz~s==zw-23{>3JXu0=3z*v`4OaPFtZ*%}klI+l54ZqwVk=`G`N kqqzCzv6IghDLmwE@Ojtg`DD^c7sH|;f6tbO23!o*02@O^$p8QV diff --git a/docs/icons/pie5.gif b/docs/icons/pie5.gif deleted file mode 100644 index 57aee93f0707a6fea58637c351c4ac1dae6459cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 189 zcmZ?wbhEHb6k!l!SjfQe|Ns9p|Nk?9f#N^Ekc`Y?g~Xx~1t67~r%;lSs!&jxl#`jP zkdmL9n3<=i;GJ3ql<+7`&qyuSQOE}IG8|GfOZ1ZSb9EGgQwvH`bCXhw6bvmbO&Jt_ zvM@3*Ff!-Xz+}_Yzw-23{>3JXu0=3z*v`4OaPFtZ*%}klI+l54ZqwVk=`G`N gqqzCzdnff4?UOy9X2Yes-Xz+~Cezw-23{>3JXu0=3z*v`4OaPFtZ*%}klI+l54ZqwVk=`G`N dBfa+_^}iWi*Dq8}v{CBqS-80Up#c|zH2^Q-Xz+}3JXu0=3z*v`4OaPFkWM->GJsune#*ygc&t5eqP cin@0;&wnp$nZ|PQtB_G$pA6d$4F(2l04BFX#Q*>R diff --git a/docs/icons/pie8.gif b/docs/icons/pie8.gif deleted file mode 100644 index 59ddb34ce0f42f40fc010aa2bcf059d891fccadf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 173 zcmZ?wbhEHb6k!l!SjfQe|Ns9p|Nk?9f#N^Ekc`Y?g~Xx~1t67~r%;lSs!&jxl#`jP zkdmL9n3<=i;GJ3ql<+7`&qyuSQOE}IG8|GfOZ1ZSb9EGgQwvH`bCXhw6bvmbO&Jt_ zvM@3*Ff!-Xz@*dDzw-23{>3JXu4R1A-L;ud>%okkhl!IyUaie(+qXfR+ave> Q)*p2%lMkH{VP&ue01>A?od5s; diff --git a/docs/icons/portal.gif b/docs/icons/portal.gif deleted file mode 100644 index 0e6e506e004caddde40da13470f5b566c4ebd3e4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 254 zcmZ?wbhEHb6k!l!IK;s49|+DEp8*m;Fw=PE%$df<#taM$ivRpVGBS%55{pU{fK+Cl zLP!lN`jBehsZAsfWYa7fK8(M!(H)lmpeEhtIN zO-e0NFtoHZWl;Rd!pOkD#GnH-odIM!19M@xy5abNeolJ^dKQ(i&E!y0oZhYAIz1P__bl`CXaRbu>JEQyKU^X{_%FW>4o vqif4-qpv>D{n{&YXnDYZz! z(9+VBLGdRGBLf2?gAT|RknIf2=@z^8d^F&3SUp#HpXaXk2Sl>&JZ}wU>twhgl(8#J z&4;IaU+5wAJ;6lrj$UyQTKrXC=eAut`Q_@GqDYq{i?eZ? fuRb@A(YSxvky)&eSX80_ zq%!jqN-|Ov3QCi5GLscj@^ce2^Yj$FQ_Fx79;N9Ssl_@9*&tqqLuzJ;UUGh}jzVy1 zK}l+EQfiTcp{1oMgW^vXMg|5(1|6X33?SPXnCmij?fGaR;jntH+P+NdaQBLW*w$93 zLXW4dLa(j`>C2pYt0=I?YR#HS>z@C9sN+1ND~Ts;Qmd-42b05628YQhH#GTgelWA? zX*zt-Xz@**Nzw)%~qgf4szES6oR(^g_8+4;}QR+O8Rat3Y55;}UDY3n~ OBkprQ{}oXN25SJEJ%$YNdjg1*#K=GenNJeI{LSj*g0+7ngQz*$u zRVXM;%E?StNXgGl%*@kM@J=lQN_do}XQUSEC}e|p84jtLC3?yExjG8LsRbpexk;%- z3Wk=JrVNTdSr{1@7#VaxR)B10U@n!|b?2W!n^SiVYewRG7AFm!*eRWl9lSzTtP=4S z(YLfe5`E@s3_lC2EJ%$YNdjg1*#K=GenNJeI{LSj*g0+7ngQz*$u zRVXM;%E?StNXgGl%*@kM@J=lQN_do}XQUSEC}e|p84jtLC3?yExjG8LsRbpexk;%- z3Wk=JrVNTdSr{1@7#VaxR)B10V6O7mwdbROfWzv!D*H06&kJ4;Roc;eowd{9p;(CH zi7%4jOn=^)>HKMOOmxr@^Rrv9(Zj|os#X5-Q4yu|;5S>$t1~+pUK<~i5YtS$=vU@u yeU(L%F~&2zjqBi^) diff --git a/docs/icons/script.gif b/docs/icons/script.gif deleted file mode 100644 index d8a853bc5828cf534c4c46a0efbf4b1d7d3c52fc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 242 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIn&tKm;nhW{__jT$ShV!EGkg|Qki)QB^jv- z1*J(jnaK(%`MHUid3p-osbxS3kJ9vv)M6clY!ENQAvLo^FF8L~MXnDYZz! z(9+VBLGdRGBLf2?gAT|RknIf2sTRBTd^F&3SUp#HU#9hW!Rw()J3?6|OcFmLXwbvQ z;yXWN*R#T&@77%j8VV0WP6%GqkhE;|xp+C~4`X#h&eoZ4tM=c%ZhDQk{(Ri#ES<}4 d7Yj^x^9CF~_};qCSmD=yXLEt#WPVNtYXEP%SK9yp diff --git a/docs/icons/small/README.txt b/docs/icons/small/README.txt deleted file mode 100644 index deb96702b7..0000000000 --- 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 GIT binary patch literal 0 HcmV?d00001 literal 129 zcmZ?wbhEHb6krfwSoEJkQBl#*&@d`0s->l+r>Ez@fddR+p!k!8k%57gK?lSGsbyex zi`aFC_kd@D&y?=4?(Pes3MEI<1Y!g8G%~jxUU1@6RIiH;$6BEo^BN2cqBwk-7hXtI c(vnrUxMBN-xh<~83yn{BaU>KdGcs5M0L&38p8x;= diff --git a/docs/icons/small/binary.gif b/docs/icons/small/binary.gif deleted file mode 100644 index 995f79b9b10d5a49fd6e6d9f641d3bb65cfffa02..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 134 zcmV;10D1pMNk%w1VGsZi0HXf@|Ns9vIXP=4 o#kZK`47H){6`LuGH;j-%Jne!zs_mH6LPMOYA{Q)|S&IY!JF>VnX#fBK diff --git a/docs/icons/small/binhex.gif b/docs/icons/small/binhex.gif deleted file mode 100644 index 3d54a5458e6edfde1f60b8a35d549e3af1552ffd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 131 zcmV-}0DS*PNk%w1VGsZi0HXf@|Ns9vIXP=NV?p<;}t+_F|n1vIhdG61y)fInX+{xz%o-MD*`-pgKX5xCVZ_5 lPsPf~hJ=DqCWLWTOyuOYZ1$d>Ba9hs3e#^gj&X!xZAVnu4@CeN-d>06V1HFU9}> diff --git a/docs/icons/small/burst.gif b/docs/icons/small/burst.gif deleted file mode 100644 index d882ceba9cbf05051d5081f2e102ebff5f24edac..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 128 zcmZ?wbhEHb6krfwSoELaz<~priULty691oD&Y82+%PWWh3>1H|FoGC5AOfV8f!UQ~ z*PVX`hZb>6bP*BCs6S}H;Vd99C5S^ubKfnY9r=Gl6W4NkFT36}`PFx$95FVrz#Gvo Z(|nHUXljWp;?_Q1GLa!b)18UI8UVh_DDeOQ diff --git a/docs/icons/small/comp1.gif b/docs/icons/small/comp1.gif deleted file mode 100644 index 712f36afdb27370918ce1eb008be6073aba769e6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 130 zcmV-|0Db>QNk%w1VGsZi0HXf@|NsA#l$5~0z$qaZT4Q55rOtD`-T(jqA^8LW00062 zEC2ui01yBW0009=D7xJKFt$LdB@lxJ4RqIg#Z8m diff --git a/docs/icons/small/comp2.gif b/docs/icons/small/comp2.gif deleted file mode 100644 index 7759eb11f95a4bb3803ca55eae6c3ff8fd100b96..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 131 zcmV-}0DS*PNk%w1VGsZi0HXf@|Ns9O7#M_vgsrWuz`(##T3U0)=KufzA^8LW000C4 zEC2ui01yBW0009>NV?qqFg8)DEpK4KIl+xqbkqNgD~s^aKww; lWe8G`jyjbQNm3FtI?)idj0B1>qD63^77l^1cw9^X06XYXE$jdQ diff --git a/docs/icons/small/compressed.gif b/docs/icons/small/compressed.gif deleted file mode 100644 index d3b156072ac0b62c0248694d2d05791379e34927..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 128 zcmZ?wbhEHb6krfwSoELa|NsBl+1YdE%sFu2!277EYykl;1`tsE$->CMz|5cn;(*jL zFuPjpx+AC8q?t7P$~sH6D{%rMQ(HBiPS!|-)_OUXyj2ijRTh5h@?e)dzw#N~vZiai c6)G%M%rgTM8yr{}o0lx>>ev_S%EVv|0H!@EhyVZp diff --git a/docs/icons/small/continued.gif b/docs/icons/small/continued.gif deleted file mode 100644 index e1c9f2cfa68034f0439e336d3b3903deb44a0883..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114 zcmV-&0FD1gNk%w1VGsZi0HXf@|Ns9vIXP=|;7%PM|whF~X2*V%{U5E|8iMaEOD$ U0n_;{NXL`HRB1Y&&_@CQJD2_|n*aa+ diff --git a/docs/icons/small/dir.gif b/docs/icons/small/dir.gif deleted file mode 100644 index 7b37b099177d12b3f6ee7056c03d992b09e7fee1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 132 zcmZ?wbhEHb6krfwSoELa|Gl;U@2op;;J}Urwc*~@+N!b)V4(Pug^_`Qi9rX%1F2&GNR2Uen0VOOkQ~&?~ diff --git a/docs/icons/small/dir2.gif b/docs/icons/small/dir2.gif deleted file mode 100644 index 425d6e4b77ceb7ba16ded08c4915c809acf69c12..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 122 zcmZ?wbhEHb6krfwSoELaz<~qrvy+Q06{i$?9a~$xbV@b@7%2W^VFWRBKmt>yewCRwrrVbz0%P@q&p!pQbR!HK;_&hjwjs0n_k|_ba-tRk+Il!xvcWvVE3&b1Cxh RG|&8^tTFrSX;&r&YXB6~L|Om< diff --git a/docs/icons/small/forward.gif b/docs/icons/small/forward.gif deleted file mode 100644 index 2997466eb4de77500cbe27060b1a590f251102ab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 125 zcmZ?wbhEHb6krfwSoEL4($X?JJG-Z+=fHsj=gysDfC0syEQ|~c%nUjp0gze-W+#hX zTmETtFwSL&2y5Nl=5irbM5W{Lcb21_)0{VRxK0$bkc%jd_Yl5)#{CVW($PnOg`QH9 VToX4n&1RWCdxjo&kqQHYH2_QCMz|5cn;(*jL zFuPc2E&As#5ERnD*ARJtfp=NqymCk7r3mVwz!V%Hr- z1E&XvCVaS5R(RiAy>mgUql=e;(y~pho8&ujXu&V@o)YW0l^; H!e9*mJvSwK diff --git a/docs/icons/small/image.gif b/docs/icons/small/image.gif deleted file mode 100644 index dc3d95ced763c4a905d8ceee4b2550e2131fd42f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 126 zcmZ?wbhEHb6krfwSoELa|NsBl+1WikJqHdPcpnwjl5F_?nk54RgW^vXMg|6E1|1+9 zs8RsPcDC4c=iE~pb*_oUQ#(Fu98;_~oS3sjVNNUao_t9rW#;4UEG%bvrx?u3by&?> e&3OOfw2*gItqmas!g_N~w>q49yG@Lf!5RRR*e}ok diff --git a/docs/icons/small/image2.gif b/docs/icons/small/image2.gif deleted file mode 100644 index a5c40f15508516b54f02ecb77b9995116dc11308..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 138 zcmV;50CoRINk%w1VGsZi0HXf@|NsBMz`*}fQUH4)0DHBJjFeJRS^xk5A^8LW00031 zEC2ui01yBW0009|7`oiPN}S-D%%k z#wa;mSK3`9k(pCGM`QUUra7VZmHVu_rmbdA-1QFo2l NCU4lW(}RJ*8UX)gL+=0p diff --git a/docs/icons/small/movie.gif b/docs/icons/small/movie.gif deleted file mode 100644 index 7b4a42e7a0eec8e4508903e9bd49cd966e966e21..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 134 zcmZ?wbhEHb6krfwSoEL4($X?JJG-Z+=fHsj=gysb{`@%u7%2W^VPs%nX3zogKx!G7 zy*+mMeAYkV+1#MabHG}Fse$nzdz^H8ru>rzC6{fBxi)IB^anlsy)r`O#>SQkwF`?k i-+B_~9;vx~3vcGG7n{Cov&^1%&M%y6veyh225SHs|1u2# diff --git a/docs/icons/small/patch.gif b/docs/icons/small/patch.gif deleted file mode 100644 index 100484e59822e79e22ab469fecd4a39052a66875..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 182 zcmZ?wbhEHb6krfw_{6|qX=$0Ao!!&ZbMD-^=g*)2|Nox>3>1H|FfuT(F)03%Nvc%v zO)M(O%+vEON=(g7EpqTp&d>|?^VD-mWzYes2AOpTmr2ad8N2S7sdgD9bMoA>*d;jA zG*oa~#%+fN-d&Iql96D6GMaovr)0~p+w&0R?vcik1 Ky{BB67_0$$w?x1I diff --git a/docs/icons/small/rainbow.gif b/docs/icons/small/rainbow.gif deleted file mode 100644 index 8216b89bade87b795a7345329da487735f3e07eb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3811 zcmX9*2|QHo+ddH{AxoAlA=?Pq8Eb=SjP)JMn6Xa`Ml#0M*kcR^Nimp;vQxd3HA&gG zP{>{hMJ1K2r{2-6a=6k2nDoQqb?SX0=ifo1OVxD)*A%?C=kWsLqNg*gMnlaOlHxTOc20< zz!KXE2Y^c~F~0BUQJ^eB8vwL{tO*bUf-x+@CIAvQ*$SYR z&94POIgkkeEO$8&lw%=q08CD13E=<$2jOfb2w@M|2>=kr4#Qe70Dyr29t80$Py)OL z0M|f30t6+1A-3%hJN6ulhyTQ80pJ`vHvpD`bO4}(pdgD20D>TzRnZ`bW~%{~3v0mA zv*01tc8+DhIt0`L*dMDFWL=iM0o&SGAekKnAcHZio~?}mHvhk4U6}o-vkUuQ06YiD zR#Yp|w6yc|^G?~>CRdM`9LWn~Fzkx#EN)tel!*A>@%LA#thBFDynC1OFGZ_fOG~0j z!l%^-{rItQM+c;n+}(}pL!B8ob4Fl9fcS!_Ix*ok<#u}J^l9KV5Wg6ou)OkKXLS|x z2_w5MD;x4XL}g3Gb$3?|l#Bco8OimRiv;QDuEJaJL-d*ML~g28hWV*q<5t)GlCuv5 z5{tvD{H>44nNO^u4gt^CCpdzEn$wBT6^}*AbKTURC+jExgqY2c8ibWBh!_jr1VNSj+5_ zp*2yT57lD%aNQo+A+u1w3bd6cf9h*Kj}N4Y9(vfjaO$8D{5SmSd!yTmm$xdjBR`%f zA7q+8y&C;Rsj-OI^E8wG{nQXm#R^G{-G)!9xpyw+#2fN1siC_n%#W#pRSEN*f2n_u zY63767tK{LJ%x@aLn-7U^17ssd2DejTM&9ORZ8hPJnES9HQ?n&)E_NT zN6w(Z@?Om@K9^DLVOZ&?&PzDwnBKHkK0mM!^(x0OAzAmu^#taDf|c<`^D6<uj6|Y%%DOL(v@tY|+Aw)l?I3cCNKRBTjtCrVn_-h%?cGew=uk2$MXjYD} zA3OPIgpviV6oEt6a^d9`rd*sHS^x~zJFP&_BYGEu^UuMEc?4JW7kZMHf27t%y-gGM ziT~QtEq4DPzzR`Fp8*~W2Vc}^aIxPaB;Ts6 z`zI;F6U`CLu$0LnUGkrDmBthppe{Hka(XR2_Y-qGQLjhc0^Y)Dg!V4X1RdUn7b%LU$dF-mY_O zcAYZ~_vSHKH5T8VR66w0BG>F|gHOWR0p`Kiw?}=&0pDb9SGjFfD4sK(rYJD;%pONS zUqYA7u(voXcy}cUR1?wwAC-%>K#~s~p9gZB;DMF)){{hc{f84>Ji?iQ`YysRqFQxh ze)AFcC2kfVW13UQ7Qrg^^jCd-mS*U$X}Im7nO5$+`q-}_r;U2%KA;UuClLQ67<0aU z!woIx<5jgS^AyVa#89$a&-7S+{qET*F$ey7@@-3LF;SJGcG!zE0q|*VSN+G>oQa4c z7e4=!oHx818nC7B?WI>?))U2NqVM~Ae<4()&yA5hrrW*02|RqV7(U|JE#>p$YLV$T zIzINZhxn5>N>A;5j>YdS`|SVXJb0G4J0e(ZD%&mBU<;|swG{KfsY|t%3D|5DiYZ)I z*DEZ)`lnG`D{DgQXiOvLJ@u549VgwABV$Bot)Qs{=a=>K-KX7cXzp9pNBV~aA^(!? z0~#SSdcwW>W1A)6yix+*<-JXB5uwIEUfo%8>r+t9Ql*5rF5YB{+U|yyF@?QEU;4rN zvoaY{}F4+jl5k8=GIY!8}5^F~Xc5H8a(s8r+vNK0~+Q zM`rR`aCVQwC3@7aZ{FfLFUfR+v_#zAPLpz~;h8fMmRvwPZbjLYTpF^HT|?Y46Y@LD zbq;E!%GGjM|C2?@oJYO-lv>KIm1+pKt;L>EUeQPt-)?m3q=jo0at5C`7pL~(2XB?? zDj)yKoO97axc>7C{Ly#xrEV>9UrU(^ro_idBb0S&CxZzxqeq7~pkYsK>J;Oc#!uHD z2jv$}-G2IP=_z^<3xBV0N0qa6x*kbSWX33^9QAT@DaIfaBGNJ?M;i`)hV|&2;?7ym zTISQt?|rkmX_$3*Me*QIfsNwYJpQv#bG%@VEd5VLVH>TdTBEPQFAqhiD|9@O-d94N z+z1>|&NtZ=yc2J^<%oR!a`FX#CZ$&jQ){_;+S4{mnp`XT0Or(2d+eI~rS5~V@xW4G z{TRtSIHEvJeRBHe;~`sz+qYKLgQkx^xqN%(Qpzju@1&9OF?Yq-yW2y;#j_L0lFIhE z>3T}{m$TjmS z59mqmj}7HC70Y~kV=~BSf7nnj+ayI?+F*=7Gue40Y&M0gcw@32@O>Nlb*g64E`Db< zx2BgeZKX)^+`cj<}BrgL>P30~YbyOSQty`|}~>ic&$^6r{#F<>`7E8jvmyWfPj|A;@fc2;vGk+V63TQP~E z&+k46?>5l&-pAT;;7r~NNFs21T9;oR4>jEM3mL@CA{`el`G*%dhV(dwItv?Ax?3O( z0$m9493B=s29?utfIa+)?-n`R9Vm9egEgQgn+HU}Nn zW-}tb7>NW|QFBn~!jTB`;UaS%uBb6Xyo9A&(+7DJR=c4(9Xjcz&VlVx)X{aehw3J& zZHL4#GkU9&2GcJ}OzEm9Uk;k}+pEz7Yv}*+2raaR=JyL7f+iovB^yn-?>8s&wUH{$ zAtFT3$0fqJccK4sopWlAaj6XZFVM4;BM=ZL6VhXEV9E0OUJCux4yN-+zgIUb^b9@O%n(O@t^2cZhht_OD)T$9?VpQ0JBWbp~kgVMg>QEva_~YrS<4tsr)3M(+~T zfUb54hl`+J5cmJ}h)$ZNlf@}UVwqp3l$W^)u~<_4AZ2|m8Ga}xTsI|42Ytma#({>; z$_TjI7SJr}B+Nzq%bhK8j_P|Hse%G-1tAp*vIj-uI!^^f889g6);a}o#zd*hG#9Da zEA87?(!_k|$efm-_*}7*xEloyt2sqtzB&|Hd}bQJae?qSZE(={aK+V{bS=@9gqI(+ z0@I=*9^)lb6aR>ue><2Pf0xftC+S%s_Txu5SMW8%3SEb-B!3m9fc=XCs-an;*R$xM z$LBATDf&i**O%Nfe-M(j&XbOS?ujaS$L2^8kb-I09ObgNQ(+<$OAI YQf)BD<7dvMP-NGBf&PAQ3ILe=54mLULI3~& diff --git a/docs/icons/small/sound.gif b/docs/icons/small/sound.gif deleted file mode 100644 index a7a89ffd9ed29c24e1759e48291cadb875f6562a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 130 zcmV-|0Db>QNk%w1VGsZi0HXf@|NsAUb92DJz}B3c_ZS$h0022kN&o-=A^8LW00062 zEC2ui01yBW0009=D7xJKa0M|0iNY9L?>oRm4WtwVAYcqvtDHa_pF~g>Zy?Whj|;FJ k&6i_@dN;{osSB_y&_-ah8I>H<4WSc3QKFczSdah!J59YUXaE2J diff --git a/docs/icons/small/sound2.gif b/docs/icons/small/sound2.gif deleted file mode 100644 index 07706e07b86d25525e8e7fcb8cd2d8b10c235d49..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 119 zcmZ?wbhEHb6krfwSoEL4($X?JJG-Z+=fHsj=gysDfC0syEQ|~c%nUjp0gze-W*duL zK7aHX7^e#>G_TrlZjM+_!c@ diff --git a/docs/icons/small/tar.gif b/docs/icons/small/tar.gif deleted file mode 100644 index 59c3ffb9a5f0dcbcc0052a6dc8b428f4b033d316..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 132 zcmV-~0DJ#ONk%w1VGsZi0HXf@|Ns9vIXP=H^|M=26Efy0jDoCS8nDw3MpHX8$hcs!0R5&$~~!7=6l diff --git a/docs/icons/small/text.gif b/docs/icons/small/text.gif deleted file mode 100644 index 66ceefbc8c46837738701f2ab48d202b4df62686..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 128 zcmV-`0Du2SNk%w1VGsZi0HXf@|Ns9vIXP=L7D<;z<5S%P>S%fZDrUCEXNey i3D;T)3BKR#h$NV?p<;}t+_F|o}`C)Qk76hx+MVW0-gHlm8q0>wI1hP+I5AqX7Z lsY3_=D?$QFWeCnFftzz@X-@K f4p@7|h&XnDYZz!(9+VBLGdRGBLf2ygAUMi29WIx%-I^d?))<_JM1*!l}uu2Kl{c)an9BQ z8Fjp~isqGPnlRppzAozM@n_rZ?DB^@TMqI1Z!lq-XpvS})uOfhlGZ1!vqC)g^DkYQ rbCHkPIiy`w;vU-;D{*7rCt7AIb`rH-)ly|T)gs(25}jS#oD9|g^MhHm diff --git a/docs/icons/sound2.gif b/docs/icons/sound2.gif deleted file mode 100644 index 48e6a7fb2faeb6ba254a87945246f5ca5980583b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 221 zcmZ?wbhEHb6k!l!IK;s4|Ns9pKy>EJ%$YOO($b8LjTyi|@tVo`|#kjl(c zD9K1wC@4+J$xK#A$~K Lz}Ywz1_o;YcDqp^ diff --git a/docs/icons/sphere1.gif b/docs/icons/sphere1.gif deleted file mode 100644 index 7067070da2786b9842212ff1ce2307fb404407ce..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 285 zcmZ?wbhEHb6k!l!c+9}?9|&g7{BLZ0=KudQXU@!=IWvuc!PwZC0S8e0=NFQZS*(y) zRH6W+GV>HlGEx-^N|SOjlND0(a}zW3^c1{P%YYIdrRf=|#X1VvAYO(;YG#REa(=Fk zLU3w9NosCVYLSAWrKKr@;!hSv1_ovZ9gvM6S23_u6rAu}z1QM(uhlIPp`JtRT@DHy zZ8JL^S8aON%CRcz&DRnUR>3@1XNE@hlZ*^I1j}_C#yT z68XztxyIW*eK)gq&Gg$oObhE&HaxGaZep#g4-2m9Y;B7#>??2R@5{BXndV`dHEXt- HAcHjk`1fN- diff --git a/docs/icons/sphere2.gif b/docs/icons/sphere2.gif deleted file mode 100644 index a9e462a377c8d451bd0c0d07a47035bd44caf57e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 264 zcmZ?wbhEHb6k!l!IK;s49|&g7{BLZ021L(HV_+~gHfCU8Q2gf?l95@gkXTfr0HiYW z6iPBu6$(m|ax#+@Qu1>XGxPKmyi?175+0@L8L7oO3fUlDhC^y*iC%Jku8u-*YC%bA zZc=KIf}y3QDTCrq7DfgJW(FOg=?oy-8JMdxcJ29GAmOljuG+p#>+^!wLzQ;)UT5um zk+|bSXOMfYd{L=zjsF9o(~1rvGBq{}GB`LmSXvkRdn%jF4af{C6R?=uy5ZaLzjm9G zwH8$Kxi4iXD)_78aNoVF=4GE7r)afPMP*}_m05#Wld*D7Z?_kl#}r$ALGzij95@-Q E0diYklmGw# diff --git a/docs/icons/tar.gif b/docs/icons/tar.gif deleted file mode 100644 index 4032c1bd3d407abddd0f0e8801e3091726574171..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 219 zcmZ?wbhEHb6k!l!_{6~Q|NsB}`}gnOy*n%{)ZE;h0R|NRxrAh77As^X=jSPa=sbmz zj8uh!(xjZsWQCOc+{Da0Jq1HcOH&2!)H0x~M`?OSYO#(&Hi(zukeXSdmz{U7WG~8yuhh5Zb<@7 z`xV^^pIq^?J6sl`b?E$;oi=gneQc#~{w%G2Eo$=bQcK8x IUrq*V0QdG)RsaA1 diff --git a/docs/icons/tex.gif b/docs/icons/tex.gif deleted file mode 100644 index 45e43233b845960c59aa8933251d6d745b324031..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 251 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIn&tKm;nhW{__jT$ShV!EGkg|Qki)QB^jv- z1*J(jnaK(%`MHUid3p-osbxS3kJ9vv)M6clY!ENQAvLo^FF8L~MXnDYZz! z(9+VBLGdRGBLf2?gAT|RknIf2c^13&d^F&3SUp#HU#6xa!*tin>9Z0|^A1!l(>hWb zZ!PfsEZ4Gxo$}LGGYd#m9-20(LPaIeg)1oN=Z{6M>Y}HwOe>foy~6k})9y8|ETZxl nuQycuR$g`V{oCDj`rkkOugz?zPGxp)?{Kpc$nTBfWUvMReehfo diff --git a/docs/icons/text.gif b/docs/icons/text.gif deleted file mode 100644 index 4c623909fbfb54658f19186beec8d362f87e233b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 229 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIn&tKm;nhW{__jT$ShV!EGkg|Qki)QB^jv- z1*J(jnaK(%`MHUid3p-osbxS3kJ9vv)M6clY!ENQAvLo^FF8L~MXnDYZz! z(9+VBLGdRGBLf2?gAT|RknIf25f;1ld^F&3SUp#HU#9hW!Rw()J9@9P7P`C+IwEjh zoojbq@AhdAxLane{lx8+w_BW5Lq@1~%@UylHdfUEOTOIP6XtsB<@c_)dDA0}cD??? QSNCCuzu3fEy_^iz0A2r7i2wiq diff --git a/docs/icons/transfer.gif b/docs/icons/transfer.gif deleted file mode 100644 index 33697dbb667a8c898bc501cedd8039a3e9e04272..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 242 zcmZ?wbhEHb6k!l!IK;s49|(+%&;0*CbLPx61_oneV+Jr#{O1>vky)&eSX80_q%!jq zN-|Ov3QCi5GLscj@^ce2^Yj$FQ_Fx79;N9Ssl_@9*&tqqLuzJ;UUGh}jzVy1K}l+E zQfiTcp{1oMgW^vXMg|5Z1|5+3Aln(3Q#G`%?loA)#Gq@m*=ucI?DJZ$h{7jq60EN$ z%~d?lR>S0McO~B8j-}Ir=et8&oIMkM8Y@liURvT6>$dvF%11Mo3W@nQRp?BsQ#|oZ hcdptv6Cq9pYXE?dSF`{C diff --git a/docs/icons/unknown.gif b/docs/icons/unknown.gif deleted file mode 100644 index 32b1ea23fb6f6195f1bb17adf9c3cb2cc29dfefa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 245 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIn&tKm;nhW{__jT$ShV!EGkg|Qki)QB^jv- z1*J(jnaK(%`MHUid3p-osbxS3kJ9vv)M6clY!ENQAvLo^FF8L~MXnDYZz! z(9+VBLGdRGBLf2?gAT|RknIf285X-Xz@*&Mzw-23{>5{AIi%LijXHkMRw1HyNzyFOS#mnvM?d*oFAHE` Gum%9J?KeFD diff --git a/docs/icons/uu.gif b/docs/icons/uu.gif deleted file mode 100644 index 4387d529f69f77810347be63429d13ff38bcb2c1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 236 zcmZ?wbhEHb6k!l!IK;s4|Ns9p|NqaNIn&tKm;nhW{__jT$ShV!EGkg|Qki)QB^jv- z1*J(jnaK(%`MHUid3p-osbxS3kJ9vv)M6clY!ENQAvLo^FF8L~MXnDYZz! z(9+VBLGdRGBLf2?gAT|RknIf2@fN%Gd^F&3SUp#HpJvB@7K6@PEKNyM9n&%bmCrCe zcjss6%XbLBY-{hkn53brAS;k_~V>SO;rqEX_zty4nJbR|}ofI+Ll^r*| X^XnDYZz! z(9+VBLGdRGBLf2?gAT|RknIf2@fN%Gd^F&3SUp#HpJvB@7K6@PEKNyM9n&%bmCrCe zcjss6%XbLBY-{hkn53brAS;k_~V>SO;rqEX_zty4nJbR|}ofI+Ll^r*| X^XGxPKmyi?175+0@L8L7oO3fUlDhC^y*iC%Jku8u-*YC%bAZc=KIf}y3Q zDTCrq7DfgJMg|?A=?own8JLoL`d3=Lojq&DmV<08H)chf_{g}X9%4v)7BSC#N7g2- z#f}=s?(`k{vcq_8jpbY)WyV!4N-Aq^MwZQ4x?oEC?F~i2;bkXPZnEj*mSpYLJUDmD atT54C`TIV6aAK=hU_0K-zaxNw!5RQ*npTkj diff --git a/docs/icons/world2.gif b/docs/icons/world2.gif deleted file mode 100644 index e3203f7a881283a15f895af86b7727878592257a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 261 zcmZ?wbhEHb6k!l!IK;s4|Ns9pKy>EJ%$YM8W*Rf388d)^;y=HTjLc$%#G(=fAeEV? zP?C|VP*9qblbNiLlAoKHnWv}VomvKz@F-2sNG;Y;$OiE;98xn&^pf*)brgbA3rbRR zlTwQm3@t5985DoAFfuSOGU$NJ2ieZRTp_XR&O5bJ*Ohi!T+-@^=jL?!gy~R6SmeCA7ufyx{6*ATcJslr}J. -.\" -.SH NAME -ab \- Apache HTTP server benchmarking tool -.SH SYNOPSIS -.B ab -[ -.B \-k -] [ -.B \-e -] [ -.B \-q -] [ -.B \-S -] [ -.B \-i -] [ -+ .B \-s -] [ -.BI \-n " requests" -] [ -.BI \-t " timelimit" -] [ -.BI \-c " concurrency" -] [ -.BI \-p " POST file" -] [ -.BI \-A " Authentication username:password" -] [ -.BI \-P " Proxy Authentication username:password" -] [ -.BI \-H " Custom header" -] [ -.BI \-C " Cookie name=value" -] [ -.BI \-T " content-type" -] [ -.BI \-X " proxy [ :port ]" -] [ -.BI \-v " verbosity" -] -] [ -.BI \-w " output HTML" -] -] [ -.BI \-g " output GNUPLOT" -] -] [ -.BI \-e " output CSV" -] -] [ -.BI \-x " attributes" -] -] [ -.BI \-y " attributes" -] -] [ -.BI \-z "
    attributes" -] -.I [http[s]://]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 of how your current -Apache installation performs. This especially shows you how many -requests per second your Apache installation is capable of serving. -.PP -.SH OPTIONS -.TP 12 -.B \-k -Enable the HTTP KeepAlive feature, i.e., perform multiple requests within one -HTTP session. Default is no KeepAlive. -.TP 12 -.BI \-n " requests" -Number of requests to perform for the benchmarking session. The default is to -just perform a single request which usually leads to non-representative -benchmarking results. -.TP 12 -.BI \-t " timelimit" -Maximum number of seconds to spend for benchmarking. This implies -.B \-d -Do not display the "percentage served within XX [ms] table". (legacy -support). -.TP 12 -.B \-S -Do not display the median and standard deviation values, nor display -the warning/error messages when the average and median are more than -one or two times the standard deviation apart. And default to the -min/avg/max values. (legacy support). -.TP 12 -.B \-s -When compiled in (bb -h will show you) use the SSL protected -.B https -rather than the -.B http -protocol. This feature is experimental and -.B very -rudimentary. You propably do not want to use it. -.TP 12 -.B \-k -Enable the HTTP KeepAlive feature; that is, perform multiple requests -within one HTTP session. Default is no KeepAlive. -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 to perform at a time. -Default is one request at a time. - -.TP 12 -.BI \-p " POST file" -File containing data to POST. - -.TP 12 -.BI \-A " Authentication username:password" -Supply BASIC Authentication credentials to the server. The username -and password are separated by a single ':' and sent on the wire uuencoded. -The string is sent regardless of whether the server needs it; (i.e., has -sent an 401 authentication needed). - -.TP 12 -.BI \-X " proxy[:port]" -Route all requests through the proxy (at optional port). - -.TP 12 -.BI \-P " Proxy-Authentication username:password" -Supply BASIC Authentication credentials to a proxy en-route. The username -and password are separated by a single ':' and sent on the wire uuencoded. -The string is sent regardless of whether the proxy needs it; (i.e., has -sent an 407 proxy authentication 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" -Append 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 -.BI \-g " gnuplot file" -Write all measured values out as a 'gnuplot' or TSV (Tab separate values) -file. This file can easily be imported into packages like Gnuplot, IDL, Mathematica, -Igor or even Excell. The labels are on the first line of the file. - -.TP 12 -.BI \-q -When processing more than 150 requsts; -.B ab -outputs a progress count on -.B stderr -every 10% or 100 requests or so. The -.B -q -flag qill suppress these messages. - -.TP 12 -.BI \-e " CSV file" -Write a Comma separated value (CSV) file which contains for each -percentage (from 1% to 100%) the time (in milli seconds) it took -to serve that percentage of the requests. This is usually more -usefull than the 'gnuplot' file; as the results are already -'binned'. - -.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) -.P -The HTML output is not as complete as the text output. -.P -Up to version 1.3d -.B ab -has propably reported values way to low for most measurements; -as a single timeout (which is usually in the order of seconds) -will shift several thousands of milli-second responses by a -considerable factor. This was further componded by a serious -interger overrun which would for realistic run's (i.e. those -longer than a few minutes) produce believable but totally -bogus results. Thanks to Sander Temme -for solving this riddle. -. diff --git a/docs/man/apachectl.8 b/docs/man/apachectl.8 deleted file mode 100644 index a683eef29d..0000000000 --- a/docs/man/apachectl.8 +++ /dev/null @@ -1,132 +0,0 @@ -.TH apachectl 1 "September 1997" -.\" 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 -.\" . -.\" -.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://httpd.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 SIGWINCH. 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 63ff5f5177..0000000000 --- a/docs/man/apxs.8 +++ /dev/null @@ -1,458 +0,0 @@ -.TH apxs 8 "April 1998" -.\" 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 -.\" . -.\" -.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/modules/mod_foo.so - chmod 755 /path/to/apache/modules/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 automatically 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 independent 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 modules -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 -"modules" 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/modules/mod_foo.so - chmod 755 /path/to/apache/modules/mod_foo.so - [activating module `foo' in /path/to/apache/etc/httpd.conf] - $ _ -.fi - -This way a line named - -.nf - LoadModule foo_module modules/mod_foo.so -.fi - -is added to the configuration file if still not present. -If you want to have 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/modules/mod_foo.so - chmod 755 /path/to/apache/modules/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 fc86f8ebd7..0000000000 --- a/docs/man/dbmmanage.1 +++ /dev/null @@ -1,170 +0,0 @@ -.TH dbmmanage 1 "March 1998" -.\" 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 -.\" . -.\" -.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 existence, 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 98e52bc446..0000000000 --- a/docs/man/htdigest.1 +++ /dev/null @@ -1,95 +0,0 @@ -.TH htdigest 1 "January 2001" -.\" 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 -.\" . -.\" -.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. -.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 ca5059e093..0000000000 --- a/docs/man/htpasswd.1 +++ /dev/null @@ -1,250 +0,0 @@ -.TH htpasswd 1 "May 2000" -.\" 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 -.\" . -.\" -.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 -.br -.B htpasswd -.B \-n -[ -.B \-m -| -.B \-d -| -.B \-s -| -.B \-p -] -.I username -.br -.B htpasswd -.B \-nb -[ -.B \-m -| -.B \-d -| -.B \-s -| -.B \-p -] -.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 manage usernames and passwords -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 -\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. This option cannot be combined with -the \fB-n\fP option. -.IP \-n -Display the results on standard output rather than updating a file. -This is useful for generating password records acceptable to Apache -for inclusion in non-text data stores. This option changes the -syntax of the command line, since the \fIpasswdfile\fP argument -(usually the first one) is omitted. It cannot be combined with -the \fB-c\fP option. -.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 -on all platforms, it is not supported by the -.B httpd -server on Windows and TPF. -.IP \-s -Use SHA encryption for passwords. Facilitates 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 platforms, the -.B httpd -daemon 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 c5ec4c2b3b..0000000000 --- a/docs/man/httpd.8 +++ /dev/null @@ -1,189 +0,0 @@ -.TH httpd 8 "February 1997" -.\" 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 -.\" . -.\" -.SH NAME -httpd \- Apache hypertext transfer protocol server -.SH SYNOPSIS -.B httpd -[ -.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 \-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. -.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://httpd.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). If -.BI \-D " DUMP_VHOSTS" -is also set, details of the virtual host configuration will be printed. -.TP -.B \-T -Same as option -.B \-t -but does not check the configured document roots. -.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/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 diff --git a/docs/man/logresolve.8 b/docs/man/logresolve.8 deleted file mode 100644 index b105b6e04d..0000000000 --- a/docs/man/logresolve.8 +++ /dev/null @@ -1,86 +0,0 @@ -.TH logresolve 8 "March 1998" -.\" 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 -.\" . -.\" -.SH NAME -logresolve \- resolve hostnames for IP-addresses 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-addresses 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 b4e6e23447..0000000000 --- a/docs/man/rotatelogs.8 +++ /dev/null @@ -1,88 +0,0 @@ -.TH rotatelogs 8 "March 2001" -.\" 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 -.\" . -.\" -.SH NAME -rotatelogs \- rotate Apache logs without having to kill the server -.SH SYNOPSIS -.B rotatelogs -.I logfile -.I rotationtime -.I [offset] -.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. If \fBlogfile\fP includes any -'%' characters, it is treated as a format string for \fIstrftime(3)\fP. -Otherwise, the suffix .nnnn is automatically added and is the time at which -the logfile was created. -.IP \fB\fIrotationtime\fP -The rotation time in seconds. -.IP \fB\fIoffset\fP -The number of minutes offset from UTC. If omitted, zero is assumed and -UTC is used. For example, to use local time in the zone UTC -5 hours, -specify a value of \fI-300\fP for this argument. -.PD -.SH SEE ALSO -.BR httpd(8) diff --git a/docs/man/suexec.8 b/docs/man/suexec.8 deleted file mode 100644 index a9a94feba7..0000000000 --- a/docs/man/suexec.8 +++ /dev/null @@ -1,75 +0,0 @@ -.TH suexec 8 "March 2001" -.\" 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 -.\" . -.\" -.SH NAME -suexec \- Switch User For Exec -.SH SYNOPSIS -.B suexec -V -.PP -No other synopsis for usage, because this program -is otherwise only used internally by the Apache HTTP server. -.PP -.SH DESCRIPTION -.B suexec -is the "wrapper" support program for the suexec behaviour for the -Apache HTTP server. It is run from within the server automatically -to switch the user when an external program has to be run under a -different user. For more information about suexec, see the online -document `Apache suexec Support' on the HTTP server project's -Web site at http://httpd.apache.org/docs/suexec.html . -.SH OPTIONS -.IP -V -Display the list of compile-time settings used when \fBsuexec\fP -was built. No other action is taken. -.PD -.SH SEE ALSO -.BR httpd(8) diff --git a/docs/manual/LICENSE b/docs/manual/LICENSE deleted file mode 100644 index 2395e3927a..0000000000 --- a/docs/manual/LICENSE +++ /dev/null @@ -1,58 +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. - */ - diff --git a/docs/manual/bind.html b/docs/manual/bind.html deleted file mode 100644 index 208c6c54a2..0000000000 --- a/docs/manual/bind.html +++ /dev/null @@ -1,78 +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.

    - -

    The Listen directive tells the server to accept -incoming requests only on the specified port or address-and-port -combinations. If only a port number is specified in the -Listen directive, 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

    - -

    Listen does not implement Virtual Hosts. It only tells 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 behavior 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 behavior 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 -Listen directive, -Virtual Hosts, -Port directive, -DNS Issues -and -<VirtualHost> section. - - - - - diff --git a/docs/manual/bind.html.en b/docs/manual/bind.html.en deleted file mode 100644 index 208c6c54a2..0000000000 --- a/docs/manual/bind.html.en +++ /dev/null @@ -1,78 +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.

    - -

    The Listen directive tells the server to accept -incoming requests only on the specified port or address-and-port -combinations. If only a port number is specified in the -Listen directive, 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

    - -

    Listen does not implement Virtual Hosts. It only tells 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 behavior 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 behavior 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 -Listen directive, -Virtual Hosts, -Port directive, -DNS Issues -and -<VirtualHost> section. - - - - - diff --git a/docs/manual/cgi_path.html b/docs/manual/cgi_path.html deleted file mode 100644 index 2b7bd963b1..0000000000 --- a/docs/manual/cgi_path.html +++ /dev/null @@ -1,93 +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 -counterintuitive, 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 -guaranteed that -"http://$SERVER_NAME:$SERVER_PORT$SCRIPT_NAME$PATH_INFO" -will always be an accessible URL that points to the current script, -something which was not necessarily 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 necessary 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 existence 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 2b7bd963b1..0000000000 --- a/docs/manual/cgi_path.html.en +++ /dev/null @@ -1,93 +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 -counterintuitive, 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 -guaranteed that -"http://$SERVER_NAME:$SERVER_PORT$SCRIPT_NAME$PATH_INFO" -will always be an accessible URL that points to the current script, -something which was not necessarily 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 necessary 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 existence 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.en b/docs/manual/configuring.html.en deleted file mode 100644 index f626637083..0000000000 --- a/docs/manual/configuring.html.en +++ /dev/null @@ -1,248 +0,0 @@ - - - -Configuration Files - - - - - -

    Configuration Files

    - - - -
    - -

    Main Configuration Files

    - - - -
    -Related Modules

    -mod_mime
    -
    -Related Directives

    -<IfDefine>
    -Include
    -TypesConfig
    -
    - -

    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. 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.

    - -

    New with Apache 1.3.13 is a feature where if any configuration -file is actually a directory, Apache will enter that directory -and parse any files (and subdirectories) found there as configuration -files. One possible use for this would be to add VirtualHosts -by creating small configuration files for each host, and placing -them in such a configuration directory. Thus, you can add or -remove VirtualHosts without editing any files at all, simply -adding or deleting them. This makes automating such processes -much easier. - -

    -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

    - -

    Apache configuration files contain one directive per line. The -back-slash "\" may be used as the last character on a line to indicate -that the directive continues onto the next line. There must be no -other characters or white space between the back-slash and the end of -the line. - -

    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. Blank lines and white space occurring before -a directive are 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

    - - -
    -Related Modules

    -mod_so
    -
    -Related Directives

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

    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. -Configuration directives may be included conditional on a presence of -a particular module by enclosing them in an <IfModule> block. - -

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


    - -

    Scope of Directives

    - -
    -Related Directives

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

    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

    - -
    -Related Directives

    -AccessFileName
    -AllowOverride
    -
    - -

    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, 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.html b/docs/manual/configuring.html.html deleted file mode 100644 index 461de9960c..0000000000 --- a/docs/manual/configuring.html.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/manual/configuring.html.ja.jis b/docs/manual/configuring.html.ja.jis deleted file mode 100644 index c1b41e5251..0000000000 --- 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 d1b4ab20ab..0000000000 --- a/docs/manual/content-negotiation.html +++ /dev/null @@ -1,590 +0,0 @@ - - - -Apache Content Negotiation - - - - - -

    Content Negotiation

    - -

    -Apache's support for content negotiation has been updated to meet the -HTTP/1.1 specification. It can choose the best representation of a -resource based on the browser-supplied preferences for media type, -languages, character set and encoding. It is also implements a -couple of features to give more intelligent handling of requests from -browsers which send incomplete negotiation information.

    - -Content negotiation is provided by the -mod_negotiation module, -which is compiled in by default. - -


    - -

    About Content Negotiation

    - -

    -A resource may be available in several different representations. For -example, it might be available in different languages or different -media types, or a combination. One way of selecting the most -appropriate choice is to give the user an index page, and let them -select. However it is often possible for the server to choose -automatically. This works because browsers can send as part of each -request information about what representations they prefer. For -example, a browser could indicate that it would like to see -information in French, if possible, else English will do. Browsers -indicate their preferences by headers in the request. To request only -French representations, the browser would send - -

    -  Accept-Language: fr
    -
    - -

    -Note that this preference will only be applied when there is a choice -of representations and they vary by language. -

    - -As an example of a more complex request, this browser has been -configured to accept French and English, but prefer French, and to -accept various media types, preferring HTML over plain text or other -text types, and preferring GIF or JPEG over other media types, but also -allowing any other media type as a last resort: - -

    -  Accept-Language: fr; q=1.0, en; q=0.5
    -  Accept: text/html; q=1.0, text/*; q=0.8, image/gif; q=0.6,
    -        image/jpeg; q=0.6, image/*; q=0.5, */*; q=0.1
    -
    - -Apache 1.2 supports 'server driven' content negotiation, as defined in -the HTTP/1.1 specification. It fully supports the Accept, -Accept-Language, Accept-Charset and Accept-Encoding request headers. -Apache 1.3.4 also supports 'transparent' content negotiation, which is -an experimental negotiation protocol defined in RFC 2295 and RFC 2296. -It does not offer support for 'feature negotiation' as defined in -these RFCs. -

    - -A resource is a conceptual entity identified by a URI -(RFC 2396). An HTTP server like Apache provides access to -representations of the resource(s) within its namespace, -with each representation in the form of a sequence of bytes with a -defined media type, character set, encoding, etc. Each resource may be -associated with zero, one, or more than one representation -at any given time. If multiple representations are available, -the resource is referred to as negotiable and each of its -representations is termed a variant. The ways in which the -variants for a negotiable resource vary are called the -dimensions of negotiation. - -

    Negotiation in Apache

    - -

    -In order to negotiate a resource, the server needs to be given -information about each of the variants. This is done in one of two -ways: - -

      -
    • Using a type map (i.e., a *.var file) which - names the files containing the variants explicitly, or -
    • Using a 'MultiViews' search, where the server does an implicit - filename pattern match and chooses from among the results. -
    - -

    Using a type-map file

    - -

    -A type map is a document which is associated with the handler -named type-map (or, for backwards-compatibility with -older Apache configurations, the mime type -application/x-type-map). Note that to use this feature, -you must have a handler set in the configuration that defines a -file suffix as type-map; this is best done with a - -

    -  AddHandler type-map .var
    -
    - -in the server configuration file. See the comments in the sample config -file for more details.

    - -Type map files have an entry for each available variant; these entries -consist of contiguous HTTP-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 (although this -is not required, and if present will be ignored). An example -map file is: - -

    -  URI: foo
    -
    -  URI: foo.en.html
    -  Content-type: text/html
    -  Content-language: en
    -
    -  URI: foo.fr.de.html
    -  Content-type: text/html;charset=iso-8859-2
    -  Content-language: fr, de
    -
    - -If the variants have different source qualities, that may be indicated -by the "qs" parameter to the media type, as in this picture (available -as jpeg, gif, or ASCII-art): - -
    -  URI: foo
    -
    -  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
    -
    -

    - -qs values can vary in the range 0.000 to 1.000. Note that any variant with -a qs value of 0.000 will never be chosen. Variants with no 'qs' -parameter value are given a qs factor of 1.0. The qs parameter indicates -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 an original ascii art, then an ascii representation would -have a higher source quality than a jpeg representation. A qs value -is therefore specific to a given variant depending on the nature of -the resource it represents. - -

    -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 --- charset, level and "qs" parameters may be given. These - are often referred to as MIME types; typical media types are - image/gif, text/plain, or - text/html; level=3. -
    Content-Language: -
    The languages of the variant, specified as an Internet standard - language tag from RFC 1766 (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. - 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-Length: -
    The size of the file. Specifying content - lengths in the type-map allows the server to compare file sizes - without checking the actual files. -
    Description: -
    A human-readable textual description of the variant. If Apache cannot - find any appropriate variant to return, it will return an error - response which lists all available variants instead. Such a variant - list will include the human-readable variant descriptions. -
    - -

    Multiviews

    - -

    -MultiViews is a per-directory option, meaning it can be set with -an Options directive within a <Directory>, -<Location> or <Files> -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. - -

    -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. - -

    -MultiViews may also apply 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 when reading the directive is a CGI script, -it's not obvious what should happen. The code gives that case -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. - -

    The Negotiation Methods

    - -After Apache has obtained a list of the variants for a given resource, -either from a type-map file or from the filenames in the directory, it -invokes one of two methods to decide on the 'best' variant to -return, if any. It is not necessary to know any of the details of how -negotiation actually takes place in order to use Apache's content -negotiation features. However the rest of this document explains the -methods used for those interested. -

    - -There are two negotiation methods: - -

      - -
    1. Server driven negotiation with the Apache -algorithm is used in the normal case. The Apache algorithm is -explained in more detail below. When this algorithm is used, Apache -can sometimes 'fiddle' the quality factor of a particular dimension to -achieve a better result. The ways Apache can fiddle quality factors is -explained in more detail below. - -
    2. Transparent content negotiation is used when the -browser specifically requests this through the mechanism defined in RFC -2295. This negotiation method gives the browser full control over -deciding on the 'best' variant, the result is therefore dependent on -the specific algorithms used by the browser. As part of the -transparent negotiation process, the browser can ask Apache to run the -'remote variant selection algorithm' defined in RFC 2296. - -
    - - -

    Dimensions of Negotiation

    - - - - - - - -
    Dimension -Notes -
    Media Type -Browser indicates preferences with the Accept header field. Each item -can have an associated quality factor. Variant description can also -have a quality factor (the "qs" parameter). -
    Language -Browser indicates preferences with the Accept-Language header field. -Each item can have a quality factor. Variants can be associated with none, one -or more than one language. -
    Encoding -Browser indicates preference with the Accept-Encoding header field. -Each item can have a quality factor. -
    Charset -Browser indicates preference with the Accept-Charset header field. -Each item can have a quality factor. -Variants can indicate a charset as a parameter of the media type. -
    - -

    Apache Negotiation Algorithm

    - -

    -Apache can use the following algorithm to select the 'best' variant -(if any) to return to the browser. This algorithm is not -further configurable. It operates as follows: - -

      -
    1. First, for each dimension of the negotiation, check the appropriate -Accept* header field and assign a quality to each -variant. If the Accept* header for any dimension implies that this -variant is not acceptable, eliminate it. If no variants remain, go -to step 4. - -
    2. Select the 'best' variant by a process of elimination. Each of the -following tests is applied in order. Any variants not selected at each -test are eliminated. After each test, if only one variant remains, -select it as the best match and proceed to step 3. If more than one -variant remains, move on to the next test. - -
        -
      1. Multiply the quality factor from the Accept header with the - quality-of-source factor for this variant's media type, and select - the variants with the highest value. - -
      2. Select the variants with the highest language quality factor. - -
      3. Select the variants with the best language match, using either the - order of languages in the Accept-Language header (if present), or else - the order of languages in the LanguagePriority - directive (if present). - -
      4. Select the variants with the highest 'level' media parameter - (used to give the version of text/html media types). - -
      5. Select variants with the best charset media parameters, - as given on the Accept-Charset header line. Charset ISO-8859-1 - is acceptable unless explicitly excluded. Variants with a - text/* media type but not explicitly associated - with a particular charset are assumed to be in ISO-8859-1. - -
      6. Select those variants which have associated - charset media parameters that are not ISO-8859-1. - If there are no such variants, select all variants instead. - -
      7. Select the variants with the best encoding. If there are - variants with an encoding that is acceptable to the user-agent, - select only these variants. Otherwise if there is a mix of encoded - and non-encoded variants, select only the unencoded variants. - If either all variants are encoded or all variants are not encoded, - select all variants. - -
      8. Select the variants with the smallest content length. - -
      9. Select the first variant of those remaining. This will be either the - first listed in the type-map file, or when variants are read from - the directory, the one whose file name comes first when sorted using - ASCII code order. - -
      - -
    3. The algorithm has now selected one 'best' variant, so return - it as the response. The HTTP response header Vary is set to indicate the - dimensions of negotiation (browsers and caches can use this - information when caching the resource). End. - -
    4. To get here means no variant was selected (because none are acceptable - to the browser). Return a 406 status (meaning "No acceptable representation") - with a response body consisting of an HTML document listing the - available variants. Also set the HTTP Vary header to indicate the - dimensions of variance. - -
    - -

    Fiddling with Quality Values

    - -

    -Apache sometimes changes the quality values from what would be -expected by a strict interpretation of the Apache negotiation -algorithm above. This is to get a better result from the algorithm for -browsers which do not send full or accurate information. Some of the -most popular browsers send Accept header information which would -otherwise result in the selection of the wrong variant in many -cases. If a browser sends full and correct information these fiddles -will not be applied. -

    - -

    Media Types and Wildcards

    - -

    -The Accept: request header indicates preferences for media types. It -can also include 'wildcard' media types, such as "image/*" or "*/*" -where the * matches any string. So a request including: -

    -  Accept: image/*, */*
    -
    - -would indicate that any type starting "image/" is acceptable, -as is any other type (so the first "image/*" is redundant). Some -browsers routinely send wildcards in addition to explicit types they -can handle. For example: -
    -  Accept: text/html, text/plain, image/gif, image/jpeg, */*
    -
    - -The intention of this is to indicate that the explicitly -listed types are preferred, but if a different representation is -available, that is ok too. However under the basic algorithm, as given -above, the */* wildcard has exactly equal preference to all the other -types, so they are not being preferred. The browser should really have -sent a request with a lower quality (preference) value for *.*, such -as: -
    -  Accept: text/html, text/plain, image/gif, image/jpeg, */*; q=0.01
    -
    - -The explicit types have no quality factor, so they default to a -preference of 1.0 (the highest). The wildcard */* is given -a low preference of 0.01, so other types will only be returned if -no variant matches an explicitly listed type. -

    - -If the Accept: header contains no q factors at all, Apache sets -the q value of "*/*", if present, to 0.01 to emulate the desired -behavior. It also sets the q value of wildcards of the format -"type/*" to 0.02 (so these are preferred over matches against -"*/*". If any media type on the Accept: header contains a q factor, -these special values are not applied, so requests from browsers -which send the correct information to start with work as expected. - -

    Variants with no Language

    - -

    -If some of the variants for a particular resource have a language -attribute, and some do not, those variants with no language -are given a very low language quality factor of 0.001.

    - -The reason for setting this language quality factor for -variant with no language to a very low value is to allow -for a default variant which can be supplied if none of the -other variants match the browser's language preferences. - -For example, consider the situation with three variants: - -

      -
    • foo.en.html, language en -
    • foo.fr.html, language en -
    • foo.html, no language -
    - -

    -The meaning of a variant with no language is that it is -always acceptable to the browser. If the request Accept-Language -header includes either en or fr (or both) one of foo.en.html -or foo.fr.html will be returned. If the browser does not list -either en or fr as acceptable, foo.html will be returned instead. - -

    Extensions to Transparent Content Negotiation

    - -Apache extends the transparent content negotiation protocol (RFC 2295) -as follows. A new {encoding ..} element is used in -variant lists to label variants which are available with a specific -content-encoding only. The implementation of the -RVSA/1.0 algorithm (RFC 2296) is extended to recognize encoded -variants in the list, and to use them as candidate variants whenever -their encodings are acceptable according to the Accept-Encoding -request header. The RVSA/1.0 implementation does not round computed -quality factors to 5 decimal places before choosing the best variant. - -

    Note on hyperlinks and naming conventions

    - -

    -If you are using language negotiation you can choose between -different naming conventions, because files can have more than one -extension, and the order of the extensions is normally irrelevant -(see mod_mime documentation for details). -

    -A typical file has a MIME-type extension (e.g., html), -maybe an encoding extension (e.g., gz), and of course a -language extension (e.g., en) when we have different -language variants of this file. - -

    -Examples: -

      -
    • foo.en.html -
    • foo.html.en -
    • foo.en.html.gz -
    - -

    -Here some more examples of filenames together with valid and invalid -hyperlinks: -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FilenameValid hyperlinkInvalid hyperlink
    foo.html.enfoo
    - foo.html
    -
    foo.en.htmlfoofoo.html
    foo.html.en.gzfoo
    - foo.html
    foo.gz
    - foo.html.gz
    foo.en.html.gzfoofoo.html
    - foo.html.gz
    - foo.gz
    foo.gz.html.enfoo
    - foo.gz
    - foo.gz.html
    foo.html
    foo.html.gz.enfoo
    - foo.html
    - foo.html.gz
    foo.gz
    - -

    -Looking at the table above you will notice that it is always possible to -use the name without any extensions in an hyperlink (e.g., foo). -The advantage is that you can hide the actual type of a -document rsp. file and can change it later, e.g., from html -to shtml or cgi without changing any -hyperlink references. - -

    -If you want to continue to use a MIME-type in your hyperlinks (e.g. -foo.html) the language extension (including an encoding extension -if there is one) must be on the right hand side of the MIME-type extension -(e.g., foo.html.en). - - -

    Note on Caching

    - -

    -When a cache stores a representation, it associates it with the request URL. -The next time that URL is requested, the cache can use the stored -representation. But, if the resource is negotiable at the server, -this might result in only the first requested variant being cached and -subsequent cache hits might return the wrong response. To prevent this, -Apache normally marks all responses that are returned after content negotiation -as non-cacheable by HTTP/1.0 clients. Apache also supports the HTTP/1.1 -protocol features to allow caching of negotiated responses.

    - -For requests which come from a HTTP/1.0 compliant client (either a -browser or a cache), the directive CacheNegotiatedDocs can be -used to allow caching of responses which were subject to negotiation. -This directive can be given in the server config or virtual host, and -takes no arguments. It has no effect on requests from HTTP/1.1 clients. - - - - diff --git a/docs/manual/content-negotiation.html.en b/docs/manual/content-negotiation.html.en deleted file mode 100644 index d1b4ab20ab..0000000000 --- a/docs/manual/content-negotiation.html.en +++ /dev/null @@ -1,590 +0,0 @@ - - - -Apache Content Negotiation - - - - - -

    Content Negotiation

    - -

    -Apache's support for content negotiation has been updated to meet the -HTTP/1.1 specification. It can choose the best representation of a -resource based on the browser-supplied preferences for media type, -languages, character set and encoding. It is also implements a -couple of features to give more intelligent handling of requests from -browsers which send incomplete negotiation information.

    - -Content negotiation is provided by the -mod_negotiation module, -which is compiled in by default. - -


    - -

    About Content Negotiation

    - -

    -A resource may be available in several different representations. For -example, it might be available in different languages or different -media types, or a combination. One way of selecting the most -appropriate choice is to give the user an index page, and let them -select. However it is often possible for the server to choose -automatically. This works because browsers can send as part of each -request information about what representations they prefer. For -example, a browser could indicate that it would like to see -information in French, if possible, else English will do. Browsers -indicate their preferences by headers in the request. To request only -French representations, the browser would send - -

    -  Accept-Language: fr
    -
    - -

    -Note that this preference will only be applied when there is a choice -of representations and they vary by language. -

    - -As an example of a more complex request, this browser has been -configured to accept French and English, but prefer French, and to -accept various media types, preferring HTML over plain text or other -text types, and preferring GIF or JPEG over other media types, but also -allowing any other media type as a last resort: - -

    -  Accept-Language: fr; q=1.0, en; q=0.5
    -  Accept: text/html; q=1.0, text/*; q=0.8, image/gif; q=0.6,
    -        image/jpeg; q=0.6, image/*; q=0.5, */*; q=0.1
    -
    - -Apache 1.2 supports 'server driven' content negotiation, as defined in -the HTTP/1.1 specification. It fully supports the Accept, -Accept-Language, Accept-Charset and Accept-Encoding request headers. -Apache 1.3.4 also supports 'transparent' content negotiation, which is -an experimental negotiation protocol defined in RFC 2295 and RFC 2296. -It does not offer support for 'feature negotiation' as defined in -these RFCs. -

    - -A resource is a conceptual entity identified by a URI -(RFC 2396). An HTTP server like Apache provides access to -representations of the resource(s) within its namespace, -with each representation in the form of a sequence of bytes with a -defined media type, character set, encoding, etc. Each resource may be -associated with zero, one, or more than one representation -at any given time. If multiple representations are available, -the resource is referred to as negotiable and each of its -representations is termed a variant. The ways in which the -variants for a negotiable resource vary are called the -dimensions of negotiation. - -

    Negotiation in Apache

    - -

    -In order to negotiate a resource, the server needs to be given -information about each of the variants. This is done in one of two -ways: - -

      -
    • Using a type map (i.e., a *.var file) which - names the files containing the variants explicitly, or -
    • Using a 'MultiViews' search, where the server does an implicit - filename pattern match and chooses from among the results. -
    - -

    Using a type-map file

    - -

    -A type map is a document which is associated with the handler -named type-map (or, for backwards-compatibility with -older Apache configurations, the mime type -application/x-type-map). Note that to use this feature, -you must have a handler set in the configuration that defines a -file suffix as type-map; this is best done with a - -

    -  AddHandler type-map .var
    -
    - -in the server configuration file. See the comments in the sample config -file for more details.

    - -Type map files have an entry for each available variant; these entries -consist of contiguous HTTP-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 (although this -is not required, and if present will be ignored). An example -map file is: - -

    -  URI: foo
    -
    -  URI: foo.en.html
    -  Content-type: text/html
    -  Content-language: en
    -
    -  URI: foo.fr.de.html
    -  Content-type: text/html;charset=iso-8859-2
    -  Content-language: fr, de
    -
    - -If the variants have different source qualities, that may be indicated -by the "qs" parameter to the media type, as in this picture (available -as jpeg, gif, or ASCII-art): - -
    -  URI: foo
    -
    -  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
    -
    -

    - -qs values can vary in the range 0.000 to 1.000. Note that any variant with -a qs value of 0.000 will never be chosen. Variants with no 'qs' -parameter value are given a qs factor of 1.0. The qs parameter indicates -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 an original ascii art, then an ascii representation would -have a higher source quality than a jpeg representation. A qs value -is therefore specific to a given variant depending on the nature of -the resource it represents. - -

    -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 --- charset, level and "qs" parameters may be given. These - are often referred to as MIME types; typical media types are - image/gif, text/plain, or - text/html; level=3. -
    Content-Language: -
    The languages of the variant, specified as an Internet standard - language tag from RFC 1766 (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. - 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-Length: -
    The size of the file. Specifying content - lengths in the type-map allows the server to compare file sizes - without checking the actual files. -
    Description: -
    A human-readable textual description of the variant. If Apache cannot - find any appropriate variant to return, it will return an error - response which lists all available variants instead. Such a variant - list will include the human-readable variant descriptions. -
    - -

    Multiviews

    - -

    -MultiViews is a per-directory option, meaning it can be set with -an Options directive within a <Directory>, -<Location> or <Files> -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. - -

    -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. - -

    -MultiViews may also apply 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 when reading the directive is a CGI script, -it's not obvious what should happen. The code gives that case -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. - -

    The Negotiation Methods

    - -After Apache has obtained a list of the variants for a given resource, -either from a type-map file or from the filenames in the directory, it -invokes one of two methods to decide on the 'best' variant to -return, if any. It is not necessary to know any of the details of how -negotiation actually takes place in order to use Apache's content -negotiation features. However the rest of this document explains the -methods used for those interested. -

    - -There are two negotiation methods: - -

      - -
    1. Server driven negotiation with the Apache -algorithm is used in the normal case. The Apache algorithm is -explained in more detail below. When this algorithm is used, Apache -can sometimes 'fiddle' the quality factor of a particular dimension to -achieve a better result. The ways Apache can fiddle quality factors is -explained in more detail below. - -
    2. Transparent content negotiation is used when the -browser specifically requests this through the mechanism defined in RFC -2295. This negotiation method gives the browser full control over -deciding on the 'best' variant, the result is therefore dependent on -the specific algorithms used by the browser. As part of the -transparent negotiation process, the browser can ask Apache to run the -'remote variant selection algorithm' defined in RFC 2296. - -
    - - -

    Dimensions of Negotiation

    - - - - - - - -
    Dimension -Notes -
    Media Type -Browser indicates preferences with the Accept header field. Each item -can have an associated quality factor. Variant description can also -have a quality factor (the "qs" parameter). -
    Language -Browser indicates preferences with the Accept-Language header field. -Each item can have a quality factor. Variants can be associated with none, one -or more than one language. -
    Encoding -Browser indicates preference with the Accept-Encoding header field. -Each item can have a quality factor. -
    Charset -Browser indicates preference with the Accept-Charset header field. -Each item can have a quality factor. -Variants can indicate a charset as a parameter of the media type. -
    - -

    Apache Negotiation Algorithm

    - -

    -Apache can use the following algorithm to select the 'best' variant -(if any) to return to the browser. This algorithm is not -further configurable. It operates as follows: - -

      -
    1. First, for each dimension of the negotiation, check the appropriate -Accept* header field and assign a quality to each -variant. If the Accept* header for any dimension implies that this -variant is not acceptable, eliminate it. If no variants remain, go -to step 4. - -
    2. Select the 'best' variant by a process of elimination. Each of the -following tests is applied in order. Any variants not selected at each -test are eliminated. After each test, if only one variant remains, -select it as the best match and proceed to step 3. If more than one -variant remains, move on to the next test. - -
        -
      1. Multiply the quality factor from the Accept header with the - quality-of-source factor for this variant's media type, and select - the variants with the highest value. - -
      2. Select the variants with the highest language quality factor. - -
      3. Select the variants with the best language match, using either the - order of languages in the Accept-Language header (if present), or else - the order of languages in the LanguagePriority - directive (if present). - -
      4. Select the variants with the highest 'level' media parameter - (used to give the version of text/html media types). - -
      5. Select variants with the best charset media parameters, - as given on the Accept-Charset header line. Charset ISO-8859-1 - is acceptable unless explicitly excluded. Variants with a - text/* media type but not explicitly associated - with a particular charset are assumed to be in ISO-8859-1. - -
      6. Select those variants which have associated - charset media parameters that are not ISO-8859-1. - If there are no such variants, select all variants instead. - -
      7. Select the variants with the best encoding. If there are - variants with an encoding that is acceptable to the user-agent, - select only these variants. Otherwise if there is a mix of encoded - and non-encoded variants, select only the unencoded variants. - If either all variants are encoded or all variants are not encoded, - select all variants. - -
      8. Select the variants with the smallest content length. - -
      9. Select the first variant of those remaining. This will be either the - first listed in the type-map file, or when variants are read from - the directory, the one whose file name comes first when sorted using - ASCII code order. - -
      - -
    3. The algorithm has now selected one 'best' variant, so return - it as the response. The HTTP response header Vary is set to indicate the - dimensions of negotiation (browsers and caches can use this - information when caching the resource). End. - -
    4. To get here means no variant was selected (because none are acceptable - to the browser). Return a 406 status (meaning "No acceptable representation") - with a response body consisting of an HTML document listing the - available variants. Also set the HTTP Vary header to indicate the - dimensions of variance. - -
    - -

    Fiddling with Quality Values

    - -

    -Apache sometimes changes the quality values from what would be -expected by a strict interpretation of the Apache negotiation -algorithm above. This is to get a better result from the algorithm for -browsers which do not send full or accurate information. Some of the -most popular browsers send Accept header information which would -otherwise result in the selection of the wrong variant in many -cases. If a browser sends full and correct information these fiddles -will not be applied. -

    - -

    Media Types and Wildcards

    - -

    -The Accept: request header indicates preferences for media types. It -can also include 'wildcard' media types, such as "image/*" or "*/*" -where the * matches any string. So a request including: -

    -  Accept: image/*, */*
    -
    - -would indicate that any type starting "image/" is acceptable, -as is any other type (so the first "image/*" is redundant). Some -browsers routinely send wildcards in addition to explicit types they -can handle. For example: -
    -  Accept: text/html, text/plain, image/gif, image/jpeg, */*
    -
    - -The intention of this is to indicate that the explicitly -listed types are preferred, but if a different representation is -available, that is ok too. However under the basic algorithm, as given -above, the */* wildcard has exactly equal preference to all the other -types, so they are not being preferred. The browser should really have -sent a request with a lower quality (preference) value for *.*, such -as: -
    -  Accept: text/html, text/plain, image/gif, image/jpeg, */*; q=0.01
    -
    - -The explicit types have no quality factor, so they default to a -preference of 1.0 (the highest). The wildcard */* is given -a low preference of 0.01, so other types will only be returned if -no variant matches an explicitly listed type. -

    - -If the Accept: header contains no q factors at all, Apache sets -the q value of "*/*", if present, to 0.01 to emulate the desired -behavior. It also sets the q value of wildcards of the format -"type/*" to 0.02 (so these are preferred over matches against -"*/*". If any media type on the Accept: header contains a q factor, -these special values are not applied, so requests from browsers -which send the correct information to start with work as expected. - -

    Variants with no Language

    - -

    -If some of the variants for a particular resource have a language -attribute, and some do not, those variants with no language -are given a very low language quality factor of 0.001.

    - -The reason for setting this language quality factor for -variant with no language to a very low value is to allow -for a default variant which can be supplied if none of the -other variants match the browser's language preferences. - -For example, consider the situation with three variants: - -

      -
    • foo.en.html, language en -
    • foo.fr.html, language en -
    • foo.html, no language -
    - -

    -The meaning of a variant with no language is that it is -always acceptable to the browser. If the request Accept-Language -header includes either en or fr (or both) one of foo.en.html -or foo.fr.html will be returned. If the browser does not list -either en or fr as acceptable, foo.html will be returned instead. - -

    Extensions to Transparent Content Negotiation

    - -Apache extends the transparent content negotiation protocol (RFC 2295) -as follows. A new {encoding ..} element is used in -variant lists to label variants which are available with a specific -content-encoding only. The implementation of the -RVSA/1.0 algorithm (RFC 2296) is extended to recognize encoded -variants in the list, and to use them as candidate variants whenever -their encodings are acceptable according to the Accept-Encoding -request header. The RVSA/1.0 implementation does not round computed -quality factors to 5 decimal places before choosing the best variant. - -

    Note on hyperlinks and naming conventions

    - -

    -If you are using language negotiation you can choose between -different naming conventions, because files can have more than one -extension, and the order of the extensions is normally irrelevant -(see mod_mime documentation for details). -

    -A typical file has a MIME-type extension (e.g., html), -maybe an encoding extension (e.g., gz), and of course a -language extension (e.g., en) when we have different -language variants of this file. - -

    -Examples: -

      -
    • foo.en.html -
    • foo.html.en -
    • foo.en.html.gz -
    - -

    -Here some more examples of filenames together with valid and invalid -hyperlinks: -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FilenameValid hyperlinkInvalid hyperlink
    foo.html.enfoo
    - foo.html
    -
    foo.en.htmlfoofoo.html
    foo.html.en.gzfoo
    - foo.html
    foo.gz
    - foo.html.gz
    foo.en.html.gzfoofoo.html
    - foo.html.gz
    - foo.gz
    foo.gz.html.enfoo
    - foo.gz
    - foo.gz.html
    foo.html
    foo.html.gz.enfoo
    - foo.html
    - foo.html.gz
    foo.gz
    - -

    -Looking at the table above you will notice that it is always possible to -use the name without any extensions in an hyperlink (e.g., foo). -The advantage is that you can hide the actual type of a -document rsp. file and can change it later, e.g., from html -to shtml or cgi without changing any -hyperlink references. - -

    -If you want to continue to use a MIME-type in your hyperlinks (e.g. -foo.html) the language extension (including an encoding extension -if there is one) must be on the right hand side of the MIME-type extension -(e.g., foo.html.en). - - -

    Note on Caching

    - -

    -When a cache stores a representation, it associates it with the request URL. -The next time that URL is requested, the cache can use the stored -representation. But, if the resource is negotiable at the server, -this might result in only the first requested variant being cached and -subsequent cache hits might return the wrong response. To prevent this, -Apache normally marks all responses that are returned after content negotiation -as non-cacheable by HTTP/1.0 clients. Apache also supports the HTTP/1.1 -protocol features to allow caching of negotiated responses.

    - -For requests which come from a HTTP/1.0 compliant client (either a -browser or a cache), the directive CacheNegotiatedDocs can be -used to allow caching of responses which were subject to negotiation. -This directive can be given in the server config or virtual host, and -takes no arguments. It has no effect on requests from HTTP/1.1 clients. - - - - diff --git a/docs/manual/custom-error.html b/docs/manual/custom-error.html deleted file mode 100644 index 09604ea972..0000000000 --- a/docs/manual/custom-error.html +++ /dev/null @@ -1,177 +0,0 @@ - - - -Custom 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. - None of these will be set if your ErrorDocument is an - external redirect (i.e., anything starting with a - scheme name - like http:, even if it refers to the same host as the - server).

    - -

    Configuration - -
    Use of "ErrorDocument" is enabled for .htaccess files when the - "FileInfo" override is - allowed. - -

    Here are some examples... - -

    -ErrorDocument 500 /cgi-bin/crash-recover
    -ErrorDocument 500 "Sorry, our script crashed. 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. Note: the (") prefix isn't - displayed. - -
    2. An external URL to redirect to. - -
    3. A local URL to redirect to. - -
    -
    - -


    - -

    Custom error responses and redirects

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

    - -

    Old behavior - -
    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 behavior -
    - -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 becomes -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. -Both the original URL and the URL being redirected to can be logged in -the access log. - -
    -

    -If the ErrorDocument specifies a local redirect to a CGI script, the script -should include a "Status:" header field in its output -in order to ensure the propagation all the way back to the client -of the error condition that caused it to be invoked. For instance, a Perl -ErrorDocument script might include the following: -

    -
    -      :
    -    print  "Content-type: text/html\n";
    -    printf "Status: %s Condition Intercepted\n", $ENV{"REDIRECT_STATUS"};
    -      :
    -
    -

    -If the script is dedicated to handling a particular error condition, such as -404 Not Found, it can use the specific code and -error text instead. -

    - - - - diff --git a/docs/manual/custom-error.html.en b/docs/manual/custom-error.html.en deleted file mode 100644 index 09604ea972..0000000000 --- a/docs/manual/custom-error.html.en +++ /dev/null @@ -1,177 +0,0 @@ - - - -Custom 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. - None of these will be set if your ErrorDocument is an - external redirect (i.e., anything starting with a - scheme name - like http:, even if it refers to the same host as the - server).

    - -

    Configuration - -
    Use of "ErrorDocument" is enabled for .htaccess files when the - "FileInfo" override is - allowed. - -

    Here are some examples... - -

    -ErrorDocument 500 /cgi-bin/crash-recover
    -ErrorDocument 500 "Sorry, our script crashed. 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. Note: the (") prefix isn't - displayed. - -
    2. An external URL to redirect to. - -
    3. A local URL to redirect to. - -
    -
    - -


    - -

    Custom error responses and redirects

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

    - -

    Old behavior - -
    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 behavior -
    - -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 becomes -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. -Both the original URL and the URL being redirected to can be logged in -the access log. - -
    -

    -If the ErrorDocument specifies a local redirect to a CGI script, the script -should include a "Status:" header field in its output -in order to ensure the propagation all the way back to the client -of the error condition that caused it to be invoked. For instance, a Perl -ErrorDocument script might include the following: -

    -
    -      :
    -    print  "Content-type: text/html\n";
    -    printf "Status: %s Condition Intercepted\n", $ENV{"REDIRECT_STATUS"};
    -      :
    -
    -

    -If the script is dedicated to handling a particular error condition, such as -404 Not Found, it can use the specific code and -error text instead. -

    - - - - diff --git a/docs/manual/developer/API.html b/docs/manual/developer/API.html deleted file mode 100644 index 496be760c9..0000000000 --- a/docs/manual/developer/API.html +++ /dev/null @@ -1,1161 +0,0 @@ - - -Apache API notes - - - - - -
    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. -
    - -

    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 recognize 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 */
    -   NULL                      /* header parser */
    -};
    -
    - -

    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 -ap_table_get and ap_table_set routines.

    -

    - Note that the Content-type header value cannot be - set by module content-handlers using the ap_table_*() - routines. Rather, it is set by pointing the content_type - field in the request_rec structure to an appropriate - string. E.g., -
    -  r->content_type = "text/html";
    - 
    -
    -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 ap_sub_req_lookup_file, - ap_sub_req_lookup_uri, and - ap_sub_req_method_uri; these construct 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 ap_run_sub_req). -

    - -

    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 ap_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 ap_rputc -and ap_rprintf, for internally generated output, and -ap_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 --- ap_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 -ap_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 = ap_set_content_length (r, r->finfo.st_size))
    -	|| (errstatus = ap_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);
    -    ap_send_http_header (r);
    -
    -    if (!r->header_only) send_fd (f, r);
    -    ap_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 -ap_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 ap_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 ap_auth_type, - ap_auth_name, and ap_requires. -
    • Common routines, to handle the protocol end of things, at least - for HTTP basic authentication (ap_get_basic_auth_pw, - which sets the connection->user structure field - automatically, and ap_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 ap_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, ap_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 -ap_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 *)ap_palloc (r->pool, sizeof(my_structure));
    -}
    -
    -

    -Note that there is no ap_pfree --- -ap_palloced memory is freed only when the associated -resource pool is cleared. This means that ap_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 ap_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 ap_pcalloc has the same -interface as ap_palloc, but clears out the memory it -allocates before it returns it. The function ap_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 ap_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: -

    -
    -     ap_pstrcat (r->pool, "foo", "/", "bar", NULL);
    -
    -

    -returns a pointer to 8 bytes worth of memory, initialized to -"foo/bar". -

    -

    Commonly-used pools in the Apache Web server

    -

    -A pool is really defined by its lifetime more than anything else. There -are some static pools in http_main which are passed to various -non-http_main functions as arguments at opportune times. Here they are: -

    -
    -
    permanent_pool -
    -
    -
      -
    • never passed to anything else, this is the ancestor of all pools -
    • -
    -
    -
    pconf -
    -
    -
      -
    • subpool of permanent_pool -
    • -
    • created at the beginning of a config "cycle"; exists until the - server is terminated or restarts; passed to all config-time - routines, either via cmd->pool, or as the "pool *p" argument on - those which don't take pools -
    • -
    • passed to the module init() functions -
    • -
    -
    -
    ptemp -
    -
    -
      -
    • sorry I lie, this pool isn't called this currently in 1.3, I - renamed it this in my pthreads development. I'm referring to - the use of ptrans in the parent... contrast this with the later - definition of ptrans in the child. -
    • -
    • subpool of permanent_pool -
    • -
    • created at the beginning of a config "cycle"; exists until the - end of config parsing; passed to config-time routines via - cmd->temp_pool. Somewhat of a "bastard child" because it isn't - available everywhere. Used for temporary scratch space which - may be needed by some config routines but which is deleted at - the end of config. -
    • -
    -
    -
    pchild -
    -
    -
      -
    • subpool of permanent_pool -
    • -
    • created when a child is spawned (or a thread is created); lives - until that child (thread) is destroyed -
    • -
    • passed to the module child_init functions -
    • -
    • destruction happens right after the child_exit functions are - called... (which may explain why I think child_exit is redundant - and unneeded) -
    • -
    -
    -
    ptrans -
    -
    -
      -
    • should be a subpool of pchild, but currently is a subpool of - permanent_pool, see above -
    • -
    • cleared by the child before going into the accept() loop to receive - a connection -
    • -
    • used as connection->pool -
    • -
    -
    -
    r->pool -
    -
    -
      -
    • for the main request this is a subpool of connection->pool; for - subrequests it is a subpool of the parent request's pool. -
    • -
    • exists until the end of the request (i.e., - ap_destroy_sub_req, or - in child_main after process_request has finished) -
    • -
    • note that r itself is allocated from r->pool; i.e., - r->pool is - first created and then r is the first thing palloc()d from it -
    • -
    -
    -
    -

    -For almost everything folks do, r->pool is the pool to use. But you -can see how other lifetimes, such as pchild, are useful to some -modules... such as modules that need to open a database connection once -per child, and wish to clean it up when the child dies. -

    -

    -You can also see how some bugs have manifested themself, such as setting -connection->user to a value from r->pool -- in this case -connection exists -for the lifetime of ptrans, which is longer than r->pool (especially if -r->pool is a subrequest!). So the correct thing to do is to allocate -from connection->pool. -

    -

    -And there was another interesting bug in mod_include/mod_cgi. You'll see -in those that they do this test to decide if they should use r->pool -or r->main->pool. In this case the resource that they are registering -for cleanup is a child process. If it were registered in r->pool, -then the code would wait() for the child when the subrequest finishes. -With mod_include this could be any old #include, and the delay can be up -to 3 seconds... and happened quite frequently. Instead the subprocess -is registered in r->main->pool which causes it to be cleaned up when -the entire request is done -- i.e., after the output has been sent to -the client and logging has happened. -

    -

    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 ap_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 = ap_pfopen (r->pool, r->filename, "r");
    -
    -     if (f == NULL) { ... } else { ... }
    -
    -

    -There is also a ap_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 ap_pfopen, and ap_popenf, -namely ap_pfclose and ap_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 ap_pfopen and -ap_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. -
    -

    -Pool cleanups live until clear_pool() is called: clear_pool(a) recursively -calls destroy_pool() on all subpools of a; then calls all the cleanups for a; -then releases all the memory for a. destroy_pool(a) calls clear_pool(a) -and then releases the pool structure itself. i.e., clear_pool(a) doesn't -delete a, it just frees up all the resources and you can start using it -again immediately. -

    -

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

    - -On rare occasions, too-free use of ap_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 ap_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 -ap_clear_pool and ap_destroy_pool, respectively. -(The difference is that ap_clear_pool frees resources -associated with the pool, while ap_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 ap_sub_req_... functions) -is ap_destroy_sub_req, 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 -ap_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 -ap_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 *) ap_palloc (p, sizeof(mime_dir_config));
    -
    -    new->forced_types = ap_make_table (p, 4);
    -    new->encoding_types = ap_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 *)ap_palloc (p, sizeof(mime_dir_config));
    -
    -    new->forced_types = ap_overlay_tables (p, subdir->forced_types,
    -                                        parent_dir->forced_types);
    -    new->encoding_types = ap_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;
    -    ap_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 ap_get_module_config function. - -
    -int find_ct(request_rec *r)
    -{
    -    int i;
    -    char *fn = ap_pstrdup (r->pool, r->filename);
    -    mime_dir_config *conf = (mime_dir_config *)
    -             ap_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=ap_rind(fn,'.')) < 0) return DECLINED;
    -    ++i;
    -
    -    if ((type = ap_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=ap_rind(fn,'.')) < 0) return OK;
    -        ++i;
    -    }
    -
    -    if ((type = ap_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 *)
    -            ap_get_module_config(s->module_config,&alias_module);
    -    alias_entry *new = ap_push_array (conf->redirects);
    -
    -    if (!ap_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 581f1b8c58..0000000000 --- a/docs/manual/developer/debugging.html +++ /dev/null @@ -1,178 +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 b/docs/manual/developer/documenting deleted file mode 100644 index 0994b10d78..0000000000 --- a/docs/manual/developer/documenting +++ /dev/null @@ -1,43 +0,0 @@ -Apache 2.0 is using ScanDoc to document the API's and global variables in -the code. This will explain the basics of how to document using Scandoc. - -To start a scandoc block, use /** -To end a scandoc block, use */ - -In the middle of the block, there are multiple tags we can use: - - Description of this functions purpose - @param parameter_name description - @tip Any information the programmer should know - @deffunc function prototype. - -The deffunc is not always necessary. ScanDoc 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: - -/** - * 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: - *
    - *                 "/foo/bar/gum"   -> "gum"
    - *                 "/foo/bar/gum/"  -> ""
    - *                 "gum"            -> "gum"
    - *                 "wi\\n32\\stuff" -> "stuff"
    - * 
    - * @deffunc const char * ap_filename_of_pathname(const char *pathname) - */ - -At the top of the header file, we 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/footer.html b/docs/manual/developer/footer.html deleted file mode 100644 index 1e5f739ebe..0000000000 --- a/docs/manual/developer/footer.html +++ /dev/null @@ -1,8 +0,0 @@ -
    - -

    - Apache HTTP Server Version 2.0 -

    - -
    Index -Home diff --git a/docs/manual/developer/header.html b/docs/manual/developer/header.html deleted file mode 100644 index 9533b02bda..0000000000 --- a/docs/manual/developer/header.html +++ /dev/null @@ -1,6 +0,0 @@ -
    - [APACHE DOCUMENTATION] -

    - Apache HTTP Server Version 2.0 -

    -
    diff --git a/docs/manual/developer/hooks.html b/docs/manual/developer/hooks.html deleted file mode 100644 index 6ab1ad6b74..0000000000 --- a/docs/manual/developer/hooks.html +++ /dev/null @@ -1,207 +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 93eb0d9d2f..0000000000 --- a/docs/manual/developer/index.html +++ /dev/null @@ -1,25 +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

    -

    Debugging Memory Allocation in APR

    -

    Apache 1.3 API Notes

    - - - diff --git a/docs/manual/developer/layeredio.html b/docs/manual/developer/layeredio.html deleted file mode 100644 index acf9c1b802..0000000000 --- a/docs/manual/developer/layeredio.html +++ /dev/null @@ -1,76 +0,0 @@ - - - -Apache 2.0 Layered I/O - - - - - -

    Apache Layered I/O

    - -

    Layered I/O has been the holy grail of Apache module writers for years. -With Apache 2.0, module writers can finally take advantage of layered I/O -in their modules. - -

    In all previous versions of Apache, only one handler was allowed to modify -the data stream that was sent to the client. With Apache 2.0, one module -can modify the data and then specify that other modules can modify the data -if they would like. - -

    Taking advantage of layered I/O

    - -

    In order to make a module use layered I/O, there are some modifications -needed. A new return value has been added for modules, RERUN_HANDLERS. -When a handler returns this value, the core searches through the list of -handlers looking for another module that wants to try the request. - -

    When a module returns RERUN_HANDLERS, it must modify two fields of the -request_rec, the handler and content_type fields. Most modules will -set the handler field to NULL, and allow the core to choose the which -module gets run next. If these two fields are not modified, then the server -will loop forever calling the same module's handler. - -

    Most modules should not write out to the network if they want to take -advantage of layered I/O. Two BUFF structures have been added to the -request_rec, one for input and one for output. The module should read and -write to these BUFFs. The module will also have to setup the input field for -the next module in the list. A new function has been added, ap_setup_input, -which all modules should call before they do any reading to get data to modify. -This function checks to determine if the previous module set the input field, -if so, that input is used, if not the file is opened and that data source -is used. The output field is used basically the same way. The module must -set this field before they call ap_r* in order to take advantage of -layered I/O. If this field is not set, ap_r* will write directly to the -client. Usually at the end of a handler, the input (for the next module) -will be the read side of a pipe, and the output will be the write side of -the same pipe. - -

    An Example of Layered I/O.

    - -

    This example is the most basic layered I/O example possible. It is -basically CGIs generated by mod_cgi and sent to the network via http_core. - -

    mod_cgi executes the cgi script, and then sets request_rec->input to -the output pipe of the CGI. It then NULLs out request_rec->handler, and -sets request_rec->content_type to whatever the CGI writes out (in this case, -text/html). Finally, mod_cgi returns RERUN_HANDLERS. - -

    ap_invoke_handlers() then loops back to the top of the handler list -and searches for a handler that can deal with this content_type. In this case -the correct module is the default_handler from http_core. - -

    When default handler starts, it calls ap_setup_input, which has found -a valid request_rec->input, so that is used for all inputs. The output field -in the request_rec is NULL, so when default_handler calls an output primitive -it gets sent out over the network.

    - -Ryan Bloom, 25th March 2000 - - diff --git a/docs/manual/developer/modules.html b/docs/manual/developer/modules.html deleted file mode 100644 index 8a265f5ec1..0000000000 --- a/docs/manual/developer/modules.html +++ /dev/null @@ -1,203 +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 8a265f5ec1..0000000000 --- a/docs/manual/developer/modules.html.en +++ /dev/null @@ -1,203 +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/dns-caveats.html b/docs/manual/dns-caveats.html deleted file mode 100644 index a20127abfe..0000000000 --- a/docs/manual/dns-caveats.html +++ /dev/null @@ -1,188 +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 name-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. - -

        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 bff578e444..0000000000 --- a/docs/manual/dso.html +++ /dev/null @@ -1,394 +0,0 @@ - - -Apache 1.3 Dynamic Shared Object (DSO) support - - - - -

        - - -
        - -

        -Apache 1.3
        -Dynamic Shared Object (DSO)
        -Support -

        - -
        Originally written by
        -Ralf S. Engelschall <rse@apache.org>, 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 build-time by specifying -lfoo to the linker command. This -hard-codes library references into the executable program file so that at -start-time the Unix loader is able to locate libfoo.so in -/usr/lib, in paths hard-coded via linker-options like --R 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 reusable 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), 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 top-level -INSTALL file) or by changing the AddModule command -in your src/Configuration into a SharedModule -command (see src/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 (APache eXtenSion) 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-dependent 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-dependent 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 top-level -INSTALL file) or by changing the Rule command in -your Configuration file to Rule SHARED_CORE=yes (see -src/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 on all platforms, 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 but -adequate 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 1999) is this: - -

        -

          -
        • Out-of-the-box supported platforms:
          -(actually tested versions in parenthesis) - -
          -o  FreeBSD            (2.1.5, 2.2.x, 3.x, 4.x)
          -o  OpenBSD            (2.x)
          -o  NetBSD             (1.3.1)
          -o  BSDI               (3.x, 4.x)
          -o  Linux              (Debian/1.3.1, RedHat/4.2)
          -o  Solaris            (2.4, 2.5, 2.6, 2.7)
          -o  SunOS              (4.1.3)
          -o  Digital UNIX       (4.0)
          -o  IRIX               (5.3, 6.2)
          -o  HP/UX              (10.20)
          -o  UnixWare           (2.01, 2.1.2)
          -o  SCO                (5.0.4)
          -o  AIX                (3.2, 4.1.5, 4.2, 4.3)
          -o  ReliantUNIX/SINIX  (5.43)
          -o  SVR4               (-)
          -o  Mac OS X Server    (1.0)
          -o  Mac OS             (10.0 preview 1)
          -o  OpenStep/Mach      (4.2)
          -o  DGUX               (??)
          -o  NetWare            (5.1)
          -
          - -

          -

        • Explicitly unsupported platforms: - -
          -o  Ultrix             (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): - -

          -

            -
          • Build and install via configure (preferred): -
            -
            -$ ./configure --prefix=/path/to/install
            -              --enable-rule=SHARED_CORE ...
            -$ make install
            -
            -
            - -
          • 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/modules\"
            -$ make 
            -$ cp src/libhttpd.so* /path/to/install/modules/
            -$ cp src/libhttpd.ep  /path/to/install/modules/
            -$ 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: - -

          -

            -
          • Build and install via configure (preferred): -
            -
            -$ ./configure --prefix=/path/to/install
            -        --enable-shared=foo
            -$ make install
            -
            -
            - -
          • 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/modules
            -- Edit /path/to/install/etc/httpd.conf
            -  >> LoadModule foo_module /path/to/install/modules/mod_foo.so
            -
            -
            -
          - -
        3. Build and install a third-party Apache module, say -mod_foo.c, into its own DSO mod_foo.so - -

          -

            -
          • Build and install via configure (preferred): -
            -
            -$ ./configure --add-module=/path/to/3rdparty/mod_foo.c 
            -        --enable-shared=foo
            -$ make install
            -
            -
            - -
          • 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/modules
            -- Edit /path/to/install/etc/httpd.conf
            -  >> LoadModule foo_module /path/to/install/modules/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: - -

          -

            -
          • 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 an 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 of code into the address space - of a program. -

          -

        • 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 independent 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 - independent code. The only chances to use other code is to either make - sure the Apache core itself already contains a reference to it, loading - the code yourself via dlopen() or enabling the - SHARED_CHAIN rule while building Apache when your platform - supports linking DSO files against DSO libraries. -

          -

        • 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. -
        - - -
        - - diff --git a/docs/manual/dso.html.en b/docs/manual/dso.html.en deleted file mode 100644 index bff578e444..0000000000 --- a/docs/manual/dso.html.en +++ /dev/null @@ -1,394 +0,0 @@ - - -Apache 1.3 Dynamic Shared Object (DSO) support - - - - -
        - - -
        - -

        -Apache 1.3
        -Dynamic Shared Object (DSO)
        -Support -

        - -
        Originally written by
        -Ralf S. Engelschall <rse@apache.org>, 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 build-time by specifying -lfoo to the linker command. This -hard-codes library references into the executable program file so that at -start-time the Unix loader is able to locate libfoo.so in -/usr/lib, in paths hard-coded via linker-options like --R 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 reusable 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), 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 top-level -INSTALL file) or by changing the AddModule command -in your src/Configuration into a SharedModule -command (see src/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 (APache eXtenSion) 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-dependent 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-dependent 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 top-level -INSTALL file) or by changing the Rule command in -your Configuration file to Rule SHARED_CORE=yes (see -src/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 on all platforms, 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 but -adequate 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 1999) is this: - -

        -

          -
        • Out-of-the-box supported platforms:
          -(actually tested versions in parenthesis) - -
          -o  FreeBSD            (2.1.5, 2.2.x, 3.x, 4.x)
          -o  OpenBSD            (2.x)
          -o  NetBSD             (1.3.1)
          -o  BSDI               (3.x, 4.x)
          -o  Linux              (Debian/1.3.1, RedHat/4.2)
          -o  Solaris            (2.4, 2.5, 2.6, 2.7)
          -o  SunOS              (4.1.3)
          -o  Digital UNIX       (4.0)
          -o  IRIX               (5.3, 6.2)
          -o  HP/UX              (10.20)
          -o  UnixWare           (2.01, 2.1.2)
          -o  SCO                (5.0.4)
          -o  AIX                (3.2, 4.1.5, 4.2, 4.3)
          -o  ReliantUNIX/SINIX  (5.43)
          -o  SVR4               (-)
          -o  Mac OS X Server    (1.0)
          -o  Mac OS             (10.0 preview 1)
          -o  OpenStep/Mach      (4.2)
          -o  DGUX               (??)
          -o  NetWare            (5.1)
          -
          - -

          -

        • Explicitly unsupported platforms: - -
          -o  Ultrix             (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): - -

          -

            -
          • Build and install via configure (preferred): -
            -
            -$ ./configure --prefix=/path/to/install
            -              --enable-rule=SHARED_CORE ...
            -$ make install
            -
            -
            - -
          • 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/modules\"
            -$ make 
            -$ cp src/libhttpd.so* /path/to/install/modules/
            -$ cp src/libhttpd.ep  /path/to/install/modules/
            -$ 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: - -

          -

            -
          • Build and install via configure (preferred): -
            -
            -$ ./configure --prefix=/path/to/install
            -        --enable-shared=foo
            -$ make install
            -
            -
            - -
          • 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/modules
            -- Edit /path/to/install/etc/httpd.conf
            -  >> LoadModule foo_module /path/to/install/modules/mod_foo.so
            -
            -
            -
          - -
        3. Build and install a third-party Apache module, say -mod_foo.c, into its own DSO mod_foo.so - -

          -

            -
          • Build and install via configure (preferred): -
            -
            -$ ./configure --add-module=/path/to/3rdparty/mod_foo.c 
            -        --enable-shared=foo
            -$ make install
            -
            -
            - -
          • 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/modules
            -- Edit /path/to/install/etc/httpd.conf
            -  >> LoadModule foo_module /path/to/install/modules/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: - -

          -

            -
          • 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 an 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 of code into the address space - of a program. -

          -

        • 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 independent 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 - independent code. The only chances to use other code is to either make - sure the Apache core itself already contains a reference to it, loading - the code yourself via dlopen() or enabling the - SHARED_CHAIN rule while building Apache when your platform - supports linking DSO files against DSO libraries. -

          -

        • 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. -
        - - -
        - - diff --git a/docs/manual/ebcdic.html b/docs/manual/ebcdic.html deleted file mode 100644 index 74d01485cc..0000000000 --- a/docs/manual/ebcdic.html +++ /dev/null @@ -1,505 +0,0 @@ - - - -The Apache EBCDIC Port - - - - - - -
        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. -
        - -

        Overview of the Apache EBCDIC Port

        - -

        - Version 1.3 of the Apache HTTP Server is the first version which - includes a port to a (non-ASCII) mainframe machine which uses - the EBCDIC character set as its native codeset.
        - (It is the SIEMENS family of mainframes running the - BS2000/OSD - operating system. This mainframe OS nowadays features a - SVR4-derived POSIX subsystem). -

        - -

        - The port was started initially to -

          -
        • prove the feasibility of porting - the Apache HTTP server - to this platform -
        • find a "worthy and capable" successor for the venerable - CERN-3.0 daemon - (which was ported a couple of years ago), and to -
        • prove that Apache's preforking process model can on this platform - easily outperform the accept-fork-serve model used by CERN by a - factor of 5 or more. -
        -

        - -

        - This document serves as a rationale to describe some of the design - decisions of the port to this machine. -

        - -

        Design Goals

        -

        - One objective of the EBCDIC port was to maintain enough backwards - compatibility with the (EBCDIC) CERN server to make the transition to - the new server attractive and easy. This required the addition of - a configurable method to define whether a HTML document was stored - in ASCII (the only format accepted by the old server) or in EBCDIC - (the native document format in the POSIX subsystem, and therefore - the only realistic format in which the other POSIX tools like grep - or sed could operate on the documents). The current solution to - this is a "pseudo-MIME-format" which is intercepted and - interpreted by the Apache server (see below). Future versions - might solve the problem by defining an "ebcdic-handler" for all - documents which must be converted. -

        - -

        Technical Solution

        -

        - Since all Apache input and output is based upon the BUFF data type - and its methods, the easiest solution was to add the conversion to - the BUFF handling routines. The conversion must be settable at any - time, so a BUFF flag was added which defines whether a BUFF object - has currently enabled conversion or not. This flag is modified at - several points in the HTTP protocol: -

          -
        • set before a request is received (because the - request and the request header lines are always in ASCII - format) - -
        • set/unset when the request body is - received - depending on the content type of the request body - (because the request body may contain ASCII text or a binary file) - -
        • set before a reply header is sent (because the - response header lines are always in ASCII format) - -
        • set/unset when the response body is - sent - depending on the content type of the response body - (because the response body may contain text or a binary file) -
        -

        - -

        Porting Notes

        -

        -

          -
        1. - The relevant changes in the source are #ifdef'ed into two - categories: -
          -
          #ifdef CHARSET_EBCDIC -
          Code which is needed for any EBCDIC based machine. This - includes character translations, differences in - contiguity of the two character sets, flags which - indicate which part of the HTTP protocol has to be - converted and which part doesn't etc. -
          #ifdef _OSD_POSIX -
          Code which is needed for the SIEMENS BS2000/OSD - mainframe platform only. This deals with include file - differences and socket implementation topics which are - only required on the BS2000/OSD platform. -
          -

        2. - -
        3. - The possibility to translate between ASCII and EBCDIC at the - socket level (on BS2000 POSIX, there is a socket option which - supports this) was intentionally not chosen, because - the byte stream at the HTTP protocol level consists of a - mixture of protocol related strings and non-protocol related - raw file data. HTTP protocol strings are always encoded in - ASCII (the GET request, any Header: lines, the chunking - information etc.) whereas the file transfer parts (i.e., GIF - images, CGI output etc.) should usually be just "passed through" - by the server. This separation between "protocol string" and - "raw data" is reflected in the server code by functions like - bgets() or rvputs() for strings, and functions like bwrite() - for binary data. A global translation of everything would - therefore be inadequate.
          - (In the case of text files of course, provisions must be made so - that EBCDIC documents are always served in ASCII) -

        4. - -
        5. - This port therefore features a built-in protocol level conversion - for the server-internal strings (which the compiler translated to - EBCDIC strings) and thus for all server-generated documents. - The hard coded ASCII escapes \012 and \015 which are - ubiquitous in the server code are an exception: they are - already the binary encoding of the ASCII \n and \r and must - not be converted to ASCII a second time. This exception is - only relevant for server-generated strings; and external - EBCDIC documents are not expected to contain ASCII newline characters. -

        6. - -
        7. - By examining the call hierarchy for the BUFF management - routines, I added an "ebcdic/ascii conversion layer" which - would be crossed on every puts/write/get/gets, and a - conversion flag which allowed enabling/disabling the - conversions on-the-fly. Usually, a document crosses this - layer twice from its origin source (a file or CGI output) to - its destination (the requesting client): file -> - Apache, and Apache -> client.
          - The server can now read the header - lines of a CGI-script output in EBCDIC format, and then find - out that the remainder of the script's output is in ASCII - (like in the case of the output of a WWW Counter program: the - document body contains a GIF image). All header processing is - done in the native EBCDIC format; the server then determines, - based on the type of document being served, whether the - document body (except for the chunking information, of - course) is in ASCII already or must be converted from EBCDIC. -

        8. - -
        9. - For Text documents (MIME types text/plain, text/html etc.), - an implicit translation to ASCII can be used, or (if the - users prefer to store some documents in raw ASCII form for - faster serving, or because the files reside on a NFS-mounted - directory tree) can be served without conversion. -
          - Example:
          - to serve files with the suffix .ahtml as a raw ASCII text/html - document without implicit conversion (and suffix .ascii - as ASCII text/plain), use the directives:
          -      AddType  text/x-ascii-html  .ahtml
          -      AddType  text/x-ascii-plain .ascii
          -      
          - Similarly, any text/XXXX MIME type can be served as "raw ASCII" by - configuring a MIME type "text/x-ascii-XXXX" for it using AddType. -

        10. - -
        11. - Non-text documents are always served "binary" without conversion. - This seems to be the most sensible choice for, .e.g., GIF/ZIP/AU - file types. This of course requires the user to copy them to the - mainframe host using the "rcp -b" binary switch. -

        12. - -
        13. - Server parsed files are always assumed to be in native (i.e., - EBCDIC) format as used on the machine, and are converted after - processing. -

        14. - -
        15. - For CGI output, the CGI script determines whether a conversion is - needed or not: by setting the appropriate Content-Type, text files - can be converted, or GIF output can be passed through unmodified. - An example for the latter case is the wwwcount program which we ported - as well. -

        16. -
        -

        - -

        Document Storage Notes

        -

        Binary Files

        -

        - All files with a Content-Type: which does not - start with text/ are regarded as binary files - by the server and are not subject to any conversion. - Examples for binary files are GIF images, gzip-compressed - files and the like. -

        -

        - When exchanging binary files between the mainframe host and a - Unix machine or Windows PC, be sure to use the ftp "binary" - (TYPE I) command, or use the - rcp -b command from the mainframe host - (the -b switch is not supported in unix rcp's). -

        - -

        Text Documents

        -

        - The default assumption of the server is that Text Files - (i.e., all files whose Content-Type: starts with - text/) are stored in the native character - set of the host, EBCDIC. -

        - -

        Server Side Included Documents

        -

        - SSI documents must currently be stored in EBCDIC only. No - provision is made to convert it from ASCII before processing. -

        - -

        Apache Modules' Status

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Module - Status - Notes -
        http_core - + - -
        mod_access - + - -
        mod_actions - + - -
        mod_alias - + - -
        mod_asis - + - -
        mod_auth - + - -
        mod_auth_anon - + - -
        mod_auth_db - ? - with own libdb.a -
        mod_auth_dbm - ? - with own libdb.a -
        mod_autoindex - + - -
        mod_cern_meta - ? - -
        mod_cgi - + - -
        mod_digest - + - -
        mod_dir - + - -
        mod_so - - - no shared libs -
        mod_env - + - -
        mod_example - - - (test bed only) -
        mod_expires - + - -
        mod_headers - + - -
        mod_imap - + - -
        mod_include - + - -
        mod_info - + - -
        mod_log_agent - + - -
        mod_log_config - + - -
        mod_log_referer - + - -
        mod_mime - + - -
        mod_mime_magic - ? - not ported yet -
        mod_negotiation - + - -
        mod_proxy - + - -
        mod_rewrite - + - untested -
        mod_setenvif - + - -
        mod_speling - + - -
        mod_status - + - -
        mod_unique_id - + - -
        mod_userdir - + - -
        mod_usertrack - ? - untested -
        - -

        Third Party Modules' Status

        - - - - - - - - - - - - - - - - -
        Module - Status - Notes -
        mod_jserv - - - JAVA still being ported. -
        mod_php3 - + - mod_php3 runs fine, with LDAP and GD and FreeType libraries -
        mod_put - ? - untested -
        mod_session - - - untested -
        - - - - diff --git a/docs/manual/env.html b/docs/manual/env.html deleted file mode 100644 index f436e32819..0000000000 --- a/docs/manual/env.html +++ /dev/null @@ -1,305 +0,0 @@ - - - -Environment Variables in Apache - - - - - -

        Environment Variables in Apache

        - -

        Many operating systems provide a facility for storage and -transmission of information called environment variables. Apache uses -environment variables in many ways to control operations and to -communicate with other programs like CGI scripts. This document -explains some of the ways to use environment variables in Apache.

        - - - -
        - -

        Setting Environment Variables

        - - -
        -Related Modules

        - -mod_env
        -mod_rewrite
        -mod_setenvif
        -mod_unique_id
        - -
        -Related Directives

        - -BrowserMatch
        -BrowserMatchNoCase
        -PassEnv
        -RewriteRule
        -SetEnv
        -SetEnvIf
        -SetEnvIfNoCase
        -UnsetEnv
        -
        - -

        Basic Environment Manipulation

        - -

        The most basic way to set an environment variable in Apache is -using the unconditional SetEnv directive. Variables -may also be passed from the environment of the shell which started -the server using the PassEnv directive.

        - -

        Conditional Per-Request Settings

        - -

        For additional flexibility, the directives provided by mod_setenvif -allow environment variables to be set on a per-request basis, -conditional on characteristics of particular requests. For example, a -variable could be set only when a specific browser (User-Agent) is -making a request, or only when a specific Referer [sic] header is -found. Even more flexibility is available through the mod_rewrite's -RewriteRule which uses the [E=...] option to -set environment variables.

        - -

        Unique Identifiers

        - -

        Finally, mod_unique_id sets the environment variable -UNIQUE_ID for each request to a value which is guaranteed -to be unique across "all" requests under very specific conditions.

        - -

        Standard CGI Variables

        - -

        In addition to all environment variables set within the Apache -configuration and passed from the shell, CGI scripts and SSI pages are -provided with a set of environment variables containing -meta-information about the request as required by the CGI specification.

        - -

        Some Caveats

        - -
          - -
        • It is not possible to override or change the standard CGI -variables using the environment manipulation directives.
        • - -
        • When suexec is used to launch CGI -scripts, the environment will be cleaned down to a set of -safe variables before CGI scripts are launched. The list of -safe variables is defined at compile-time in -suexec.c.
        • - -
        • For portability reasons, the names of environment variables -may contain only letters, numbers, and the underscore character. -In addition, the first character may not be a number. Characters -which do not match this restriction will be replaced by an -underscore when passed to CGI scripts and SSI pages.
        • - -
        - - -
        - -

        Using Environment Variables

        - -
        -Related Modules

        - -mod_access
        -mod_cgi
        -mod_include
        -mod_log_config
        -mod_rewrite
        - -
        -Related Directives

        - -Allow
        -CustomLog
        -Deny
        -LogFormat
        -RewriteCond
        -RewriteRule
        - -
        - -

        CGI Scripts

        - -

        One of the primary uses of environment variables is to communicate -information to CGI scripts. As discussed above, the environment -passed to CGI scripts includes standard meta-information about the request -in addition to any variables set within the Apache configuration. -For more details, see the CGI tutorial. -

        - -

        SSI Pages

        - -

        Server-parsed (SSI) documents processed by mod_include's -server-parsed handler can print environment variables -using the echo element, and can use environment variables -in flow control elements to makes parts of a page conditional on -characteristics of a request. Apache also provides SSI pages with the -standard CGI environment variables as discussed above. For more -details, see the SSI tutorial. -

        - -

        Access Control

        - -

        Access to the server can be controlled based on the value of -environment variables using the allow from env= and -deny from env= directives. In combination with -SetEnvIf, this allows for flexible control of access to -the server based on characteristics of the client. For example, you -can use these directives to deny access to a particular browser -(User-Agent). -

        - -

        Conditional Logging

        - -

        Environment variables can be logged in the access log using the -LogFormat option %e. In addition, the -decision on whether or not to log requests can be made based on the -status of environment variables using the conditional form of the -CustomLog directive. In combination with -SetEnvIf this allows for flexible control of which -requests are logged. For example, you can choose not to log requests -for filenames ending in gif, or you can choose to only -log requests from clients which are outside your subnet. -

        - -

        URL Rewriting

        - -

        The %{ENV:...} form of TestString in the -RewriteCond allows mod_rewrite's rewrite engine to make -decisions conditional on environment variables. Note that the -variables accessible in mod_rewrite without the ENV: -prefix are not actually environment variables. Rather, they -are variables special to mod_rewrite which cannot be accessed from -other modules.

        - -
        - -

        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. -

        - -

        downgrade-1.0

        -

        -This forces the request to be treated as a HTTP/1.0 request even if it -was in a later dialect. -

        - -

        force-no-vary

        -

        -This causes any Vary fields to be removed from the response -header before it is sent back to the client. Some clients don't -interpret this field correctly (see the -known client problems -page); setting this variable can work around this problem. Setting -this variable also implies force-response-1.0. -

        - -

        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. -

        - -

        nokeepalive

        -

        -This disables KeepAlive when set. -

        - - -
        - -

        Examples

        - -

        Changing protocol behavior with misbehaving clients

        - -

        We recommend that the following lines be included in httpd.conf -to deal with known client problems.

        - -
        -#
        -# The following directives modify normal HTTP response behavior.
        -# The first directive disables keepalive for Netscape 2.x and browsers that
        -# spoof it. There are known problems with these browser implementations.
        -# 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
        -
        - -

        Do not log requests for images in the access log

        - -

        This example keeps requests for images from appearing -in the access log. It can be easily modified to prevent logging -of particular directories, or to prevent logging of requests -coming from particular hosts.

        - -
        -    SetEnvIf Request_URI \.gif image-request
        -    SetEnvIf Request_URI \.jpg image-request
        -    SetEnvIf Request_URI \.png image-request
        -    CustomLog logs/access_log env=!image-request
        -
        - -

        Prevent "Image Theft"

        - -

        This example shows how to keep people not on your server from using -images on your server as inline-images on their pages. This is not -a recommended configuration, but it can work in limited -circumstances. We assume that all your images are in a directory -called /web/images.

        - -
        -    SetEnvIf Referer "^http://www.example.com/" local_referal
        -    # Allow browsers that do not send Referer info
        -    SetEnvIf Referer "^$" local_referal
        -    <Directory /web/images>
        -       Order Deny,Allow
        -       Deny from all
        -       Allow from env=local_referal
        -    </Directory>
        -
        - -

        For more information about this technique, see the ApacheToday -tutorial "Keeping -Your Images from Adorning Other Sites".

        - - - - diff --git a/docs/manual/env.html.en b/docs/manual/env.html.en deleted file mode 100644 index f436e32819..0000000000 --- a/docs/manual/env.html.en +++ /dev/null @@ -1,305 +0,0 @@ - - - -Environment Variables in Apache - - - - - -

        Environment Variables in Apache

        - -

        Many operating systems provide a facility for storage and -transmission of information called environment variables. Apache uses -environment variables in many ways to control operations and to -communicate with other programs like CGI scripts. This document -explains some of the ways to use environment variables in Apache.

        - - - -
        - -

        Setting Environment Variables

        - - -
        -Related Modules

        - -mod_env
        -mod_rewrite
        -mod_setenvif
        -mod_unique_id
        - -
        -Related Directives

        - -BrowserMatch
        -BrowserMatchNoCase
        -PassEnv
        -RewriteRule
        -SetEnv
        -SetEnvIf
        -SetEnvIfNoCase
        -UnsetEnv
        -
        - -

        Basic Environment Manipulation

        - -

        The most basic way to set an environment variable in Apache is -using the unconditional SetEnv directive. Variables -may also be passed from the environment of the shell which started -the server using the PassEnv directive.

        - -

        Conditional Per-Request Settings

        - -

        For additional flexibility, the directives provided by mod_setenvif -allow environment variables to be set on a per-request basis, -conditional on characteristics of particular requests. For example, a -variable could be set only when a specific browser (User-Agent) is -making a request, or only when a specific Referer [sic] header is -found. Even more flexibility is available through the mod_rewrite's -RewriteRule which uses the [E=...] option to -set environment variables.

        - -

        Unique Identifiers

        - -

        Finally, mod_unique_id sets the environment variable -UNIQUE_ID for each request to a value which is guaranteed -to be unique across "all" requests under very specific conditions.

        - -

        Standard CGI Variables

        - -

        In addition to all environment variables set within the Apache -configuration and passed from the shell, CGI scripts and SSI pages are -provided with a set of environment variables containing -meta-information about the request as required by the CGI specification.

        - -

        Some Caveats

        - -
          - -
        • It is not possible to override or change the standard CGI -variables using the environment manipulation directives.
        • - -
        • When suexec is used to launch CGI -scripts, the environment will be cleaned down to a set of -safe variables before CGI scripts are launched. The list of -safe variables is defined at compile-time in -suexec.c.
        • - -
        • For portability reasons, the names of environment variables -may contain only letters, numbers, and the underscore character. -In addition, the first character may not be a number. Characters -which do not match this restriction will be replaced by an -underscore when passed to CGI scripts and SSI pages.
        • - -
        - - -
        - -

        Using Environment Variables

        - -
        -Related Modules

        - -mod_access
        -mod_cgi
        -mod_include
        -mod_log_config
        -mod_rewrite
        - -
        -Related Directives

        - -Allow
        -CustomLog
        -Deny
        -LogFormat
        -RewriteCond
        -RewriteRule
        - -
        - -

        CGI Scripts

        - -

        One of the primary uses of environment variables is to communicate -information to CGI scripts. As discussed above, the environment -passed to CGI scripts includes standard meta-information about the request -in addition to any variables set within the Apache configuration. -For more details, see the CGI tutorial. -

        - -

        SSI Pages

        - -

        Server-parsed (SSI) documents processed by mod_include's -server-parsed handler can print environment variables -using the echo element, and can use environment variables -in flow control elements to makes parts of a page conditional on -characteristics of a request. Apache also provides SSI pages with the -standard CGI environment variables as discussed above. For more -details, see the SSI tutorial. -

        - -

        Access Control

        - -

        Access to the server can be controlled based on the value of -environment variables using the allow from env= and -deny from env= directives. In combination with -SetEnvIf, this allows for flexible control of access to -the server based on characteristics of the client. For example, you -can use these directives to deny access to a particular browser -(User-Agent). -

        - -

        Conditional Logging

        - -

        Environment variables can be logged in the access log using the -LogFormat option %e. In addition, the -decision on whether or not to log requests can be made based on the -status of environment variables using the conditional form of the -CustomLog directive. In combination with -SetEnvIf this allows for flexible control of which -requests are logged. For example, you can choose not to log requests -for filenames ending in gif, or you can choose to only -log requests from clients which are outside your subnet. -

        - -

        URL Rewriting

        - -

        The %{ENV:...} form of TestString in the -RewriteCond allows mod_rewrite's rewrite engine to make -decisions conditional on environment variables. Note that the -variables accessible in mod_rewrite without the ENV: -prefix are not actually environment variables. Rather, they -are variables special to mod_rewrite which cannot be accessed from -other modules.

        - -
        - -

        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. -

        - -

        downgrade-1.0

        -

        -This forces the request to be treated as a HTTP/1.0 request even if it -was in a later dialect. -

        - -

        force-no-vary

        -

        -This causes any Vary fields to be removed from the response -header before it is sent back to the client. Some clients don't -interpret this field correctly (see the -known client problems -page); setting this variable can work around this problem. Setting -this variable also implies force-response-1.0. -

        - -

        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. -

        - -

        nokeepalive

        -

        -This disables KeepAlive when set. -

        - - -
        - -

        Examples

        - -

        Changing protocol behavior with misbehaving clients

        - -

        We recommend that the following lines be included in httpd.conf -to deal with known client problems.

        - -
        -#
        -# The following directives modify normal HTTP response behavior.
        -# The first directive disables keepalive for Netscape 2.x and browsers that
        -# spoof it. There are known problems with these browser implementations.
        -# 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
        -
        - -

        Do not log requests for images in the access log

        - -

        This example keeps requests for images from appearing -in the access log. It can be easily modified to prevent logging -of particular directories, or to prevent logging of requests -coming from particular hosts.

        - -
        -    SetEnvIf Request_URI \.gif image-request
        -    SetEnvIf Request_URI \.jpg image-request
        -    SetEnvIf Request_URI \.png image-request
        -    CustomLog logs/access_log env=!image-request
        -
        - -

        Prevent "Image Theft"

        - -

        This example shows how to keep people not on your server from using -images on your server as inline-images on their pages. This is not -a recommended configuration, but it can work in limited -circumstances. We assume that all your images are in a directory -called /web/images.

        - -
        -    SetEnvIf Referer "^http://www.example.com/" local_referal
        -    # Allow browsers that do not send Referer info
        -    SetEnvIf Referer "^$" local_referal
        -    <Directory /web/images>
        -       Order Deny,Allow
        -       Deny from all
        -       Allow from env=local_referal
        -    </Directory>
        -
        - -

        For more information about this technique, see the ApacheToday -tutorial "Keeping -Your Images from Adorning Other Sites".

        - - - - diff --git a/docs/manual/expand.pl b/docs/manual/expand.pl deleted file mode 100644 index 782b70a669..0000000000 --- a/docs/manual/expand.pl +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/local/bin/perl5 - -# This is a very simple Perl script to expand server-side includes -# in the directory it is run, and direct subdirectories. It will -# work only on SSI directives of the form -# -# -# -# Filename must be relative to the directory the file appears in. -# -# Nov 30, 1996 - Alexei Kosut - -# ==================================================================== -# 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 -# . -# - -# Put a list of dirs (except ..) into @dirs - -opendir DIR, "." or die "Could not open directory: $!"; -@dirs = grep !/^\.\.$/, (grep -d, readdir DIR); -closedir DIR; - -foreach $dir (@dirs) { - print "Entering directory $dir\n"; - opendir SUBDIR, "$dir" or die "Could not open subdir $dir: $!"; - foreach $file (grep /\.html$/, readdir SUBDIR) { - print "Expanding file $dir/$file\n"; - rename "$dir/$file", "$dir/${file}.old"; - open READ, "$dir/${file}.old" or die "Couldn't read $dir/$file: $!"; - open WRITE, ">$dir/$file" or die "Couldn't write $dir/$file: $!"; - while ($r = ) { - if ($r =~ //) { - ($pre, $include, $post) = ($`, $1, $'); - print WRITE $pre; - - open INC, "$dir/$include" or - print "Could not include file $dir/$include: $!"; - print WRITE while (); - close INC; - - print WRITE $post; - } - else { - print WRITE $r; - } - } - close READ; - close WRITE; - unlink "$dir/$file.old"; - } - closedir SUBDIR; -} - - diff --git a/docs/manual/filter.html b/docs/manual/filter.html deleted file mode 100644 index c62b4315b0..0000000000 --- a/docs/manual/filter.html +++ /dev/null @@ -1,58 +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.

        - -

        Filters are used internally by Apache to perform functions such as -chunking and byte-range request handling. In addition, modules can -provide filters which are selectable using run-time configuration -directives. The set of filters which apply to data can be manipulated -with the SetInputFilter and SetOutputFilter -directives.

        - -

        The only configurable filter currently included with the Apache -distribution is the INCLUDES 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 c62b4315b0..0000000000 --- a/docs/manual/filter.html.en +++ /dev/null @@ -1,58 +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.

        - -

        Filters are used internally by Apache to perform functions such as -chunking and byte-range request handling. In addition, modules can -provide filters which are selectable using run-time configuration -directives. The set of filters which apply to data can be manipulated -with the SetInputFilter and SetOutputFilter -directives.

        - -

        The only configurable filter currently included with the Apache -distribution is the INCLUDES 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/footer.html b/docs/manual/footer.html deleted file mode 100644 index 3f3255b536..0000000000 --- a/docs/manual/footer.html +++ /dev/null @@ -1,6 +0,0 @@ -
        -

        - Apache HTTP Server -

        - -Index diff --git a/docs/manual/handler.html.en b/docs/manual/handler.html.en deleted file mode 100644 index c9c2427514..0000000000 --- a/docs/manual/handler.html.en +++ /dev/null @@ -1,152 +0,0 @@ - - - -Apache's Handler Use - - - - - -

        Apache's Handler Use

        - - - -
        -

        What is a Handler

        - - - - -
        -Related Modules

        - -mod_actions
        -mod_asis
        -mod_cgi
        -mod_imap
        -mod_info
        -mod_mime
        -mod_negotiation
        -mod_status
        -
        -Related Directives

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

        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 types are "handled" -separately.

        - -

        Apache 1.1 adds the ability to use handlers explicitly. Based on -either filename extensions or on location, handlers can be specified -without relation to file type. This is advantageous both because it is -a more elegant solution, and because it also allows for both a type -and a handler to be associated with a file. (See also -Files with Multiple -Extensions.)

        - -

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

        - -
          -
        • default-handler: - Send the file using the default_handler(), which is the - handler used by default to handle static content. - (core) -
        • 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: - Parse as an imagemap rule file. - (mod_imap) -
        • server-info: - Get the server's configuration information. - (mod_info) -
        • server-status: - Get the server's status report. - (mod_status) -
        • type-map: - Parse as a type map file for content negotiation. - (mod_negotiation) -
        - -
        - -

        Examples

        - -

        Modifying static content using a CGI script

        - -

        The following directives will cause requests for files with the -html extension to trigger the launch of the -footer.pl CGI script.

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

        Then the CGI script is responsible for sending the originally -requested document (pointed to by the PATH_TRANSLATED -environment variable) and making whatever modifications or additions -are desired.

        - -

        Files with HTTP headers

        - -

        The following directives will enable the send-as-is -handler, which is used for files which contain their own HTTP headers. -All files in the /web/htdocs/asis/ directory will be -processed by the send-as-is handler, regardless of their -filename extensions.

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

        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, albeit using -the handler name instead of a content type. While it is not -necessary, the naming convention for handlers is to use a -dash-separated word, with no slashes, so as to not invade the media -type name-space.

        - - - - - diff --git a/docs/manual/handler.html.html b/docs/manual/handler.html.html deleted file mode 100644 index ea974eac59..0000000000 --- a/docs/manual/handler.html.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/manual/handler.html.ja.jis b/docs/manual/handler.html.ja.jis deleted file mode 100644 index 917aabdccd..0000000000 --- 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/header.html b/docs/manual/header.html deleted file mode 100644 index 2d1017a8cd..0000000000 --- a/docs/manual/header.html +++ /dev/null @@ -1,6 +0,0 @@ -
        - [APACHE DOCUMENTATION] -

        - Apache HTTP Server -

        -
        diff --git a/docs/manual/howto/cgi.html.en b/docs/manual/howto/cgi.html.en deleted file mode 100644 index fadbceb41c..0000000000 --- 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 b6bf58c219..0000000000 --- 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/footer.html b/docs/manual/howto/footer.html deleted file mode 100644 index 4a0991e6fa..0000000000 --- a/docs/manual/howto/footer.html +++ /dev/null @@ -1,8 +0,0 @@ -


        - -

        - Apache HTTP Server Version 2.0 -

        - -Index -Home diff --git a/docs/manual/howto/header.html b/docs/manual/howto/header.html deleted file mode 100644 index 9bc11593a3..0000000000 --- a/docs/manual/howto/header.html +++ /dev/null @@ -1,6 +0,0 @@ -
        - [APACHE DOCUMENTATION] -

        - Apache HTTP Server Version 2.0 -

        -
        diff --git a/docs/manual/howto/ssi.html.en b/docs/manual/howto/ssi.html.en deleted file mode 100644 index da17836b41..0000000000 --- a/docs/manual/howto/ssi.html.en +++ /dev/null @@ -1,521 +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
        -        <FilesMatch "\.shtml[.$]">
        -          SetOutputFilter INCLUDES
        - </FilesMatch> -
        - -

        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 eafa3150b7..0000000000 --- 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 GIT binary patch literal 0 HcmV?d00001 literal 4084 zcmW+(X*ksT`~G~tvzTFw!C-8eLAF#gwy`%xA*GN`k~EB%kfyThbiS5^C|hM24A~MH zYuX28$zGAD&X82M6yV1I-oQ8!(89ezI2XreGf2SO9k?d~_izyI?d{FwauX91 zt8pNU0qz6FA`VDNKnf_m#z0B~QX7!UB{g!v{X{Uy22w5%0JapcCqcLrgbT7L(o`UA z2cJiP^vy2~1>T_G*PSN!v`Wv|pDypiovgZng>=KCV5JYzD*qsVMM#JOYzW#wHJ5|Z#CY;Vw0!3d3 zFKeQQ+dhJ=yr1Nu0(FCjgUc)LKYR>#P*8wg>g!Qt)HJoU)bW~{a$DlY#QlA!l+*-< zyV8)Bb}UKHUEp@o4RcU-gD2IqaRU~uXHT#fBPn=gb$7lsgL5R~(4SUcpKNbPuRBG= z?0+@TT01Irt(?P9smZBci72J?dEu=1!S8bJLY5b|3s06a+ils_->r4zc2=;N;fI;g zR^GFE%aj2CsciD;-w(X!AId=%9|rl7`R9;f*mG+yjwn^b#&msbt%0ooTe;?9I5Cay z1`Ey26LW+;=|nZ65#6M*2a(%*fY{H0!|`1ya`XMoTx_=cr#xz9Xg!@{* zyzSo4Bb5n@D_VP9B>F4JdpM$z(4qW(>wyo|`A;($9P!6+!g5&4FBLfiGuzc^s z2hAQh96?O|n1aR1EVV1RZ*(}y_7Od{nnB>OS5QGX2*BlhgRr&BJ2M_+3GSF9K!ZqNpA`JWtY5|o*@!D(HXL0X|4#W=Q2KaXy?f$k+9_Z8xosV4RjyxW;SMC zE_EpVSXE^KEUzu&Sr(JH^LCpFixsM0@&WOm6qSImy+`S+B!h&#dzW>?hPk5YKdsfQJs%8X)`k;;rpGZKdD7T3P?zo5CpLwa;^ z9moP3AW79*y2oPH%pBwmW!(2TAOOW zo%P@hP4#~nP@AlmeV(frz6kC3!hf@HFX}2P>Uem0>-Yd6N(t+`gKksU1=Ed^p8amf zu_zG}Vyu|cwqP`Xj~PT>xldZZ(S`7}--V!9Cl@?wEy+(v5t>JAehkTREZ!RTstKVqm zq}-5i?KGZxqTa$43XpUh8xY3YTBcS3c(xrYS~p}6i$!8^&NMeEg;64Dxd8gur-bz|p*JMZ2q>LI5}~AxslCG zxe}KioYGgb9C2lc!x6om)F=`gdwvnikXHNdPRF><30X2(@er1PfX^oCM^?YoT^Dem zL2u>v>^0wFFCJ`rVdewTWh5nV(}{%lrtbSzx_`E3xY-xJCE6EVR~i$#VmhUJFqq($ z&KRKvrSARl#qdg-99<026MTJyelQ9RX7*V=iy6bZ@O$w)#~W8Z+jH#OwN^6x%qOzi9x+?c;T(H7d4cx|%eE)~FdXjWG?Ci#KqHGLx8?*VQ z{qYrYZWIfZ5Vm3!+Ec6TY#P+ndHJ*qX(wEjlmsX{Acv9Gvi}Y(I{y4ViV)j`GWSCv zlKMk=9+2}JOD5ZkAtx)uaH8!FF7D}VTv>y_pVK&OYkgNSfD1{n0BpU$54kp6o;Em? z^7{lSM0+7OkkjKwrvF`}{|1qX`C3U_${Z6DJ4EL_J_Kq0oa)=+hdTQTR<)2o7b3f4 zHwbyIsK^#ZI#MvO)b0IdPqyVk%ewpP4mc_*gmN|~r+-oVKLZwxLz$rA(ys6+w=k0? z6=fN}76q(7OXJ{*_|R(Bhh)ul32tv^x7tOnuB+YC%*byjmUv0Ej`MOjMr^wrY`3MP zp!a3=DKt#&KI;^1uUOxfW}Y5`9d>~ihpAkdR)qUf6fpj%y0K5cMrvPu>*Rgb1s~7Q zWb^eUx4n0sULE;cTa$`mm#xW~l)>=s`xsq1g7XzglU4e4$3JHI8CmPK`{zr} zwoa6mMAdDVJ!V+dX~JpsgJ*steP6JXejmH^PnNudPl_9Y5`+H9Pcs)Z z8Qu)Tf>%DxZY5gaQ=7G~SYE75+aTP$Z}pR6U}3fK^b0D?>-{6ym#uQ^(}TK>8VCu6 z;W*f+OQTE17PYEiyOGo~VOc|ycQO23O7=}sjZ5+f-9$u`(IfzKfIJC!%0v^zJb~JA z=Si4~m^Z4aw0fy9)HMG#JTbq|Sf?X6=DE+-U!fa7A_J&t+@b2Ul1Ctn=cU4(yF4mV ziI2&0Vx*KNKja*m_7oyq`<+sF&ad;FKP4jFIi4tjshntIAsAoa4c7qji-^4kq8V46 zXfgiZl3`QD({!fhLA0ikr;o_VHo4h%Jj&miN?B_;ZNP_+W(AK5HAl4rYo2EwVMqbp z;Q`7ZJxBxaHz$~B5iP~Yv0_G7Huk9&o|M||M<-(Fhx5>k?O*8 z>ixQDn;MCb4%X3BKQnj;rGcUX;W$H^bM8+{u98hId8cYl+7SgLzIF*vg`n~@ti(}q z@r8F+rB|G!^giA`nXi!-jBw0UjKT>9`9P$k6P;9BBx#u5`RU? z`=0M$tc8)l7!lYJ4Y~of8|*lR2e~Z(#Zgh09IAz=P!81l2ncV1GMUs)A9!n;e@4bG zHBb1GdXauSIJ^<4@r%;a?I00@_7_cXn?WNLSK1VNGLw$Q7uRK65x5vO`GC%A-rCQt z%&9KHHOJ=}=AUFNP8fNG+o&Vs4zKkLy04$m;$IE^RfAR)2#6hO6>@QcDXX+jUA5s|hB z0O0z`XYvJ_A_41}U{t-dn^Af?mxoOdW?04hPL&d-g=M~nt5wUSHwO%7^=Xy2HVab2 zbj*P0%5Q*`*wVTAuMC)_yfw3v-Crd5=k{h0Muu(G(e*IV_L_x8?z8GWv+598*6>|M znWM&0u1Y|6SA|vwSP+K9SXAhkRZ4uXm_90h9J*U$Ovh(h2Qn$0FfP^=RUZl~w)|1e zSvfOtik&~Zr*d9@-XTBts!@KW&ofGc zC^e~mbr+d6t@(Ac@%lRKvJ?6xIY0FBifyNj_SHtig~iv;VKkLQRbsrwL5S)RFIZRC zh*>^Rms!6)TTAyVJ^xpI)18bo+Z%1R5iR+3t*v#lHYn+dC)Z|a+`~R+SD6j?%EJ7U zwP%7Vf70u_b1I(<2u7AGecemj{Te6l@MG9a156l(1YY|AI@&JZtKy+7H)J7F$OMbm zZ(jQiJoDMtCoA}`P1E=5(9Z#6(-XtZvZc>V)HL^5g27xWRYc@BViQG)Y3w_CH*WsD z=Ts2!SVF~?n1HXTs4w5+f7Wi+!wS}{1l`L@|NYS*Rc~DXQHz9?CQnDJoEMqSv@pMM z6tG;!Fyb6Gp~Zv%36D>I3xW{;sYeY!(&`v~b^ETiAJbaHNp|q+A=kDmXhhLdv)%iB z^_D~Jza_T&mbClbZTFvP5BS;6(d-Da>j*y7p%{|b!7J$qyW0^l(-C>0*a-l;{{yo0 B(}n;5 diff --git a/docs/manual/images/custom_errordocs.gif b/docs/manual/images/custom_errordocs.gif deleted file mode 100644 index d566c5d891e5c574267fe715fc10706c5702b790..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 23291 zcmbq(Wl$VV7w+PVyM`nLcMC2FL4pK#54N}mx4`0yJ1i31-95OwySoS1Gk!sySv-L!2t{gJ3BioDLsL`yXJ0O0)1{Ox-4`A@tRfY-PCO=AZE*gL9gRbz&MnB z9Qq&JH|ufe>znELIQ!eXH|5Q5eEfC%Kdf)%+i>5IgI)p9*SC2559lj9=#?G%%KrNL zA5hRM2>J?oeH-u_rdKHF^(_Q%2>!nl^M5V;_bmV@Fkg7Ee?VYRa7ZX5EIcAIDmo@M zE)S?=?}zb)E%hI>JG-Cl1Y=Q%I*y#`E0o|P?ggkMS+R6MMs}I7)P&C ztUFkpH=M+7Jd`$Qzf}m!8Sm(Zo%Ig?{cEp*YQX3Ke_WfFC64K?8B*?hxuuUf)0Id$Yvu3H*A^@G zeF~Ta*;W^%2L*}Ng2=LZ~8wWJhbLJF;c9sT7yr0YEr;}bi!=XPniz&@kaAiguXiDmr2`@ zf)pFrz;=csICvt~X6|>m$kfGxkFIn@+*t0$ znYD9dE15i<+qu6&WSSPUC%Kp6bLZ+Lm@{Z0DXXQGM2k8lzNkRWs5&^{PMr(5*t&Qz zqp_?e6N0wiP@ibUYSQSKf1E|c+P~5=VJM}U6xB7mnd*UjSd_nFd2Ce2q%33BKDWnU zn-)U&OqpUd1Y!C6jmPt>hXAIrOXw)iGiVzy#?Nn=1qgF|@xNH8Iv~ubt4+qm9RNRruf@{%jA5#~AbbWfa{+k%- ze#6K0JKv^Cur4>8o$-nC>ab`JN$>Wd&BJaqcX`tu%(|R3hxc3L!$EG6t-yjR_Eg7F zX~Ws$ab-X2(@E{T?bB)Fe)-c`>)qMYc?SyH^F19X2oZ3a^UVwkn^f$;RI`95m8cx1o|4j zL=Kdry~qS(3m~EVxd+l+4q5QEQsB9|iA#LT4pN9WBI+&dWs;eMXr3$}(-HKcnZbWr*Lu&`IlKA4b-ijZ_x$otLL8FtC&o-{C&(d;4$Mw7fn*RH z3oqJXB$t*2X4oUpRTAVTYe2lrC-qG|#v+3&mkP~d@T;j(jD_qDBeB+yc5`*CsTYXC zYH(QY@iHmJjf_U;q3i6>A;~Iti`muUhfH)#3}NdoaTEQp*wkg>0=X%xnzW>aHeT`u z#y;2E4=wY7GM_mikdRx2s7A{8mB@JXhr6X2r0FIG+(nt8F|D3XgP zRxKcdwHH9+i#11!)ioA?g|;^(2ACy6t&DTk(3{d_3MTFOp}Be=(K6eJ65ahHpcB?c zx!Y)o{@u`g`{PZ8FJ`F$%8!LEvfIiKxl$wI;e|ed+p6e@QWLr#i$mJC)ybo!KU?-& z$2@LpGBL}{C4VeUL2qjd<;pA_T-5^dl=F+1wM7?tkLGxH({3B zbMyOck=->8NR(6Hq4@#D0UtWvmpc`Nb?s=+HxF|&AhzP^9eLcfz>jnw_E@c8ge0}@ zzCTB-4*Q}+J6W$lmc`9bHLpAp6?92+AhG$-ZLyOS*QuKC({vb`aO>Lf`G%5KsyGzZ zinZ0gCTxf7;kowjmI$8ElG zKhrB~H9nI|$&^ntSNLOX47rStt{|vP*?uzNns>_hM#KKqqIi#ZKQ`RO>&j<#z%+Dh zS}`?-fm&$Am+>e6uufuG)M%KWDq>0lsd;S-9R?gVRVAE$5m!P=nyHOEXQ9xTLsnhu z;jTwTefF8-wWF7Y{5W62ub_O0l81C6R3-0hrLa6_1SsxOn+58 zrNsd^aSNa`IgvJY5i91Z2EJ3oz>dIBS&*^iV`tjg9;$TlhU5X^O8#2ywM*+6Vur_R z2~%C`zaKIns;f*!7PD`!7Aop%?=m~p4=M~!CqWJD0adKODqhNl0@m^I1N%5zr-irN z#|h!TV>#x$dk=so;a?`{)sBZe@|@^`p?Fw(wS?)Wl7R~=Ypm%3e@loG--!T>v4(C^qLN#bIJ$AJq+**L=K z=on~8vPdLuTi8+OQwAMersOm)vqkA=t?J*@hUD_1ZihAod1wQ)yG%Dc5a ztsXwNnlJr|I5E@SYFDun9PQRquQKk~j-_>EWR12N_FS35Bj{)tg>8a8m-4d8JzRgS z*fcA^hRS(7HVtj;#ctEqxzG65T%#1y5On7JuuTP>EAIOczRuP0dhV!=pDh?|9BCw7 zUp2s1hJS8cW=3VjPPW-IA`9ffo!bkP2wlxvEe>C;IgX}|?0>#AG*%0wqj8v@?wRUMQBmgNYneFk^H2<^sP{iNYAaoFMb8=VpD z-ANW~PHBX5P{2%@0oxPcYYBJrS%3ZzxGi5eh0prJ3x3p^j^Et^*L?$|lXak3{`!Ud zswBc68+|l2gLZNP%y#*^5Ch&Niik-CnUVxM(qmgDf3r?D0UHGVY7F+03U=1~cEA;6 zz7QOs88Ukj?0aBy4hjih2wCwB`75g9e-IL{8M;6bnwT64<->C6)xa&#$|Qkg^FeYo zA^C2Q!emHsBcyZzf<+WiLKs%f7gnnoR__+pm>kyZrd`(Sygbi-55@kQ=vM((*q9wbMi zO{fjH8RA^%43TJz6h>ZaM%}ta-6uyqHby-!M8Py8RXQSF-7K>Abted;&b!^y=&-K_ zFt8q?aY$qE_+tpPVu;*hRB)n|gTld;dhL9uaFzPIInlTs(W7oL^eM57O|i_2v8)fV z#nCbFp`q~xew5O{Gbv#_04B9XELtWhJ88Tqf4sO>{CBMw&ZZayQjaZ-xN%;%V&Aw{ zHDNpo0Gfq~e|8|oEf6!56YDU+-XVSvkk}xS*kh1rl#*yk8qX;$C?e(f@c~HY=0|KF z_nu$oR>Px)2zA02purD^sF*-kmy|dGOGy5gPzFdeNg*xiNUkS^b{(u%knm!SlHpKv)I7~?8PoE7% z&pk}3+(_GShwf-)6c)vB-5Ut@#n|zE!@I~(N(nw^021HF_a-TO?8&Upe1An@3sFq) zDT-bW1pGx!>$`JmL3ZvBO&l3S$6QKZDoRUPOvbZJ-(*N9gk+IwC;qKWClJWkBh99? zM3+v<$h}R}$P4zr$Y3T*V1dab)h$|82mfFPStW2ud;kIAd;vctV};0aP!il;^F3K> zGesCu5<|(Q7@=WJSwxmu*u`1np()aj$;uG!G_5R>Z5~OP^dFEs14yo}KzfdJo)Tj| z74$8~I~HW9*T-|rK+6ZSon#8gG?Q>Cl2Pk_qc+>Ux~QTx#I-f0B5G%jAi8by*w-}t zLf1|=W6Ur-%8Px>HD5~C(9Sc4=E*;%3`(bbgrvzG<)x8jDQFYqG8SP#v!aXhOD&<+ z(2UTa>~HiQVdg+*j}jtt6TNw7f5}`}ku~J8#8(CgUdq9@hocDvh>+#-dw8H&0wZM7 zqaKUWWy<0hi(wRKc~h2o8QNtUkTR8}vOLC=WtpNS%c3I2@*j`sWlQDkgZVaOCDlto zM>*L{9wjctC8M)Crh6s6w^jqLgSr)=M{EEOPjK~aAQse00&XN7bHk10Rmvl%qJ&7e5cs+$eW62*k6Fx9Ue1eoER>YVSGUSn z8P25^%$J7Ntqj(wE+q#aCaWG7>4nvYFV-h7r5O&_TMd`9=rquyR+P+HpJGJcz0%%QqZT8I8c2q*N#lDB3wLRpF5yDC7VD%qnE_#%?Se1!$Bqp^qC51KMCW(`$ z1UpCr-L;$X44Rja8#l!Oqcm`Bp*7K|3OTlp2AdjFTbgyCZo@%#WFh|Sju$tL z1v;(cgmAqQUl7^h&QX)AQ?W3cTBZcsW`?WVJmo!)wZrY3qmFgkQIlJdnzm|MW6;~^ zwAv0*+mBij=a&t$JZbEuN)ad8&hJ}wxT8o@{yw(+eO~?xd-@9??|>KTK-BF(_UZtp zb)dC&V61dtJ$K-ccj5_k5(vea5Vz(^>WxTslCN}rcI0iXS-nEfOWK%EAY8iLJYL;=Y25;8S_2Cje;T_*$a_SEdc<{mzI*jZd1+2`17x4! zWk&$=2D30~a!vpV z;UacvLxpLBPUOSw&%+&QeKjk-xzD{tUL!%JgJtYUD%S9-CnNIYBU3`7u$j{QXpE8^ zuVIbY;X!Nowdc{Xk)elo0L7D05|zH$w6UYsF$wq4qwTRDt-}M>@CssY`z>SR&!bSk zv6Gc?*z-6+Q$MW-s9twSUuhsIZT!(|{7!Zp%Vz8r1MrM7L7+ED#DW1Y{EhVecvAR; zitgA3#^_!+Ic>+73>p+;sE8i3VR?}c%cErqeL7UDg;09h%wn3@8@=qd+aqrjC1S!} zw^yxn$nF`Qs*IGTZH!Z{+|;U=aWyUeVMeJeo$n=Cxh&DiYF4XlCfRdZw;4k>eY$4C z^7rnvzx_~g_>iMDd}!%kICdnoh#A_|sT`Tv`JyQe%vrhgSr0i_hPzFR&dWTx=k$l+ z`4*fxqxa}p7z6Rv6aLY|EwX*0a=m4(Xd~7$80n<=dZQX`b-H0wZZGK#VGEya7TBbh zdU56oy%)g37$xZorIpjRi~0dxBW#M}>((=9n3KsdGe^v`bm>K1ZS&C#OIfQ+a;NhZ zEEu|avmKQy?SR$F_ke0lLBe_c=+z!2@=21b35?T;Ht+FYZBxI{8%&31_RD57^_KcE z>rJfI4Bo9@3eTSF6=@+X1)kRRmeoDT&FXl}cgWSzv25JfOslo5BeAYlwNCFlt=ecV zr|9;MJx^e_EjOHwZoi-HmfLWNSW6mAQ5ap9Kdn1VU-5>?mCHPG(YDtgTW)Q-*LR+7 zIu1{9lrOQ5Z5;^LQ)A7(p006!Xb}3a4I9~bzqgUtI#j~E7{@Xrn-;_IF!w^f^iF^6 z=jo)@oY<0Zr3<+*ATX;qMwq}G;eUWPO`jbg*72Q zW^Kv>G*90V9i4kd-zCU(+7jv;12mj01DD*%R*apWkwIIXv(p|fs8b{v**nD=sM zvbBIF^Ww{w z)mQnmMAnPy@_*N-r-rs0XdnNfV_&_q``3?k*2lUa+CDP?yCA_nXT<(@vhwflYylj7 zj{Bv5_R9sA-64L(wOqv+iNf^x*cG4f4dTx$IG-z%j2occh0ypJ()!Kkzhk17OrZv+dnt-rRig z$+sPZM{j%e8FR}qay>y{59F~O%6b-neHD*=b2@gX_Iv%Z{X|E5&+Yei zPuZQz+R2CCx8KM2rLZ5mGIn)-t~A&_ww&)dEZ?21t#|#sWIkOpe$5;Bb4B^(Id<)_ z?#F#^`AJ{Y^B3&>UWJ#?^^K2FBbKAXRM^V{r?b(2mRi5U3bbxreRk|iZxw}Lo99dU zHn5tr>r1x8gTMFsaF^mNz3b~o=dUZi0054Nrny^4a$)1Z!ofX|l!0Gbiy_2KtEg#k z@$dna3{8N2VuHdK$|zz9)do=DL=VA4p1KS?byBUYn2w&%$yey5n60JKEJ|BPR!Wm) zfu}-pdN#t^9>tKMVwMZC)S(}#KiXST`JA7OF1yag>{-4l{IvTW_0d;1ZTDhuth+ss(gEB6 z$%bIE;Y~|%7L26}c|MX4isWay2uo$F2I7&6!Zi~l{<@pk8xB(`T6+%VE}1LSZ4rfD z!qHY?)6#>5po~RB0nEePWxY(rVuhliDHjmlinTVc^I1Zs1F_a9bJTj#Jg2$k#51z) z&nWY>)h*skI_=^7H93C)U9ht_%S7W%H6+{$!ilM};jNOYI1E;lHq#XZ{;3W+~Lu)=IGAsDzO}rWkdh0a%*regljxZ!U%> zR@nbR`Gm%0h5uL+QB#d0f__@{B|XFl@&e*bbm0i}#ibFJE$qe-pw2?T#b#96#**GB z6c3aEgl-xx6Evt=Vw52eI;mnxt;;gXOM?B`L)WNc_Pm%?W!z_|v;$uywpg%saqS+rUaEf3v8bJL!n`riEL|pDUDdQAg ztWMe#!Y!$yRD>9!eT$+x5S?m;Tn}Aleg?!+p4Hr1V_Zf4vu3w znhSRLE|^_6s?XZdD?ay#yaSuKY)-t_;*ja`Z4`(u0%NjZtib!TF4&8q3SP*VHrabn z6;wLoJ&Csb(+_v(gQ0@MPy>;Zl`@ps-;RaY(ctx|!(1|Hab_@XFF{gk*x3MF+fQi@YHSi0rlJ0@fm;}%>|rX~{9$FL8eu8jxBaMB#z#SA+xv|X)AUfGYpaJ5iXcvCPzGVAimxT}D<_MuaG7gooro{hq&_gfk z08uWbB&;y+Wj1mM(>|dj{(I2N4t5APVx}S;H}B)hc8IXFrh2!2@SR2) zfRJbwnxb!4R6cukLy@&47a9DO4;OoDFSB#Wa%Rj2Q=A@W8_n&DUJ99zLD@$HZ-6;m z>SduQ;VlPRrWY7f96<3+H7w|>5os#D1nuY9OoI`@T;%tLeDkZ}A$toMP8k2vV2>Du zo>1m|j+dDCgcyU7ZUlJ*nE)9f(N3h#*5WHJ*Yq^^2a>@@CU~j<_|93*kmivOxZ9LT zF2D#?qRkPuDAaMcp&V4ey%K5WLx5+ba#Wt`H}04_nZ1Z(WEP4bCN+^}38T>%yCVbs z#VKxWgCcRRPzb_q=w!ISHp*SizVH(bu3Zbw5&#K!k< zYBTDu3x9V8K=hwKO?q=?PiCSKk_c1GU|tmUo0eB%m{xA%=z_Si6b+R`9*Ln&)L`}I z4M~{OF3Y=^;nZ^K?2B)7-eg_1S;fv}X(E46b=d0FcMjrhpe=iin13Dv#U zm~;#9uOb&&n#b z`5)kGI5wJo99;aGcLy>W93sr6DM6Lzy8_%}<-|O|M*Q&qpb4ik~dLk}MTsP5RxO`X`4NsNSe*6p4jq_OeAf+&D57IB^7U%NIkempiuWi^B^v3K7V4q9I zPM4Mki=f$`iA?2A1U!>b3J18c&%!K2b`FPHc$RdcGEw*#zjlsSZ09wTt0XFsl1-Mf z($c|2`vY1R`H4I~69(W5o#7cL$k`rJ`t2wbbIkR&P;$$|dF#899RDq|bpiY^K@tU` z;HsQ;ZrzX4 zZLFCdz!f%}707ocmXz0aKqTKVW8}qOsZ6WCL~mIq(9c8SE@naQzdZ77{#}`@aFa-@ zQgWTHCZBd7b3{7eWh(lAdYJ6(`(U&sKT7TT!)xzrPM66R$Em2MCoVtl@TnUDKoyS) zw6;b_MQY*io1%=uN_%UrV{0tq7`3N*w-)=&+A7zgb)q;!G*-_kbEnS!#8Pw@MO!iG z9XpRRZLml8_=A1Fs`puh3g_9J`{{)0yJS3EZEX6>*jTs@t&{1d(9idJ?{K=~6!~bv zzw%oKip6%a+CkVrl6NDo;VngT{O-2tcGkzMlduZZ@P2l9|7^C)4F!^KoyabA9*H`A zo8Gx%gHN{wh|R>%bMHPr3wYJb4rUT;2TGA~=Zge4{@VtM4XpHSS!}5S@joagw6jIvrgIu+)b%K)0)B3+VwkVss5(_WSOiaw2q_Y1U zMuGg2c6e2QZ^ZBuu`)?Ba3a2LUPOHCxR%lek{d|sTeAX&z70p{q66zD;07C16cDGLb#J-^AztFPHnAZg#{Er*e~=$UoE*V z&u&HF_mCh9zJNHz0F{6MhelK(2~rw2hn=Kf)3m;edx9B;Y}D$wnD=fQ)oOBgnsmI{ zKB~XNs?ZN}50;~^E#TJ4b2SQ`nDMfDFZ*EOZHv{fX9qeumT&he6 zHzhg5tgV$5Yj*kuYU%X%nIY_SVGl?r&S4DFu?f=Wf*^2O4S#y%IuHcZR;EBWj?KmhJ`3iMVE zzoIoHwb4@I_&9|JHY8oBBk@!Gn?drou5?L(T4{b3$rMqKnz16=F|-dsk9-O8MX}F7 zFkk}lbBc3BkjZtBNevGY9XF*vJlt16B>#gRry;$$t79E~Jh5gB>48BzQfQSDepg)( z{a}1DPAoNQl&^FY*gb*KJ#sS9##1x8Ch>#dXQVzc`Yuy=*$s$wu+$V-K zien^3p91f_NJ!}2LF8}PVr0Kmvg%+`U{P!l&?leIXVVO*GMf+>lnQ5nBq5gA!;XNc z?!V+rpRMBPf|$fBW&D(5`=Ww=g=_e;USGH#_>Cla0GRNU4V`_6nUzj29}GRbgA?S9 z_N4Un2RBa-q{Jbj>Y(p&v1d|swB!`N+V=YB?Cqds+>}I4K}keeZS0hcO?Q}% z1OZBL6I@pDX91&g2Qt070szUszTSnB#0ZtSDF~w4Gj5R9x*^8|ryblXo_~vM?*XZ8 zf^I*3#Nx>8HP2+zHjkUcGPLm7x5&xUw6T^>v@nKeS%CbRiD;7+aCJ%}H1`xE<%p~G z1P7tp^wE*iv%xHZIe`zBsE?T$cLArAVA=z6&VL+WBVyqVqcZwGU$b3C!MyCIX>N!? z`9!YS*_QpBdA}ZU58@QzDc^gz0Z~LF;87FFQS!w;xe06AGNBmfQv;bgINfJ_E>W|; zL;M}3;{_XYhi-G7AVpLhh!eGdIT z`141aVHvp~?TPpjp#j@WhH`{s>}v^sd>|D%83d0p?kzyd25E{SdZ?Q4Sv`nyD8_EN zh%UKqBw6rj+PP?^eou#G1<2TlVb%AUx^-k_X#$91odtKMR_=`s<)1V_6t+{Mh?zYI zwpA7@kSldKs^YA>U8%cXMNXJnUW$+D7?1?B@(aFFUBDIOuBxJ`&Y zi1m(y#=ca_as}*t?vk&?p0v%iHp3XI6i9japP8SO>ILe1D!qRTSk2eF;=xrtnB?#xhwpLA->_2TQUuh-Yu(U_NY!4mu93Q z)@fZg(SlCs{lkguqmSk>0z$sL9p>9$xU~M~YOJ_&Ql~BI$D8aSRX1uO$ zld{>@YCeh<%?S)-|E|ok4B;B6_@}K?y(AmOSS`s|q=hWF)7Y~9qa#iPY5zy75z`;) zK-I@$`n=)1?O-lt#ZUW!+MUZ4J31QZ;UPZaiiOkFd3j|o?~15Pa;sE27?@Gz)atXT z+i<1*-Qp2NgFgx;1=oe-ir$+vq#ZSX9a6~9>9J($XcrGM<&%Xmp0qjl zHa|F(Od-}S79;p6HSvwK(@wxIDI@nWXhcH(fQDriqs5L7;a|w)GMJj2w?c3`iBtKzYIVA zlI@q#5pYgb812zjvmO9ZAPs2PY)RraA`^i{27u%-qq&1_X^3#joHXnjpH3@s)U%RQS(XkG36;$e7!{G!3QP@6we;^>m4GS{C^Hf6bKP?5{*GY` zegMaq)`gL$V1J+(`+x)3kp*stkL`z#ZKVPC$WhOPP)}CIj&#R%F<|2zX&;AYBp=0d z4aj9wbxWju5pIJVe8>QD6RGE(l^INbWOfVlazsGrNan!`;_S-qGkv?}TG3T8e}9a=}Th=ENVpfmGg8G;Op0Mo<|}rx;k~ z*wf#=r|=849#O-nV4@Zdp2|In)+hq{B^iy#>~`auBfs;kV1);KC2y)oFD}PprRSiBB86#V~^hz8TiV16ri70ZFE=^@q1bMbJ46An2 z<#&fk3S{!S)$pzs!n3|jqZ?f$EDKbY@vxMzgZofg(G^PJv51I`pWah*FDo-;i>PM{ zv!fdm-Wvc%AZOe2&t;&J&F$`>onYz@GtFsW_HniuO ztg_|6*`NP`n406~aW>i7HqgFoCcUhTyx$3-*umFdh0WV+LOGE5*d5WkIPZ9VRU?=}|W(pSD` zY~abSUhD3NoNeHI+4*7n{;MxLM(i4=3RPgFqA(hQ{18xN0+Akv9gmZ#%n3mVAd7+1 z-DB00XQGiwu+S{*t|XU4i(Vj!Tn<@X9C&|VWV1iavO0iyJZv*13OgDVUIm{KjxHNk z3IA-vI{CY1xN;8$v_QBa5h&kz_X;H`Q(fwgTO zrf>lrWj~vN0A{6+?7{Wc{8eMfYiE7$H&OIqn^$LN$YU#q%;$uxi^t64{bk2GpOElk zMbw<76uzrCrf%Npu@8>%GEUS?9Qy+AG@}X-X?=NvGA>v)PE*GwDqgmp15}&Z$|xaz z{5PLYMBmFq?zd-NzOE6=!6^9gcJZ^DzvBI15ogGYa~fK^m0>MIhTO)=}w z1T&K2&8Fgw*8>v$r7d8(I0TD*{dWa3Yhagcs5l)MBbSjv+Eza2j)>_EQYd%|q%|}W z69Y3PRIf%yF~r+l;r+;yvgN4mNny5eOrU7sL6mB^n?6stDKA8LQi0bb$&3V2x z`pYKd-g2DD8Nn$VVNal=^c5K>EiD5M^j8QBP?Qb;Z8-u0CMJAcJ$zM7J<=Nkw;rRD4WqlKubXYKyJBQ?Y<%MX<=U=q zY;OI>wS`rv2=N5)NT15E001=p0y4MK|1N`q1fTE1NN8j(r4^~9LeTW#0}rR^RMK%| zxM&z>@ey;_m4_vc)mb82JYI?enUmS$Xnx4^_y1qAt#nQPXzJ`#Qw?uGI-2`+eC<2V zf$yQXEN2XITM83cGC@EkFe46x^m`(`Gag7iqnd=$JCO4=u$qYNXNNq| z5BG4Au@<+hqt)StiuJz>g@r2B{)L#oS-y~G}Gj}a&8Fj`|q5fP^RKJptxat zyn2$PZcP)7vaa*$_j%49n!*h*2G4=PPjK0l zF3f*wr1tRs(KJo3-ll!1+uQyPc%<`aiJSWhpD?99TsE; zF-FFQGXyR|25+bbAkhrSBF2nEIq4L$xH~j}w5F8&Qf%ifD~YSg``HK(D)bMdc_&e( zHH1?;%&&<9kdY6NWjc(Tcj+%GTyZ%*ZOAZMTo4dHtt3@6*B_vzd_Q!xQp>_zE#{mQ z9b7__-bkT<9?k4XRP~RW3nE5P< z_$d=ROrRvqWd=?@i4Q-cnB_)BN~LaohYGQ+)_EU}yIEo;cJ-e5z_OSk6O}d?M!e%Y zK1NuU^TWu4rJh8?tgByD!{%mohlFmx_?Eu2Sd}Hs6RG*RSwlQ}qK!%1#3dtNZc=oC zEBV5=`$o3)YEWg)vNVoZ%``-n#*E1T>idW&B(ual@Kch(XNumZk@mWf3N(^cbl`U; z<#Y<5F+M#tv#l^s1&M{rZVg?i^XKE2MD`_0cEFQGe-rpditD5ZMo#QNq_j6cmCuC7 zmzto*4amf@Ht0mQ493|AHTc3z55`i)M*HrtabhXXE)Amyb3yi8ACIMpSXhX1y}#14 z)fZubNI;}}TNaYAq%hq7K#b;9v;%tA`yRnvif1PEhyYh96ARnchX~j{?p8 z!C8@!yUBJt!30vdwH2p%@`rR7B_Vx+(X!v;(`H^;&m01)wJ5+rMM!lhOxi%$1G z;Ij{PMBwzMU;HF>m=<%0Pr~Hl-3Y_)j*GcT6HWe*66R)Rlw(K*bmBV`}bl~42c=DSc*Uf2`}9gdU7J$ zh$wBm*L&h{nL1H7XY!rTxhYa8xHF`G}0{fe5F#X&IW@Fhp2LiyZyuqDgs z|H1k?hhp|%i+N}gVmkw*{ltLJ+N_Ms{wWbuhsn}3aXNxQuQ@l<=%9nanNfM4o7TNk_tw9=_##t3X|e8{vtA|MGklJaO6hEaR__g1Wn`^G)*+ zw$A6!)r~I=jlIHFu1TJH9cZr2`+?;ygC#3_<-|=>H)kHbo@@6I;_CZ0X~m!XGoJ=8 zNuG|^`L=%OpS_WTd(tbwi^Hpa9)z9e5%!LxPjeMR4Xu#2ZKldF!<)$YcAR#0x6^m} z*yudv7+5Es{3BaE^?ZNX^9Oy7LzlmQvuc3H$gOjGl|4>lWM348Y=SWHIAj;Y?Aw0I#82DnoIzO& z$7IsPCT`0wgbgDfT~mf#(mB1iSJo6hFIMS#b9j|m9UbNiw2mf}#~rp>YD9UoSKB%T z*tMsdJ(3U4YNH%|?$_2oTT8RsBtlBS!EB$qPj7^=Sho;SxK_m|`i` zs4-XbetsNAulMn2cYVKa`RuE2{VVLgqH*yd%w@S$ceHj!t2XI3qNeX-0lS&2L$<52 zB#ptXnJ*5BpD%}xPQzEs5GPM3HDOas>F>XABn-!UjDIIede35F?fTt*m+hj(qCYT@ zMz)ld&|3mH;%VZa2lD}vF-Y!px=qczcl-dp+a zIOx+lN|N|&Y|-joBw7Od>=s;pcFY-Y&{>U1XdL6kG>vSj57Q2cJamq%Nd_M;*d8_7 z9(_0C*pIvz&?Kslq)?AWTm-N2VL2zey7EP;@kH1)MkqE$As>RoUCjTQ#&|o05^F_~ z!5AzXzel{Mw~(j@nG}YFnFjdpnT$0W`~_N{(NjfF>wsyT?IZHkqei~W)k|5Z97`Znm3MZ6o2(LdUR9jQ2thTmL4jw#5$Q;}nY zLrgN%6FtE9!uF#Cc1}>Xxt^!xjXRXZA!t@XokB{7$%Ep;kjDDj< z&W|SW)di~c^O@MtEJUd^IjY}mI9>n(?#-esYHe?x6#G$L2A`xqjT+gkGT!76_ha`z zD-CXJ9y#ns31+6~uWCMZJ7Nb(?oBhCi#5w#2Sud);5zKStn>}#JeiK+~$vx(( zH+xDwdJ6FQ^1J8hleyEO84%y+nRs|_slZ0Q0w zw0xT(YZBKub2J-wvO+)Nyi}fSQohg;lMuxPGg|s!PIE9Ny*=6kUffX>mqwAVU(tuk zqSDHu4>;s$5X=lRz#jpcWHN}KDwxHgc)_4RGBB9gEdhuW9MM>aoe=X=DgfCf2o6+I z<6+h=lh`GLnYUEbtyDUTQ=Da4ye8r=ei$U+j%D}=i5&#nXqEinGp`~m1(BrHH3zL| z$4D{+$`tW&Uo5LmOK69hwpv zcDZL;>|vH)WEVFOWmH%Bnwa<#sj^Yp@>$bzIUymB&oG}q6$PeKdB#(9;!!^Iwy`Eq zTxL*BGh99_Q%pNteR@>XyHw5kgvR7qJ#MY<{s zWd33rMkENXTd37}0Evav3`48aWvbnN6w{?PFdsK~JvDGFH&9xY`n_w+D=z00Yy^8Y zhW==z32S@=#&!3`yFS!wd4_9R)#El*Bp=twhxtAi_%=(FRcV3`O)Wp|#oG_Z|9CL` zL>v6wDl*C?y)h9Iq*Zs>XokWcotPRa{t#1#ZgnVC1KXErjJ0YEL9ZDKE9bRpWIt|= z9&Y{pgyH(5?Gt+2f=(kAPwd}R{UV(@h6AHOYDXT5#woqF?ATYbzGAqaXvJ6zBBXlrx#o*$l2$D zm-!95PCsXm-An!JGuTzy(&7B@*J-ioFEpy{pv#NY^gg5nwA`Vx(yaKl;(v}G5%2sE z-bzm1HF(_UYSl)(g2A2I2C-_TDQ)HP>@gdJRfv=KOD5OJK9|}acYG$V7}@xPgokl# z!2+e@c(e$3Dvk|wAK=7j4z@@Ne@Fx$cJ(&Kg^|@B1P+8V+i*4|$_Ylqd-X=T^(*XE zI1coBSamKfH+Vj^QhIeUwsiVG_4*1{7lwDP3^$kyHCd%bg?ZI$rVZm3B_pNvC#NR0 zhDX5j{)sts#zTY#uk-{~mM@0BOHHVChalgk_ViZCt@uq!*+kT(xE-b>G^Khs zrlb^(mRO7~p^f4T+BR8830c*IrdE6Cj0=`jQ>Qk}>(qP>8^4zw4oj^uldVB~Ujqxb zB}Pv>)=k~P&jUf(Paq|2-Wg>)+M_J`EXjbp+;~ky*K74&eMTleR}K$KhDzdmi0tuf33}4MVT{y@2G_-veZA~V3K3; zem+iPhCj*qpQq~AB{wF4T*uYtL%9t zvu!sEi4oR@mVVFEc}c5_l86f(`-|C_i`h>J&Jp(74S|jVOQmg6nV2qR@0ZKpFDfK; zYcno4>WPPznKrF1BV8{|A1=eXSon>+DP{#$1|qn9y)gz?S2V;5V+I$;gjdtSxk8ew z3pU=hHuIC5i6azV*XYZO!fU8qQ*h1Qw)@?_l4~a{t8YG3vhUvChMazlZ4wK22kPnc;

        NJBr8l*+>3!pZ>`f<1VQh5z!dWX991Pqv^fncj8Lo^}`!@J!yPhY&c=(sd8HIpRb z>i+~18tvtVj=h{+=4IfsuIpCz>!>+ymbrrWnCiyGVAuNV;#Na)KG}b2zr$WY-t1k* zT!rbL?%HKo&}eMl4()Df?9{esiCS;TsFZcPXVQ+z(U9Y}UG4^?S7U3o5lzMF#<{3F zz+%g5fp%a~mZ*{J?-BkhXKu!*m^ra~Eay?nbIBm^8rqJO1Ki{e^81DLLS5~{AREI8B_a865wN>F+B94`7c-U zfA*Ua|A6oU05CN;6@ZwixX9S(_y`#(IZ0V*d5M{+xyjk-`KdTC(9j@YdMY4FdRhP= z5ODg!Aj>dYTT46p@?vs0_3OK9GCVkF0*aihyv(f0Fj4|@xcd^IMWeO#qLr2PvVpb1 z#Z|`D#RVi%3?RZ#2v98uFgy5BvJNCa0x}p7GFWShpc3`~m|y@ffV@Qu1E^c@j$gHA z6f0W1{)jQ7#*K?ql|p68BP&<1Ox==2YnLu+)DA70GRuU)brU(-yopm2Om*<)F-Vbu zMv7}$Xk^i%C7e=lTzI++@GhRAcktvLlgFgT4+a5biby1=9g~2AUI^@`Xdyy)3X46> z2{*3XxpZxc1et2oM**!~#j+-F!97MkxbEpB<^@3;)g;GNhDnjp7NkyCgB1Y zg|)E+B`rE4;!BZM!sQN2)&NDBiQK(F!V5ytu*Fc=q~J{!OaTxhIc1b%&RZP4L*SKm z-ifCtM~0-=NJ_{c4B2DjJesF-E;#^IN!ur z&N)A9l*R`&DT->Uss^xUUaOdL+$qX2`6NqK%DHN;%-p)^7FleOVhWQv#~uD zrjRU9zak}GH*K01+PIt;%K;^q4NP#s1*c(cBxwji2E&z1VFVgWP0a5GXe9iS7h;Iv zg%pxVG0r$1Gh&7rXOw(0$|akuvKdU23v(!a;?=FJ;0{`=SuyYY2~6f~dK9o)1W~3? zB|5hqypjS%ri#gS#u+#1mf81`Pam6aIE)*8poYvBe~9 zX?H1Z0W9S-yr`y9qUDeU7l}J!?9wD)t?;wnwNZ7iM&4_v6pb>Gz zV=yuN7-M+BubgX-vw_=@paFLyXViV86ii65g!R~4AI0@&EUqo!uL}O>tT%?}R5=P0Pk*I7yAc?1BY&dtxF|=|CiMX=xmU zr7R7mMO^A`pZnY;BRmKRG-wQtj2L0afQJU+B{T~DXxJVd<(4-lTu-9hI~_Hxv`q39 zQbM_a=8rB4QYuYhTI9&)QsRe&^1J{GkmE)rIYYkz9_3!ta-tKLScaa|B8{o*4wsD8 z9m?Et5n{Z|P%oiIekv7TU+CRZA|Zwlmhps;U;+>lLM)XV-u!eEx-Qt2tUoBB91^X!&(9f zVT&DL{~AZY0u~Kn8^a`6o2o(3(D`GYwl4CEjS*}pbMPGG>r zi^Lel9l+pCl0P}*C`)+xI#lOC3wqGMx$}|58YKyx9K1gm}XYG%Z`F|$5Utu-?1 zTHiXT!a&4^n^dlBKDgu2ZgiFJ$n+ube(yCD(le2=@{x2r)eZjF|@Q^KG9S+BI)E%>iEWeGh!-{Qh^#18#AO)7;?WPWsPv zj`VvQ9p^HqcfUU#^qt2%*GB&~(Pf@>a`_s~PP#NNICLQ|3t|`(zxd2Q?sm7&yyQg3 zI>Cc}cazgy;8CAD-1{!{tZUojSob%;Pmc7AuN>ug2fMBf4)3Q|T<%Ms{MNzVc)KsY z>MK9G$}4~Ox6i%j`G)+^3vceyU!CeEN4?LlEq7|mJ5{4bG|mzoO(s_pQ4>FU+(qyA z%f~+F!VmlKHGl4?D?RL^Cw}CK-*e2vyy;r6e&c_RZjWQX>%iZB@-q*5>T}-J(06{} z#eZ{^>z(}S55D#OlP-JA8=vY2AD>spS6f3OnI*k26mJ)oaf+vO(?@y#wtkiOdeJ9( zT<3eM2Ym1cbUr74E;n@{cX&-#dhgbE+XjJ_ka`4Yc%J8YomYG)H-LmEdE-Zd0(f!> z7Ggr7EbM2Hb%mt$oo zE=-scNhpO2LWNZ*Y6!;8L)(p$HiY&(wte8x0 z$Y0R33>CPGJokC9D2m8Hiy1+R!nkp`c7#WGg|C=?@#c)1P>e`;jP8bS$!LsbQ8THYk)xjU%WG%UB8RR*t}kjIH>KrFf3PIF7#PfzPN3%t(ywSdIBOfyrQx zexnN82#^X_KF@TAjL47ew}W4IgGG0YR=0%lmx&3vcupsKGAM#9D1p!Cc`T@ks@H%! zn2eeDff8wpmnU$^XM-3hbuIXjBDirJ>5-fFa^%K=F$sTl$C59Zk*cSPF?f=&=#d2% zlm0&GbT$WhGe}LM-~da>luhXX-MCSQR**ZU3&S>S(!_oysdz5Ad^sp|jCXiJ$&g!T zf+snE)0c88c!D=~gJtQHCV7!yDSd7!d~}I#@V1p}>4MEDi(|=>c}b3YnQdc9mKkZ5 z!zY*&NSN>EfQH9?>Iar>>6Izhk1?Z^PU)0TX)}@-6H1mLOr|5931yl%e>FIn7WtSx zX_QxomVfz^1lXD{n1B!Yf)@Fejt85kc$=&FbaJViys2~Ex0kPpo6%>0vALUr*_f$G zoWi-4Y5AO5cbu#jn84X?$f=lHb(xsSl$vQ0dBy-*W*TT`m7Jz(&WL(U=bY4;{(}zr za`C5?>M4UF2cOJ2evyfgODL1%hFNp`qEY;5*sYt|fr_?8iga~!&JkNKPM zh@HO(g6s*SYDtR%sEq2Ef?3&oY>9pN2&DK}qx<-yDX5=zIgB$ZoLc#!YU!i9hM(v+ zZ4X*~SL%XGilnzV03q6)BWh&e$x+OqWPa9YmH3h%_U?*aoq%VU zaLSgII;o9mejB-g6}m_u%AMXBRvndQP?BSdMht06n)1hVIm&V_dZ9Q-gMpcW8LF!j zYMOwFtGB6;r?{ZFS*syOo4HD=%Brj~I;&Ypt15Yk3dwatxude#ke1r34{56_*>w&X zZWb7VFG`WS3YQ^es+ftYm1ao7;0v0jAzKz{`WcUpn2L{xC+V7*V!D|?SZZK+YG?Ol z^Gc)+TA70wjrb}g`r4H1`fD8(Y<*UqDta38T9R_Au%noN=W^hW(^l?Z5AC| zW^5aavMHOdUkauo`mu!bu#1=>7m{{-wswxDvN@}>9@4Q(iK_nlwTQSE5KmDhli&eI ziwH;S0T!XOO4|uYo3xJrwG=V6nXt5tP_>JYwOWg`P8$GT%LrTR2w4lZ7NHyEcCb79 zp)3og4y&p`+kgJYdz)~zUz-tiYqy+$w~(;6%+R->@VAK&xPnW#g*&#Du(x8%x12DP zl#sS+TdHguqCZQJ|2l+#8?|?<2!m_1l)$;j@VT16xuILPrMtL@Yr3JUwTx?x`UtsF z*0V0lOx{?cDj|f+aJ6^~wYgimOWV6&>$F{Kx`qq9T#L27o3y%%ym`C3#Y?urTfBnX zyj$zF&>Ov*yS&LOwPb6!%DcIF8wtysz1qvW<@>u)tNys?_@+gfmPq-!*eJQD%C9h_ zh+n8P%22kMo4e%8yVnc7y$iO@>%57pz546B`&+pE3%=6pyan991Ps1iOT5ghz<-Ot z-J8G&9K4bsz7c%D`rEx1%(>ypzI_Ru?^}p1E4vyMAxDOW0E@p148qKtz!^Nlb_>A* zyuia7!8LrtJnX28^{*i^E5(!=$^!M@+*+jKnhRqs~d6(}}{mT{yQtBhP!p#z!W^iQOv_Ye8+JN$4%VH zR4m7$tjC{R%65FZ#_PXxT*|Br%GWEzefzoLs*}anrHqWOUuu7OvBLTHwjQ+$mF&kK zjJ`O`$I%vw3&Ik7%zXUJ$BfJ~49&&7#G{IONIjz(FJI&KQ?bAOE)IlxOLrv60ZPYxy(o(pctFYAb z3n<^HXcThNHI%35>@GASQ*xB?beAf z)@8lbhvp=n`I(0zn(Fk{d(GFT8oxgap5n=7Qjo#_4-s{cY?G4=Bz1gPl5dlfx09hRMjo{0+aV6+>^^45(AmQr04icQc>6br;$u96Q zFY_}`>3?$R{s&L&5`X{_KmePb?IZu&vF_*HPVqn=+$b*r0)X)WK<-SR0Rh1Az+LGA z0Pi}Q@VQ&F>4)25R?=cVaGq3h*zwAsc=7Mh*duAOR0h_Abxw zY0vhX&-rNn>}swgnBMc7p7T3D0h^BP*-qTCe)XEZ_k5q{6X5s0{p(HN^igl<5}^CK zAMU}8_*T#O0ATeXAMcP4<7VI8lP>`k!2HZF?3Zus0U#^2k859bX3 z=@2mf=exiAzYXz<(B0jK4ZwkRb{8V4|TW|clp5>Dd z2muy@gbx4$hyo3Xhy#p|kdcy;l$Dm3my3yxn4O-VprN9pq@|{(sHv)}tfHETuZR$g zoRS0x0uu#&X9+ZFcq4-tonu>!TN00GAO7qFngg9sBUT*$DYr&x>PC5lIo5rK8M z5bfGUAOeAp#60~9MzUmtW(24SSjSQTH(90#SU_M-z`1gi+9i6olHWWC+6WQS$Ef~a zMTbZq4NS_ksne%Wqe_hg5vIghM-i=?U_loIW)Tof_&6+NCzEJTLP%LDZLn^qEC{lY z5|_G4IuY@dsL4@;uhN*611FEx)TB!fD_+dFv17$m8Nu~OX{-bZVm%_VEDD-uXq`Sg zQ}w{Y18)#;Udk(AuTRRIj6P17c((1^xO3~a6j@T%-G^DbF8rJ7qvF6_8BWf;x%1}= zd$WVCSU9}b$dw+aUaB_t@8H9WFHC;=_@>r-5^uo1z5Dm)Q3FIM;e-@cXyJtzW~kwY9Cqm8hZN4E*SU4&ooC{S zD5j|5iqyG7q9QEDDC3MY)@UOuE~=*ph&=Y_NG7S|l1w(~0+ zo_zM{=bwNED(Iku7Ha6Bh$gD&qKr1`=%bMOS`m}aW!rkr-_>8GHED(a}D cmTKy$sHUpws;su^>Z`EED(kGYni>cIJO8`nHUIzs diff --git a/docs/manual/images/home.gif b/docs/manual/images/home.gif deleted file mode 100644 index 11299c1cb7ef6aed8ee4b159d733668de8662f22..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1465 zcmW+#YfO^|6g_P}`hb?UfCU7!Ag=*RMW7WJEwIjlKme;k1}ab&2*DvZXLNHgz%i{n z3mR9Y7$rv8M5m%)l>+jRM?iElgAB@Rn)yW3VbpIQyFYGjZf@>9=j7ZC(Vxqt=^BXf zHG1$6}$N0HhEs1{h#YOn?T0#13OAoUz{88vFO7xf%Wan41F$ zvoRaJcqhiP)8UXvpx2|Nh3elp3tt)yQYqY^Tv(twRYGu5QmA5745xS7sN%vC{1a{s z7U)dSd_*{cTCosH56Iys5@GFHjE+L-f=rMsSmeS?r&Ew%e{enws>#Z~@)j zumIC+#{2h}RD+u0!rk4PIpKyfk1GCY3{@(^k);q8h6kaEb>Y6L*u-j1;`ym>=OC^CNoG6R#aAIEolu&@SI z9v=Ac0S6cyBTka2p5bF0qQfx|3Q>mmvzd7On8E;ZIamZp0a$d3K3w4Ja8uv?CFWrRB8irk+8diujrupK}iE_ zY@kvhGZRJ}+=V#;%wyR63m&$$;pIylg_y*4CvaEMkpMQILV`&FXyJUUgqK*1&`|8& z4XqX(9n`I0u?U_}PU8DO0!mMa1r!Co4}v79^72Aj8b}g!8YPH*Ff8;iKSh|WEf&(C z(cr`h*z&0TZGP~y0-Xco!zw2SazD(^L+%c_8{QP_{DWRay zqPC5P#YK=6AWJE`zSS(Lp2g!qr^CgI6n&x)1_HGAQ2eI7g!#{eSo^<)vRxus?#vc2+eTOvP+lpVZ!Fb7Xp_TZ}$yX4uG^@QEFF zco~b74x4EGT=SW}8s3B1FGN3@i@v=QY0yXi))o{zZvQb?bb3v{QCcKkn~PbjM$u?x|e0@l@=M028tTa{kh%sHFXdxbw5B@+uRf zLbgScD_L2eJ`owZ!g&4K)ATZpTy*VOfl1RSOX@8c7WAxXt?}J{%h}pGk+o6ia{QUz z;^6y7nz0oz_8e)L;bSmo>+=n!&C`_5K9cINoz>#L+btv3(IVtA4pZXeP z!q8hnq9bs->OPIf>C3PZn3}Kuk?}wmQR!vN-Fw$7z)jpE3HFC5=U#FK7LE*K1o zO^7<`VCbX0(zD%WI->b{S@oSgbeEk)Nfv8ob&B(6+z{}>FmH*;fy6SGG!wlpY{R&? zn0xbPdusfD_sLtamKk^=)G&cCj?2j;s*`)?b& z3j5o;9{pY@vT_cz6siQD5uWQ6`Y7wC>hU2@#@F|Lu;Oss%J__+(+aVruBm;cH#rjB L;Md}uqCn_>{mJyz diff --git a/docs/manual/images/index.gif b/docs/manual/images/index.gif deleted file mode 100644 index 741c8939d77d2423d67beaaef8fe78aed13a94bb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1540 zcma)5X;V`N6g^2EAqfEj3FHAmLln@6kxfB?HbDhZNdqfbC>Xlu)u%~i4fxr zzJ!Ylva@mP7Gz+zw_{`kMmA>_j_13=(h?F02v~kb=lD2<&y`h?98{sgmB3Y7|P-oTat3#t{+%}_+4$c(KApcmUwEFv-z zQkXL`K&NAD41LL%jpJryk+4|17MCw$Vge?%6%BNmEzZkPk^&wNT69%Zpr?mYaBGFx z2vR77uP>64s45aIBGWK5aSpx$Fc>H=$Fpa6{~i-r;BesXj$ONOAr>|uii*(O3=V;B zkzlgJbM#NBV6>%t*;#=sg?S1Xr!ZkcwKbR;r2Po9pC4}Apa6m=PeAfOa$!ON1AG$j zh6_Pp>QtnrqP`vf&K< z549Tm_oKBHeSMS{HZ?gXC;0n=57HGjc5obzg$HCZNX#%0V4HA7EJjceR;|MJ?a*pr zGEpUL#Eu9-{A4CRBah34rzb)~ariJ2p*5Q+h3BJaS2<8dY$GCY-~e<`mz1EY3jO^k zo)4KA%dtsDf&-efGxow99Ss==$;og-*v*@e5pX8JWMan->TKjp;NwTQ2~o8HCKZGb zSX)z@m74b=E)Fd%P{QvCHZy>6NCiy9$taeK5V8SezeUz8IGcF?-Sq!XUSE)3enHNf z1dSzHqB~u$VezHw^t#eUP4gzxutT0fms>j#+^N5MwsCda9aW;A_roSDIF{W-%W4<< zDe9IJ^V^)Fg%gf#8e7NfD){dmk4$i9+ z3Wpe@J|?#JZ;wr)%O>B3Wy1S4sR1nw$0VqiSa>Ith1sm_{3G2ep^>%Z_c_s9RVi!S zmW3Od3te~hF8^LNW7peLq~NGjR8P){yYT3AUrX8U684qS#d-3=r}mfb77*g~{xdST zq0#5G-!BvwPHC{gXqFHg@^6gU`rXBJ9o@8Pk$e;;{PdNFnVP8OfEo>nO1 z7mXPa z8}g=~3>^KF=R+TS?B~`#ta05FyyLE~Qmb1L%RCyJIDg4-`hx}DK{Q5a-=1j&PDfGN zb=%1CzwbBKK5gk7a(b1((%M*>HcMj|M(wyqZj|MUAev?HAi+p?Ve5Gc-)*d>$N*LF OiPzOh=dG1;1pN#BQV7)m diff --git a/docs/manual/images/mod_rewrite_fig1.fig b/docs/manual/images/mod_rewrite_fig1.fig deleted file mode 100644 index 7c80fea3f1..0000000000 --- a/docs/manual/images/mod_rewrite_fig1.fig +++ /dev/null @@ -1,60 +0,0 @@ -#FIG 3.2 -Landscape -Center -Inches -Letter -100.00 -Single --2 -1200 2 -0 32 #efefef -0 33 #cfcfef -0 34 #bebebe -2 1 0 4 4 7 0 0 -1 0.000 0 0 -1 1 0 6 - 1 1 2.00 120.00 240.00 - 6675 5250 6900 5250 6900 4650 4950 4650 4950 4050 5475 4050 -2 1 0 4 4 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 6900 4050 7650 4050 -2 1 0 4 4 7 0 0 -1 0.000 0 0 -1 1 0 6 - 1 1 2.00 120.00 240.00 - 9375 4050 9900 4050 9900 4650 7200 4650 7200 5250 7650 5250 -2 1 0 4 9 7 0 0 -1 0.000 0 0 -1 1 0 4 - 1 1 2.00 120.00 240.00 - 9300 5250 9900 5250 9900 6300 6975 6300 -2 1 2 4 0 7 0 0 -1 7.500 1 1 -1 0 0 2 - 3900 2100 3900 1500 -2 1 2 4 0 7 0 0 -1 7.500 1 1 -1 0 0 2 - 3900 7950 3900 7350 -2 1 1 4 9 7 0 0 -1 10.000 0 0 -1 1 0 4 - 1 1 2.00 120.00 240.00 - 5625 6300 2700 6300 2700 7050 3225 7050 -2 1 0 4 9 7 0 0 -1 0.000 0 0 -1 1 0 4 - 1 1 2.00 120.00 240.00 - 5550 3000 2700 3000 2700 5250 3225 5250 -2 1 1 4 9 7 0 0 -1 10.000 0 0 -1 1 0 4 - 1 1 2.00 120.00 240.00 - 9225 2325 9900 2325 9900 3000 6975 3000 -2 1 0 4 9 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 4800 5250 5550 5250 -2 4 0 2 9 7 0 0 -1 0.000 0 0 7 0 0 5 - 6900 3300 5700 3300 5700 2700 6900 2700 6900 3300 -2 4 0 2 9 7 0 0 -1 0.000 0 0 7 0 0 5 - 6900 6600 5700 6600 5700 6000 6900 6000 6900 6600 -4 0 0 0 0 0 20 0.0000 4 195 1455 3300 5400 RewriteRule\001 -4 0 0 0 0 1 20 0.0000 4 210 1440 7800 4200 CondPattern\001 -4 0 0 0 0 1 20 0.0000 4 270 1110 5625 4200 TestString\001 -4 0 0 0 0 0 20 0.0000 4 195 1905 3300 4200 RewriteCond \001 -4 0 0 0 0 1 20 0.0000 4 210 1320 7800 5400 Substitution\001 -4 0 0 0 0 1 20 0.0000 4 195 825 5700 5400 Pattern\001 -4 0 0 0 0 0 20 0.0000 4 195 1455 3300 7200 RewriteRule\001 -4 0 0 0 0 0 20 0.0000 4 195 1455 3300 2400 RewriteRule\001 -4 0 0 0 0 1 20 0.0000 4 195 825 5700 7200 Pattern\001 -4 0 0 0 0 1 20 0.0000 4 210 1320 7800 7200 Substitution\001 -4 0 0 0 0 1 20 0.0000 4 210 1320 7800 2400 Substitution\001 -4 0 0 0 0 1 20 0.0000 4 195 825 5700 2400 Pattern\001 -4 0 9 0 0 18 12 0.0000 4 135 645 6000 2925 current\001 -4 0 9 0 0 18 12 0.0000 4 135 375 6075 3150 URL\001 -4 0 9 0 0 18 12 0.0000 4 135 825 5925 6225 rewritten\001 -4 0 9 0 0 18 12 0.0000 4 135 375 6075 6450 URL\001 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 GIT binary patch literal 0 HcmV?d00001 literal 3525 zcmV;$4Lb5iNk%v~VXOgx0igf@000000I&Z50RR90EC2ui0IUIl0RRI2oR6u??GK}z zwAzca-n{z{hT=$;=82~2%C_zc$MQ_q_KoNI&iDQg3<`(DqVb4KDwoWr^9hYgr_`$T zip^@b+^+Wv4vWX+viXcotJmzd`wfrF=k&V$j?e4&{J#GW7$`VMSZH{Nn5ekO*y#8O z87VnQS!sERnW?$S+3EQS8ma{VAZi*%daBx%y6XB08!J0YTWfoZJJ_1b`?T8&tn?d9 zTx@)doUFXe+}t>uEKSD7VUw$V!fPAKs7Md zyD+KN9Q=3h;kSZ|nq;i_tyjVj)go#8aj#*#l1DDS3)(Z@%69kyPTY9&V!4&)rtBFx zuj2)w`FT#Zid9C@pqy*6bX(4r!i z`&oEWA8EOQzK;7h-_)wNdu5K?Iehubp{JLgo4RDqgZ`)Y*B;$$)*%+$dHscE#A{gb zR-kbH1*IQZjHxyr2lYAeQhMI0XB~uIWhh>7=EXn_fCXlz9*RV4IG20X@n;)YEyjqV zZzf#W#9BIHb|Q;WnUx=P*|kMtQ@s&q*LfQbkywavf%hMh?0vUnUk~7jP?lP5$z_*b zehFrnVvb2>nP#3T29{_Bqvo2uwCQFpaK?GdoOIS==bf|Usb?&FW&>ZKf(}Y(p@H_f zM*u!3is&7TF4|}vkNz-eq;FK(1E!X;q3H^pF7W53V|Z$>}`s%Bqu>#xc1iDTV{;D&&R{HCsu*yp8vByf1Y%|O9+Ux z-3#mecOiw7a5$cc3$nP<;RJq2<6evY1GyoR!%g|+e`u}&=de^Bx#tvsE~n^zl#IIR zpR0~*Af&ghHS4gSF8l0!yl#8wxx0e|zaD&_XPZ1tY z8sBI|GGg#PLSdr?;8?|v9qvbAnbL=N1Qhdf)ZUCxu8f|=>UjiK^T)Xn(x5qHnABbZJemex0KS7O!VPvHiOI4 zbn-}bfu$R3X+v_v206$;FM3iA0kfKH24|KF;HD2d zbRTN!D4cp3&Ii01OhUGDkjTWQh(1H1vfzgU==9q&4^*N+R+E+Z5vDd*iNt1}U>K-G z&pMFgA1Ap;K(B0NDE{eqOAToel@Xoi2I_gEdqydR`rKkX56Xbri1afU4FN$zN+EY@ z@jpEpr3d^;AbtrDV3 z8zUqoPBzGn7d>jJ2p9ykQema15Nyx@3k1VTK|6)@D+(rP1jQ<4rlFAR*%12!%R-@` zrqJvLAX@~_o=LR-!mJNSTPD-g7gL!zm2Ld9`Fd@01J4)Jd^-|4~*ahD_FpK zeC~oD3}HALIKmXJu!YgsV1Wo0zSMGWW%)}=5SMNs8x}F(JPe8wvkS$aP_Z)f`wAE1 zi^ZOhG0|w;2^${+#;(w@F?hTRA2$uhoDeeDh`b3Sr;WrW=5Qo{tO_Lq1Imq^@QRsi z3tW zla!qSrQ;asOrmg^adiU8P@2#pim{RgHdy&pneohVSpnZih{MM+D4kU zC~y|7O4MBX5~l_oW-smO?RJ@lk_OlKKV>uW6Rk7dx3zRr7OtcT<>%jfRx?lveoX$x z=KQBFdZe_y=I0URQ%D|_d92BZYX8EYstA5?*kuPLdhNN{4a+L37O=#vv&?H`#b)ux_e3j_lTMFt< z^_KH9>jUok*W=*KvL^!VYmc(nJUY4n><{pn|a8_Mtg$NqLd{;{RM z{N`_e3BW)9*f&SBU#$xJw>Fs)fcWPqKwyAMAb^pBGN!PAmeYXhLOF;NEuWQuNAQ4# z<2PoLH=vM#zXJiX5-Y+YEX+oNv~nR12PzWyI3ZXzD0nVp(<>ubfmgzUdgFpWGlF&_ zgC`h+sB(cu@PUH>gy7|aNkcY2$bl;u3PZ>^IruX#h=ep)D{q5bH~0;>6@*3Lgsw9< zOVfo2xP@_`g^1>Cd^0@jMl%9uf-2aCkoJZwvuWnShC1kmb_j=fh$Cf)Gyms@e+Y;s zBLiwkhi9mVokEClh=_Bjh%2**b+~SPScrj0iIo_L6S!J;!-JUP{)l0?J7e=UR%jt$ zn1}r50H7!}qWD?$w_{^ydmZ>JG02Ho=!#!xHFsl#jzfzM2#e^lgq`y^wHSdG&@o7J zhocjWyf}>B;E7ToiOeXBLGX;-(2P+aThZt{*Jz5RvW(l9UkK=pDv(^&_&=7|FyV-f z>8OscK#uF^9Pao9?Ff%BGml*$kM#&%_?QLvh>!fJkN*ge0V$9JNst9;kOygg{y2|$ za*P}W01t_J(ROnXnG_F69uygoS#W6?NrswMhZ1R#i}qO zhk~eW$~I857HZtlcxS*^AZ0@>`960DFwZ8FN0e+N$&o|;bdy2F1t>X`KzVFBDF@%i zX%N{*ocC3Kgpw3#ZVA^?Md=dlc9Ix*l~QSyLbW1Fxp-n3Z&In2V(D>M`4v{_lBIZ1 zZs|}?(jEXsC1@FQwqcepqD#`c!5cEh}o9Zv_B#TP1bahF$H$4 zL70&#cwos;;c-kSS5Ad#m|qEXgoSaU$(J5Sl51d^pmv!vQkgfUP8F`AC znin~4JV#Zl*_wQ}8h*zLE7h0!)_5NUk~TF=BJ^@|_f$%Gl;pv75wce`Wu4R+QyF&$ z&{=w;2~Kato!$v`MFM!8$#_o17KP`UHNsCEr+BO8iFncJ253p2huKnMr9p4WmV}8< zdP$yhX`5B4cR{%WnrV8Y*K~Ht9$^Wa26>6auilG?+ni*OG#mS)} zv7sL-q9aP8CHg%cYNDH&qEHp0E9#;z3ZpSvCMYVSEkL6+8k#t&qdUr@Jvt^g>Z3*( zq!TfuMQWr+`U*gbq-nLJa@C?unwwB6rBh0!RcfVIilteqrCZ9SUFxOoR{#JzTehj$ diff --git a/docs/manual/images/mod_rewrite_fig2.fig b/docs/manual/images/mod_rewrite_fig2.fig deleted file mode 100644 index facf410fc9..0000000000 --- a/docs/manual/images/mod_rewrite_fig2.fig +++ /dev/null @@ -1,50 +0,0 @@ -#FIG 3.2 -Landscape -Center -Inches -Letter -100.00 -Single --2 -1200 2 -0 32 #efefef -0 33 #cfcfef -0 34 #bebebe -2 1 2 4 0 7 0 0 -1 10.000 1 1 -1 0 0 2 - 4050 3750 4050 4425 -2 1 0 2 9 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 4950 4800 5550 4800 -2 1 0 2 9 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 4950 3600 5550 3600 -2 1 0 2 9 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 6600 5700 7725 5700 -2 1 0 2 9 7 0 0 -1 0.000 0 0 -1 1 0 6 - 1 1 2.00 120.00 240.00 - 6600 5550 6900 5550 6900 5100 4950 5100 4950 2850 5550 2850 -2 1 0 2 4 7 0 0 -1 0.000 0 0 -1 1 0 6 - 1 1 2.00 120.00 240.00 - 9525 4800 9750 4800 9750 5100 7200 5100 7200 5550 7725 5550 -2 1 0 2 4 7 0 0 -1 0.000 0 0 -1 1 0 6 - 1 1 2.00 120.00 240.00 - 9450 3000 9750 3000 9750 3225 5100 3225 5100 3450 5550 3450 -2 1 0 2 4 7 0 0 -1 0.000 0 0 -1 1 0 6 - 1 1 2.00 120.00 240.00 - 9450 3600 9750 3600 9750 3825 5100 3825 5100 4050 5550 4050 -2 1 0 2 4 7 0 0 -1 0.000 0 0 -1 1 0 6 - 1 1 2.00 120.00 240.00 - 9450 4200 9750 4200 9750 4425 5100 4425 5100 4650 5550 4650 -4 0 0 0 0 0 20 0.0000 4 195 1905 3300 4800 RewriteCond \001 -4 0 0 0 0 1 20 0.0000 4 210 1620 7800 4800 CondPatternN\001 -4 0 0 0 0 0 20 0.0000 4 195 1905 3300 3600 RewriteCond \001 -4 0 0 0 0 1 20 0.0000 4 210 1575 7800 3600 CondPattern2\001 -4 0 0 0 0 1 20 0.0000 4 270 1290 5625 4800 TestStringN\001 -4 0 0 0 0 1 20 0.0000 4 270 1245 5625 3600 TestString2\001 -4 0 0 0 0 0 20 0.0000 4 195 1905 3300 3000 RewriteCond \001 -4 0 0 0 0 1 20 0.0000 4 270 1245 5625 3000 TestString1\001 -4 0 0 0 0 1 20 0.0000 4 210 1575 7800 3000 CondPattern1\001 -4 0 0 0 0 1 20 0.0000 4 210 1320 7800 5700 Substitution\001 -4 0 0 0 0 1 20 0.0000 4 195 825 5700 5700 Pattern\001 -4 0 0 0 0 0 20 0.0000 4 195 1455 3300 5700 RewriteRule\001 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 GIT binary patch literal 0 HcmV?d00001 literal 2553 zcmV*@J5W=b#yB~Kp0=~-bve892N4)}p(pW%2p5sZht~LD zI1%}hx8|otxH2g-xLK0vxppC@5V~NentIoI(rJ0{2OE+}BP-$wx*=Bz983yn zON(iU%aN>EEQsprz_yI0Q)?}KoO*nQ-CZ_4KxX`yc3=u2d>*X_(0`guqzqd@*%#-LfeXh5BVQWpLp z)QG8|NtFn{$$Q4mA4HAe4t}G#aHU6(6t}s=hq0PVmJMrKq`A|k!e|9O8l4z&!W#`S zjZ$>#(5cRsJn6|i1(K`QjsTk`MM>77$!02Ard6pHsnu+78$i8lc7VuF^ky0)tFtHF zr(QWty35d@Uzmf7Y8_lL2S2v}^FhUV^=(jScxmn>5x6qvpoM!Pb&QqLVZdksM=H$I z>f6||`_!fUG4I*j11X7%v6>pY2xh3(3xa*;o zNYwSdUv1ZB&wdX*)_krZ4vewXW?IWbBeN8I)p6nPzS&B?4Ba$!41htm$T)Y{DsLok!AXXP!Iasb`-s^66)wB?2mFp%M~m zXrkQ3=fOx@uY&%$*{vTrQ0I{>pr{8vB)Ijjp5X8oW+QCNZyu6c=x)f=Sie!59OmW78?Uq0#Q z-A_M>*2j0|B3IR1{j3WUtyZmwDmAPb*OzWZ(KlCd!!olPXD?x<)MZ`WCSOCy2xXtD zBJXyVst}vinMV{8xGT+dtvA`ugw^Np$GNUjU414?N3v`l^XJ|U-Mw}&ZPjtd6m(DJ z6=fj;N4r>Zw<*{1t;9aJ(R|1-mS1mQ3*BsPl^rbC)KrgcT-_5(HI>#v|5g>Q3aoBpX0Y3fE=(`y56f!k?an7cM1Y2Z z>89<%9O0m%5>UCP<%ld{q4w}rZ#fjfi|+vUI%bW2f9l`Je*0g%Phpa(w)!Vrq^ zK;-L{1y9HXM4@nnK~NzJU&sR&!f=MpVu1{4I70`L;D$JSp$#5&cs{ zYT@jNOnhJx6M&^AO3?#^;?n*Uuh<3#lnIMmM8^c;)kQ!3a6w;0P#6_8#t_^LgJ*0~ z8bMIOHp($7bF3p3?TE(>#4(Rt+#?@BK)p8k@sBNFBX(pkNJ5^-eBJ6mA{CheLyiju zkA&n2BzXe>G;%|hOadk^RLM@dsDz>{!Y2<^N+X=|L7_|~AW7-UAgr=&FKA^fYs5%I z`f7x{?4>V%3Cv(F(FvN=r3r6Y#~>n;iOO825u52uAwn~nIGiRmXK2l9zA&5GEP^J# zSxjy@;+s@?7XnT-%uMkmW9qbo!NR!*cxJ^gHB45ja8-zDopYBYWED8c87Y7YLT~j< z!9TkN&v44KJU)w6L;elAvYZ*|nCAo|*E}W(wrLbBv>95q?)j~FcCxUUeXSS_qn!ztLk!=+AD_Zz6^so0i)aBZQiC`j+k z*P9!?-z)_r-R~*Ey)V3Rf27Mu^G49eU|?}Kw+G83*MP`hFtU<|l;kJNfXQBPvXr$L z_+~zF2`O9&Z^NR0`=RE7#d1Vx) zpa1;+r88#{$%0-X#R_fcFCrR+hhDS=8|`QXLORm?n>3~6XX#6$FVmXV9;Z87n?$UQ1dKj$WxKWt%&lC&*2KeJ zg|Jc^3%8wSJbJ~>Es5hsvVku&bMOtThffzVrY3bjZp9qQL0cRG3m7&S2lxLF`)k|Z zf?Q-y{q1!w@@ujE{JG!dHe$z|&Vcqbv=aBY>W)J$AvZ9!qFH%?Ma*N^PF&p0-WiVv zzMQNZfxTa!4%O>=-_E_8*b=)>dpCpizhqA8omJk;HIvg6=s4YH_3mYv&UCJ#46a;f zD6N=H-t{KN>tGW*NzbkI=0cs4Ge);y`zlrYMtkMWtfc2gZs#07qC6*Y8&p!K)?pjTI?meG(PwMLdKh&2SzNe>a{NyWt`OI&=^Pdm> P=u3b4)UW=R3jhE+CPVN4 diff --git a/docs/manual/images/pixel.gif b/docs/manual/images/pixel.gif deleted file mode 100644 index c0801475d2729dddd97b223bfc8af320516926e2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 61 zcmZ?wbhEHbWMp7uXkcLY4+e_=_AdZs(b)vW+xP(Py6C*@L zL<}GZDo$WT5k&(CqM{Qwz;y!Z;7)MG`HYh<)bIaaSJ$mu{q8&WoO9o+4h;|S79@R! z{J}RPFdB^*hQ-9hBqt|lW@f5Xs=B(m-rimW01N;Q0DJ%h0EhvI2Ot@MGypOI7)5{) z0dBs~z0wh%oa+5J*>tsZ}wSu(NnA8{$BjzT@^96j2&qa&_AU9Ji7GY`0$k=UASb)7PdXQX7zC&=(8>a1lhm-u{$P{?R0!ZqQWJsE zNm7$LVy5yY3~)IhCV7hfWQ{m&%7d6RFqSz*d{TXUJgDOWaSTwg0C&;`)zq%k%Bj`c zbyMK1rYS#C)27M92On^aV1Nra zO;ZK8$3TY>^ooIi16anXyfp?0DnaT1m>dGX6=cQ(ff3Y+05=tgjG!_TOwNSW3(`hG z?${K9$~YBsV*qymq;fFU*i^4fG2j?MS|t!=0=^NX8bPuV#IpeMZOT<_Ux;B?M~%Trt2>0ZRoql~YTTYy~j@iw9UPU_G0H<%$3@HkEM102u(29VeMj zzL;@pl>fhH^6+!M;~@Zyz;&u_>P`re$xA_=8KzNp<{;BtR`hAAyZ2yr;>xh*nw}!o zoRlYh&9#A$bztGl@RsA(%ba6Rt`OW+0H-Lkz6l7|Tf}tpRO#hO*}25eFRrKU`Ec0t zm;NmY5jPe-YJrVJge_GUX2Fnfy1l%vYT55gmls+^oICyS4_Qyl{**d2+irneD~zsz zE>*ug-PoPiRMA?0r+gCk)O5EMEt11#1o1(a*dnilm|U4e?Z4@3-?n?iTju=Lm$rYu z`|{N5doZyf(ao#r?Vu+4X307Q7&LSC@AJ+MbT4MuScH|IU!O2fK3Wx=w&mTyx$B2Y z94UW?Z)jZn=g#pO=G!HWQPu9@#*IN-m0fr~<41Ec>Cc(Io1ba8c8*c~%;g_vG{+w}i0l%c2xq!;8Q2?GMUE z3Y_a3Mhacey&5Uv^*TQCHtR+x?yUw}D(^~Me({_;kvX@#|CHX_D;Qg>gb*904o1_q9U$yg=efLT zIDRnYO=Cm7Pc60piO#`-tc`c<7{21@t7g#?tld=M2UzCT_AX|ae@9rm(BrN&Im+iE z)*ZpuKIx+HFW7e%d)`}ZcY991=Z%H#R~coI?texmM+q9S}PW$NdaKzfY0E zEV)^bu#;dOrvrpTTciP3$WkFpv^cHFCMPzl-*jW4uH#o3%hrzfIMy`x_Wr#6CDCeg zZa=9Y7yogOU5V?ez8kKV@b#NV<7^)~s6Nk&;MQM?DRNs01r{aso)*eS2!gl;*AzyfdnUpv9ih10gIc&+G(DB2VkPjc42_z!|CpYyvCdNqTXI(hDjNil!_!6V zSaSsv6)IfL?gp^z=BJRbF0;~?E;uzjUZKR>G-z=*lmV2b!ffhiy!8ujl1FZIQT!#C zS*{_t8WTGUqn^}Ef0|Wn8^Wm?w-=cd@s``X%FCe2?~fipMrCeE!Krmkjn%Pwhm zdo;=-FH^2s{m07>>U-^1Jb`x(<8YSf7Ku(^y|b0g#WFvf&kZ!xcYwc-Bv;@aB#H6* z-o6l@kNXo3cQFo1vz_{HkS}C+nQU>$wewDz_9gC7!B6{U`hv1seBG z>#3%m5?-6zXIfHMmt$4ENg)cnuov-@La*A0^UfvhB}k-}f2oP{9#xlY^0Z}M1a$>9 z!PP&VZZN-KzTo^KvZv6-hr{H%fL`oU5@oK=Sr@ z?0@LS{rV4S)K%Wyy}i=Blku&laXl$Bg-iGNgAvcAsyaKzJ2gr1d#0Td#?HFizSOg+ zYer9c0zWdvqK3K7Ql|*zN%i(wtX~n4|AQ zr^V-5qHdjDGw0+{N_CVGVj zph8{N`1M-v!HI}X%Fd>*v|7_}zumLK?i4IjcA?RY?-!rpc^|^77eLS%vO5ZKs8A%;jJKbqiS8rU$=wGe{G`e0jJr%Q2-JddgP13|&AW1WYID zp3~k;{HbuShCF2i<|{l7muW$G)~UBhRKOH0)T^esIKi83J?a%Y?$opln`IJ2&lxgCUAQ5LIgla!NcK$!epjuI{yZVFG?j(U z)nutwzZ;3`)qA_eRToC_vUhDV;B4J%_k^p={kQ76*9<6$yo_q<>b`w59`W+{uiArC z;>w(;0VJ2N0onPApif{4$J)67H!9@0}366FzqTJ zyQpscGULzm&}R*yF|1OvbjCI(B#T@=)@fR!#XI{YG1tc7Ec(R+sNc?PMuQ=D)+$qqv~7f0?O#*9_RjjB2cJ&Ax45yk zrF!q$O|_P9FcRlwK-T?-5d@yX)kxW-oA`Ld`0w$In~a%DP26N0sB91}k$=Y9kh4C< zc#D4QR-%#p(aaWgWV4oXj<>zlKiN^Ovj=cKmKw+&gWWW- z&U&6J8~18!ZdiG4qpiIlJA6S4K9-Fau-$ri)XQ?Z!w?-GOn=KZG010M*16r2(}pqb z6Lwe+$K<&N3`*%Aomc9%zgg_->Qnf^lWtY^>khkgZR&@4Sf)Zintci>7_WCjG)nSVBm*YEG_)uZ-)mOOE#fwVXiu;l9HA10f z4)Jb2Q7+lLg6XkVZ&S`fE_EaO414txNUec5!EiWQI9;KO31Pq8-(e?afOsC}LW8l=>{-{Gjv}M(3HAc@#+Oy1?A);D1J$Euw}T z**HhJ-;X5Nho=f!t_o?y36(1Bf-3T%D$3k$){Fx&f&-)^uuOO$?(l*5ZDuR90ZSy_ zHX=}X6?2a^nP@#AJA4pF6g36_7Yw$=U`!8RX@<_X!Y)G0Y8BIJ71;R@!x>g4@(-pg zFVDN+httjT)#G95>e=#XZajFF7P|U{ZYuS8s->++r%`w&A9!^5PCzTPt~HwA6pFcz zbMHDx_dKjPvwU767dM}WpRcp@Wgk{u|B0c4whq&u80drZXm`}K42Ewb=6l&dX_Y3& z={P5&!3_!a^EQj5@rr?MM`ioV-K8=s-io=$Wp-?MuJQh~F%9jZl6F_l*#5$QKx1{* zfYxs!S4hc)(tvU{c_J7z>85-9z4AX(@F4Ff?4!0%0wHX?SOKiD#EO{2j+eWKCG_na z+8scBAzyz_U1d6C)xayMk&>GX_RojOo%gJF8i<*S8aUb(h}G`@)R=b$z?#@u82rP- z#|&fWwMRavf8EApUDG9*dT*-LQ+D66IxQ)gxcA#m%x@D$g6^+c2SQfq2rIuGyF;vv zZ?7Yp&foVO@{>;EVzB->>@0+5N+CL%KE$Iv(1u!sP<`S=dFWZds)!?c=3H+L6F7kRd z2GP~@XL;-I%W3BA)JEV8^3ffu$ow?&0RvK``z=Sf*1#dH#Yl#6qFXO*wD8smQUK z@rHU)PJgw$TB`{9U5_^Lg6cKw5;^kA!BsniNQWay&LjOXJ>=YUBI%oh;|OsbmhqdO zR3;;BRUoAjvYbSDkVm-r<-kp*$Z|Ddu%gNKZTzlqLWlzI!NytZ;haOzRVI`!^Z8p& zlQ=@7##XvsO6$^YXqVC)kmJ2-3f6}fZ9q?G(c^41@`%Xdx}KAA zr&UM>K+MjPjGssfEmEK(Z#F|uu+atsdUEoZY@{eubOR5f@h~C=@X<%pEH53HBZGzW zEwEpo%V~@Z>iaax_SMvG1$7W(SvvZ*saZuy=ztUb zOAKV8#_w~v#PGA+br{cPdokE_3LEFlu43v}_l?i4FQaw6PHT~%$AzcLwe2I(zG}Al z|HOz&xyH~*Oammhb3`ddg0~W-Y>V1)LW+)%peDN35Lf6)>4pV)N@SGd#C*IZ?Y@2U z#mMvW?ekUWj$HafDSbpu|DfM(A~azF*bU&^c%8Cw)%r`t(SQ(GvulGZ-o-!-IB#`Y zkFvd}c>!mub!4pqZL_n^mtVeul6D$}q|WvwZePt4w8VtFo5yF_t&+t{VNMSjZwJooa(gb`*W1dPA7h+(r#*~*UjjIqj?lw*hdT^mciA9 zu%iOU$NK3%bjP!2MeD;w61@LMI}ZuI{2MO9fRjk@!AhI}D~^|#Fdo{jkzX#FDZNT`!)9vQ8%mdy z+OMQOQo7!s#~tycC&cL(de4*_vpE{wd>#%<7+6Ddi7?%7!Bu zc(HUF@`!vAkJc*D!f`ZXVQ4d;v?!2If;9)QK11>LR%KU0-Uif}Q!A(Ve4_N)bIQ~d zvD<@t&D6o{h1X%)%j_KkhMqV2KOO?Q!XfH0n_;E_QDx9b88j1vU3lrv>Nu`W_si4A zmw(tU2fM`vd@vjDD8WZ7aY~Z?(L*?q-cF*%d)wk_HA5#1k(-^U7u2EG^wdEkM!gnF z(elunDzr`M{FFvpoKC%$MY(6Dc)F2xxod+~eW`R6{e?EK2Qqo(X<|_Ntoe7g|M=`R z{{k~PR1Pm9mTTeV0KZ`-!PoX$tQ_xO+W*fWQlFlsHBfEy zX;0+zY|E&ZYTBO?>Q&oE@7y}Rb<7t>5WNOKs{^GrE3 zT>_i3eX>L0S-PC3J%FrBuvQYBdAZDIFBARwUOa-AayV825WfevBqq-^v|(l0GtIsg z>_-oHv@#F+Uvk=eHhok$`;!ntHMDY~iHTx&V-xLp?fl0^$>h&(6k|gyJ@iEnu{4l{ zPPuaD>+-7Q$~OKc1u0!xaA=5BBo*uXkkx-9$9SbxTBJhvrdn#-E~K>FwrW$9*sr2p zmw2{Y(^hWZ0lj}K8V3JPc(%paQk7m_Ny?6ixDNi2K*KxTfA7je@rM)Nm#{Ks#+vN1 z@Yu*BIhZY#teE3qX8kdI>D*fMv@Y zb}8NBaz1Xr-w^q|c>fT;KB-;RK(cGu>-@=p%_diS$751v8lbU**D`B2|{gCwI~ z=GlHh?7purT9gLavtjO)kLsLvdt2Z2e|V=;yW{aIKZW*P-e3O7GO)nU#zP^$yE5A2 ziT6_Xjp*Bk@jq@`otPN!;Vt{Y|7b576LCxg- - -Apache HTTP Server Version 2.0 Documentation - - -

        - -
        - - -
        -
        - - - - - -
        -
        - - - - - - - - - -
        - - -
        - Release Notes -
        -New Features in Version 2.0 -
        -Upgrading to Version 2.0 -
        -Apache License -
        - -

        - -
        -Reference Manual -
        -Compiling and Installing -
        -Starting -
        -Stopping or Restarting -
        -Run-time Configuration Directives -
        -Modules: By Type or - Alphabetical -
        -Multi-Processing Modules (MPMs) -
        -Server and Supporting Programs -
        -Dynamic Shared Object (DSO) Support -
        - -

        - -
        -Platform Specific Notes -
        -Microsoft Windows -
        -Other Platform Specific Notes -
        - -

        -
        .
        -
        - -
        -Using the Apache HTTP Server -
        -Configuration Files -
        -Server-Wide Configuration -
        -Mapping URLs to the Filesystem -
        -Virtual Hosts -
        -Handlers -
        -Filters -
        -Content negotiation -
        -Environment Variables -
        -Using SetUserID Execution for CGI -
        -General Performance hints -
        -Security tips -
        -URL Rewriting Guide -
        - -

        - -
        -Other Topics -
        -Frequently Asked Questions -
        -Tutorials -
        -Documentation for Developers -
        -Other Notes -
        -

        - -
        - -

        Maintained by the Apache HTTP Server -Documentation Project.

        - - - - diff --git a/docs/manual/index.html.fr b/docs/manual/index.html.fr deleted file mode 100644 index f83b26fec9..0000000000 --- a/docs/manual/index.html.fr +++ /dev/null @@ -1,163 +0,0 @@ - - - - -Documentation du serveur HTTP Apache version 2.0 - - - -
        - - - - - - - - - - - - -
        - [Documentation Apache]
        - - - - - - -
        - FAQ - - Directives - - Modules - - Rechercher -
        -
         
        -

        Serveur HTTP Apache version 2.0

        -
        -
        - -
        - - -
        -
        - - - - - -
        -
        - - - - - - - -
        - - -
        - Notes sur cette version -
        -Nouvelles fonctionnalités de la version 2.0 -
        -Migrer vers la version 2.0 -
        -Licence Apache -
        - -

        - -
        -Manuel de référence -
        -Compilation et installation -
        -Démarrage -
        -Arrêt et redémarrage -
        -Directives de configuration de l'exécution -
        -Modules par type ou - par ordre alphabétique -
        -Modules Multi-Traitements (MPMs) -
        -Support des Objets partagés dynamiques (DSO) -
        - -

        - -
        -Notes liées aux plates-formes -
        -Microsoft Windows -
        -Autres notes pour plates-formes spécifiques -
        - -

        -
        .
        -
        - -
        -Utilisation du serveur HTTP Apache -
        -Fichiers de configuration -
        -Configuration globale du serveur -
        -Hôtes virtuels -
        -Handlers -
        -Négotiation de contenu -
        -Variables d'environnement -
        -Utilisation du SetUserID pour les CGI -
        -Aides sur les performances générales -
        -Trucs sur la sécurité -
        -Guide de réécriture d'URLs -
        - -

        - -
        -Autres sujets -
        -Foires aux questions -
        -Tutoriels -
        -Documentation pour les développeurs -
        -Autres notes -
        -

        - -
        - - - - - diff --git a/docs/manual/index.html.html b/docs/manual/index.html.html deleted file mode 100644 index ee6e66d05f..0000000000 --- a/docs/manual/index.html.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/manual/index.html.ja.jis b/docs/manual/index.html.ja.jis deleted file mode 100644 index 1d2ea9f808..0000000000 --- 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-tpf.html b/docs/manual/install-tpf.html deleted file mode 100644 index 8ff7d26082..0000000000 --- a/docs/manual/install-tpf.html +++ /dev/null @@ -1,342 +0,0 @@ - - - -Installing Apache on TPF - - - - -
        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. -
        - -

        - Installing the Apache 1.3 HTTP Server on TPF -

        -
        -
        Download -  | Compilation -  | Installation -  | VisualAge ] -
        -
        -
        - -

        -This document outlines the steps needed to install Apache onto a TPF system. -

        -

        -You should first read -htdocs/manual/readme-tpf.html -for basic information on the port of Apache to TPF including required PUT level -and supported functions & modules. -

        -

        Download

        -Releases of the Apache server are compressed into a "tarball" file and stored on the Apache web site. -You will need to choose a version and download the corresponding tarball to your PC. -Additionally the source code from the tarball will need to be copied onto an MVS OS/390 Open Edition machine -(later referred to simply as "Open Edition") for compiling. -So here are all the details on how to get Apache and how to get it where it needs to be: -
          -
        1. Download - the gzipped Apache files (the "tarball") to your PC. - The file name on the web site will be something like apache_1.3.x.tar.gz. -
          TIP: Be sure to keep the .tar.gz extension - when choosing the name of the PC file. -

          -
        2. Decompress the tarball on your PC using WinZip or some other PC decompression tool. -
          TIP: If you are using WinZip verify that the - "TAR File Smart CR/LF Conversion" option (under Options, Configuration) is NOT checked.
          - This is what you can expect if you use WinZip: -
            -
          • open the tarball with WinZip (this can usually be done simply by double-clicking - on the downloaded tarball) -
          • you will be told that the archive contains one file (such as apache_1.3.x.tar) - - allow WinZip to decompress it to a temporary folder -
          • extract the archived files onto your PC - - you'll be using files from the conf, htdocs, and icons directories later in the install phase -
          -
          -
        3. FTP the tarball to your Open Edition machine using binary mode: -
            -
          • activate FTP in an MSDOS window: ftp your.open.edition.machine.com -
          • sign in -
          • set mode to binary: binary -
          • send the file to Open Edition:
            -    send c:\downloaded_filename.tar.gz open_edition_filename.tar.gz -
          • exit FTP: bye -
          -
          TIP: - Open Edition and UNIX file names are case sensitive. If you use an NFS client to transfer files - from your PC to Open Edition (instead of using FTP as described above) verify that the NFS drive will transfer the - file names with upper/lower case preserved.
          -
          -
        4. Decompress the gzipped file on Open Edition: gunzip open_edition_filename.tar.gz -
          Note that the .tar.gz file will be replaced by the gunzipped .tar archive file. -

          -
        5. Extract the archived files necessary for compiling Apache: -
            -
          • pax -rvkf open_edition_filename.tar -o from=ISO8859-1,to=IBM-1047 "*/src" -
          • switch to the source code subdirectory of the newly extracted apache directory: cd apache-1.3/src -
          • remove unnecessary subdirectories: - rm -r os/bs2000 os/mpeix os/netware os/os2 os/os390 os/win32 -
          -
        -
        -

        Compilation

        -

        -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, it is necessary to generate a short bit of -code (modules.c) which simply has a list of them. If you are using the Configure utility -and make, modules.c and other necessary files will be created for you automatically. -

        -

        -The provided scripts assume a c89 compiler and have only been tested on an -Open Edition environment. If you are using a platform other that -Open Edition you may need to modify src/os/tpf/TPFExport and src/Configure -to match your environment. -

        -TIP: -Editing files on your PC prior to moving them to Open Edition may result -in the loss/addition of unprintable characters. Files of concern include shell -scripts and src/Configuration. The most common problems are with -tab characters and CR/LF characters. Most editors will handle the CR/LF problem correctly -but none seem to handle tab characters. If you need to edit files prior to moving them to Open Edition, -edit them in a UNIX editor such as vi or emacs.
        -

        -Note that Open Edition commands in this section are shown in -bold, -are case sensitive, and must be made from the "src" directory. -

        -
          -
        1. Overlay src/Configuration with src/Configuration.tmpl: - cp Configuration.tmpl Configuration -

          -
        2. Edit src/Configuration. It contains the list and settings - of various "Rules" and an additional section at the bottom that determines - which modules to compile: -

          -
            -
          • Adjust the Rules and EXTRA_CFLAGS|LIBS|LDFLAGS|INCLUDES - if you feel so inclined. -

            -
          • Comment out (by preceding the line with a "#") lines corresponding - to those modules you DO NOT wish to include. -

            -
          • Uncomment (by removing the initial "#", if present) lines - corresponding to those optional modules you wish - to include or add new lines corresponding to any custom modules - you have written. - The htdocs/manual/readme-tpf.html - document lists the modules that have been tested on TPF. -
          -
          The modules placed in the Apache distribution are the ones that have been - 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 - http://www.apache.org/dist/httpd/contrib/modules/. - There are instructions on that page for linking these modules into the core Apache - code. -

          -
        3. Set the TPF environment variables: - . os/tpf/TPFExport -
          - (The initial period and blank on the command are required to ensure - the environment variables exist beyond the scope of the shell script.) - This script will set the environment variables required to compile the - programs for TPF. Verify that the export variables are valid for your - installation, in particular, the system include file directories. The - system include files must reside on your Open Edition system in the - appropriate file structure similar to /usr/include and /usr/include/sys. - DO NOT modify the TPF=YES export variable. If this is - changed, the "Configure" script will not recognize TPF. -

          -
        4. Run the "Configure" script: - Configure -
          - This generates modules.c, include/ap_config_auto.h, and necessary Makefiles: -
          -      Using config file: Configuration
          -      Creating Makefile
          -       + configured for TPF platform
          -       + setting C compiler to c89
          -       + setting C pre-processor to c89 -E
          -       + checking for system header files
          -       + adding selected modules
          -       + checking sizeof various data types
          -      Creating Makefile in support
          -      Creating Makefile in regex
          -      Creating Makefile in os/tpf
          -      Creating Makefile in ap
          -      Creating Makefile in main
          -      Creating Makefile in modules/standard
          -      $ _
          -      
          - If you want to maintain multiple configurations, you can - say, e.g., -
          - Configure -file Configuration.ai -
          -
          -      Using config file: Configuration.ai
          -      Creating Makefile
          -       + configured for <whatever> platform
          -       + setting C compiler to <whatever>
          -      et cetera
          -      
          - If you receive an error such as "Configure 146: FSUM7351 not found" - the most likely explanation is that one or more of the make related - files were edited on a non-UNIX platform, corrupting the end-of-line marks. - Verify that lines ending with "\" in the flagged file do not have trailing - spaces. Using the vi editor and the sample error above as an example... -

          -            pull up the flagged file:       vi Configure
          -            turn on punctuation:            :set list
          -            go to the line in question:     146G
          -               or find a line with a "\":   /\\
          - The end of line should display as "\$". If it is displayed as - "\ $" (with a blank between \ and $) then you should revert to the - distributed version of the file and make the site-specific - changes again using a UNIX compatible editor such as vi or emacs. - Then try the Configure command again. -
                      close the file:                 :q  (or :quit!)
          - -
        5. Edit include/ap_config.h if you would like the scoreboard kept in shared - memory instead of file or system heap.
          - The default behavior for Apache on all platforms except TPF is to use the - file system for maintaining the scoreboard (which holds current Apache children status). - The default behavior for Apache on TPF is to use system heap. Available with - PUT10 is the use of shared memory for the scoreboard in place of the file system. - This reduces file activity for the parent Apache ECB and improves performance. - To activate shared memory, uncomment or add the directive - #define USE_SHMGET_SCOREBOARD - and comment out or remove the directive #define USE_TPF_SCOREBOARD - both of which are in the TPF section in ap_config.h. - This change will only take effect after Apache is (re)compiled. -

          - If you prefer to use the file system instead of system heap or shared memory, ensure that both - USE_TPF_SCOREBOARD and USE_SHMGET_SCOREBOARD are commented out or removed. - This change will only take effect after Apache is (re)compiled. - -
           
          -
        6. Edit include/ap_config.h if you plan on using the ZINET DAEMON model instead of the NOLISTEN model.
          - The default behavior is to let Apache check the server status (active/inactive) with ZINET - and shut itself down when appropriate. The default behavior also includes checking Apache's activation number. - Available with PUT11 (PJ25761) ZINET can perform these functions instead of Apache by using the DAEMON model. - This model offers increased reliability and is preferred over the NOLISTEN model. - If Apache goes down while running under the NOLISTEN model ZINET will not reactivate it nor alert the operator. - To use the DAEMON model you must modify the default behavior of Apache by uncommenting or adding the directive - #define USE_TPF_DAEMON within the TPF section in ap_config.h. - This directive is also recommend when starting Apache from the command line (APAR PJ26515). - This change will only take effect after Apache is (re)compiled. -

          - - -
        7. Now compile the programs: make
          - Besides compiling, make also runs main/gen_test_char.c and main/gen_uri_delims.c - in order to create main/test_char.h and main/uri_delims.h respectively

          - If during compilation you get a warning about a missing 'regex.h', set - WANTHSREGEX=yes in the src/Configuration file and start back at the - Configure step. -
        - -  -

        Installation

        -
          -
        1. Link the compiled object files into a DLL. - Sample link JCL has been included as src/os/tpf/samples/linkdll.jcl. - You will need to modify this JCL: -
            -
          • Change the IDs, data set names, and libraries for your particular site. -
          • Add/remove mod_xxx.o files so they correspond to the - mod_xxx.o lines in your src/Configuration file. -
          -
          TIP: - Do NOT include gen_test_char.o or gen_uri_delims.o in the link JCL since these files are only - used during the make step. -

          -
        2. Create a loadset. Sample loadset JCL has been included as src/os/tpf/samples/loadset.jcl. - You will need to modify this JCL for your particular site. -

          -
        3. Load (ZOLDR LOAD) and activate (ZOLDR ACT) the loadset on your test system. -

          -
        4. Ensure that the program name you are using for Apache has RESTRICT and KEY0 authorization. - zdpat pppp (c-c) will display allocation information. - You can use zapat pppp restrict key0 (c-c) to alter the - authorization. - Note that if the program name is unallocated, you must have the loadset for it activated or you will receive - INVALID PROGRAM NAME from the zdpat/zapat entries. -

          -
        5. - Apache requires a configuration file to initialize itself during activation. - (Previously three configuration files were used.) - Copy the distribution version, /conf/httpd.conf-dist, to /conf/httpd.conf and then - edit the /conf/httpd.conf copy with your site specific information. -

          - General documentation for Apache is located at - http://www.apache.org/docs/ - and in the HTML pages included with the distribution (tarball) under the - /htdocs/manual directory. -

          -
        6. On TPF activate ZCLAW and update INETD using ZINET entries, the common case: -

          -
          -    ZINET ADD S-TFTP PGM-CTFT PORT-69 PROTOCOL-UDP MODEL-NOWAIT
          -
          -    ZINET ADD S-APACHE PGM-pppp MODEL-NOLISTEN
          -    or ZINET ADD S-APACHE PGM-pppp MODEL-DAEMON USER-root (see notes above regarding the DAEMON model)
          - Please refer to IBM Transaction Processing Facility Transmission Control - Protocol/Internet Protocol Version 4 Release 1 for more information - on ZCLAW, INETD, and TFTP. -

          -
        7. Prior to sending a request to your Apache server from a browser, - TFTP the configuration file, log, icons and web pages to your TPF system. - A typical directory structure for Apache is as follows: -
               /usr/local/apache/conf
          -     /usr/local/apache/logs
          -     /usr/local/apache/icons
          -     /usr/local/apache/htdocs
          - All gif, jpg, and zip files should be TFTP'd as binary; conf files and html pages should be TFTP'd as text. -
          The logs directory must exist in order to avoid an fopen error while running Apache. - If you're running a PUT10 or higher version of TPF make the directory using the - zfile mkdir /usr/local/apache/logs functional entry. - If you're running TPF version PUT09 TFTP an empty file into the logs subdirectory to create it. -

          -
        8. Start the server using the ZINET START S-APACHE command. -
        -  -

        Compiling with VisualAge TPF

        -

        - It is not required that make be used to compile Apache for TPF: - Individual programs may be compiled using IBM's VisualAge TPF product. - This is particularly useful when compiling selected programs for the Debug Tool. -

        - The following VisualAge compile settings are required: -

        -
          -
        • "DEFINE - Define preprocessor macro name(s)" must include - TPF, CHARSET_EBCDIC, _POSIX_SOURCE, and - USE_HSREGEX -

          -
        • "LSEARCH - Path for user include files" must include - ../src/include and ../src/os/tpf -

          -
        • "DLL - Generate DLL code" must be checked -

          -
        • "LONGNAME - Support long names" must be checked -
        -
        -
        top -  | Download -  | Compilation -  | Installation -  | VisualAge ] -
        - - - diff --git a/docs/manual/install.html b/docs/manual/install.html deleted file mode 100644 index 3b997645dd..0000000000 --- a/docs/manual/install.html +++ /dev/null @@ -1,199 +0,0 @@ - - - -Compiling and Installing Apache - - - - - - -
        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. -
        - -

        Compiling and Installing Apache 1.3

        - -This document covers compilation and installation of Apache on Unix -systems only. For compiling and installation on Windows, see Using Apache with Microsoft Windows and for -TPF see Installing the Apache 1.3 HTTP -Server on TPF. - -

        - -UnixWare users will want to consult build notes -for various UnixWare versions before compiling. - -

        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. - -

        - -If you downloaded a binary distribution, skip to Installing Apache. Otherwise read the next section -for how to compile the server. - -

        Compiling Apache

        - -Compiling Apache consists of three steps: Firstly select which Apache -modules you want to include into the server. Secondly create a -configuration for your operating system. Thirdly compile the -executable. -

        - -All configuration of Apache is performed in the src -directory of the Apache distribution. Change into this directory. - -

          -
        1. - Select modules to compile into Apache in the - Configuration file. Uncomment lines corresponding to - those optional modules you wish to include (among the AddModule lines - at the bottom of the file), or add new lines corresponding to - additional modules you have downloaded or written. (See API.html for preliminary docs on how to - write Apache modules). Advanced users can comment out some of the - default modules if they are sure they will not need them (be careful - though, since many of the default modules are vital for the correct - operation and security of the server). -

          - - You should also read the instructions in the Configuration - file to see if you need to set any of the Rule lines. - - -

        2. - Configure Apache for your operating system. Normally you can just - run the Configure script as given below. However - if this fails or you have any special requirements (e.g., to include - an additional library required by an optional module) you might need - to edit one or more of the following options in the - Configuration file: - EXTRA_CFLAGS, LIBS, LDFLAGS, INCLUDES. -

          - - Run the Configure script: -

          -
          -    % Configure
          -    Using 'Configuration' as config file
          -     + configured for <whatever> platform
          -     + setting C compiler to <whatever> *
          -     + setting C compiler optimization-level to <whatever> *
          -     + Adding selected modules
          -     + doing sanity check on compiler and options
          -    Creating Makefile in support
          -    Creating Makefile in main
          -    Creating Makefile in os/unix
          -    Creating Makefile in modules/standard
          -   
          -
          - - (*: Depending on Configuration and your system, Configure - might not print these lines. That's OK).

          - - This generates a Makefile for use in stage 3. It also creates a - Makefile in the support directory, for compilation of the optional - support programs. -

          - - (If you want to maintain multiple configurations, you can give an - option to Configure to tell it to read an alternative - Configuration file, such as Configure -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 -<http://www.apache.org/dist/httpd/contrib/modules/>. -There are instructions on that page for linking these modules into the -core Apache code. - -

        Installing Apache

        - -You will have a binary file called httpd in the -src directory. A binary distribution of Apache will -supply this file.

        - -The next step is to install the program and configure it. Apache is -designed to be configured and run from the same set of directories -where it is compiled. If you want to run it from somewhere else, make -a directory and copy the conf, logs and -icons directories into it. In either case you should -read the security tips -describing how to set the permissions on the server root directory.

        - -The next step is to edit the configuration files for the server. This -consists of setting up various directives in up to three -central configuration files. By default, these files are located in -the conf directory and are called srm.conf, -access.conf and httpd.conf. To help you get -started there are same files in the conf directory of the -distribution, called srm.conf-dist, -access.conf-dist and httpd.conf-dist. Copy -or rename these files to the names without the -dist. -Then edit each of the files. Read the comments in each file carefully. -Failure to setup these files correctly could lead to your server not -working or being insecure. You should also have an additional file in -the conf directory called mime.types. This -file usually does not need editing. - -

        - -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. - -

        - -In addition to these three files, the server behavior can be configured -on a directory-by-directory basis by using .htaccess -files in directories accessed by the server. - -

        Set your system time properly!

        - -Proper operation of a public web server requires accurate time -keeping, since elements of the HTTP protocol are expressed as the time -of day. So, it's time to investigate setting up NTP or some other -time synchronization system on your Unix box, or whatever the -equivalent on NT would be. - -

        Compiling Support Programs

        - -In addition to the main httpd server which is compiled -and configured as above, Apache includes a number of support programs. -These are not compiled by default. The support programs are in the -support directory of the distribution. To compile -the support programs, change into this directory and type -
        -    make
        -
        - - - - diff --git a/docs/manual/install.html.en b/docs/manual/install.html.en deleted file mode 100644 index 3b997645dd..0000000000 --- a/docs/manual/install.html.en +++ /dev/null @@ -1,199 +0,0 @@ - - - -Compiling and Installing Apache - - - - - - -
        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. -
        - -

        Compiling and Installing Apache 1.3

        - -This document covers compilation and installation of Apache on Unix -systems only. For compiling and installation on Windows, see Using Apache with Microsoft Windows and for -TPF see Installing the Apache 1.3 HTTP -Server on TPF. - -

        - -UnixWare users will want to consult build notes -for various UnixWare versions before compiling. - -

        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. - -

        - -If you downloaded a binary distribution, skip to Installing Apache. Otherwise read the next section -for how to compile the server. - -

        Compiling Apache

        - -Compiling Apache consists of three steps: Firstly select which Apache -modules you want to include into the server. Secondly create a -configuration for your operating system. Thirdly compile the -executable. -

        - -All configuration of Apache is performed in the src -directory of the Apache distribution. Change into this directory. - -

          -
        1. - Select modules to compile into Apache in the - Configuration file. Uncomment lines corresponding to - those optional modules you wish to include (among the AddModule lines - at the bottom of the file), or add new lines corresponding to - additional modules you have downloaded or written. (See API.html for preliminary docs on how to - write Apache modules). Advanced users can comment out some of the - default modules if they are sure they will not need them (be careful - though, since many of the default modules are vital for the correct - operation and security of the server). -

          - - You should also read the instructions in the Configuration - file to see if you need to set any of the Rule lines. - - -

        2. - Configure Apache for your operating system. Normally you can just - run the Configure script as given below. However - if this fails or you have any special requirements (e.g., to include - an additional library required by an optional module) you might need - to edit one or more of the following options in the - Configuration file: - EXTRA_CFLAGS, LIBS, LDFLAGS, INCLUDES. -

          - - Run the Configure script: -

          -
          -    % Configure
          -    Using 'Configuration' as config file
          -     + configured for <whatever> platform
          -     + setting C compiler to <whatever> *
          -     + setting C compiler optimization-level to <whatever> *
          -     + Adding selected modules
          -     + doing sanity check on compiler and options
          -    Creating Makefile in support
          -    Creating Makefile in main
          -    Creating Makefile in os/unix
          -    Creating Makefile in modules/standard
          -   
          -
          - - (*: Depending on Configuration and your system, Configure - might not print these lines. That's OK).

          - - This generates a Makefile for use in stage 3. It also creates a - Makefile in the support directory, for compilation of the optional - support programs. -

          - - (If you want to maintain multiple configurations, you can give an - option to Configure to tell it to read an alternative - Configuration file, such as Configure -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 -<http://www.apache.org/dist/httpd/contrib/modules/>. -There are instructions on that page for linking these modules into the -core Apache code. - -

        Installing Apache

        - -You will have a binary file called httpd in the -src directory. A binary distribution of Apache will -supply this file.

        - -The next step is to install the program and configure it. Apache is -designed to be configured and run from the same set of directories -where it is compiled. If you want to run it from somewhere else, make -a directory and copy the conf, logs and -icons directories into it. In either case you should -read the security tips -describing how to set the permissions on the server root directory.

        - -The next step is to edit the configuration files for the server. This -consists of setting up various directives in up to three -central configuration files. By default, these files are located in -the conf directory and are called srm.conf, -access.conf and httpd.conf. To help you get -started there are same files in the conf directory of the -distribution, called srm.conf-dist, -access.conf-dist and httpd.conf-dist. Copy -or rename these files to the names without the -dist. -Then edit each of the files. Read the comments in each file carefully. -Failure to setup these files correctly could lead to your server not -working or being insecure. You should also have an additional file in -the conf directory called mime.types. This -file usually does not need editing. - -

        - -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. - -

        - -In addition to these three files, the server behavior can be configured -on a directory-by-directory basis by using .htaccess -files in directories accessed by the server. - -

        Set your system time properly!

        - -Proper operation of a public web server requires accurate time -keeping, since elements of the HTTP protocol are expressed as the time -of day. So, it's time to investigate setting up NTP or some other -time synchronization system on your Unix box, or whatever the -equivalent on NT would be. - -

        Compiling Support Programs

        - -In addition to the main httpd server which is compiled -and configured as above, Apache includes a number of support programs. -These are not compiled by default. The support programs are in the -support directory of the distribution. To compile -the support programs, change into this directory and type -
        -    make
        -
        - - - - diff --git a/docs/manual/invoking.html b/docs/manual/invoking.html deleted file mode 100644 index 9f42048c62..0000000000 --- a/docs/manual/invoking.html +++ /dev/null @@ -1,118 +0,0 @@ - - - -Starting Apache - - - - - -

        Starting Apache

        - - - - -
        - -

        Starting Apache On Windows

        - -

        On Windows, Apache is normally run as a service on Windows NT, or -as a console application on Windows 95. For details, see running Apache for Windows.

        - -

        Starting Apache on Unix

        - -

        On Unix, the httpd program is run -as a daemon which executes continuously in the background to handle -requests.

        - -

        If the Port specified in the -configuration file is the default of 80 (or any other port below -1024), then it is necessary to have root privileges in order to start -apache, so that it can bind to this privileged port. Once the server -has started and performed a few preliminary activities such as opening -its log files, it will launch several child processes which -do the work of listening for and answering requests from clients. The -main httpd process continues to run as the root user, but -the child processes run as a less privileged user. This is controlled -by the selected Multi-Processing Module.

        - -

        The first thing that httpd does when it is invoked is -to locate and read the configuration -file httpd.conf. The location of this file is set at -compile-time, but it is possible to specify its location at run time -using the -f command-line option as in

        -
        /usr/local/apache/bin/httpd -f -/usr/local/apache/conf/httpd.conf
        - -

        As an alternative to invoking the httpd binary -directly, a shell script called apachectl is provided which can be -used to control the daemon process with simple commands such as -apachectl start and apachectl stop.

        - -

        If all goes well during startup, the server will detach from the -terminal and the command prompt will return almost immediately. -This indicates that the server is up and running. You can then -use your browser to connect to the server and view the test -page in the DocumentRoot -directory and the local copy of the documentation linked from -that page.

        - -

        Errors During Start-up

        - -

        If Apache suffers a fatal problem during startup, it will write a -message describing the problem either to the console or to the ErrorLog before exiting. One of the -most common error messages is "Unable to bind to Port -...". This message is usually caused by either:

        -
          -
        • Trying to start the server on a privileged port when not -logged in as the root user; or
        • -
        • Trying to start the server when there is another instance -of Apache or some other web server already bound to the same Port.
        • -
        -

        For further trouble-shooting instructions, consult the Apache FAQ.

        - -

        Starting at Boot-Time

        - -

        If you want your server to continue running after a system reboot, -you should add a call to httpd or apachectl -to your system startup files (typically rc.local or a -file in an rc.N directory). This will start Apache as -root. Before doing this ensure that your server is properly configured -for security and access restrictions. The apachectl -script is designed so that it can often be linked directly as an init -script, but be sure to check the exact requirements of your system.

        - -

        Additional Information

        - -

        Additional information about the command-line options of httpd and apachectl as well as other support -programs included with the server is available on the Server and Supporting Programs page. There is -also documentation on all the modules included with -the Apache distribution and the directives that they provide.

        - - - - - diff --git a/docs/manual/invoking.html.en b/docs/manual/invoking.html.en deleted file mode 100644 index 9f42048c62..0000000000 --- a/docs/manual/invoking.html.en +++ /dev/null @@ -1,118 +0,0 @@ - - - -Starting Apache - - - - - -

        Starting Apache

        - - - - -
        - -

        Starting Apache On Windows

        - -

        On Windows, Apache is normally run as a service on Windows NT, or -as a console application on Windows 95. For details, see running Apache for Windows.

        - -

        Starting Apache on Unix

        - -

        On Unix, the httpd program is run -as a daemon which executes continuously in the background to handle -requests.

        - -

        If the Port specified in the -configuration file is the default of 80 (or any other port below -1024), then it is necessary to have root privileges in order to start -apache, so that it can bind to this privileged port. Once the server -has started and performed a few preliminary activities such as opening -its log files, it will launch several child processes which -do the work of listening for and answering requests from clients. The -main httpd process continues to run as the root user, but -the child processes run as a less privileged user. This is controlled -by the selected Multi-Processing Module.

        - -

        The first thing that httpd does when it is invoked is -to locate and read the configuration -file httpd.conf. The location of this file is set at -compile-time, but it is possible to specify its location at run time -using the -f command-line option as in

        -
        /usr/local/apache/bin/httpd -f -/usr/local/apache/conf/httpd.conf
        - -

        As an alternative to invoking the httpd binary -directly, a shell script called apachectl is provided which can be -used to control the daemon process with simple commands such as -apachectl start and apachectl stop.

        - -

        If all goes well during startup, the server will detach from the -terminal and the command prompt will return almost immediately. -This indicates that the server is up and running. You can then -use your browser to connect to the server and view the test -page in the DocumentRoot -directory and the local copy of the documentation linked from -that page.

        - -

        Errors During Start-up

        - -

        If Apache suffers a fatal problem during startup, it will write a -message describing the problem either to the console or to the ErrorLog before exiting. One of the -most common error messages is "Unable to bind to Port -...". This message is usually caused by either:

        -
          -
        • Trying to start the server on a privileged port when not -logged in as the root user; or
        • -
        • Trying to start the server when there is another instance -of Apache or some other web server already bound to the same Port.
        • -
        -

        For further trouble-shooting instructions, consult the Apache FAQ.

        - -

        Starting at Boot-Time

        - -

        If you want your server to continue running after a system reboot, -you should add a call to httpd or apachectl -to your system startup files (typically rc.local or a -file in an rc.N directory). This will start Apache as -root. Before doing this ensure that your server is properly configured -for security and access restrictions. The apachectl -script is designed so that it can often be linked directly as an init -script, but be sure to check the exact requirements of your system.

        - -

        Additional Information

        - -

        Additional information about the command-line options of httpd and apachectl as well as other support -programs included with the server is available on the Server and Supporting Programs page. There is -also documentation on all the modules included with -the Apache distribution and the directives that they provide.

        - - - - - diff --git a/docs/manual/location.html b/docs/manual/location.html deleted file mode 100644 index 1f7d8e25e7..0000000000 --- a/docs/manual/location.html +++ /dev/null @@ -1,68 +0,0 @@ - - - -Access Control by URL - - - - - -

        Access Control by URL

        - -

        The <Location> Directive

        - -Syntax: <Location URL prefix>
        -Context: server config, virtual host
        -Status: core
        - -

        The <Location> directive provides for access control by -URL. It is comparable to the <Directory> directive, and -should be matched with a </Location> directive. Directives that -apply to the URL given should be listed -between them. <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 -necessarily have to protect a directory (it can be an individual -file, or a number of files), and can include wild-cards. In a wild-card -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>
        -
        - - - - - diff --git a/docs/manual/misc/API.html b/docs/manual/misc/API.html deleted file mode 100644 index 496be760c9..0000000000 --- a/docs/manual/misc/API.html +++ /dev/null @@ -1,1161 +0,0 @@ - - -Apache API notes - - - - - -
        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. -
        - -

        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 recognize 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 */
        -   NULL                      /* header parser */
        -};
        -
        - -

        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 -ap_table_get and ap_table_set routines.

        -

        - Note that the Content-type header value cannot be - set by module content-handlers using the ap_table_*() - routines. Rather, it is set by pointing the content_type - field in the request_rec structure to an appropriate - string. E.g., -
        -  r->content_type = "text/html";
        - 
        -
        -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 ap_sub_req_lookup_file, - ap_sub_req_lookup_uri, and - ap_sub_req_method_uri; these construct 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 ap_run_sub_req). -

        - -

        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 ap_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 ap_rputc -and ap_rprintf, for internally generated output, and -ap_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 --- ap_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 -ap_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 = ap_set_content_length (r, r->finfo.st_size))
        -	|| (errstatus = ap_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);
        -    ap_send_http_header (r);
        -
        -    if (!r->header_only) send_fd (f, r);
        -    ap_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 -ap_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 ap_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 ap_auth_type, - ap_auth_name, and ap_requires. -
        • Common routines, to handle the protocol end of things, at least - for HTTP basic authentication (ap_get_basic_auth_pw, - which sets the connection->user structure field - automatically, and ap_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 ap_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, ap_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 -ap_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 *)ap_palloc (r->pool, sizeof(my_structure));
        -}
        -
        -

        -Note that there is no ap_pfree --- -ap_palloced memory is freed only when the associated -resource pool is cleared. This means that ap_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 ap_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 ap_pcalloc has the same -interface as ap_palloc, but clears out the memory it -allocates before it returns it. The function ap_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 ap_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: -

        -
        -     ap_pstrcat (r->pool, "foo", "/", "bar", NULL);
        -
        -

        -returns a pointer to 8 bytes worth of memory, initialized to -"foo/bar". -

        -

        Commonly-used pools in the Apache Web server

        -

        -A pool is really defined by its lifetime more than anything else. There -are some static pools in http_main which are passed to various -non-http_main functions as arguments at opportune times. Here they are: -

        -
        -
        permanent_pool -
        -
        -
          -
        • never passed to anything else, this is the ancestor of all pools -
        • -
        -
        -
        pconf -
        -
        -
          -
        • subpool of permanent_pool -
        • -
        • created at the beginning of a config "cycle"; exists until the - server is terminated or restarts; passed to all config-time - routines, either via cmd->pool, or as the "pool *p" argument on - those which don't take pools -
        • -
        • passed to the module init() functions -
        • -
        -
        -
        ptemp -
        -
        -
          -
        • sorry I lie, this pool isn't called this currently in 1.3, I - renamed it this in my pthreads development. I'm referring to - the use of ptrans in the parent... contrast this with the later - definition of ptrans in the child. -
        • -
        • subpool of permanent_pool -
        • -
        • created at the beginning of a config "cycle"; exists until the - end of config parsing; passed to config-time routines via - cmd->temp_pool. Somewhat of a "bastard child" because it isn't - available everywhere. Used for temporary scratch space which - may be needed by some config routines but which is deleted at - the end of config. -
        • -
        -
        -
        pchild -
        -
        -
          -
        • subpool of permanent_pool -
        • -
        • created when a child is spawned (or a thread is created); lives - until that child (thread) is destroyed -
        • -
        • passed to the module child_init functions -
        • -
        • destruction happens right after the child_exit functions are - called... (which may explain why I think child_exit is redundant - and unneeded) -
        • -
        -
        -
        ptrans -
        -
        -
          -
        • should be a subpool of pchild, but currently is a subpool of - permanent_pool, see above -
        • -
        • cleared by the child before going into the accept() loop to receive - a connection -
        • -
        • used as connection->pool -
        • -
        -
        -
        r->pool -
        -
        -
          -
        • for the main request this is a subpool of connection->pool; for - subrequests it is a subpool of the parent request's pool. -
        • -
        • exists until the end of the request (i.e., - ap_destroy_sub_req, or - in child_main after process_request has finished) -
        • -
        • note that r itself is allocated from r->pool; i.e., - r->pool is - first created and then r is the first thing palloc()d from it -
        • -
        -
        -
        -

        -For almost everything folks do, r->pool is the pool to use. But you -can see how other lifetimes, such as pchild, are useful to some -modules... such as modules that need to open a database connection once -per child, and wish to clean it up when the child dies. -

        -

        -You can also see how some bugs have manifested themself, such as setting -connection->user to a value from r->pool -- in this case -connection exists -for the lifetime of ptrans, which is longer than r->pool (especially if -r->pool is a subrequest!). So the correct thing to do is to allocate -from connection->pool. -

        -

        -And there was another interesting bug in mod_include/mod_cgi. You'll see -in those that they do this test to decide if they should use r->pool -or r->main->pool. In this case the resource that they are registering -for cleanup is a child process. If it were registered in r->pool, -then the code would wait() for the child when the subrequest finishes. -With mod_include this could be any old #include, and the delay can be up -to 3 seconds... and happened quite frequently. Instead the subprocess -is registered in r->main->pool which causes it to be cleaned up when -the entire request is done -- i.e., after the output has been sent to -the client and logging has happened. -

        -

        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 ap_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 = ap_pfopen (r->pool, r->filename, "r");
        -
        -     if (f == NULL) { ... } else { ... }
        -
        -

        -There is also a ap_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 ap_pfopen, and ap_popenf, -namely ap_pfclose and ap_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 ap_pfopen and -ap_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. -
        -

        -Pool cleanups live until clear_pool() is called: clear_pool(a) recursively -calls destroy_pool() on all subpools of a; then calls all the cleanups for a; -then releases all the memory for a. destroy_pool(a) calls clear_pool(a) -and then releases the pool structure itself. i.e., clear_pool(a) doesn't -delete a, it just frees up all the resources and you can start using it -again immediately. -

        -

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

        - -On rare occasions, too-free use of ap_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 ap_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 -ap_clear_pool and ap_destroy_pool, respectively. -(The difference is that ap_clear_pool frees resources -associated with the pool, while ap_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 ap_sub_req_... functions) -is ap_destroy_sub_req, 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 -ap_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 -ap_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 *) ap_palloc (p, sizeof(mime_dir_config));
        -
        -    new->forced_types = ap_make_table (p, 4);
        -    new->encoding_types = ap_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 *)ap_palloc (p, sizeof(mime_dir_config));
        -
        -    new->forced_types = ap_overlay_tables (p, subdir->forced_types,
        -                                        parent_dir->forced_types);
        -    new->encoding_types = ap_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;
        -    ap_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 ap_get_module_config function. - -
        -int find_ct(request_rec *r)
        -{
        -    int i;
        -    char *fn = ap_pstrdup (r->pool, r->filename);
        -    mime_dir_config *conf = (mime_dir_config *)
        -             ap_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=ap_rind(fn,'.')) < 0) return DECLINED;
        -    ++i;
        -
        -    if ((type = ap_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=ap_rind(fn,'.')) < 0) return OK;
        -        ++i;
        -    }
        -
        -    if ((type = ap_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 *)
        -            ap_get_module_config(s->module_config,&alias_module);
        -    alias_entry *new = ap_push_array (conf->redirects);
        -
        -    if (!ap_is_url (url)) return "Redirect to non-URL";
        -
        -    new->fake = f; new->real = url;
        -    return NULL;
        -}
        -
        - - diff --git a/docs/manual/misc/FAQ-A.html b/docs/manual/misc/FAQ-A.html deleted file mode 100644 index 504f0aec76..0000000000 --- a/docs/manual/misc/FAQ-A.html +++ /dev/null @@ -1,321 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Apache Server Frequently Asked Questions - - - - -

        Apache Server Frequently Asked Questions

        -

        - $Revision: 1.5 $ ($Date: 2001/02/28 03:35:59 $) -

        -

        - The latest version of this FAQ is always available from the main - Apache web site, at - <http://www.apache.org/docs/misc/FAQ.html>. -

        - - - - - - - - - - - - - - - -

        - If you are reading a text-only version of this FAQ, you may find numbers - enclosed in brackets (such as "[12]"). These refer to the list of - reference URLs to be found at the end of the document. These references - do not appear, and are not needed, for the hypertext version. -

        -

        The Questions

        -
          - - -
        1. Background -
            -
          1. What is Apache? -
          2. -
          3. How and why was Apache created? -
          4. -
          5. Why the name "Apache"? -
          6. -
          7. OK, so how does Apache compare to other servers? -
          8. -
          9. How thoroughly tested is Apache? -
          10. -
          11. What are the future plans for Apache? -
          12. -
          13. Whom do I contact for support? -
          14. -
          15. Is there any more information on Apache? -
          16. -
          17. Where can I get Apache? -
          18. -
          -
        2. - - -
        - -
        - -

        The Answers

        - - -

        A. Background

        -
          -
        1. - What is Apache? - -

          The Apache httpd server

          - -
            -
          • is a powerful, flexible, HTTP/1.1 compliant web server -
          • implements the latest protocols, including HTTP/1.1 (RFC2616) -
          • is highly configurable and extensible with third-party modules -
          • can be customised by writing 'modules' using the Apache module API -
          • provides full source code and comes with an unrestrictive license -
          • runs on Windows NT/9x, Netware 5.x, OS/2, and most versions of Unix, - as well as several other operating systems -
          • is actively being developed -
          • encourages user feedback through new ideas, bug reports and patches -
          • implements many frequently requested features, including:

            -
            -
            DBM databases for authentication
            -
            allows you to easily set up password-protected pages with - enormous numbers of authorized users, without bogging down the server. -
            Customized responses to errors and problems
            -
            Allows you to set up files, or even CGI scripts, which are - returned by the server in response - to errors and problems, e.g. setup a script to intercept - 500 Server Errors and perform on-the-fly diagnostics for - both users and yourself.
            -
            Multiple DirectoryIndex directives
            -
            Allows you to say DirectoryIndex index.html - index.cgi, which instructs the server to either send - back index.html or run index.cgi - when a directory URL is requested, whichever it finds in the - directory. -
            Unlimited flexible URL rewriting and aliasing
            -
            Apache has no fixed limit on the numbers of Aliases and - Redirects which may be declared in the config files. In addition, - a powerful rewriting engine can be used to solve most URL - manipulation problems. -
            Content negotiation
            -
            i.e. the ability to automatically serve clients of varying - sophistication and HTML level compliance, with documents which - offer the best representation of information that the client is - capable of accepting.
            -
            Virtual Hosts
            -
            A much requested feature, sometimes known as multi-homed servers. - This allows the server to distinguish between requests made to - different IP addresses or names (mapped to the same machine). Apache - also offers dynamically configurable mass-virtual hosting. -
            -
            Configurable Reliable Piped Logs
            -
            You can configure - Apache to generate logs in the format that you want. In addition, on - most Unix architectures, Apache can send log files to a pipe, allowing - for log rotation, hit filtering, real-time splitting of multiple vhosts - into separate logs, and asynchronous DNS resolving on the fly. -
            -
          - -
          -
        2. - -
        3. - How and why was Apache created? - -

          - The About Apache - document explains how the Apache project evolved from its beginnings - as an outgrowth of the NCSA httpd project to its current status as - one of the fastest, most efficient, and most functional web servers - in existence. -

          -
          -
        4. - -
        5. - Why the name "Apache"? - -

          - A cute name which stuck. Apache is "A - PAtCHy server". It was - based on some existing code and a series of "patch files". -

          - -

          - For many developers it is also a reverent connotation to the Native - American Indian tribe of Apache, well-known for their - superior skills in warfare strategy and inexhaustible endurance. - Online information about the Apache Nation is tough to locate; we - suggest searching - Google, - Northernlight, - Infoseek, or - AllTheWeb. -

          -

          - In addition, http://www.indian.org/ and http://www.nativeweb.com/ are - two excellent resources for Native American information. -

          -
          -
        6. - -
        7. - OK, so how does Apache compare to other servers? - -

          - For an independent assessment, see - Web Compare's - comparison chart. -

          -

          - Apache has been shown to be substantially faster, more stable, and - more feature-full than many other web servers. Although certain - commercial servers have claimed to surpass Apache's speed (it has - not been demonstrated that any of these "benchmarks" are a - good way of measuring WWW server speed at any rate), we feel that it - is better to have a mostly-fast free server than an extremely-fast - server that costs thousands of dollars. Apache is run on sites that - get millions of hits per day, and they have experienced no - performance difficulties. -

          -
          -
        8. - -
        9. - How thoroughly tested is Apache? - -

          - Apache is run on over 6 million Internet servers (as of February - 2000). It has been tested thoroughly by both developers and - users. The Apache Group maintains rigorous standards before - releasing new versions of their server, and our server runs without - a hitch on over one half of all WWW servers available on the - Internet. When bugs do show up, we release patches and new versions - as soon as they are available. -

          -
          -
        10. - -
        11. - What are the future plans for Apache? - -

          -

            -
          • to continue to be an "open source" no-charge-for-use HTTP server, -
          • -
          • to keep up with advances in HTTP protocol and web developments in - general, -
          • -
          • to collect suggestions for fixes/improvements from its users, -
          • -
          • to respond to needs of large volume providers as well as - occasional users. -
          • -
          -

          -
          -
        12. - -
        13. - 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. -

          -
          -
        14. - -
        15. - Is there any more information available on - Apache? - -

          - Indeed there is. See the main - Apache web site. - There is also a regular electronic publication called - Apache Week - available. Links to relevant Apache Week articles are - included below where appropriate. There are also some - Apache-specific books available. -

          -
          -
        16. - -
        17. - Where can I get Apache? - -

          - You can find out how to download the source for Apache at the - project's - main web page. -

          -
          -
        18. -
        - - - - - - - - diff --git a/docs/manual/misc/FAQ-B.html b/docs/manual/misc/FAQ-B.html deleted file mode 100644 index 054914c415..0000000000 --- a/docs/manual/misc/FAQ-B.html +++ /dev/null @@ -1,441 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Apache Server Frequently Asked Questions - - - - -

        Apache Server Frequently Asked Questions

        -

        - $Revision: 1.7 $ ($Date: 2001/03/28 21:26:29 $) -

        -

        - The latest version of this FAQ is always available from the main - Apache web site, at - <http://www.apache.org/docs/misc/FAQ.html>. -

        - - - - - - - - - - - - - - - -

        - If you are reading a text-only version of this FAQ, you may find numbers - enclosed in brackets (such as "[12]"). These refer to the list of - reference URLs to be found at the end of the document. These references - do not appear, and are not needed, for the hypertext version. -

        -

        The Questions

        -
          - - -
        1. General Technical Questions -
            -
          1. "Why can't I ...? Why won't ... - work?" What to do in case of problems -
          2. -
          3. How compatible is Apache with my existing - NCSA 1.3 setup? -
          4. -
          5. Is Apache Year 2000 compliant? -
          6. -
          7. How do I submit a patch to the Apache Group? -
          8. -
          9. Why has Apache stolen my favourite site's - Internet address? -
          10. -
          11. Why am I getting spam mail from the Apache site? -
          12. -
          13. May I include the Apache software on a CD or other - package I'm distributing? -
          14. -
          15. What's the best hardware/operating system/... How do - I get the most out of my Apache Web server? -
          16. -
          17. What are "regular expressions"? -
          18. -
          19. Why isn't there a binary for my platform?
          20. -
          -
        2. - - -
        - -
        - -

        The Answers

        - - - -

        B. General Technical Questions

        -
          - -
        1. - "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. -
          -
          -
        2. - -
        3. - How compatible is Apache with my existing NCSA 1.3 - setup? - -

          - Apache attempts to offer all the features and configuration options - of NCSA httpd 1.3, as well as many of the additional features found in - NCSA httpd 1.4 and NCSA httpd 1.5. -

          -

          - NCSA httpd appears to be moving toward adding experimental features - which are not generally required at the moment. Some of the experiments - will succeed while others will inevitably be dropped. The Apache - philosophy is to add what's needed as and when it is needed. -

          -

          - Friendly interaction between Apache and NCSA developers should ensure - that fundamental feature enhancements stay consistent between the two - servers for the foreseeable future. -

          -
          -
        4. - -
        5. - Is Apache Year 2000 compliant? - -

          - Yes, Apache is Year 2000 compliant. -

          -

          - Apache internally never stores years as two digits. - On the HTTP protocol level RFC1123-style addresses are generated - which is the only format a HTTP/1.1-compliant server should - generate. To be compatible with older applications Apache - recognizes ANSI C's asctime() and - RFC850-/RFC1036-style date formats, too. - The asctime() format uses four-digit years, - but the RFC850 and RFC1036 date formats only define a two-digit year. - If Apache sees such a date with a value less than 70 it assumes that - the century is 20 rather than 19. -

          -

          - Although Apache is Year 2000 compliant, you may still get problems - if the underlying OS has problems with dates past year 2000 - (e.g., OS calls which accept or return year numbers). - Most (UNIX) systems store dates internally as signed 32-bit integers - which contain the number of seconds since 1st January 1970, so - the magic boundary to worry about is the year 2038 and not 2000. - But modern operating systems shouldn't cause any trouble - at all. -

          -

          - The Apache HTTP Server project is an open-source software product of - the Apache Software Foundation. The project and the Foundation - cannot offer legal assurances regarding any suitability - of the software for your application. There are several commercial - Apache support organizations and derivative server products available - that may be able to stand behind the software and provide you with - any assurances you may require. You may find links to some of these - vendors at - <http://httpd.apache.org/info/support.cgi>. -

          -

          - The Apache HTTP server software is distributed with the following - disclaimer, found in the software license: -

          -
          -   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.
          -  
          -
          -
        6. - -
        7. - How do I submit a patch to the Apache Group? -

          - The Apache Group encourages patches from outside developers. There - are 2 main "types" of patches: small bugfixes and general - improvements. Bugfixes should be submitting using the Apache bug report page. - Improvements, modifications, and additions should follow the - instructions below. -

          -

          - In general, the first course of action is to be a member of the - new-httpd@apache.org mailing list. This indicates to - the Group that you are closely following the latest Apache - developments. Your patch file should be generated using either - 'diff -c' or 'diff -u' against - the latest CVS tree. To submit your patch, send email to - new-httpd@apache.org with a Subject: line - that starts with [PATCH] and includes a general - description of the patch. In the body of the message, the patch - should be clearly described and then included at the end of the - message. If the patch-file is long, you can note a URL to the file - instead of the file itself. Use of MIME enclosures/attachments - should be avoided. -

          -

          - Be prepared to respond to any questions about your patches and - possibly defend your code. If your patch results in a lot of - discussion, you may be asked to submit an updated patch that - incorporate all changes and suggestions. -

          -
          -
        8. - -
        9. Why has Apache stolen my favourite site's - Internet address? -

          - The simple answer is: "It hasn't." This misconception is usually - caused by the site in question having migrated to the Apache Web - server software, but not having migrated the site's content yet. When - Apache is installed, the default page that gets installed tells the - Webmaster the installation was successful. The expectation is that - this default page will be replaced with the site's real content. - If it doesn't, complain to the Webmaster, not to the Apache project -- - we just make the software and aren't responsible for what people - do (or don't do) with it. -

          -
          -
        10. - -
        11. Why am I getting spam mail from the - Apache site? -

          - The short answer is: "You aren't." Usually when someone thinks the - Apache site is originating spam, it's because they've traced the - spam to a Web site, and the Web site says it's using Apache. See the - previous FAQ entry for more details on this - phenomenon. -

          -

          - No marketing spam originates from the Apache site. The only mail - that comes from the site goes only to addresses that have been - requested to receive the mail. -

          -
          -
        12. - -
        13. May I include the Apache software on a - CD or other package I'm distributing? -

          - The detailed answer to this question can be found in the - Apache license, which is included in the Apache distribution in - the file LICENSE. You can also find it on the Web at - <http://www.apache.org/LICENSE.txt>. -

          -
          -
        14. - -
        15. - What's the best hardware/operating system/... How do - I get the most out of my Apache Web server? - -

          - Check out Dean Gaudet's - performance tuning page. -

          -
          -
        16. - -
        17. - What are "regular expressions"? -

          - Regular expressions are a way of describing a pattern - for example, "all - the words that begin with the letter A" or "every 10-digit phone number" - or even "Every sentence with two commas in it, and no capital letter Q". - Regular expressions (aka "regex"s) are useful in Apache because they - let you apply certain attributes against collections of files or resources - in very flexible ways - for example, all .gif and .jpg files under - any "images" directory could be written as /\/images\/.*(jpg|gif)$/. -

          -

          - The best overview around is probably the one which comes with Perl. - We implement a simple subset of Perl's regex support, but it's - still a good way to learn what they mean. You can start by going - to the CPAN page on regular expressions, and branching out from - there. -

          -
          -
        18. - -
        19. - Why isn't there a binary for my platform? -

          - The developers make sure that the software builds and works - correctly on the platforms available to them; this does - not necessarily mean that your platform - is one of them. In addition, the Apache HTTP server project - is primarily source oriented, meaning that distributing - valid and buildable source code is the purpose of a release, - not making sure that there is a binary package for all of the - supported platforms. -

          -

          - If you don't see a kit for your platform listed in the - binary distribution area - (<URL:http://httpd.apache.org/dist/httpd/binaries/>), - it means either that the platform isn't available to any of - the developers, or that they just haven't gotten around to - preparing a binary for it. As this is a voluntary project, - they are under no obligation to do so. Users are encouraged - and expected to build the software themselves. -

          -

          - The sole exception to these practices is the Windows package. - Unlike most Unix and Unix-like platforms, Windows systems - do not come with a bundled software development environment, - so we do prepare binary kits for Windows when we make - a release. Again, however, it's a voluntary thing and only - a limited number of the developers have the capability to build - the InstallShield package, so the Windows release may lag - somewhat behind the source release. This lag should be - no more than a few days at most. -

          -
          -
        20. - -
        - - - - - - - - diff --git a/docs/manual/misc/FAQ-C.html b/docs/manual/misc/FAQ-C.html deleted file mode 100644 index 3f226c08f8..0000000000 --- a/docs/manual/misc/FAQ-C.html +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Apache Server Frequently Asked Questions - - - - -

        Apache Server Frequently Asked Questions

        -

        - $Revision: 1.1 $ ($Date: 1999/06/24 15:02:51 $) -

        -

        - The latest version of this FAQ is always available from the main - Apache web site, at - <http://www.apache.org/docs/misc/FAQ.html>. -

        - - - - - - - - - - - - - - - -

        - If you are reading a text-only version of this FAQ, you may find numbers - enclosed in brackets (such as "[12]"). These refer to the list of - reference URLs to be found at the end of the document. These references - do not appear, and are not needed, for the hypertext version. -

        -

        The Questions

        -
          - - -
        1. Building Apache -
            -
          1. Why do I get an error about an undefined - reference to "__inet_ntoa" or other - __inet_* symbols? -
          2. -
          3. Why won't Apache compile with my - system's cc? -
          4. -
          5. Why do I get complaints about redefinition - of "struct iovec" when compiling under Linux? -
          6. -
          7. I'm using gcc and I get some compilation errors, - what is wrong? -
          8. -
          9. I'm using RedHat Linux 5.0, or some other - glibc-based Linux system, and I get errors with the - crypt function when I attempt to build Apache 1.2. -
          10. -
          -
        2. - - -
        - -
        - -

        The Answers

        - - - -

        C. Building Apache

        -
          - -
        1. - Why do I get an error about an undefined reference to - "__inet_ntoa" or other - __inet_* symbols? - -

          - If you have installed BIND-8 - then this is normally due to a conflict between your include files - and your libraries. BIND-8 installs its include files and libraries - /usr/local/include/ and /usr/local/lib/, while - the resolver that comes with your system is probably installed in - /usr/include/ and /usr/lib/. If - your system uses the header files in /usr/local/include/ - before those in /usr/include/ but you do not use the new - resolver library, then the two versions will conflict. -

          -

          - To resolve this, you can either make sure you use the include files - and libraries that came with your system or make sure to use the - new include files and libraries. Adding -lbind to the - EXTRA_LDFLAGS line in your Configuration - file, then re-running Configure, should resolve the - problem. (Apache versions 1.2.* and earlier use - EXTRA_LFLAGS instead.) -

          -

          - Note:As of BIND 8.1.1, the bind libraries and files are - installed under /usr/local/bind by default, so you - should not run into this problem. Should you want to use the bind - resolvers you'll have to add the following to the respective lines: -

          -

          -

          -
          EXTRA_CFLAGS=-I/usr/local/bind/include -
          - EXTRA_LDFLAGS=-L/usr/local/bind/lib -
          - EXTRA_LIBS=-lbind
          -
          -
          -

          -
          -
        2. - -
        3. - Why won't Apache compile with my system's - cc? - -

          - If the server won't compile on your system, it is probably due to one - of the following causes: -

          -
            -
          • The Configure script doesn't recognize your system - environment. -
            - This might be either because it's completely unknown or because - the specific environment (include files, OS version, et - cetera) isn't explicitly handled. If this happens, you may - need to port the server to your OS yourself. -
          • -
          • Your system's C compiler is garbage. -
            - Some operating systems include a default C compiler that is either - not ANSI C-compliant or suffers from other deficiencies. The usual - recommendation in cases like this is to acquire, install, and use - gcc. -
          • -
          • Your include files may be confused. -
            - In some cases, we have found that a compiler installation or system - upgrade has left the C header files in an inconsistent state. Make - sure that your include directory tree is in sync with the compiler and - the operating system. -
          • -
          • Your operating system or compiler may be out of - revision. -
            - Software vendors (including those that develop operating systems) - issue new releases for a reason; sometimes to add functionality, but - more often to fix bugs that have been discovered. Try upgrading - your compiler and/or your operating system. -
          • -
          -

          - The Apache Group tests the ability to build the server on many - different platforms. Unfortunately, we can't test all of the OS - platforms there are. If you have verified that none of the above - issues is the cause of your problem, and it hasn't been reported - before, please submit a - problem report. - Be sure to include complete details, such as the compiler - & OS versions and exact error messages. -

          -
          -
        4. - -
        5. - Why do I get complaints about redefinition - of "struct iovec" when - compiling under Linux? - -

          - This is a conflict between your C library includes and your kernel - includes. You need to make sure that the versions of both are matched - properly. There are two workarounds, either one will solve the problem: -

          -

          -

            -
          • Remove the definition of struct iovec from your C - library includes. It is located in /usr/include/sys/uio.h. - Or, -
          • -
          • Add -DNO_WRITEV to the EXTRA_CFLAGS - line in your Configuration and reconfigure/rebuild. - This hurts performance and should only be used as a last resort. -
          • -
          -

          -
          -
        6. - -
        7. I'm using gcc and I get some - compilation errors, what is wrong? -

          - GCC parses your system header files and produces a modified subset which - it uses for compiling. This behaviour ties GCC tightly to the version - of your operating system. So, for example, if you were running IRIX 5.3 - when you built GCC and then upgrade to IRIX 6.2 later, you will have to - rebuild GCC. Similarly for Solaris 2.4, 2.5, or 2.5.1 when you upgrade - to 2.6. Sometimes you can type "gcc -v" and it will tell you the version - of the operating system it was built against. -

          -

          - If you fail to do this, then it is very likely that Apache will fail - to build. One of the most common errors is with readv, - writev, or uio.h. This is not a - bug with Apache. You will need to re-install GCC. -

          -
          -
        8. - -
        9. - I'm using RedHat Linux 5.0, or some other - glibc-based Linux system, and I get errors with the - crypt function when I attempt to build Apache 1.2. - - -

          - glibc puts the crypt function into a separate - library. Edit your src/Configuration file and set this: -

          -
          -
          EXTRA_LIBS=-lcrypt -
          -
          -

          - Then re-run src/Configure and re-execute the make. -

          -
          -
        10. - -
        - - - - - - - - diff --git a/docs/manual/misc/FAQ-D.html b/docs/manual/misc/FAQ-D.html deleted file mode 100644 index f54c7c3a5d..0000000000 --- a/docs/manual/misc/FAQ-D.html +++ /dev/null @@ -1,432 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Apache Server Frequently Asked Questions - - - - -

        Apache Server Frequently Asked Questions

        -

        - $Revision: 1.8 $ ($Date: 2001/02/28 03:35:59 $) -

        -

        - The latest version of this FAQ is always available from the main - Apache web site, at - <http://www.apache.org/docs/misc/FAQ.html>. -

        - - - - - - - - - - - - - - - -

        - If you are reading a text-only version of this FAQ, you may find numbers - enclosed in brackets (such as "[12]"). These refer to the list of - reference URLs to be found at the end of the document. These references - do not appear, and are not needed, for the hypertext version. -

        -

        The Questions

        -
          - - -
        1. Error Log Messages and Problems Starting Apache -
            -
          1. Why do I get "setgid: Invalid - argument" at startup? -
          2. -
          3. Why am I getting "httpd: could not - set socket option TCP_NODELAY" in my error log? -
          4. -
          5. Why am I getting "connection - reset by peer" in my error log? -
          6. -
          7. The errorlog says Apache dumped core, - but where's the dump file? -
          8. -
          9. When I run it under Linux I get "shmget: - function not found", what should I do? -
          10. -
          11. Server hangs, or fails to start, and/or error log - fills with "fcntl: F_SETLKW: No record locks - available" or similar messages -
          12. -
          13. Why am I getting "Expected </Directory> - but saw </Directory>" when I try to start Apache? -
          14. -
          15. I'm using RedHat Linux and I have problems with httpd - dying randomly or not restarting properly -
          16. -
          17. I upgraded from an Apache version earlier - than 1.2.0 and suddenly I have problems with Apache dying randomly - or not restarting properly -
          18. -
          19. When I try to start Apache from a DOS - window, I get a message like "Cannot determine host name. - Use ServerName directive to set it manually." What does - this mean? -
          20. -
          21. When I try to start Apache for Windows, I get a message - like "Unable To Locate WS2_32.DLL...". What should I do? -
          22. -
          23. Apache for Windows does not start. - Error log contains this message "[crit] (10045) The attempted - operation is not supported for the type of object referenced: Parent: - WSADuplicateSocket failed for socket ###". What does this - mean? -
          24. -
          -
        2. - - -
        - -
        - -

        The Answers

        - - - -

        D. Error Log Messages and Problems Starting Apache

        -
          - -
        1. - Why do I get "setgid: Invalid - argument" at startup? - -

          - Your - Group - directive (probably in conf/httpd.conf) needs to name a - group that actually exists in the /etc/group file (or - your system's equivalent). This problem is also frequently seen when - a negative number is used in the Group directive - (e.g., "Group #-1"). Using a group name - -- not group number -- found in your system's group database should - solve this problem in all cases. -

          -
          -
        2. - -
        3. - Why am I getting "httpd: could not set socket - option TCP_NODELAY" in my error log? - -

          - This message almost always indicates that the client disconnected - before Apache reached the point of calling setsockopt() - for the connection. It shouldn't occur for more than about 1% of the - requests your server handles, and it's advisory only in any case. -

          -
          -
        4. - -
        5. - Why am I getting "connection reset by - peer" in my error log? - -

          - This is a normal message and nothing about which to be alarmed. It simply - means that the client canceled the connection before it had been - completely set up - such as by the end-user pressing the "Stop" - button. People's patience being what it is, sites with response-time - problems or slow network links may experiences this more than - high-capacity ones or those with large pipes to the network. -

          -
          -
        6. - -
        7. - The errorlog says Apache dumped core, but where's the dump - file? - -

          - In Apache version 1.2, the error log message - about dumped core includes the directory where the dump file should be - located. However, many Unixes do not allow a process that has - called setuid() to dump core for security reasons; - the typical Apache setup has the server started as root to bind to - port 80, after which it changes UIDs to a non-privileged user to - serve requests. -

          -

          - Dealing with this is extremely operating system-specific, and may - require rebuilding your system kernel. Consult your operating system - documentation or vendor for more information about whether your system - does this and how to bypass it. If there is a documented way - of bypassing it, it is recommended that you bypass it only for the - httpd server process if possible. -

          -

          - The canonical location for Apache's core-dump files is the - ServerRoot - directory. As of Apache version 1.3, the location can be set via - the - CoreDumpDirectory - directive to a different directory. Make sure that this directory is - writable by the user the server runs as (as opposed to the user the server - is started as). -

          -
          -
        8. - -
        9. - When I run it under Linux I get "shmget: - function not found", what should I do? - -

          - Your kernel has been built without SysV IPC support. You will have - to rebuild the kernel with that support enabled (it's under the - "General Setup" submenu). Documentation for kernel - building is beyond the scope of this FAQ; you should consult the Kernel - HOWTO, or the documentation provided with your distribution, or - a Linux - newsgroup/mailing list. As a last-resort workaround, you can - comment out the #define USE_SHMGET_SCOREBOARD - definition in the LINUX section of - src/conf.h and rebuild the server (prior to 1.3b4, - simply removing #define HAVE_SHMGET would have - sufficed). This will produce a server which is slower and less - reliable. -

          -
          -
        10. - -
        11. - Server hangs, or fails to start, and/or error log - fills with "fcntl: F_SETLKW: No record locks - available" or similar messages - - -

          - These are symptoms of a fine locking problem, which usually means that - the server is trying to use a synchronization file on an NFS filesystem. -

          -

          - Because of its parallel-operation model, the Apache Web server needs to - provide some form of synchronization when accessing certain resources. - One of these synchronization methods involves taking out locks on a file, - which means that the filesystem whereon the lockfile resides must support - locking. In many cases this means it can't be kept on an - NFS-mounted filesystem. -

          -

          - To cause the Web server to work around the NFS locking limitations, include - a line such as the following in your server configuration files: -

          -
          -
          LockFile /var/run/apache-lock -
          -
          -

          - The directory should not be generally writable (e.g., don't use - /var/tmp). - See the LockFile - documentation for more information. -

          -
          -
        12. - -
        13. Why am I getting "Expected - </Directory> but saw </Directory>" when - I try to start Apache? -

          - This is a known problem with certain versions of the AIX C compiler. - IBM are working on a solution, and the issue is being tracked by - problem report #2312. -

          -
          -
        14. - -
        15. - I'm using RedHat Linux and I have problems with httpd - dying randomly or not restarting properly - - -

          - RedHat Linux versions 4.x (and possibly earlier) RPMs contain - various nasty scripts which do not stop or restart Apache properly. - These can affect you even if you're not running the RedHat supplied - RPMs. -

          -

          - If you're using the default install then you're probably running - Apache 1.1.3, which is outdated. From RedHat's ftp site you can - pick up a more recent RPM for Apache 1.2.x. This will solve one of - the problems. -

          -

          - If you're using a custom built Apache rather than the RedHat RPMs - then you should rpm -e apache. In particular you want - the mildly broken /etc/logrotate.d/apache script to be - removed, and you want the broken /etc/rc.d/init.d/httpd - (or httpd.init) script to be removed. The latter is - actually fixed by the apache-1.2.5 RPMs but if you're building your - own Apache then you probably don't want the RedHat files. -

          -

          - We can't stress enough how important it is for folks, especially - vendors to follow the stopping Apache - directions given in our documentation. In RedHat's defense, - the broken scripts were necessary with Apache 1.1.x because the - Linux support in 1.1.x was very poor, and there were various race - conditions on all platforms. None of this should be necessary with - Apache 1.2 and later. -

          -
          -
        16. - -
        17. - I upgraded from an Apache version earlier - than 1.2.0 and suddenly I have problems with Apache dying randomly - or not restarting properly - - -

          - You should read the previous note about - problems with RedHat installations. It is entirely likely that your - installation has start/stop/restart scripts which were built for - an earlier version of Apache. Versions earlier than 1.2.0 had - various race conditions that made it necessary to use - kill -9 at times to take out all the httpd servers. - But that should not be necessary any longer. You should follow - the directions on how to stop - and restart Apache. -

          -

          As of Apache 1.3 there is a script - src/support/apachectl which, after a bit of - customization, is suitable for starting, stopping, and restarting - your server. -

          -
          -
        18. - -
        19. - When I try to start Apache from a DOS - window, I get a message like "Cannot determine host name. - Use ServerName directive to set it manually." What does - this mean? - -

          - It means what it says; the Apache software can't determine the - hostname of your system. Edit your conf\httpd.conf - file, look for the string "ServerName", and make sure there's an - uncommented directive such as -

          -
          -
          ServerName localhost
          -
          -

          - or -

          -
          -
          ServerName www.foo.com
          -
          -

          - in the file. Correct it if there one there with wrong information, or - add one if you don't already have one. -

          -

          - Also, make sure that your Windows system has DNS enabled. See the TCP/IP - setup component of the Networking or Internet Options control panel. -

          -

          - After verifying that DNS is enabled and that you have a valid hostname - in your ServerName directive, try to start the server - again. -

          -
          -
        20. -
        21. - When I try to start Apache for Windows, I get a message - like "Unable To Locate WS2_32.DLL...". What should I do? -

          - Short answer: You need to install Winsock 2, available from - http://www.microsoft.com/windows95/downloads/ -

          -

          - Detailed answer: Prior to version 1.3.9, Apache for Windows used Winsock 1.1. Beginning with - version 1.3.9, Apache began using Winsock 2 features (specifically, WSADuplicateSocket()). - WS2_32.DLL implements the Winsock 2 API. Winsock 2 ships with Windows NT 4.0 and Windows 98. - Some of the earlier releases of Windows 95 did not include Winsock 2. -

          -
          -
        22. -
        23. - Apache for Windows does not start. Error log contains this message: - "[crit] (10045) The attempted operation is not supported for - the type of object referenced: Parent: WSADuplicateSocket failed for - socket ###". What does this mean? -

          - We have seen this problem when Apache is run on systems along with - Virtual Private Networking clients like Aventail Connect. Aventail Connect - is a Layered Service Provider (LSP) that inserts itself, as a "shim," - between the Winsock 2 API and Window's native Winsock 2 implementation. - The Aventail Connect shim does not implement WSADuplicateSocket, which is - the cause of the failure. -

          -

          - The shim is not unloaded when Aventail Connect is shut down. Once - observed, the problem persists until the shim is either explicitly - unloaded or the machine is rebooted. Instructions for temporarily - removing the Aventail Connect V3.x shim can be found here: - "How to Remove Aventail Connect v3.x from the LSP Order for Testing - Purposes." -

          -

          - Another potential solution (not tested) is to add apache.exe - to the Aventail "Connect Exclusion List". See this link for details: - "How to Add an Application to Aventail Connect's Application Exclusion - List." -

          -
          -
        24. -
        - - - - - - - - diff --git a/docs/manual/misc/FAQ-E.html b/docs/manual/misc/FAQ-E.html deleted file mode 100644 index 555c7c4c9f..0000000000 --- a/docs/manual/misc/FAQ-E.html +++ /dev/null @@ -1,626 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Apache Server Frequently Asked Questions - - - - -

        Apache Server Frequently Asked Questions

        -

        - $Revision: 1.7 $ ($Date: 2001/02/28 03:35:59 $) -

        -

        - The latest version of this FAQ is always available from the main - Apache web site, at - <http://www.apache.org/docs/misc/FAQ.html>. -

        - - - - - - - - - - - - - - - -

        - If you are reading a text-only version of this FAQ, you may find numbers - enclosed in brackets (such as "[12]"). These refer to the list of - reference URLs to be found at the end of the document. These references - do not appear, and are not needed, for the hypertext version. -

        -

        The Questions

        -
          - - -
        1. Configuration Questions -
            -
          1. Why can't I run more than <n> - virtual hosts? -
          2. -
          3. Can I increase FD_SETSIZE - on FreeBSD? -
          4. -
          5. Why doesn't my ErrorDocument - 401 work? -
          6. -
          7. Why does Apache send a cookie on every response? -
          8. -
          9. Why don't my cookies work, I even compiled in - mod_cookies? -
          10. -
          11. Why do my Java app[let]s give me plain text - when I request an URL from an Apache server? -
          12. -
          13. How do I get Apache to send a MIDI file so the - browser can play it? -
          14. -
          15. How do I add browsers and referrers to my logs? -
          16. -
          17. Why does accessing directories only work - when I include the trailing "/" - (e.g.http://foo.domain.com/~user/) but - not when I omit it - (e.g.http://foo.domain.com/~user)? -
          18. -
          19. Why doesn't mod_info list any - directives? -
          20. -
          21. I upgraded to Apache 1.3 and now my - virtual hosts don't work! -
          22. -
          23. I'm using RedHat Linux and my .htm files are - showing up as HTML source rather than being formatted! -
          24. -
          25. My .htaccess files are being - ignored. -
          26. -
          27. Why do I get a - "Forbidden" message whenever I try to - access a particular directory? -
          28. Why do my files appear correctly in - Internet Explorer, but show up as source or trigger a save - window with Netscape? -
          -
        2. - - -
        - -
        - -

        The Answers

        - - - -

        E. Configuration Questions

        -
          - -
        1. - Why can't I run more than <n> - virtual hosts? - -

          - You are probably running into resource limitations in your - operating system. The most common limitation is the - per-process limit on file descriptors, - which is almost always the cause of problems seen when adding - virtual hosts. Apache often does not give an intuitive error - message because it is normally some library routine (such as - gethostbyname()) which needs file descriptors and - doesn't complain intelligibly when it can't get them. -

          -

          - Each log file requires a file descriptor, which means that if you are - using separate access and error logs for each virtual host, each - virtual host needs two file descriptors. Each - Listen - directive also needs a file descriptor. -

          -

          - Typical values for <n> that we've seen are in - the neighborhood of 128 or 250. When the server bumps into the file - descriptor limit, it may dump core with a SIGSEGV, it might just - hang, or it may limp along and you'll see (possibly meaningful) errors - in the error log. One common problem that occurs when you run into - a file descriptor limit is that CGI scripts stop being executed - properly. -

          -

          - As to what you can do about this: -

          -
            -
          1. Reduce the number of - Listen - directives. If there are no other servers running on the machine - on the same port then you normally don't - need any Listen directives at all. By default Apache listens to - all addresses on port 80. -
          2. -
          3. Reduce the number of log files. You can use - mod_log_config - to log all requests to a single log file while including the name - of the virtual host in the log file. You can then write a - script to split the logfile into separate files later if - necessary. Such a script is provided with the Apache 1.3 distribution - in the src/support/split-logfile file. -
          4. -
          5. Increase the number of file descriptors available to the server - (see your system's documentation on the limit or - ulimit commands). For some systems, information on - how to do this is available in the - performance hints page. There is a specific - note for FreeBSD below. -

            - For Windows 95, try modifying your C:\CONFIG.SYS file to - include a line like -

            -
            -
            FILES=300 -
            -
            -

            - Remember that you'll need to reboot your Windows 95 system in order - for the new value to take effect. -

            -
          6. -
          7. "Don't do that" - try to run with fewer virtual hosts -
          8. -
          9. Spread your operation across multiple server processes (using - Listen - for example, but see the first point) and/or ports. -
          10. -
          -

          - Since this is an operating-system limitation, there's not much else - available in the way of solutions. -

          -

          - As of 1.2.1 we have made attempts to work around various limitations - involving running with many descriptors. - More information is available. -

          -
          -
        2. - -
        3. - Can I increase FD_SETSIZE on FreeBSD? - -

          - On versions of FreeBSD before 3.0, the FD_SETSIZE define - defaults to 256. This means that you will have trouble usefully using - more than 256 file descriptors in Apache. This can be increased, but - doing so can be tricky. -

          -

          - If you are using a version prior to 2.2, you need to recompile your - kernel with a larger FD_SETSIZE. This can be done by adding a - line such as: -

          -
          -
          options FD_SETSIZE nnn -
          -
          -

          - to your kernel config file. Starting at version 2.2, this is no - longer necessary. -

          -

          - If you are using a version of 2.1-stable from after 1997/03/10 or - 2.2 or 3.0-current from before 1997/06/28, there is a limit in - the resolver library that prevents it from using more file descriptors - than what FD_SETSIZE is set to when libc is compiled. To - increase this, you have to recompile libc with a higher - FD_SETSIZE. -

          -

          - In FreeBSD 3.0, the default FD_SETSIZE has been increased to - 1024 and the above limitation in the resolver library - has been removed. -

          -

          - After you deal with the appropriate changes above, you can increase - the setting of FD_SETSIZE at Apache compilation time - by adding "-DFD_SETSIZE=nnn" to the - EXTRA_CFLAGS line in your Configuration - file. -

          -
          -
        4. - -
        5. - Why doesn't my ErrorDocument 401 work? - -

          - You need to use it with a URL in the form - "/foo/bar" and not one with a method and - hostname such as "http://host/foo/bar". See the - ErrorDocument - documentation for details. This was incorrectly documented in the past. -

          -
          -
        6. - -
        7. - Why does Apache send a cookie on every response? - -

          - Apache does not automatically send a cookie on every - response, unless you have re-compiled it with the - mod_usertrack - module, and specifically enabled it with the - CookieTracking - directive. - This module has been in Apache since version 1.2. - This module may help track users, and uses cookies to do this. If - you are not using the data generated by mod_usertrack, do - not compile it into Apache. -

          -
          -
        8. - -
        9. - Why don't my cookies work, I even compiled in - mod_cookies? - - -

          - Firstly, you do not need to compile in - mod_cookies in order for your scripts to work (see the - previous question - for more about mod_cookies). Apache passes on your - Set-Cookie header fine, with or without this module. If - cookies do not work it will be because your script does not work - properly or your browser does not use cookies or is not set-up to - accept them. -

          -
          -
        10. - -
        11. - Why do my Java app[let]s give me plain text when I request - an URL from an Apache server? - -

          - As of version 1.2, Apache is an HTTP/1.1 (HyperText Transfer Protocol - version 1.1) server. This fact is reflected in the protocol version - that's included in the response headers sent to a client when - processing a request. Unfortunately, low-level Web access classes - included in the Java Development Kit (JDK) version 1.0.2 expect to see - the version string "HTTP/1.0" and do not correctly interpret - the "HTTP/1.1" value Apache is sending (this part of the - response is a declaration of what the server can do rather than a - declaration of the dialect of the response). The result - is that the JDK methods do not correctly parse the headers, and - include them with the document content by mistake. -

          -

          - This is definitely a bug in the JDK 1.0.2 foundation classes from Sun, - and it has been fixed in version 1.1. However, the classes in - question are part of the virtual machine environment, which means - they're part of the Web browser (if Java-enabled) or the Java - environment on the client system - so even if you develop - your classes with a recent JDK, the eventual users might - encounter the problem. - The classes involved are replaceable by vendors implementing the - Java virtual machine environment, and so even those that are based - upon the 1.0.2 version may not have this problem. -

          -

          - In the meantime, a workaround is to tell - Apache to "fake" an HTTP/1.0 response to requests that come - from the JDK methods; this can be done by including a line such as the - following in your server configuration files: -

          -

          -

          -
          BrowserMatch Java1.0 force-response-1.0 -
          - BrowserMatch JDK/1.0 force-response-1.0
          -
          -
          -

          -

          - More information about this issue can be found in the - Java and HTTP/1.1 - page at the Apache web site. -

          -
          -
        12. - -
        13. - How do I get Apache to send a MIDI file so the browser can - play it? - -

          - Even though the registered MIME type for MIDI files is - audio/midi, some browsers are not set up to recognize it - as such; instead, they look for audio/x-midi. There are - two things you can do to address this: -

          -
            -
          1. Configure your browser to treat documents of type - audio/midi correctly. This is the type that Apache - sends by default. This may not be workable, however, if you have - many client installations to change, or if some or many of the - clients are not under your control. -
          2. -
          3. Instruct Apache to send a different Content-type - header for these files by adding the following line to your server's - configuration files: -

            -

            -
            AddType audio/x-midi .mid .midi .kar -
            -
            -

            -

            - Note that this may break browsers that do recognize the - audio/midi MIME type unless they're prepared to also - handle audio/x-midi the same way. -

            -
          4. -
          -
          -
        14. - -
        15. - How do I add browsers and referrers to my logs? - -

          - Apache provides a couple of different ways of doing this. The - recommended method is to compile the - mod_log_config - module into your configuration and use the - CustomLog - directive. -

          -

          - You can either log the additional information in files other than your - normal transfer log, or you can add them to the records already being - written. For example: -

          -

          - - CustomLog logs/access_log "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\"" - -

          -

          - This will add the values of the User-agent: and - Referer: headers, which indicate the client and the - referring page, respectively, to the end of each line in the access - log. -

          -

          - You may want to check out the Apache Week article - entitled: - "Gathering Visitor Information: Customizing Your - Logfiles". -

          -
          -
        16. - -
        17. - Why does accessing directories only work when I include - the trailing "/" - (e.g.http://foo.domain.com/~user/) - but not when I omit it - (e.g.http://foo.domain.com/~user)? - -

          - When you access a directory without a trailing "/", Apache needs - to send what is called a redirect to the client to tell it to - add the trailing slash. If it did not do so, relative URLs would - not work properly. When it sends the redirect, it needs to know - the name of the server so that it can include it in the redirect. - There are two ways for Apache to find this out; either it can guess, - or you can tell it. If your DNS is configured correctly, it can - normally guess without any problems. If it is not, however, then - you need to tell it. -

          -

          - Add a ServerName directive - to the config file to tell it what the domain name of the server is. -

          -
          -
        18. - -
        19. - Why doesn't mod_info list any directives? - -

          - The mod_info - module allows you to use a Web browser to see how your server is - configured. Among the information it displays is the list modules and - their configuration directives. The "current" values for - the directives are not necessarily those of the running server; they - are extracted from the configuration files themselves at the time of - the request. If the files have been changed since the server was last - reloaded, the display will not match the values actively in use. - If the files and the path to the files are not readable by the user as - which the server is running (see the - User - directive), then mod_info cannot read them in order to - list their values. An entry will be made in the error log in - this event, however. -

          -
          -
        20. - -
        21. - I upgraded to Apache 1.3 and now my virtual hosts don't - work! - -

          - In versions of Apache prior to 1.3b2, there was a lot of confusion - regarding address-based virtual hosts and (HTTP/1.1) name-based - virtual hosts, and the rules concerning how the server processed - <VirtualHost> definitions were very complex and not - well documented. -

          -

          - Apache 1.3b2 introduced a new directive, - NameVirtualHost, - which simplifies the rules quite a bit. However, changing the rules - like this means that your existing name-based - <VirtualHost> containers probably won't work - correctly immediately following the upgrade. -

          -

          - To correct this problem, add the following line to the beginning of - your server configuration file, before defining any virtual hosts: -

          -
          -
          NameVirtualHost n.n.n.n -
          -
          -

          - Replace the "n.n.n.n" with the IP address to - which the name-based virtual host names resolve; if you have multiple - name-based hosts on multiple addresses, repeat the directive for each - address. -

          -

          - Make sure that your name-based <VirtualHost> blocks - contain ServerName and possibly ServerAlias - directives so Apache can be sure to tell them apart correctly. -

          -

          - Please see the Apache - Virtual Host documentation for further details about configuration. -

          -
          -
        22. - -
        23. - I'm using RedHat Linux and my .htm files are showing - up as HTML source rather than being formatted! - - -

          - RedHat messed up and forgot to put a content type for .htm - files into /etc/mime.types. Edit /etc/mime.types, - find the line containing html and add htm to it. - Then restart your httpd server: -

          -
          -
          kill -HUP `cat /var/run/httpd.pid` -
          -
          -

          - Then clear your browsers' caches. (Many browsers won't - re-examine the content type after they've reloaded a page.) -

          -
          -
        24. - -
        25. - My .htaccess files are being ignored. -

          - This is almost always due to your - AllowOverride directive being set incorrectly for the directory in - question. If it is set to None then .htaccess files will - not even be looked for. If you do have one that is set, then be certain - it covers the directory you are trying to use the .htaccess file in. - This is normally accomplished by ensuring it is inside the proper - Directory container. -

          -
          -
        26. -
        27. - Why do I get a "Forbidden" message - whenever I try to access a particular directory? -

          - This message is generally caused because either -

          -
            -
          • The underlying file system permissions do not allow the - User/Group under which Apache is running to access the necessary - files; or -
          • The Apache configuration has some access restrictions in - place which forbid access to the files. -
          -

          - You can determine which case applies to your situation by checking the - error log. -

          -

          - In the case where file system permission are at fault, remember - that not only must the directory and files in question be readable, - but also all parent directories must be at least searchable by the - web server in order for the content to be accessible. -

          -
          -
        28. -
        29. - Why do my files appear correctly in Internet - Explorer, but show up as source or trigger a save window - with Netscape? -

          - Internet Explorer (IE) and Netscape handle mime type detection in different - ways, and therefore will display the document differently. In particular, - IE sometimes relies on the file extension to determine the mime type. This - can happen when the server specifies a mime type of - application/octet-stream or text/plain. - (Unfortunately, this behavior makes it impossible to properly send plain - text in some situations unless the file extension is txt.) - There are more details available on IE's mime type detection behavior in an - MSDN - article. -

          - -

          - In order to make all browsers work correctly, you should assure - that Apache sends the correct mime type for the file. This is - accomplished by editing the mime.types file or using - an AddType - directive in the Apache configuration files. -

          -
          -
        30. -
        - - - - - - - - diff --git a/docs/manual/misc/FAQ-F.html b/docs/manual/misc/FAQ-F.html deleted file mode 100644 index 0f7e7046db..0000000000 --- a/docs/manual/misc/FAQ-F.html +++ /dev/null @@ -1,564 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Apache Server Frequently Asked Questions - - - - -

        Apache Server Frequently Asked Questions

        -

        - $Revision: 1.9 $ ($Date: 2001/02/28 03:36:00 $) -

        -

        - The latest version of this FAQ is always available from the main - Apache web site, at - <http://www.apache.org/docs/misc/FAQ.html>. -

        - - - - - - - - - - - - - - - -

        - If you are reading a text-only version of this FAQ, you may find numbers - enclosed in brackets (such as "[12]"). These refer to the list of - reference URLs to be found at the end of the document. These references - do not appear, and are not needed, for the hypertext version. -

        -

        The Questions

        -
          - - -
        1. Dynamic Content (CGI and SSI) -
            -
          1. How do I enable CGI execution - in directories other than the ScriptAlias? -
          2. -
          3. What does it mean when my - CGIs fail with "Premature end of script - headers"? -
          4. -
          5. Why do I keep getting "Method Not - Allowed" for form POST requests? -
          6. -
          7. How can I get my script's output without - Apache buffering it? Why doesn't my server push work? -
          8. -
          9. Where can I find the "CGI - specification"? -
          10. -
          11. Why isn't FastCGI included with Apache any - more? -
          12. -
          13. How do I enable SSI (parsed HTML)? -
          14. -
          15. Why don't my parsed files get cached? -
          16. -
          17. How can I have my script output parsed? -
          18. -
          19. SSIs don't work for VirtualHosts and/or - user home directories -
          20. -
          21. How can I use ErrorDocument - and SSI to simplify customized error messages? -
          22. -
          23. Why is the environment variable - REMOTE_USER not set? -
          24. -
          25. How do I allow each of my user directories - to have a cgi-bin directory? -
          26. -
          -
        2. - - -
        - -
        - -

        The Answers

        - - - -

        F. Dynamic Content (CGI and SSI)

        -
          - -
        1. - How do I enable CGI execution in directories other than - the ScriptAlias? - -

          - Apache recognizes all files in a directory named as a - ScriptAlias - as being eligible for execution rather than processing as normal - documents. This applies regardless of the file name, so scripts in a - ScriptAlias directory don't need to be named - "*.cgi" or "*.pl" or - whatever. In other words, all files in a ScriptAlias - directory are scripts, as far as Apache is concerned. -

          -

          - To persuade Apache to execute scripts in other locations, such as in - directories where normal documents may also live, you must tell it how - to recognize them - and also that it's okay to execute them. For - this, you need to use something like the - AddHandler - directive. -

          -

          -

            -
          1. In an appropriate section of your server configuration files, add - a line such as -

            -

            -
            AddHandler cgi-script .cgi -
            -
            -

            -

            - The server will then recognize that all files in that location (and - its logical descendants) that end in ".cgi" - are script files, not documents. -

            -
          2. -
          3. Make sure that the directory location is covered by an - Options - declaration that includes the ExecCGI option. -
          4. -
          -

          -

          - In some situations, you might not want to actually - allow all files named "*.cgi" to be executable. - Perhaps all you want is to enable a particular file in a normal directory to - be executable. This can be alternatively accomplished - via mod_rewrite - and the following steps: -

          -

          -

            -
          1. Locally add to the corresponding .htaccess file a ruleset - similar to this one: -

            -

            -
            RewriteEngine on -
            - RewriteBase /~foo/bar/ -
            - RewriteRule ^quux\.cgi$ - [T=application/x-httpd-cgi]
            -
            -
            -

            -
          2. -
          3. Make sure that the directory location is covered by an - Options - declaration that includes the ExecCGI and - FollowSymLinks option. -
          4. -
          -

          -
          -
        2. - -
        3. - What does it mean when my CGIs fail with - "Premature end of script headers"? - -

          - It means just what it says: the server was expecting a complete set of - HTTP headers (one or more followed by a blank line), and didn't get - them. -

          -

          - The most common cause of this problem is the script dying before - sending the complete set of headers, or possibly any at all, to the - server. To see if this is the case, try running the script standalone - from an interactive session, rather than as a script under the server. - If you get error messages, this is almost certainly the cause of the - "premature end of script headers" message. Even if the CGI - runs fine from the command line, remember that the environment and - permissions may be different when running under the web server. The - CGI can only access resources allowed for the User and - Group specified in - your Apache configuration. In addition, the environment will not be - the same as the one provided on the command line, but it can be - adjusted using the directives provided by mod_env. -

          -

          - The second most common cause of this (aside from people not - outputting the required headers at all) is a result of an interaction - with Perl's output buffering. To make Perl flush its buffers - after each output statement, insert the following statements around - the print or write statements that send your - HTTP headers: -

          -

          -

          -
          {
          -  local ($oldbar) = $|;
          -  $cfh = select (STDOUT);
          -  $| = 1;
          -  #
          -  # print your HTTP headers here
          -  #
          -  $| = $oldbar;
          -  select ($cfh);
          - }
          -
          -
          -

          -

          - This is generally only necessary when you are calling external - programs from your script that send output to stdout, or if there will - be a long delay between the time the headers are sent and the actual - content starts being emitted. To maximize performance, you should - turn buffer-flushing back off (with $| = 0 or the - equivalent) after the statements that send the headers, as displayed - above. -

          -

          - If your script isn't written in Perl, do the equivalent thing for - whatever language you are using (e.g., for C, call - fflush() after writing the headers). -

          -

          - Another cause for the "premature end of script headers" - message are the RLimitCPU and RLimitMEM directives. You may - get the message if the CGI script was killed due to a - resource limit. -

          -

          - In addition, a configuration problem in suEXEC, mod_perl, or another third party - module can often interfere with the execution of your CGI and cause - the "premature end of script headers" message. -

          -
          -
        4. - -
        5. - Why do I keep getting "Method Not Allowed" for - form POST requests? - -

          - This is almost always due to Apache not being configured to treat the - file you are trying to POST to as a CGI script. You can not POST - to a normal HTML file; the operation has no meaning. See the FAQ - entry on CGIs outside ScriptAliased - directories for details on how to configure Apache to treat the - file in question as a CGI. -

          -
          -
        6. - -
        7. - How can I get my script's output without Apache buffering - it? Why doesn't my server push work? - -

          - As of Apache 1.3, CGI scripts are essentially not buffered. Every time - your script does a "flush" to output data, that data gets relayed on to - the client. Some scripting languages, for example Perl, have their own - buffering for output - this can be disabled by setting the $| - special variable to 1. Of course this does increase the overall number - of packets being transmitted, which can result in a sense of slowness for - the end user. -

          -

          Prior to 1.3, you needed to use "nph-" scripts to accomplish - non-buffering. Today, the only difference between nph scripts and - normal scripts is that nph scripts require the full HTTP headers to - be sent. -

          -
          -
        8. - -
        9. - Where can I find the "CGI specification"? - -

          - The Common Gateway Interface (CGI) specification can be found at - the original NCSA site - < - http://hoohoo.ncsa.uiuc.edu/cgi/interface.html>. - This version hasn't been updated since 1995, and there have been - some efforts to update it. -

          -

          - A new draft is being worked on with the intent of making it an informational - RFC; you can find out more about this project at - <http://web.golux.com/coar/cgi/>. -

          -
          -
        10. - -
        11. - Why isn't FastCGI included with Apache any more? - -

          - The simple answer is that it was becoming too difficult to keep the - version being included with Apache synchronized with the master copy - at the - FastCGI web site. When a new version of Apache was released, the - version of the FastCGI module included with it would soon be out of date. -

          -

          - You can still obtain the FastCGI module for Apache from the master - FastCGI web site. -

          -
          -
        12. - -
        13. - How do I enable SSI (parsed HTML)? - -

          - SSI (an acronym for Server-Side Include) directives allow static HTML - documents to be enhanced at run-time (e.g., when delivered to - a client by Apache). The format of SSI directives is covered - in the mod_include manual; - suffice it to say that Apache supports not only SSI but - xSSI (eXtended SSI) directives. -

          -

          - Processing a document at run-time is called parsing it; - hence the term "parsed HTML" sometimes used for documents - that contain SSI instructions. Parsing tends to be - resource-consumptive compared to serving static files, and is not - enabled by default. It can also interfere with the cachability of - your documents, which can put a further load on your server. (See - the next question for more information - about this.) -

          -

          - To enable SSI processing, you need to -

          -
            -
          • Build your server with the - mod_include - module. This is normally compiled in by default. -
          • -
          • Make sure your server configuration files have an - Options - directive which permits Includes. -
          • -
          • Make sure that the directory where you want the SSI documents to - live is covered by the "INCLUDES" output filter, - either explicitly or in some ancestral location. That can be done - with the following - SetOutputFilter - directive: -

            -

            - <FilesMatch "\.shtml[.$]">
            -   SetOutputFilter INCLUDES
            - </FilesMatch> -
            -

            -

            - This indicates that all files with the extension - ".shtml" in that location (or its descendants) should be - parsed. Note that using ".html" will cause all normal - HTML files to be parsed, which may put an inordinate load on your - server. -

            -
          • -
          -

          - For additional information, see the Apache Week article on - Using Server Side Includes. -

          -
          -
        14. - -
        15. - Why don't my parsed files get cached? - -

          - Since the server is performing run-time processing of your SSI - directives, which may change the content shipped to the client, it - can't know at the time it starts parsing what the final size of the - result will be, or whether the parsed result will always be the same. - This means that it can't generate Content-Length or - Last-Modified headers. Caches commonly work by comparing - the Last-Modified of what's in the cache with that being - delivered by the server. Since the server isn't sending that header - for a parsed document, whatever's doing the caching can't tell whether - the document has changed or not - and so fetches it again to be on the - safe side. -

          -

          - You can work around this in some cases by causing an - Expires header to be generated. (See the - mod_expires - documentation for more details.) Another possibility is to use the - XBitHack Full - mechanism, which tells Apache to send (under certain circumstances - detailed in the XBitHack directive description) a - Last-Modified header based upon the last modification - time of the file being parsed. Note that this may actually be lying - to the client if the parsed file doesn't change but the SSI-inserted - content does; if the included content changes often, this can result - in stale copies being cached. -

          -
          -
        16. - -
        17. - How can I have my script output parsed? - -

          - So you want to include SSI directives in the output from your CGI - script, but can't figure out how to do it? - The short answer is "you can't." This is potentially - a security liability and, more importantly, it can not be cleanly - implemented under the current server API. The best workaround - is for your script itself to do what the SSIs would be doing. - After all, it's generating the rest of the content. -

          -

          - This is a feature The Apache Group hopes to add in the next major - release after 1.3. -

          -
          -
        18. - -
        19. - SSIs don't work for VirtualHosts and/or - user home directories. - -

          - This is almost always due to having some setting in your config file that - sets "Options Includes" or some other setting for your DocumentRoot - but not for other directories. If you set it inside a Directory - section, then that setting will only apply to that directory. -

          -
          -
        20. - -
        21. - How can I use ErrorDocument - and SSI to simplify customized error messages? - -

          - Have a look at this document. - It shows in example form how you can a combination of XSSI and - negotiation to tailor a set of ErrorDocuments to your - personal taste, and returning different internationalized error - responses based on the client's native language. -

          -
          -
        22. - -
        23. - Why is the environment variable - REMOTE_USER not set? - -

          - This variable is set and thus available in SSI or CGI scripts if and - only if the requested document was protected by access - authentication. For an explanation on how to implement these restrictions, - see - Apache Week's - articles on - Using User Authentication - or - DBM User Authentication. -

          -

          - Hint: When using a CGI script to receive the data of a HTML FORM - notice that protecting the document containing the FORM is not - sufficient to provide REMOTE_USER to the CGI script. You have - to protect the CGI script, too. Or alternatively only the CGI script (then - authentication happens only after filling out the form). -

          -
          -
        24. -
        25. How do I allow each of my user directories - to have a cgi-bin directory? -

          - Remember that CGI execution does not need to be restricted only to - cgi-bin directories. You can allow - CGI script execution in arbitrary parts of your filesystem. -

          -

          - There are many ways to give each user directory a cgi-bin directory - such that anything requested as - http://example.com/~user/cgi-bin/program will be - executed as a CGI script. - Two alternatives are: -

            -
          1. Place the cgi-bin directory next to the public_html directory: - -
            -
            ScriptAliasMatch ^/~([^/]*)/cgi-bin/(.*) /home/$1/cgi-bin/$2 -
            -
            - -
          2. -
          3. Place the cgi-bin directory underneath the public_html directory: -
            -
            <Directory /home/*/public_html/cgi-bin>
            -     Options ExecCGI
            -     SetHandler cgi-script
            - </Directory>
            -
            -
            -
          4. -
          -
          -
        26. - -
        - - - - - - - - diff --git a/docs/manual/misc/FAQ-G.html b/docs/manual/misc/FAQ-G.html deleted file mode 100644 index 3900445f8e..0000000000 --- a/docs/manual/misc/FAQ-G.html +++ /dev/null @@ -1,406 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Apache Server Frequently Asked Questions - - - - -

        Apache Server Frequently Asked Questions

        -

        - $Revision: 1.5 $ ($Date: 2001/02/28 03:36:00 $) -

        -

        - The latest version of this FAQ is always available from the main - Apache web site, at - <http://www.apache.org/docs/misc/FAQ.html>. -

        - - - - - - - - - - - - - - - -

        - If you are reading a text-only version of this FAQ, you may find numbers - enclosed in brackets (such as "[12]"). These refer to the list of - reference URLs to be found at the end of the document. These references - do not appear, and are not needed, for the hypertext version. -

        -

        The Questions

        -
          - - -
        1. Authentication and Access Restrictions -
            -
          1. Why isn't restricting access by host or domain name - working correctly? -
          2. -
          3. How do I set up Apache to require - a username and password to access certain documents? -
          4. -
          5. How do I set up Apache to allow access - to certain documents only if a site is either a local site - or the user supplies a password and username? -
          6. -
          7. Why does my authentication give - me a server error? -
          8. -
          9. Do I have to keep the (mSQL) - authentication information on the same machine? -
          10. -
          11. Why is my mSQL authentication terribly slow? -
          12. -
          13. Can I use my /etc/passwd file - for Web page authentication? -
          14. -
          15. Why does Apache ask for my password - twice before serving a file? -
          16. -
          -
        2. - - -
        - -
        - -

        The Answers

        - - -

        G. Authentication and Access Restrictions

        -
          - -
        1. - Why isn't restricting access by host or domain name - working correctly? - -

          - Two of the most common causes of this are: -

          -
            -
          1. An error, inconsistency, or unexpected mapping in the DNS - registration -
            - This happens frequently: your configuration restricts access to - Host.FooBar.Com, but you can't get in from that host. - The usual reason for this is that Host.FooBar.Com is - actually an alias for another name, and when Apache performs the - address-to-name lookup it's getting the real name, not - Host.FooBar.Com. You can verify this by checking the - reverse lookup yourself. The easiest way to work around it is to - specify the correct host name in your configuration. -
          2. -
          3. Inadequate checking and verification in your - configuration of Apache -
            - If you intend to perform access checking and restriction based upon - the client's host or domain name, you really need to configure - Apache to double-check the origin information it's supplied. You do - this by adding the -DMAXIMUM_DNS clause to the - EXTRA_CFLAGS definition in your - Configuration file. For example: -

            -

            -
            EXTRA_CFLAGS=-DMAXIMUM_DNS -
            -
            -

            -

            - This will cause Apache to be very paranoid about making sure a - particular host address is really assigned to the name it - claims to be. Note that this can incur a significant - performance penalty, however, because of all the name resolution - requests being sent to a nameserver. -

            -
          4. -
          -
          -
        2. - -
        3. - How do I set up Apache to require a username and - password to access certain documents? - -

          - There are several ways to do this; some of the more popular - ones are to use the mod_auth, - mod_auth_db, or - mod_auth_dbm modules. -

          -

          - For an explanation on how to implement these restrictions, see - Apache Week's - articles on - Using User Authentication - or - DBM User Authentication. -

          -
          -
        4. - -
        5. - How do I set up Apache to allow access to certain - documents only if a site is either a local site or - the user supplies a password and username? - -

          - Use the Satisfy directive, - in particular the Satisfy Any directive, to require - that only one of the access restrictions be met. For example, - adding the following configuration to a .htaccess - or server configuration file would restrict access to people who - either are accessing the site from a host under domain.com or - who can supply a valid username and password: -

          -

          -

          -
          Deny from all -
          - Allow from .domain.com -
          - AuthType Basic -
          - AuthUserFile /usr/local/apache/conf/htpasswd.users -
          - AuthName "special directory" -
          - Require valid-user -
          - Satisfy any
          -
          -
          -

          -

          - See the user authentication - question and the mod_access - module for details on how the above directives work. -

          -
          -
        6. - -
        7. - Why does my authentication give me a server error? - -

          - Under normal circumstances, the Apache access control modules will - pass unrecognized user IDs on to the next access control module in - line. Only if the user ID is recognized and the password is validated - (or not) will it give the usual success or "authentication - failed" messages. -

          -

          - However, if the last access module in line 'declines' the validation - request (because it has never heard of the user ID or because it is not - configured), the http_request handler will give one of - the following, confusing, errors: -

          -
            -
          • check access -
          • -
          • check user. No user file? -
          • -
          • check access. No groups file? -
          • -
          -

          - This does not mean that you have to add an - 'AuthUserFile /dev/null' line as some magazines suggest! -

          -

          - The solution is to ensure that at least the last module is authoritative - and CONFIGURED. By default, mod_auth is - authoritative and will give an OK/Denied, but only if it is configured - with the proper AuthUserFile. Likewise, if a valid group - is required. (Remember that the modules are processed in the reverse - order from that in which they appear in your compile-time - Configuration file.) -

          -

          - A typical situation for this error is when you are using the - mod_auth_dbm, mod_auth_msql, - mod_auth_mysql, mod_auth_anon or - mod_auth_cookie modules on their own. These are by - default not authoritative, and this will pass the - buck on to the (non-existent) next authentication module when the - user ID is not in their respective database. Just add the appropriate - 'XXXAuthoritative yes' line to the configuration. -

          -

          - In general it is a good idea (though not terribly efficient) to have the - file-based mod_auth a module of last resort. This allows - you to access the web server with a few special passwords even if the - databases are down or corrupted. This does cost a - file open/seek/close for each request in a protected area. -

          -
          -
        8. - -
        9. - Do I have to keep the (mSQL) authentication information - on the same machine? - -

          - Some organizations feel very strongly about keeping the authentication - information on a different machine than the webserver. With the - mod_auth_msql, mod_auth_mysql, and other SQL - modules connecting to (R)DBMses this is quite possible. Just configure - an explicit host to contact. -

          -

          - Be aware that with mSQL and Oracle, opening and closing these database - connections is very expensive and time consuming. You might want to - look at the code in the auth_* modules and play with the - compile time flags to alleviate this somewhat, if your RDBMS licences - allow for it. -

          -
          -
        10. - -
        11. - Why is my mSQL authentication terribly slow? - -

          - You have probably configured the Host by specifying a FQHN, - and thus the libmsql will use a full blown TCP/IP socket - to talk to the database, rather than a fast internal device. The - libmsql, the mSQL FAQ, and the mod_auth_msql - documentation warn you about this. If you have to use different - hosts, check out the mod_auth_msql code for - some compile time flags which might - or might not - suit you. -

          -
          -
        12. - -
        13. - Can I use my /etc/passwd file - for Web page authentication? - -

          - Yes, you can - but it's a very bad idea. Here are - some of the reasons: -

          -
            -
          • The Web technology provides no governors on how often or how - rapidly password (authentication failure) retries can be made. That - means that someone can hammer away at your system's - root password using the Web, using a dictionary or - similar mass attack, just as fast as the wire and your server can - handle the requests. Most operating systems these days include - attack detection (such as n failed passwords for the same - account within m seconds) and evasion (breaking the - connection, disabling the account under attack, disabling - all logins from that source, et cetera), but the - Web does not. -
          • -
          • An account under attack isn't notified (unless the server is - heavily modified); there's no "You have 19483 login - failures" message when the legitimate owner logs in. -
          • -
          • Without an exhaustive and error-prone examination of the server - logs, you can't tell whether an account has been compromised. - Detecting that an attack has occurred, or is in progress, is fairly - obvious, though - if you look at the logs. -
          • -
          • Web authentication passwords (at least for Basic authentication) - generally fly across the wire, and through intermediate proxy - systems, in what amounts to plain text. "O'er the net we - go/Caching all the way;/O what fun it is to surf/Giving my password - away!" -
          • -
          • Since HTTP is stateless, information about the authentication is - transmitted each and every time a request is made to the - server. Essentially, the client caches it after the first - successful access, and transmits it without asking for all - subsequent requests to the same server. -
          • -
          • It's relatively trivial for someone on your system to put up a - page that will steal the cached password from a client's cache - without them knowing. Can you say "password grabber"? -
          • -
          -

          - If you still want to do this in light of the above disadvantages, the - method is left as an exercise for the reader. It'll void your Apache - warranty, though, and you'll lose all accumulated UNIX guru points. -

          -
          -
        14. -
        15. Why does Apache ask for my password - twice before serving a file? -

          - If the hostname under which you are accessing the server is - different than the hostname specified in the - ServerName - directive, then depending on the setting of the - UseCanonicalName - directive, Apache will redirect you to a new hostname when - constructing self-referential URLs. This happens, for example, in - the case where you request a directory without including the - trailing slash. -

          -

          - When this happens, Apache will ask for authentication once under the - original hostname, perform the redirect, and then ask again under the - new hostname. For security reasons, the browser must prompt again - for the password when the host name changes. -

          -

          - To eliminate this problem you should -

          - -
            -
          1. Always use the trailing slash when requesting directories; -
          2. Change the ServerName to match the name you are - using in the URL; and/or -
          3. Set UseCanonicalName off. -
          -
          -
        16. - -
        - - - - - - - - diff --git a/docs/manual/misc/FAQ-H.html b/docs/manual/misc/FAQ-H.html deleted file mode 100644 index 778884c74d..0000000000 --- a/docs/manual/misc/FAQ-H.html +++ /dev/null @@ -1,267 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Apache Server Frequently Asked Questions - - - - -

        Apache Server Frequently Asked Questions

        -

        - $Revision: 1.2 $ ($Date: 2000/09/09 18:19:54 $) -

        -

        - The latest version of this FAQ is always available from the main - Apache web site, at - <http://www.apache.org/docs/misc/FAQ.html>. -

        - - - - - - - - - - - - - - - -

        - If you are reading a text-only version of this FAQ, you may find numbers - enclosed in brackets (such as "[12]"). These refer to the list of - reference URLs to be found at the end of the document. These references - do not appear, and are not needed, for the hypertext version. -

        -

        The Questions

        -
          - - -
        1. URL Rewriting -
            -
          1. Where can I find mod_rewrite rulesets - which already solve particular URL-related problems? -
          2. -
          3. Where can I find any published information - about URL-manipulations and mod_rewrite? -
          4. -
          5. Why is mod_rewrite so difficult to learn - and seems so complicated? -
          6. -
          7. What can I do if my RewriteRules don't work - as expected? -
          8. -
          9. Why don't some of my URLs get - prefixed with DocumentRoot when using mod_rewrite? -
          10. -
          11. How can I make all my URLs case-insensitive - with mod_rewrite? -
          12. -
          13. Why are RewriteRules in my VirtualHost - parts ignored? -
          14. -
          15. How can I use strings with whitespaces - in RewriteRule's ENV flag? -
          16. -
          -
        2. - - -
        - -
        - -

        The Answers

        - - - -

        H. URL Rewriting

        -
          - -
        1. - Where can I find mod_rewrite rulesets which already solve - particular URL-related problems? - -

          - There is a collection of - Practical Solutions for URL-Manipulation - where you can - find all typical solutions the author of - mod_rewrite - currently knows of. If you have more - interesting rulesets which solve particular problems not currently covered in - this document, send it to - Ralf S. Engelschall - for inclusion. The - other webmasters will thank you for avoiding the reinvention of the wheel. -

          -
          -
        2. - -
        3. - Where can I find any published information about - URL-manipulations and mod_rewrite? - -

          - There is an article from - Ralf S. Engelschall - about URL-manipulations based on - mod_rewrite - in the "iX Multiuser Multitasking Magazin" issue #12/96. The - german (original) version - can be read online at - <http://www.heise.de/ix/artikel/9612149/>, - the English (translated) version can be found at - <http://www.heise.de/ix/artikel/E/9612149/>. -

          -
          -
        4. - -
        5. - Why is mod_rewrite so difficult to learn and seems so - complicated? - -

          - Hmmm... there are a lot of reasons. First, mod_rewrite itself is a powerful - module which can help you in really all aspects of URL - rewriting, so it can be no trivial module per definition. To accomplish - its hard job it uses software leverage and makes use of a powerful regular - expression - library by Henry Spencer which is an integral part of Apache since its - version 1.2. And regular expressions itself can be difficult to newbies, - while providing the most flexible power to the advanced hacker. -

          -

          - On the other hand mod_rewrite has to work inside the Apache API environment - and needs to do some tricks to fit there. For instance the Apache API as of - 1.x really was not designed for URL rewriting at the .htaccess - level of processing. Or the problem of multiple rewrites in sequence, which - is also not handled by the API per design. To provide this features - mod_rewrite has to do some special (but API compliant!) handling which leads - to difficult processing inside the Apache kernel. While the user usually - doesn't see anything of this processing, it can be difficult to find - problems when some of your RewriteRules seem not to work. -

          -
          -
        6. - -
        7. - What can I do if my RewriteRules don't work as expected? - - -

          - Use "RewriteLog somefile" and - "RewriteLogLevel 9" and have a precise look at the - steps the rewriting engine performs. This is really the only one and best - way to debug your rewriting configuration. -

          -
          -
        8. - -
        9. Why don't some of my URLs - get prefixed with DocumentRoot when using mod_rewrite? - -

          - If the rule starts with /somedir/... make sure that - really no /somedir exists on the filesystem if you - don't want to lead the URL to match this directory, i.e., - there must be no root directory named somedir on the - filesystem. Because if there is such a directory, the URL will not - get prefixed with DocumentRoot. This behaviour looks ugly, but is - really important for some other aspects of URL rewriting. -

          -
          -
        10. - -
        11. - How can I make all my URLs case-insensitive with mod_rewrite? - - -

          - You can't! The reasons are: first, that, case translations for - arbitrary length URLs cannot be done via regex patterns and - corresponding substitutions. One needs a per-character pattern like - the sed/Perl tr|..|..| feature. Second, just making - URLs always upper or lower case does not solve the whole problem of - case-INSENSITIVE URLs, because URLs actually have to be rewritten to - the correct case-variant for the file residing on the filesystem - in order to allow Apache to access the file. And - the Unix filesystem is always case-SENSITIVE. -

          -

          - But there is a module named mod_speling.c in the - Apache distribution. Try this module to help correct people who use - mis-cased URLs. -

          -
          -
        12. - -
        13. - Why are RewriteRules in my VirtualHost parts ignored? - -

          - Because you have to enable the engine for every virtual host explicitly due - to security concerns. Just add a "RewriteEngine on" to your - virtual host configuration parts. -

          -
          -
        14. - -
        15. - How can I use strings with whitespaces in RewriteRule's ENV - flag? - -

          - There is only one ugly solution: You have to surround the complete - flag argument by quotation marks ("[E=...]"). Notice: - The argument to quote here is not the argument to the E-flag, it is - the argument of the Apache config file parser, i.e., the - third argument of the RewriteRule here. So you have to write - "[E=any text with whitespaces]". -

          -
          -
        16. - -
        - - - - - - - - diff --git a/docs/manual/misc/FAQ-I.html b/docs/manual/misc/FAQ-I.html deleted file mode 100644 index 1c1ea79ad1..0000000000 --- a/docs/manual/misc/FAQ-I.html +++ /dev/null @@ -1,271 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Apache Server Frequently Asked Questions - - - - -

        Apache Server Frequently Asked Questions

        -

        - $Revision: 1.9 $ ($Date: 2001/02/28 03:36:00 $) -

        -

        - The latest version of this FAQ is always available from the main - Apache web site, at - <http://www.apache.org/docs/misc/FAQ.html>. -

        - - - - - - - - - - - - - - - -

        - If you are reading a text-only version of this FAQ, you may find numbers - enclosed in brackets (such as "[12]"). These refer to the list of - reference URLs to be found at the end of the document. These references - do not appear, and are not needed, for the hypertext version. -

        -

        The Questions

        -
          - - -
        1. Features -
            -
          1. Does or will Apache act as a Proxy server? -
          2. -
          3. What are "multiviews"? -
          4. -
          5. Why can't I publish to my Apache server - using PUT on Netscape Gold and other programs? -
          6. -
          7. Why doesn't Apache include SSL? -
          8. -
          9. How can I attach a footer to my documents - without using SSI? -
          10. -
          11. Does Apache include a search engine? -
          12. -
          13. How can I rotate my log files? -
          14. -
          15. How do I keep certain requests from - appearing in my logs? -
          16. -
          -
        2. - - -
        - -
        - -

        The Answers

        - - - -

        I. Features

        -
          - -
        1. - Does or will Apache act as a Proxy server? - -

          - Apache version 1.1 and above comes with a - proxy module. - If compiled in, this will make Apache act as a caching-proxy server. -

          -
          -
        2. - -
        3. - What are "multiviews"? - -

          - "Multiviews" is the general name given to the Apache - server's ability to provide language-specific document variants in - response to a request. This is documented quite thoroughly in the - content negotiation - description page. In addition, Apache Week carried an - article on this subject entitled - "Content Negotiation Explained". -

          -
          -
        4. - -
        5. - Why can't I publish to my Apache server using PUT on - Netscape Gold and other programs? - -

          - Because you need to install and configure a script to handle - the uploaded files. This script is often called a "PUT" handler. - There are several available, but they may have security problems. - Using FTP uploads may be easier and more secure, at least for now. - For more information, see the Apache Week article - Publishing Pages with PUT. -

          -
          -
        6. - -
        7. - Why doesn't Apache include SSL? - -

          - SSL (Secure Socket Layer) data transport requires encryption, and many - governments have restrictions upon the import, export, and use of - encryption technology. If Apache included SSL in the base package, - its distribution would involve all sorts of legal and bureaucratic - issues, and it would no longer be freely available. Also, some of - the technology required to talk to current clients using SSL is - patented by RSA Data Security, - who restricts its use without a license. -

          -

          - Some SSL implementations of Apache are available, however; see the - "related projects" - page at the main Apache web site. -

          -

          - You can find out more about this topic in the Apache Week - article about - Apache and Secure Transactions. -

          -
          -
        8. -
        9. - How can I attach a footer to my documents - without using SSI? - -

          - You can make arbitrary changes to static documents by configuring an - - Action which launches a CGI script. The CGI is then - responsible for setting a content-type and delivering the requested - document (the location of which is passed in the - PATH_TRANSLATED environment variable), along with - whatever footer is needed. -

          -

          - Busy sites may not want to run a CGI script on every request, and - should consider using an Apache module to add the footer. There are - several third party modules available through the Apache Module Registry which - will add footers to documents. These include mod_trailer, PHP - (php3_auto_append_file), mod_layout, and mod_perl - (Apache::Sandwich). -

          -
          -
        10. -
        11. - Does Apache include a search engine? - -

          Apache does not include a search engine, but there are many good - commercial and free search engines which can be used easily with - Apache. Some of them are listed on the Web Site Search - Tools page. Open source search engines that are often used with - Apache include ht://Dig and SWISH-E. -

          -
          -
        12. -
        13. - How can I rotate my log files? - -

          The simple answer: by piping the transfer log into an appropriate - log file rotation utility.

          - -

          The longer answer: In the - src/support/ directory, you will find a utility called rotatelogs which can be used - like this:

          - -
          TransferLog "|/path/to/rotatelogs
          -  /path/to/logs/access_log 86400"
          - -

          to enable daily rotation of - the log files.
          - A more sophisticated solution of a logfile - rotation utility is available under the name cronolog - from Andrew Ford's site at http://www.ford-mason.co.uk/resources/cronolog/. It can - automatically create logfile subdirectories based on time and date, - and can have a constant symlink point to the rotating logfiles. (As - of version 1.6.1, cronolog is available under the Apache License). Use it like this:

          - -
          CustomLog "|/path/to/cronolog
          -  --symlink=/usr/local/apache/logs/access_log
          -  /usr/local/apache/logs/%Y/%m/access_log" combined 
          - -
          -
        14. -
        15. - How do I keep certain requests from appearing - in my logs? -

          - The maximum flexibility for removing unwanted information from - log files is obtained by post-processing the logs, or using - piped-logs to feed the logs through a program which does whatever - you want. However, Apache does offer the ability to prevent - requests from ever appearing in the log files. You can do this by - using the - SetEnvIf - directive to set an environment variable for certain requests and - then using the conditional - CustomLog - syntax to prevent logging when the environment variable is set. -

          -
          -
        16. - -
        - - - - - - - - diff --git a/docs/manual/misc/FAQ.html b/docs/manual/misc/FAQ.html deleted file mode 100644 index adde949ddc..0000000000 --- a/docs/manual/misc/FAQ.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - Apache Server Frequently Asked Questions - - - - - -

        Apache Server Frequently Asked Questions

        -

        - $Revision: 1.147 $ ($Date: 2001/02/28 03:36:00 $) -

        -

        - The latest version of this FAQ is always available from the main - Apache web site, at - <http://www.apache.org/docs/misc/FAQ.html>. -

        - - - - - - - - - - - - - - - -

        - If you are reading a text-only version of this FAQ, you may find numbers - enclosed in brackets (such as "[12]"). These refer to the list of - reference URLs to be found at the end of the document. These references - do not appear, and are not needed, for the hypertext version. -

        -

        The Questions

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          - - - - - - - - - -
        - -
        - -

        The Answers

        - - - - - - - - - - - - - diff --git a/docs/manual/misc/client_block_api.html b/docs/manual/misc/client_block_api.html deleted file mode 100644 index f2b55132a6..0000000000 --- a/docs/manual/misc/client_block_api.html +++ /dev/null @@ -1,95 +0,0 @@ - - - -Reading Client Input in Apache 1.2 - - - - - - -
        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. -
        - -

        Reading Client Input in Apache 1.2

        - -
        - -

        Apache 1.1 and earlier let modules handle POST and PUT requests by -themselves. The module would, on its own, determine whether the -request had an entity, how many bytes it was, and then called a -function (read_client_block) to get the data. - -

        However, HTTP/1.1 requires several things of POST and PUT request -handlers that did not fit into this module, and all existing modules -have to be rewritten. The API calls for handling this have been -further abstracted, so that future HTTP protocol changes can be -accomplished while remaining backwards-compatible.

        - -
        - -

        The New API Functions

        - -
        -   int ap_setup_client_block (request_rec *, int read_policy);
        -   int ap_should_client_block (request_rec *);
        -   long ap_get_client_block (request_rec *, char *buffer, int buffer_size);
        -
        - -
          -
        1. Call ap_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 possibly accept input, call - ap_should_client_block(). - This will tell the module whether or not to read input. If it is 0, - the module should assume that the input is of a non-entity type - (e.g., a GET request). A nonzero response indicates that the module - should proceed (to step 3). - 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 ap_get_client_block in a loop. Pass it a - buffer and its - size. It will put data into the buffer (not necessarily the full - buffer, in the case of chunked inputs), 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. - -
        - -

        As an example, please look at the code in -mod_cgi.c. This is properly written to the new API -guidelines.

        - - - - diff --git a/docs/manual/misc/compat_notes.html b/docs/manual/misc/compat_notes.html deleted file mode 100644 index 438d90ecec..0000000000 --- a/docs/manual/misc/compat_notes.html +++ /dev/null @@ -1,135 +0,0 @@ - - - -Apache HTTP Server: Notes about Compatibility with NCSA's Server - - - - - -
        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. -
        - - -

        Compatibility Notes with NCSA's Server

        - -
        - -While Apache is for the most part a drop-in replacement for NCSA's -httpd, there are a couple gotcha's to watch out for. These are mostly -due to the fact that the parser for config and access control files -was rewritten from scratch, so certain liberties the earlier servers -took may not be available here. These are all easily fixable. If you -know of other problems that belong here, let us know. - -

        Please also check the known -client problems page. - -

          -
        1. As of Apache 1.3.1, methods named in a - <Limit> - section must be listed in upper-case. Lower- or mixed-case - method names will result in a configuration error. -

          -

          -
        2. - -
        3. The basic mod_auth AuthGroupFile-specified group file - format allows commas between user names - Apache does not. - -

          -

        4. If you follow the NCSA guidelines for setting up access - restrictions based on client domain, you may well have added - entries for AuthType, AuthName, AuthUserFile or - AuthGroupFile. None of these are - needed (or appropriate) for restricting access based on client - domain. When Apache sees AuthType it (reasonably) - assumes you are using some authorization type based on username - and password. Please remove AuthType, it's - unnecessary even for NCSA. - -

          -

        5. OldScriptAlias is no longer supported. - -

          -

        6. exec cgi="" produces reasonable malformed - header responses when used to invoke non-CGI scripts.
          - The NCSA code ignores the missing header (bad idea). -
          Solution: write CGI to the CGI spec and use - include virtual, or use exec cmd="" instead. - -

          -

        7. Icons for FancyIndexing broken - well, no, they're not broken, - we've just upgraded the icons from flat .xbm files to pretty and - much smaller .gif files, courtesy of Kevin Hughes at EIT. If you are using the same - srm.conf from an old distribution, make sure you add the new AddIcon, AddIconByType, - and DefaultIcon - directives. - -

          -

        8. Apache versions before 1.2b1 will ignore the last line of configuration - files if the last line does not have a trailing newline. This affects - configuration files (httpd.conf, access.conf and srm.conf), and - htpasswd and htgroup files. - -

          -

        9. Apache does not permit commas delimiting the methods in <Limit>. - -

          -

        10. Apache's <VirtualHost> treats all addresses as - "optional" (i.e., the server should continue booting if it can't - resolve the address). Whereas in NCSA the default is to fail - booting unless an added optional keyword is included. - -

          -

        11. Apache does not implement OnDeny; use - ErrorDocument - instead. - -

          -

        12. Apache (as of 1.3) always performs the equivalent of - HostnameLookups minimal. minimal is not an - option to - HostnameLookups. - -

          -

        13. To embed spaces in directive arguments NCSA used a backslash - before the space. Apache treats backslashes as normal characters. To - embed spaces surround the argument with double-quotes instead. - -

          -

        14. Apache does not implement the NCSA referer - directive. See - PR#968 for a few brief suggestions on alternative ways to - implement the same thing under Apache. - -

          -

        15. Apache does not allow ServerRoot settings inside a VirtualHost - container. There is only one global ServerRoot in Apache; any desired - changes in paths for virtual hosts need to be made with the explicit - directives, e.g., DocumentRoot, TransferLog, etc. - -
        - -More to come when we notice them.... - - - - diff --git a/docs/manual/misc/custom_errordocs.html b/docs/manual/misc/custom_errordocs.html deleted file mode 100644 index c2c2310a13..0000000000 --- a/docs/manual/misc/custom_errordocs.html +++ /dev/null @@ -1,433 +0,0 @@ - - - -International Customized Server Error Messages - - - - - - -

        Using XSSI and ErrorDocument to configure -customized international server error responses

        -

        -

        Index

        - -
        -

        Introduction

        -This document describes an easy way to provide your apache WWW server -with a set of customized error messages which take advantage of -Content Negotiation -and eXtended Server Side Includes (XSSI) -to return error messages generated by the server in the client's -native language. -

        -

        -By using XSSI, all -customized messages -can share a homogenous and consistent style and layout, and maintenance work -(changing images, changing links) is kept to a minimum because all layout -information can be kept in a single file.
        -Error documents can be shared across different servers, or even hosts, -because all varying information is inserted at the time the error document -is returned on behalf of a failed request. -

        -

        -Content Negotiation then selects the appropriate language version of a -particular error message text, honoring the language preferences passed -in the client's request. (Users usually select their favorite languages -in the preferences options menu of today's browsers). When an error -document in the client's primary language version is unavailable, the -secondary languages are tried or a default (fallback) version is used. -

        -

        -You have full flexibility in designing your error documents to -your personal taste (or your company's conventions). For demonstration -purposes, we present a simple generic error document scheme. -For this hypothetic server, we assume that all error messages... -

          -
        • possibly are served by different virtual hosts (different host name, - different IP address, or different port) on the server machine, -
        • show a predefined company logo in the right top of the message - (selectable by virtual host), -
        • print the error title first, followed by an explanatory text and - (depending on the error context) help on how to resolve the error, -
        • have some kind of standardized background image, -
        • display an apache logo and a feedback email address at the bottom - of the error message. -
        -

        - -

        -An example of a "document not found" message for a german client might -look like this:
        -[Needs graphics capability to display]
        -All links in the document as well as links to the server's administrator -mail address, and even the name and port of the serving virtual host -are inserted in the error document at "run-time", i.e., when the error -actually occurs. -

        - -

        Creating an ErrorDocument directory

        - -For this concept to work as easily as possible, we must take advantage -of as much server support as we can get: -
          -
        1. By defining the MultiViews option, - we enable the language selection of the most appropriate language - alternative (content negotiation). -
        2. By setting the - LanguagePriority - directive we define a set of default fallback languages in the situation - where the client's browser did not express any preference at all. -
        3. By enabling Server Side Includes - (and disallowing execution of cgi scripts for security reasons), - we allow the server to include building blocks of the error message, - and to substitute the value of certain environment variables into the - generated document (dynamic HTML) or even to conditionally include - or omit parts of the text. -
        4. The AddHandler and - AddType directives are useful - for automatically XSSI-expanding all files with a .shtml - suffix to text/html. -
        5. By using the Alias directive, - we keep the error document directory outside of the document tree - because it can be regarded more as a server part than part of - the document tree. -
        6. The <Directory>-Block - restricts these "special" settings to the error document directory - and avoids an impact on any of the settings for the regular document tree. -
        7. For each of the error codes to be handled (see RFC2068 for an exact - description of each error code, or look at - src/main/http_protocol.c - if you wish to see apache's standard messages), an - ErrorDocument - in the aliased /errordocs directory is defined. - Note that we only define the basename of the document here - because the MultiViews option will select the best candidate - based on the language suffixes and the client's preferences. - Any error situation with an error code not handled by a - custom document will be dealt with by the server in the standard way - (i.e., a plain error message in english). -
        8. Finally, the AllowOverride - directive tells apache that it is not necessary to look for - a .htaccess file in the /errordocs directory: a minor speed - optimization. -
        -The resulting httpd.conf configuration would then look -similar to this: (Note that you can define your own error -messages using this method for only part of the document tree, -e.g., a /~user/ subtree. In this case, the configuration could as well -be put into the .htaccess file at the root of the subtree, and -the <Directory> and </Directory> directives -but not -the contained directives- must be omitted.) -
        -  LanguagePriority en fr de 
        -  Alias  /errordocs  /usr/local/apache/errordocs
        -  <Directory /usr/local/apache/errordocs>
        -   AllowOverride none
        -   Options MultiViews IncludesNoExec FollowSymLinks
        -   AddType text/html .shtml
        -   <FilesMatch "\.shtml[.$]">
        -    SetOutputFilter INCLUDES
        -   </FilesMatch>
        -  </Directory>
        -  #    "400 Bad Request",
        -  ErrorDocument  400  /errordocs/400
        -  #    "401 Authorization Required",
        -  ErrorDocument  401  /errordocs/401
        -  #    "403 Forbidden",
        -  ErrorDocument  403  /errordocs/403
        -  #    "404 Not Found",
        -  ErrorDocument  404  /errordocs/404
        -  #    "500 Internal Server Error",
        -  ErrorDocument  500  /errordocs/500
        -
        -The directory for the error messages (here: -/usr/local/apache/errordocs/) must then be created with the -appropriate permissions (readable and executable by the server uid or gid, -only writable for the administrator). - -

        Naming the individual error document files

        - -By defining the MultiViews option, the server was told to -automatically scan the directory for matching variants (looking at language -and content type suffixes) when a requested document was not found. -In the configuration, we defined the names for the error documents to be -just their error number (without any suffix). -

        -The names of the individual error documents are now determined like this -(I'm using 403 as an example, think of it as a placeholder for any of -the configured error documents): -

          -
        • No file errordocs/403 should exist. Otherwise, it would be found and - served (with the DefaultType, usually text/plain), all negotiation - would be bypassed. -
        • For each language for which we have an internationalized version - (note that this need not be the same set of languages for each - error code - you can get by with a single language version until - you actually have translated versions), a document - errordocs/403.shtml.lang is created and - filled with the error text in that language (see - below). -
        • One fallback document called errordocs/403.shtml is - created, usually by creating a symlink to the default language - variant (see below). -
        - -

        The common header and footer files

        - -By putting as much layout information in two special "include files", -the error documents can be reduced to a bare minimum. -

        -One of these layout files defines the HTML document header -and a configurable list of paths to the icons to be shown in the resulting -error document. These paths are exported as a set of XSSI environment -variables and are later evaluated by the "footer" special file. -The title of the current error (which is -put into the TITLE tag and an H1 header) is simply passed in from the main -error document in a variable called title.
        -By changing this file, the layout of all generated error -messages can be changed in a second. -(By exploiting the features of XSSI, you can easily define different -layouts based on the current virtual host, or even based on the -client's domain name). -

        -The second layout file describes the footer to be displayed at the bottom -of every error message. In this example, it shows an apache logo, the current -server time, the server version string and adds a mail reference to the -site's webmaster. -

        -For simplicity, the header file is simply called head.shtml -because it contains server-parsed content but no language specific -information. The footer file exists once for each language translation, -plus a symlink for the default language.

        -Example: for English, French and German versions -(default english)
        -foot.shtml.en,
        -foot.shtml.fr,
        -foot.shtml.de,
        -foot.shtml symlink to foot.shtml.en

        -Both files are included into the error document by using the -directives <!--#include virtual="head" --> -and <!--#include virtual="foot" --> -respectively: the rest of the magic occurs in mod_negotiation and -in mod_include. -

        - -See the listings below to see an actual HTML -implementation of the discussed example. - - -

        Creating ErrorDocuments in different languages -

        - -After all this preparation work, little remains to be said about the -actual documents. They all share a simple common structure: -
        -<!--#set var="title" value="error description title" -->
        -<!--#include virtual="head" -->
        -   explanatory error text
        -<!--#include virtual="foot" -->
        -
        -In the listings section, you can see an example -of a [400 Bad Request] error document. Documents as simple as that -certainly cause no problems to translate or expand. - -

        The fallback language

        - -Do we need a special handling for languages other than those we have -translations for? We did set the LanguagePriority, didn't we?! -

        -Well, the LanguagePriority directive is for the case where the client does -not express any language priority at all. But what -happens in the situation where the client wants one -of the languages we do not have, and none of those we do have? -

        -Without doing anything, the Apache server will usually return a -[406 no acceptable variant] error, listing the choices from which the client -may select. But we're in an error message already, and important error -information might get lost when the client had to choose a language -representation first. -

        -So, in this situation it appears to be easier to define a fallback language -(by copying or linking, e.g., the english version to a language-less version). -Because the negotiation algorithm prefers "more specialized" variants over -"more generic" variants, these generic alternatives will only be chosen -when the normal negotiation did not succeed. -

        -A simple shell script to do it (execute within the errordocs/ dir): -

        -  for f in *.shtml.en
        -  do
        -     ln -s $f `basename $f .en`
        -  done
        -
        - -

        -

        - -

        Customizing Proxy Error Messages

        - -

        - As of Apache-1.3, it is possible to use the ErrorDocument - mechanism for proxy error messages as well (previous versions always - returned fixed predefined error messages). -

        -

        - Most proxy errors return an error code of [500 Internal Server Error]. - To find out whether a particular error document was invoked on behalf - of a proxy error or because of some other server error, and what the reason - for the failure was, you can check the contents of the new - ERROR_NOTES CGI environment variable: - if invoked for a proxy error, this variable will contain the actual proxy - error message text in HTML form. -

        -

        - The following excerpt demonstrates how to exploit the ERROR_NOTES - variable within an error document: -

        -
        - <!--#if expr="$REDIRECT_ERROR_NOTES = ''" -->
        -  <p>
        -   The server encountered an unexpected condition
        -   which prevented it from fulfilling the request. 
        -  </p>
        -  <p>
        -   <A HREF="mailto:<!--#echo var="SERVER_ADMIN" -->"
        -    SUBJECT="Error message [<!--#echo var="REDIRECT_STATUS" -->] <!--#echo var="title" --> for <!--#echo var="REQUEST_URI" -->">
        -   Please forward this error screen to <!--#echo var="SERVER_NAME" -->'s
        -   WebMaster</A>; it includes useful debugging information about
        -   the Request which caused the error.
        -   <pre><!--#printenv --></pre>
        -  </p>
        - <!--#else -->
        -  <!--#echo var="REDIRECT_ERROR_NOTES" -->
        - <!--#endif -->
        -
        - -

        HTML listing of the discussed example

        - -So, to summarize our example, here's the complete listing of the -400.shtml.en document. You will notice that it contains -almost nothing but the error text (with conditional additions). -Starting with this example, you will find it easy to add more error -documents, or to translate the error documents to different languages. -
        -<!--#set var="title" value="Bad Request"
        ---><!--#include virtual="head" --><P>
        -   Your browser sent a request that this server could not understand:
        -   <BLOCKQUOTE>
        -     <STRONG><!--#echo var="REQUEST_URI" --></STRONG>
        -   </BLOCKQUOTE>
        -   The request could not be understood by the server due to malformed
        -   syntax. The client should not repeat the request without
        -   modifications.
        -   </P>
        -   <P>
        -   <!--#if expr="$HTTP_REFERER != ''" -->
        -    Please inform the owner of
        -    <A HREF="<!--#echo var="HTTP_REFERER" -->">the referring page</A> about 
        -    the malformed link.
        -   <!--#else -->
        -    Please check your request for typing errors and retry.
        -   <!--#endif -->
        -   </P>
        -<!--#include virtual="foot" -->
        -

        - -Here is the complete head.shtml file (the funny line -breaks avoid empty lines in the document after XSSI processing). Note the -configuration section at top. That's where you configure the images and logos -as well as the apache documentation directory. Look how this file displays -two different logos depending on the content of the virtual host name -($SERVER_NAME), and that an animated apache logo is shown if the browser -appears to support it (the latter requires server configuration lines -of the form
        BrowserMatch "^Mozilla/[2-4]" anigif
        -for browser types which support animated GIFs). -
        -<!--#if expr="$SERVER_NAME = /.*\.mycompany\.com/" 
        ---><!--#set var="IMG_CorpLogo"
        -            value="http://$SERVER_NAME:$SERVER_PORT/errordocs/CorpLogo.gif" 
        ---><!--#set var="ALT_CorpLogo" value="Powered by Linux!" 
        ---><!--#else
        ---><!--#set var="IMG_CorpLogo"
        -            value="http://$SERVER_NAME:$SERVER_PORT/errordocs/PrivLogo.gif" 
        ---><!--#set var="ALT_CorpLogo" value="Powered by Linux!" 
        ---><!--#endif
        ---><!--#set var="IMG_BgImage" value="http://$SERVER_NAME:$SERVER_PORT/errordocs/BgImage.gif" 
        ---><!--#set var="DOC_Apache" value="http://$SERVER_NAME:$SERVER_PORT/Apache/" 
        ---><!--#if expr="$anigif" 
        ---><!--#set var="IMG_Apache" value="http://$SERVER_NAME:$SERVER_PORT/icons/apache_anim.gif" 
        ---><!--#else
        ---><!--#set var="IMG_Apache" value="http://$SERVER_NAME:$SERVER_PORT/icons/apache_pb.gif" 
        ---><!--#endif
        ---><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
        -<HTML>
        - <HEAD>
        -  <TITLE>
        -   [<!--#echo var="REDIRECT_STATUS" -->] <!--#echo var="title" -->
        -  </TITLE>
        - </HEAD>
        - <BODY BGCOLOR="white" BACKGROUND="<!--#echo var="IMG_BgImage" -->"><UL>
        -  <H1 ALIGN="center">
        -   [<!--#echo var="REDIRECT_STATUS" -->] <!--#echo var="title" -->
        -   <IMG SRC="<!--#echo var="IMG_CorpLogo" -->"
        -        ALT="<!--#echo var="ALT_CorpLogo" -->" ALIGN=right>
        -  </H1>
        -  <HR><!-- ======================================================== -->
        -  <DIV>
        -

        - and this is the foot.shtml.en file: -
        -
        -  </DIV>
        -  <HR>
        -  <DIV ALIGN="right"><SMALL><SUP>Local Server time:
        -      <!--#echo var="DATE_LOCAL" -->
        -  </SUP></SMALL></DIV>
        -  <DIV ALIGN="center">
        -    <A HREF="<!--#echo var="DOC_Apache" -->">
        -    <IMG SRC="<!--#echo var="IMG_Apache" -->" BORDER=0 ALIGN="bottom"
        -         ALT="Powered by <!--#echo var="SERVER_SOFTWARE" -->"></A><BR>
        -    <SMALL><SUP><!--#set var="var"
        -     value="Powered by $SERVER_SOFTWARE -- File last modified on $LAST_MODIFIED"
        -    --><!--#echo var="var" --></SUP></SMALL>
        -  </DIV>
        -  <ADDRESS>If the indicated error looks like a misconfiguration, please inform
        -   <A HREF="mailto:<!--#echo var="SERVER_ADMIN" -->"
        -      SUBJECT="Feedback about Error message [<!--#echo var="REDIRECT_STATUS" 
        -        -->] <!--#echo var="title" -->, req=<!--#echo var="REQUEST_URI" -->">
        -   <!--#echo var="SERVER_NAME" -->'s WebMaster</A>.
        -  </ADDRESS>
        - </UL></BODY>
        -</HTML>
        -

        - - -

        More welcome!

        - -If you have tips to contribute, send mail to martin@apache.org - - - - - diff --git a/docs/manual/misc/descriptors.html b/docs/manual/misc/descriptors.html deleted file mode 100644 index 6a68c02251..0000000000 --- a/docs/manual/misc/descriptors.html +++ /dev/null @@ -1,182 +0,0 @@ - - - -Descriptors and Apache - - - - - -

        Descriptors and Apache

        - -

        A descriptor, also commonly called a file handle is -an object that a program uses to read or write an open file, or open -network socket, or a variety of other devices. It is represented -by an integer, and you may be familiar with stdin, -stdout, and stderr which are descriptors 0, -1, and 2 respectively. -Apache needs a descriptor for each log file, plus one for each -network socket that it listens on, plus a handful of others. Libraries -that Apache uses may also require descriptors. Normal programs don't -open up many descriptors at all, and so there are some latent problems -that you may experience should you start running Apache with many -descriptors (i.e., with many virtual hosts). - -

        The operating system enforces a limit on the number of descriptors -that a program can have open at a time. There are typically three limits -involved here. One is a kernel limitation, depending on your operating -system you will either be able to tune the number of descriptors available -to higher numbers (this is frequently called FD_SETSIZE). Or you -may be stuck with a (relatively) low amount. The second limit is called -the hard resource limit, and it is sometimes set by root in an -obscure operating system file, but frequently is the same as the kernel -limit. The third limit is called the soft -resource limit. The soft limit is always less than or equal to -the hard limit. For example, the hard limit may be 1024, but the soft -limit only 64. Any user can raise their soft limit up to the hard limit. -Root can raise the hard limit up to the system maximum limit. The soft -limit is the actual limit that is used when enforcing the maximum number -of files a process can have open. - -

        To summarize: - -

        -  #open files  <=  soft limit  <=  hard limit  <=  kernel limit
        -
        - -

        You control the hard and soft limits using the limit (csh) -or ulimit (sh) directives. See the respective man pages -for more information. For example you can probably use -ulimit -n unlimited to raise your soft limit up to the -hard limit. You should include this command in a shell script which -starts your webserver. - -

        Unfortunately, it's not always this simple. As mentioned above, -you will probably run into some system limitations that will need to be -worked around somehow. Work was done in version 1.2.1 to improve the -situation somewhat. Here is a partial list of systems and workarounds -(assuming you are using 1.2.1 or later): - -

        - -
        BSDI 2.0 -
        Under BSDI 2.0 you can build Apache to support more descriptors - by adding -DFD_SETSIZE=nnn to - EXTRA_CFLAGS (where nnn is the number of descriptors - you wish to support, keep it less than the hard limit). But it - will run into trouble if more than approximately 240 Listen - directives are used. This may be cured by rebuilding your kernel - with a higher FD_SETSIZE. -

        - -

        FreeBSD 2.2, BSDI 2.1+ -
        Similar to the BSDI 2.0 case, you should define - FD_SETSIZE and rebuild. But the extra - Listen limitation doesn't exist. -

        - -

        Linux -
        By default Linux has a kernel maximum of 256 open descriptors - per process. There are several patches available for the - 2.0.x series which raise this to 1024 and beyond, and you - can find them in the "unofficial patches" section of the Linux Information HQ. - None of these patches are perfect, and an entirely different - approach is likely to be taken during the 2.1.x development. - Applying these patches will raise the FD_SETSIZE used to compile - all programs, and unless you rebuild all your libraries you should - avoid running any other program with a soft descriptor limit above - 256. As of this writing the patches available for increasing - the number of descriptors do not take this into account. On a - dedicated webserver you probably won't run into trouble. -

        - -

        Solaris through 2.5.1 -
        Solaris has a kernel hard limit of 1024 (may be lower in earlier - versions). But it has a limitation that files using - the stdio library cannot have a descriptor above 255. - Apache uses the stdio library for the ErrorLog directive. - When you have more than approximately 110 virtual hosts - (with an error log and an access log each) you will need to - build Apache with -DHIGH_SLACK_LINE=256 added to - EXTRA_CFLAGS. You will be limited to approximately - 240 error logs if you do this. -

        - -

        AIX -
        AIX version 3.2?? appears to have a hard limit of 128 descriptors. - End of story. Version 4.1.5 has a hard limit of 2000. -

        - -

        SCO OpenServer -
        Edit the - /etc/conf/cf.d/stune file or use - /etc/conf/cf.d/configure choice 7 - (User and Group configuration) and modify the NOFILES kernel - parameter to a suitably higher value. SCO recommends a number - between 60 and 11000, the default is 110. Relink and reboot, - and the new number of descriptors will be available. - -

        - -

        Compaq Tru64 UNIX/Digital UNIX/OSF -
          -
        1. Raise open_max_soft and open_max_hard - to 4096 in the proc subsystem. - Do a man on sysconfig, sysconfigdb, and sysconfigtab. -
        2. Raise max-vnodes to a large number which is greater - than the number of apache processes * 4096 - (Setting it to 250,000 should be good for most people). - Do a man on sysconfig, sysconfigdb, and sysconfigtab. -
        3. If you are using Tru64 5.0, 5.0A, or 5.1, define - NO_SLACK to work around a bug in the OS. - CFLAGS="-DNO_SLACK" ./configure -
        - -

        - -

        Others -
        If you have details on another operating system, please submit - it through our Bug - Report Page. -

        - -

        - -

        In addition to the problems described above there are problems with -many libraries that Apache uses. The most common example is the bind -DNS resolver library that is used by pretty much every unix, which -fails if it ends up with a descriptor above 256. We suspect there -are other libraries that similar limitations. So the code as of 1.2.1 -takes a defensive stance and tries to save descriptors less than 16 -for use while processing each request. This is called the low -slack line. - -

        Note that this shouldn't waste descriptors. If you really are pushing -the limits and Apache can't get a descriptor above 16 when it wants -it, it will settle for one below 16. - -

        In extreme situations you may want to lower the low slack line, -but you shouldn't ever need to. For example, lowering it can -increase the limits 240 described above under Solaris and BSDI 2.0. -But you'll play a delicate balancing game with the descriptors needed -to serve a request. Should you want to play this game, the compile -time parameter is LOW_SLACK_LINE and there's a tiny -bit of documentation in the header file httpd.h. - -

        Finally, if you suspect that all this slack stuff is causing you -problems, you can disable it. Add -DNO_SLACK to -EXTRA_CFLAGS and rebuild. But please report it to -our Bug -Report Page so that -we can investigate. - - - - diff --git a/docs/manual/misc/fin_wait_2.html b/docs/manual/misc/fin_wait_2.html deleted file mode 100644 index 1ec709153f..0000000000 --- a/docs/manual/misc/fin_wait_2.html +++ /dev/null @@ -1,324 +0,0 @@ - - - -Connections in FIN_WAIT_2 and Apache - - - - - - - - -

        Connections in the FIN_WAIT_2 state and Apache

        -
          -
        1. What is the FIN_WAIT_2 state?

          -Starting with the Apache 1.2 betas, people are reporting many more -connections in the FIN_WAIT_2 state (as reported by -netstat) than they saw using older versions. When the -server closes a TCP connection, it sends a packet with the FIN bit -sent to the client, which then responds with a packet with the ACK bit -set. The client then sends a packet with the FIN bit set to the -server, which responds with an ACK and the connection is closed. The -state that the connection is in during the period between when the -server gets the ACK from the client and the server gets the FIN from -the client is known as FIN_WAIT_2. See the TCP RFC for the -technical details of the state transitions.

          - -The FIN_WAIT_2 state is somewhat unusual in that there is no timeout -defined in the standard for it. This means that on many operating -systems, a connection in the FIN_WAIT_2 state will stay around until -the system is rebooted. If the system does not have a timeout and -too many FIN_WAIT_2 connections build up, it can fill up the space -allocated for storing information about the connections and crash -the kernel. The connections in FIN_WAIT_2 do not tie up an httpd -process.

          - -

        2. But why does it happen?

          - -There are numerous reasons for it happening, some of them may not -yet be fully clear. What is known follows.

          - -

          Buggy clients and persistent connections

          - -Several clients have a bug which pops up when dealing with -persistent connections (aka keepalives). -When the connection is idle and the server closes the connection -(based on the -KeepAliveTimeout), the client is programmed so that the client does -not send back a FIN and ACK to the server. This means that the -connection stays in the FIN_WAIT_2 state until one of the following -happens:

          -

            -
          • The client opens a new connection to the same or a different - site, which causes it to fully close the older connection on - that socket. -
          • The user exits the client, which on some (most?) clients - causes the OS to fully shutdown the connection. -
          • The FIN_WAIT_2 times out, on servers that have a timeout - for this state. -

          -If you are lucky, this means that the buggy client will fully close the -connection and release the resources on your server. However, there -are some cases where the socket is never fully closed, such as a dialup -client disconnecting from their provider before closing the client. -In addition, a client might sit idle for days without making another -connection, and thus may hold its end of the socket open for days -even though it has no further use for it. -This is a bug in the browser or in its operating system's -TCP implementation.

          - -The clients on which this problem has been verified to exist:

          -

            -
          • Mozilla/3.01 (X11; I; FreeBSD 2.1.5-RELEASE i386) -
          • Mozilla/2.02 (X11; I; FreeBSD 2.1.5-RELEASE i386) -
          • Mozilla/3.01Gold (X11; I; SunOS 5.5 sun4m) -
          • MSIE 3.01 on the Macintosh -
          • MSIE 3.01 on Windows 95 -

          - -This does not appear to be a problem on: -

            -
          • Mozilla/3.01 (Win95; I) -
          -

          - -It is expected that many other clients have the same problem. What a -client should do is periodically check its open -socket(s) to see if they have been closed by the server, and close their -side of the connection if the server has closed. This check need only -occur once every few seconds, and may even be detected by a OS signal -on some systems (e.g., Win95 and NT clients have this capability, but -they seem to be ignoring it).

          - -Apache cannot avoid these FIN_WAIT_2 states unless it -disables persistent connections for the buggy clients, just -like we recommend doing for Navigator 2.x clients due to other bugs. -However, non-persistent connections increase the total number of -connections needed per client and slow retrieval of an image-laden -web page. Since non-persistent connections have their own resource -consumptions and a short waiting period after each closure, a busy server -may need persistence in order to best serve its clients.

          - -As far as we know, the client-caused FIN_WAIT_2 problem is present for -all servers that support persistent connections, including Apache 1.1.x -and 1.2.

          - -

          A necessary bit of code introduced in 1.2

          - -While the above bug is a problem, it is not the whole problem. -Some users have observed no FIN_WAIT_2 problems with Apache 1.1.x, -but with 1.2b enough connections build up in the FIN_WAIT_2 state to -crash their server. - -The most likely source for additional FIN_WAIT_2 states -is a function called lingering_close() which was added -between 1.1 and 1.2. This function is necessary for the proper -handling of persistent connections and any request which includes -content in the message body (e.g., PUTs and POSTs). -What it does is read any data sent by the client for -a certain time after the server closes the connection. The exact -reasons for doing this are somewhat complicated, but involve what -happens if the client is making a request at the same time the -server sends a response and closes the connection. Without lingering, -the client might be forced to reset its TCP input buffer before it -has a chance to read the server's response, and thus understand why -the connection has closed. -See the appendix for more details.

          - -The code in lingering_close() appears to cause problems -for a number of factors, including the change in traffic patterns -that it causes. The code has been thoroughly reviewed and we are -not aware of any bugs in it. It is possible that there is some -problem in the BSD TCP stack, aside from the lack of a timeout -for the FIN_WAIT_2 state, exposed by the lingering_close -code that causes the observed problems.

          - -

        3. What can I do about it?
        4. - -There are several possible workarounds to the problem, some of -which work better than others.

          - -

          Add a timeout for FIN_WAIT_2

          - -The obvious workaround is to simply have a timeout for the FIN_WAIT_2 state. -This is not specified by the RFC, and could be claimed to be a -violation of the RFC, but it is widely recognized as being necessary. -The following systems are known to have a timeout: -

          -

            -
          • FreeBSD versions starting at - 2.0 or possibly earlier. -
          • NetBSD version 1.2(?) -
          • OpenBSD all versions(?) -
          • BSD/OS 2.1, with the - - K210-027 patch installed. -
          • Solaris as of around version - 2.2. The timeout can be tuned by using ndd to - modify tcp_fin_wait_2_flush_interval, but the - default should be appropriate for most servers and improper - tuning can have negative impacts. -
          • Linux 2.0.x and - earlier(?) -
          • HP-UX 10.x defaults to - terminating connections in the FIN_WAIT_2 state after the - normal keepalive timeouts. This does not - refer to the persistent connection or HTTP keepalive - timeouts, but the SO_LINGER socket option - which is enabled by Apache. This parameter can be adjusted - by using nettune to modify parameters such as - tcp_keepstart and tcp_keepstop. - In later revisions, there is an explicit timer for - connections in FIN_WAIT_2 that can be modified; contact HP - support for details. -
          • SGI IRIX can be patched to - support a timeout. For IRIX 5.3, 6.2, and 6.3, - use patches 1654, 1703 and 1778 respectively. If you - have trouble locating these patches, please contact your - SGI support channel for help. -
          • NCR's MP RAS Unix 2.xx and - 3.xx both have FIN_WAIT_2 timeouts. In 2.xx it is non-tunable - at 600 seconds, while in 3.xx it defaults to 600 seconds and - is calculated based on the tunable "max keep alive probes" - (default of 8) multiplied by the "keep alive interval" (default - 75 seconds). -
          • Sequent's ptx/TCP/IP for - DYNIX/ptx has had a FIN_WAIT_2 timeout since around - release 4.1 in mid-1994. -
          -

          -The following systems are known to not have a timeout: -

          -

            -
          • SunOS 4.x does not and - almost certainly never will have one because it as at the - very end of its development cycle for Sun. If you have kernel - source should be easy to patch. -
          -

          -There is a -patch available for adding a timeout to the FIN_WAIT_2 state; it -was originally intended for BSD/OS, but should be adaptable to most -systems using BSD networking code. You need kernel source code to be -able to use it. If you do adapt it to work for any other systems, -please drop me a note at marc@apache.org. -

          -

          Compile without using lingering_close()

          - -It is possible to compile Apache 1.2 without using the -lingering_close() function. This will result in that -section of code being similar to that which was in 1.1. If you do -this, be aware that it can cause problems with PUTs, POSTs and -persistent connections, especially if the client uses pipelining. -That said, it is no worse than on 1.1, and we understand that keeping your -server running is quite important.

          - -To compile without the lingering_close() function, add --DNO_LINGCLOSE to the end of the -EXTRA_CFLAGS line in your Configuration file, -rerun Configure and rebuild the server. -

          -

          Use SO_LINGER as an alternative to -lingering_close()

          - -On most systems, there is an option called SO_LINGER that -can be set with setsockopt(2). It does something very -similar to lingering_close(), except that it is broken -on many systems so that it causes far more problems than -lingering_close. On some systems, it could possibly work -better so it may be worth a try if you have no other alternatives.

          - -To try it, add -DUSE_SO_LINGER -DNO_LINGCLOSE to the end of the -EXTRA_CFLAGS line in your Configuration -file, rerun Configure and rebuild the server.

          - -NOTE: Attempting to use SO_LINGER and -lingering_close() at the same time is very likely to do -very bad things, so don't.

          - -

          Increase the amount of memory used for storing connection state

          -
          -
          BSD based networking code: -
          BSD stores network data, such as connection states, -in something called an mbuf. When you get so many connections -that the kernel does not have enough mbufs to put them all in, your -kernel will likely crash. You can reduce the effects of the problem -by increasing the number of mbufs that are available; this will not -prevent the problem, it will just make the server go longer before -crashing.

          - -The exact way to increase them may depend on your OS; look -for some reference to the number of "mbufs" or "mbuf clusters". On -many systems, this can be done by adding the line -NMBCLUSTERS="n", where n is the number of -mbuf clusters you want to your kernel config file and rebuilding your -kernel.

          -

          - -

          Disable KeepAlive

          -

          If you are unable to do any of the above then you should, as a last -resort, disable KeepAlive. Edit your httpd.conf and change "KeepAlive On" -to "KeepAlive Off". - -

        5. Feedback
        6. - -If you have any information to add to this page, please contact me at -marc@apache.org.

          - -

        7. Appendix
        8. -

          -Below is a message from Roy Fielding, one of the authors of HTTP/1.1. - -

          Why the lingering close functionality is necessary with HTTP

          - -The need for a server to linger on a socket after a close is noted a couple -times in the HTTP specs, but not explained. This explanation is based on -discussions between myself, Henrik Frystyk, Robert S. Thau, Dave Raggett, -and John C. Mallery in the hallways of MIT while I was at W3C.

          - -If a server closes the input side of the connection while the client -is sending data (or is planning to send data), then the server's TCP -stack will signal an RST (reset) back to the client. Upon -receipt of the RST, the client will flush its own incoming TCP buffer -back to the un-ACKed packet indicated by the RST packet argument. -If the server has sent a message, usually an error response, to the -client just before the close, and the client receives the RST packet -before its application code has read the error message from its incoming -TCP buffer and before the server has received the ACK sent by the client -upon receipt of that buffer, then the RST will flush the error message -before the client application has a chance to see it. The result is -that the client is left thinking that the connection failed for no -apparent reason.

          - -There are two conditions under which this is likely to occur: -

            -
          1. sending POST or PUT data without proper authorization -
          2. sending multiple requests before each response (pipelining) - and one of the middle requests resulting in an error or - other break-the-connection result. -
          -

          -The solution in all cases is to send the response, close only the -write half of the connection (what shutdown is supposed to do), and -continue reading on the socket until it is either closed by the -client (signifying it has finally read the response) or a timeout occurs. -That is what the kernel is supposed to do if SO_LINGER is set. -Unfortunately, SO_LINGER has no effect on some systems; on some other -systems, it does not have its own timeout and thus the TCP memory -segments just pile-up until the next reboot (planned or not).

          - -Please note that simply removing the linger code will not solve the -problem -- it only moves it to a different and much harder one to detect. -

        - - - diff --git a/docs/manual/misc/footer.html b/docs/manual/misc/footer.html deleted file mode 100644 index 1e5f739ebe..0000000000 --- a/docs/manual/misc/footer.html +++ /dev/null @@ -1,8 +0,0 @@ -
        - -

        - Apache HTTP Server Version 2.0 -

        - -Index -Home diff --git a/docs/manual/misc/header.html b/docs/manual/misc/header.html deleted file mode 100644 index 9533b02bda..0000000000 --- a/docs/manual/misc/header.html +++ /dev/null @@ -1,6 +0,0 @@ -
        - [APACHE DOCUMENTATION] -

        - Apache HTTP Server Version 2.0 -

        -
        diff --git a/docs/manual/misc/howto.html b/docs/manual/misc/howto.html deleted file mode 100644 index 57c9f2dfa8..0000000000 --- a/docs/manual/misc/howto.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - -Apache HOWTO documentation - - - - - -

        Apache HOWTO documentation

        - -How to: - - -
        -

        How to redirect an entire server or directory to a -single URL

        - -

        There are two chief ways to redirect all requests for an entire -server to a single location: one which requires the use of -mod_rewrite, and another which uses a CGI script. - -

        First: if all you need to do is migrate a server from one name to -another, simply use the Redirect directive, as supplied -by mod_alias: - -

        -  Redirect / http://www.apache.org/
        -
        - -

        Since Redirect will forward along the complete path, -however, it may not be appropriate - for example, when the directory -structure has changed after the move, and you simply want to direct people -to the home page. - -

        The best option is to use the standard Apache module -mod_rewrite. -If that module is compiled in, the following lines - -

        RewriteEngine On
        -RewriteRule /.* http://www.apache.org/ [R]
        -
        - -will send an HTTP 302 Redirect back to the client, and no matter -what they gave in the original URL, they'll be sent to -"http://www.apache.org/". - -

        The second option is to set up a ScriptAlias pointing to -a CGI script which outputs a 301 or 302 status and the -location -of the other server.

        - -

        By using a CGI script you can intercept various requests -and -treat them specially, e.g., you might want to intercept -POST -requests, so that the client isn't redirected to a script on the other -server which expects POST information (a redirect will lose the POST -information.) You might also want to use a CGI script if you don't -want to compile mod_rewrite into your server. - -

        Here's how to redirect all requests to a script... In the server -configuration file, -

        ScriptAlias / /usr/local/httpd/cgi-bin/redirect_script/
        -
        - -and here's a simple perl script to redirect requests: - -
        -#!/usr/local/bin/perl
        -
        -print "Status: 302 Moved Temporarily\r\n" .
        -      "Location: http://www.some.where.else.com/\r\n" .
        -      "\r\n";
        -
        -
        - -
        - -

        How to reset your log files

        - -

        Sooner or later, you'll want to reset your log files (access_log and -error_log) because they are too big, or full of old information you don't -need.

        - -

        access.log typically grows by 1Mb for each 10,000 requests.

        - -

        Most people's first attempt at replacing the logfile is to just move the -logfile or remove the logfile. This doesn't work.

        - -

        Apache will continue writing to the logfile at the same offset as before the -logfile moved. This results in a new logfile being created which is just -as big as the old one, but it now contains thousands (or millions) of null -characters.

        - -

        The correct procedure is to move the logfile, then signal Apache to tell -it to reopen the logfiles.

        - -

        Apache is signaled using the SIGHUP (-1) signal. -e.g. -

        -mv access_log access_log.old
        -kill -1 `cat httpd.pid` -
        - -

        Note: httpd.pid is a file containing the -process id -of the Apache httpd daemon, Apache saves this in the same directory as the log -files.

        - -

        Many people use this method to replace (and backup) their logfiles on a -nightly or weekly basis.

        -
        - -

        How to stop or restrict robots

        - -

        Ever wondered why so many clients are interested in a file called -robots.txt which you don't have, and never did have?

        - -

        These clients are called robots (also known as crawlers, -spiders and other cute names) - special automated clients which -wander around the web looking for interesting resources.

        - -

        Most robots are used to generate some kind of web index which -is then used by a search engine to help locate information.

        - -

        robots.txt provides a means to request that robots limit their -activities at the site, or more often than not, to leave the site alone.

        - -

        When the first robots were developed, they had a bad reputation for -sending hundreds/thousands of requests to each site, often resulting -in the site being overloaded. Things have improved dramatically since -then, thanks to -Guidelines for Robot Writers, but even so, some robots may exhibit -unfriendly behavior which the webmaster isn't willing to tolerate, and -will want to stop.

        - -

        Another reason some webmasters want to block access to robots, is to -stop them indexing dynamic information. Many search engines will use the -data collected from your pages for months to come - not much use if you're -serving stock quotes, news, weather reports or anything else that will be -stale by the time people find it in a search engine.

        - -

        If you decide to exclude robots completely, or just limit the areas -in which they can roam, create a robots.txt file; refer -to the robot information pages provided by Martijn Koster for the syntax.

        - -
        -

        How to proxy SSL requests through - your non-SSL Apache server -
        - (submitted by David Sedlock) -

        -

        -SSL uses port 443 for requests for secure pages. If your browser just -sits there for a long time when you attempt to access a secure page -over your Apache proxy, then the proxy may not be configured to handle -SSL. You need to instruct Apache to listen on port 443 in addition to -any of the ports on which it is already listening: -

        -
        -    Listen 80
        -    Listen 443
        -
        -

        -Then set the security proxy in your browser to 443. That might be it! -

        -

        -If your proxy is sending requests to another proxy, then you may have -to set the directive ProxyRemote differently. Here are my settings: -

        -
        -    ProxyRemote http://nicklas:80/ http://proxy.mayn.franken.de:8080
        -    ProxyRemote http://nicklas:443/ http://proxy.mayn.franken.de:443
        -
        -

        -Requests on port 80 of my proxy nicklas are forwarded to -proxy.mayn.franken.de:8080, while requests on port 443 are -forwarded to proxy.mayn.franken.de:443. -If the remote proxy is not set up to -handle port 443, then the last directive can be left out. SSL requests -will only go over the first proxy. -

        -

        -Note that your Apache does NOT have to be set up to serve secure pages -with SSL. Proxying SSL is a different thing from using it. -

        - - - diff --git a/docs/manual/misc/index.html b/docs/manual/misc/index.html deleted file mode 100644 index 2893b456c4..0000000000 --- a/docs/manual/misc/index.html +++ /dev/null @@ -1,101 +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. -
        -
        How to use XSSI and Negotiation - for custom ErrorDocuments -
        -
        Describes a solution which uses XSSI and negotiation - to custom-tailor the Apache ErrorDocuments to taste, adding the - advantage of returning internationalized versions of the error - messages depending on the client's language preferences. -
        -
        File Descriptor use in Apache -
        Describes how Apache uses file descriptors and talks about various - limits imposed on the number of descriptors available by various - operating systems. -
        -
        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 Client Problems -
        -
        A list of problems in HTTP clients which can be mitigated by Apache. -
        -
        Performance Notes -- Apache Tuning -
        -
        Notes about how to (run-time and compile-time) configure - Apache for highest performance. Notes explaining why Apache does - some things, and why it doesn't do other things (which make it - slower/faster). -
        -
        Security Tips -
        -
        Some "do"s - and "don't"s - for keeping your - Apache web site secure. -
        -
        - - - - diff --git a/docs/manual/misc/known_client_problems.html b/docs/manual/misc/known_client_problems.html deleted file mode 100644 index 99e5d68580..0000000000 --- a/docs/manual/misc/known_client_problems.html +++ /dev/null @@ -1,305 +0,0 @@ - - - -Apache HTTP Server Project - - - - - -

        Known Problems in Clients

        - -

        Over time the Apache Group has discovered or been notified of problems -with various clients which we have had to work around, or explain. -This document describes these problems and the workarounds available. -It's not arranged in any particular order. Some familiarity with the -standards is assumed, but not necessary. - -

        For brevity, Navigator will refer to Netscape's Navigator -product (which in later versions was renamed "Communicator" and -various other names), and MSIE will refer to Microsoft's -Internet Explorer product. All trademarks and copyrights belong to -their respective companies. We welcome input from the various client -authors to correct inconsistencies in this paper, or to provide us with -exact version numbers where things are broken/fixed. - -

        For reference, -RFC1945 -defines HTTP/1.0, and -RFC2068 -defines HTTP/1.1. Apache as of version 1.2 is an HTTP/1.1 server (with an -optional HTTP/1.0 proxy). - -

        Various of these workarounds are triggered by environment variables. -The admin typically controls which are set, and for which clients, by using -mod_browser. Unless otherwise -noted all of these workarounds exist in versions 1.2 and later. - -

        Trailing CRLF on POSTs

        - -

        This is a legacy issue. The CERN webserver required POST -data to have an extra CRLF following it. Thus many -clients send an extra CRLF that -is not included in the Content-Length of the request. -Apache works around this problem by eating any empty lines which -appear before a request. - -

        Broken keepalive

        - -

        Various clients have had broken implementations of keepalive -(persistent connections). In particular the Windows versions of -Navigator 2.0 get very confused when the server times out an -idle connection. The workaround is present in the default config files: -

        -BrowserMatch Mozilla/2 nokeepalive -
        -Note that this matches some earlier versions of MSIE, which began the -practice of calling themselves Mozilla in their user-agent -strings just like Navigator. - -

        MSIE 4.0b2, which claims to support HTTP/1.1, does not properly -support keepalive when it is used on 301 or 302 (redirect) -responses. Unfortunately Apache's nokeepalive code -prior to 1.2.2 would not work with HTTP/1.1 clients. You must apply -this patch to version 1.2.1. Then add this to your config: -

        -BrowserMatch "MSIE 4\.0b2;" nokeepalive -
        - -

        Incorrect interpretation of -HTTP/1.1 in response

        - -

        To quote from section 3.1 of RFC1945: -

        -HTTP uses a "<MAJOR>.<MINOR>" numbering scheme to indicate versions -of the protocol. The protocol versioning policy is intended to allow -the sender to indicate the format of a message and its capacity for -understanding further HTTP communication, rather than the features -obtained via that communication. -
        -Since Apache is an HTTP/1.1 server, it indicates so as part of its -response. Many client authors mistakenly treat this part of the response -as an indication of the protocol that the response is in, and then refuse -to accept the response. - -

        The first major indication of this problem was with AOL's proxy servers. -When Apache 1.2 went into beta it was the first wide-spread HTTP/1.1 -server. After some discussion, AOL fixed their proxies. In -anticipation of similar problems, the force-response-1.0 -environment variable was added to Apache. When present Apache will -indicate "HTTP/1.0" in response to an HTTP/1.0 client, -but will not in any other way change the response. - -

        The pre-1.1 Java Development Kit (JDK) that is used in many clients -(including Navigator 3.x and MSIE 3.x) exhibits this problem. As do some -of the early pre-releases of the 1.1 JDK. We think it is fixed in the -1.1 JDK release. In any event the workaround: -

        -BrowserMatch Java/1.0 force-response-1.0
        -BrowserMatch JDK/1.0 force-response-1.0 -
        - -

        RealPlayer 4.0 from Progressive Networks also exhibits this problem. -However they have fixed it in version 4.01 of the player, but version -4.01 uses the same User-Agent as version 4.0. The -workaround is still: -

        -BrowserMatch "RealPlayer 4.0" force-response-1.0 -
        - -

        Requests use HTTP/1.1 but responses must be -in HTTP/1.0

        - -

        MSIE 4.0b2 has this problem. Its Java VM makes requests in HTTP/1.1 -format but the responses must be in HTTP/1.0 format (in particular, it -does not understand chunked responses). The workaround -is to fool Apache into believing the request came in HTTP/1.0 format. -

        -BrowserMatch "MSIE 4\.0b2;" downgrade-1.0 force-response-1.0 -
        -This workaround is available in 1.2.2, and in a -patch against 1.2.1. - -

        Boundary problems with header parsing

        - -

        All versions of Navigator from 2.0 through 4.0b2 (and possibly later) -have a problem if the trailing CRLF of the response header starts at -offset 256, 257 or 258 of the response. A BrowserMatch for this would -match on nearly every hit, so the workaround is enabled automatically -on all responses. The workaround implemented detects when this condition would -occur in a response and adds extra padding to the header to push the -trailing CRLF past offset 258 of the response. - -

        Multipart responses and Quoted Boundary -Strings

        - -

        On multipart responses some clients will not accept quotes (") -around the boundary string. The MIME standard recommends that -such quotes be used. But the clients were probably written based -on one of the examples in RFC2068, which does not include quotes. -Apache does not include quotes on its boundary strings to workaround -this problem. - -

        Byterange requests

        - -

        A byterange request is used when the client wishes to retrieve a -portion of an object, not necessarily the entire object. There -was a very old draft which included these byteranges in the URL. -Old clients such as Navigator 2.0b1 and MSIE 3.0 for the MAC -exhibit this behaviour, and -it will appear in the servers' access logs as (failed) attempts to -retrieve a URL with a trailing ";xxx-yyy". Apache does not attempt -to implement this at all. - -

        A subsequent draft of this standard defines a header -Request-Range, and a response type -multipart/x-byteranges. The HTTP/1.1 standard includes -this draft with a few fixes, and it defines the header -Range and type multipart/byteranges. - -

        Navigator (versions 2 and 3) sends both Range and -Request-Range headers (with the same value), but does not -accept a multipart/byteranges response. The response must -be multipart/x-byteranges. As a workaround, if Apache -receives a Request-Range header it considers it "higher -priority" than a Range header and in response uses -multipart/x-byteranges. - -

        The Adobe Acrobat Reader plugin makes extensive use of byteranges and -prior to version 3.01 supports only the multipart/x-byterange -response. Unfortunately there is no clue that it is the plugin -making the request. If the plugin is used with Navigator, the above -workaround works fine. But if the plugin is used with MSIE 3 (on -Windows) the workaround won't work because MSIE 3 doesn't give the -Range-Request clue that Navigator does. To workaround this, -Apache special cases "MSIE 3" in the User-Agent and serves -multipart/x-byteranges. Note that the necessity for this -with MSIE 3 is actually due to the Acrobat plugin, not due to the browser. - -

        Netscape Communicator appears to not issue the non-standard -Request-Range header. When an Acrobat plugin prior to -version 3.01 is used with it, it will not properly understand byteranges. -The user must upgrade their Acrobat reader to 3.01. - -

        Set-Cookie header is -unmergeable

        - -

        The HTTP specifications say that it is legal to merge headers with -duplicate names into one (separated by commas). Some browsers -that support Cookies don't like merged headers and prefer that each -Set-Cookie header is sent separately. When parsing the -headers returned by a CGI, Apache will explicitly avoid merging any -Set-Cookie headers. - -

        Expires headers and GIF89A -animations

        - -

        Navigator versions 2 through 4 will erroneously re-request -GIF89A animations on each loop of the animation if the first -response included an Expires header. This happens -regardless of how far in the future the expiry time is set. There -is no workaround supplied with Apache, however there are hacks for 1.2 -and for 1.3. - -

        POST without -Content-Length

        - -

        In certain situations Navigator 3.01 through 3.03 appear to incorrectly -issue a POST without the request body. There is no -known workaround. It has been fixed in Navigator 3.04, Netscapes -provides some -information. -There's also - -some information about the actual problem. - -

        JDK 1.2 betas lose parts of responses.

        - -

        The http client in the JDK1.2beta2 and beta3 will throw away the first part of -the response body when both the headers and the first part of the body are sent -in the same network packet AND keep-alive's are being used. If either condition -is not met then it works fine. - -

        See also Bug-ID's 4124329 and 4125538 at the java developer connection. - -

        If you are seeing this bug yourself, you can add the following BrowserMatch -directive to work around it: - -

        -BrowserMatch "Java1\.2beta[23]" nokeepalive -
        - -

        We don't advocate this though since bending over backwards for beta software -is usually not a good idea; ideally it gets fixed, new betas or a final release -comes out, and no one uses the broken old software anymore. In theory. - -

        Content-Type change -is not noticed after reload

        - -

        Navigator (all versions?) will cache the content-type -for an object "forever". Using reload or shift-reload will not cause -Navigator to notice a content-type change. The only -work-around is for the user to flush their caches (memory and disk). By -way of an example, some folks may be using an old mime.types -file which does not map .htm to text/html, -in this case Apache will default to sending text/plain. -If the user requests the page and it is served as text/plain. -After the admin fixes the server, the user will have to flush their caches -before the object will be shown with the correct text/html -type. - -

        MSIE Cookie problem with expiry date in -the year 2000

        - -

        MSIE versions 3.00 and 3.02 (without the Y2K patch) do not handle -cookie expiry dates in the year 2000 properly. Years after 2000 and -before 2000 work fine. This is fixed in IE4.01 service pack 1, and in -the Y2K patch for IE3.02. Users should avoid using expiry dates in the -year 2000. - -

        Lynx incorrectly asking for transparent -content negotiation

        - -

        The Lynx browser versions 2.7 and 2.8 send a "negotiate: trans" header -in their requests, which is an indication the browser supports transparent -content negotiation (TCN). However the browser does not support TCN. -As of version 1.3.4, Apache supports TCN, and this causes problems with -these versions of Lynx. As a workaround future versions of Apache will -ignore this header when sent by the Lynx client. - -

        MSIE 4.0 mishandles Vary response header

        - -

        MSIE 4.0 does not handle a Vary header properly. The Vary header is -generated by mod_rewrite in apache 1.3. The result is an error from MSIE -saying it cannot download the requested file. There are more details -in PR#4118. -

        -

        -A workaround is to add the following to your server's configuration -files: -

        -
        -    BrowserMatch "MSIE 4\.0" force-no-vary
        -
        -

        -(This workaround is only available with releases after -1.3.6 of the Apache Web server.) -

        - - - - - - diff --git a/docs/manual/misc/perf-tuning.html b/docs/manual/misc/perf-tuning.html deleted file mode 100644 index ce31fe5653..0000000000 --- a/docs/manual/misc/perf-tuning.html +++ /dev/null @@ -1,906 +0,0 @@ - - - - Apache Performance Notes - - - - - -
        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. -
        - -

        Apache Performance Notes

        - -

        Author: Dean Gaudet - -

        - -
        - -

        Introduction

        -

        Apache is a general webserver, which is designed to be correct first, and -fast second. Even so, its 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 0, which -means that there is no limit to the number of requests handled -per child. If your configuration currently has this set to some -very low number, such as 30, you may want to bump this up significantly. -If you are running SunOS or an old version of Solaris, limit this -to 10000 or so because of memory leaks. - -

        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 ExtendedStatus On

        - -

        If you include mod_status -and you also set ExtendedStatus On when building and running -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 -ExtendedStatus off (which is the default). - -

        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 zero 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/include/ap_config.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_PTHREAD_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), and even then -only in certain configurations. If you experiment with this you should -watch out for your server hanging and not responding. Static content -only servers may work just fine. -
        - -

        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 SINGLE_LISTEN_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) {
        -		if (read (s, junk_buffer, sizeof (junk_buffer)) <= 0) {
        -		    break;
        -		}
        -		/* 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 USE_MMAP_SCOREBOARD or -USE_SHMGET_SCOREBOARD. Defining one of those two (as -well as their companions HAVE_MMAP and HAVE_SHMGET -respectively) enables the supplied shared memory code. If your system has -another type of shared memory, 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 -SINGLE_LISTEN_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. Or you can use a method which moves the time into shared memory, -see the patches section below. - -

        As described earlier, ExtendedStatus On 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 setting ExtendedStatus Off (which -is the default). - -

        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. - -

        You may also wish to experiment with MMAP_SEGMENT_SIZE -(default 32768) which determines the maximum number of bytes that -will be written at a time from mmap()d files. Apache only resets the -client's Timeout in between write()s. So setting this -large may lock out low bandwidth clients unless you also increase the -Timeout. - -

        It may even be the case that mmap isn't -used on your architecture; if so then defining USE_MMAP_FILES -and HAVE_MMAP 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 its 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: --DSINGLE_LISTEN_UNSERIALIZED_ACCEPT -DBUFFERED_LOGS and -ExtendedStatus Off. 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: Patches Available

        - -There are - -several performance patches available for 1.3. Although they may -not apply cleanly to the current version, -it shouldn't be difficult for someone with a little C knowledge to -update them. In particular: - -
          -
        • A -patch to remove all time(2) system calls. -
        • A -patch to remove various system calls from mod_include, -these calls are used by few sites but required for backwards compatibility. -
        • A -patch which integrates the above two plus a few other speedups at the -cost of removing some functionality. -
        - -

        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 is publicly available. There is also an experimental port of -Apache 1.3 to -Netscape's Portable Run Time, which -is available -(but you're encouraged to join the -new-httpd mailing list -if you intend to use it). -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 0f469bd8b0..0000000000 --- a/docs/manual/misc/rewriteguide.html +++ /dev/null @@ -1,1906 +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 archive public to the world via a -nice Web interface. "Nice" means that I wanted to -offer an 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 stuff 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 pure 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 served 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
        -RewriteRule ^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 964d7d89bf..0000000000 --- a/docs/manual/misc/security_tips.html +++ /dev/null @@ -1,231 +0,0 @@ - - - -Apache HTTP Server: Security Tips - - - - - -

        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, others specific to Apache. - -


        - -

        Permissions on ServerRoot Directories

        -

        In typical operation, Apache is started by the root -user, and it switches to the user defined by the User directive to serve hits. -As is the case with any command that root executes, you must take care -that it is protected from modification by non-root users. Not only -must the files themselves be writeable only by root, but so must the -directories, and parents of all directories. For example, if you -choose to place ServerRoot in /usr/local/apache then it is -suggested that you create that directory as root, with commands -like these: - -

        -    mkdir /usr/local/apache
        -    cd /usr/local/apache
        -    mkdir bin conf logs
        -    chown 0 . bin conf logs
        -    chgrp 0 . bin conf logs
        -    chmod 755 . bin conf logs
        -
        - -It is assumed that /, /usr, and /usr/local are only modifiable by root. -When you install the httpd executable, you should ensure that it is -similarly protected: - -
        -    cp httpd /usr/local/apache/bin
        -    chown 0 /usr/local/apache/bin/httpd
        -    chgrp 0 /usr/local/apache/bin/httpd
        -    chmod 511 /usr/local/apache/bin/httpd
        -
        - -

        You can create an htdocs subdirectory which is modifiable by other -users -- since root never executes any files out of there, and shouldn't -be creating files in there. - -

        If you allow non-root users to modify any files that root either -executes or writes on then you open your system to root compromises. -For example, someone could replace the httpd binary so that the next -time you start it, it will execute some arbitrary code. If the logs -directory is writeable (by a non-root user), someone -could replace a log file with a symlink to some other system file, -and then root might overwrite that file with arbitrary data. If the -log files themselves are writeable (by a non-root user), then someone -may be able to overwrite the log itself with bogus data. -

        -


        -

        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. One program which can be used to allow scripts to run -as different users is suEXEC which is -included with Apache as of 1.2 and is called from special hooks in -the Apache server code. Another popular way of doing this is with -CGIWrap.

        - -


        - - -

        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
        -Allow from all
        -</Directory>
        -
        - -Then setup for specific directories

        - -This stops all overrides, Includes and accesses in all directories apart -from those named.

        -


        -

        - Protect server files by default -

        -

        -One aspect of Apache which is occasionally misunderstood is the feature -of default access. That is, unless you take steps to change it, if the -server can find its way to a file through normal URL mapping rules, it -can serve it to clients. -

        -

        -For instance, consider the following example: -

        -
          -
        1. # cd /; ln -s / public_html -
        2. -
        3. Accessing http://localhost/~root/ -
        4. -
        -

        -This would allow clients to walk through the entire filesystem. To work -around this, add the following block to your server's configuration: -

        -
        - <Directory />
        -     Order Deny,Allow
        -     Deny from all
        - </Directory>
        -
        -

        -This will forbid default access to filesystem locations. Add -appropriate -<Directory> -blocks to allow access only -in those areas you wish. For example, -

        -
        - <Directory /usr/users/*/public_html>
        -     Order Deny,Allow
        -     Allow from all
        - </Directory>
        - <Directory /usr/local/httpd>
        -     Order Deny,Allow
        -     Allow from all
        - </Directory>
        -
        -

        -Pay particular attention to the interactions of -<Location> -and -<Directory> -directives; for instance, even if <Directory /> -denies access, a <Location /> directive might -overturn it. -

        -

        -Also be wary of playing games with the -UserDir -directive; setting it to something like "./" -would have the same effect, for root, as the first example above. -If you are using Apache 1.3 or above, we strongly recommend that you -include the following line in your server configuration files: -

        -
        -
        UserDir disabled root -
        -
        - -
        -

        Please send any other useful security tips to The Apache Group -by filling out a -problem report. -If you are confident you have found a security bug in the Apache -source code itself, please let us -know. - -

        - - - - diff --git a/docs/manual/misc/tutorials.html b/docs/manual/misc/tutorials.html deleted file mode 100644 index 90bcdb2d15..0000000000 --- a/docs/manual/misc/tutorials.html +++ /dev/null @@ -1,209 +0,0 @@ - - - -Apache Tutorials - - - - - - -

        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. -
        - - -

        Apache Tutorials

        - -

        The following documents give you step-by-step instructions on how -to accomplish common tasks with the Apache http server. Many of these -documents are located at external sites and are not the work of the -Apache Software Foundation. Copyright to documents on external sites -is owned by the authors or their assignees. Please consult the official Apache Server documentation to verify what you -read on external sites. - - -

        Installation & Getting Started

        - - - - -

        Basic Configuration

        - - - -

        Security

        - - - -

        Logging

        - - - -

        CGI and SSI

        - - - -

        Other Features

        - - - - -

        If you have a pointer to a an accurate and well-written tutorial -not included here, please let us know by submitting it to the -Apache Bug Database. - - - - diff --git a/docs/manual/mod/core.html b/docs/manual/mod/core.html deleted file mode 100644 index 24f83c9f1c..0000000000 --- a/docs/manual/mod/core.html +++ /dev/null @@ -1,2703 +0,0 @@ - - - -Apache Core Features - - - - - - -

        Apache Core Features

        -

        -These configuration parameters control the core Apache features, and are -always available. -

        -

        Directives

        - -
        - -

        AccessFileName directive

        - -Syntax: AccessFileName filename -[filename] ...
        -Default: AccessFileName .htaccess
        -Context: server config, virtual host
        -Status: core
        -Compatibility: AccessFileName can accept more than -one filename only in Apache 1.3 and later

        - -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>
        -

        - -

        See Also: -AllowOverride

        -
        - -

        AddDefaultCharset directive

        -Syntax: -AddDefaultCharset On|Off|charset
        -Context: -all
        -Status: -core
        -Default: -AddDefaultCharset Off
        -Compatibility: - AddDefaultCharset is only available in Apache 1.3.12 and -later

        -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; -e.g. AddDefaultCharset utf-8. -


        - -

        AddModule directive

        - -Syntax: AddModule module [module] ...
        -Context: server config
        -Status: core
        -Compatibility: AddModule is only available in -Apache 1.2 and later

        - -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.


        - -

        AllowOverride directive

        - -Syntax: AllowOverride All|None|directive-type -[directive-type] ...
        -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.

        - -

        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 -(AddEncoding, -AddLanguage, -AddType, -DefaultType, -ErrorDocument, -LanguagePriority, 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). -

        - -

        See Also: -AccessFileName

        -
        - -

        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. 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.


        - -

        AuthType directive

        - -Syntax: AuthType Basic|Digest
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: core

        - -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.


        - -

        ClearModuleList directive

        - -Syntax: ClearModuleList
        -Context: server config
        -Status: core
        -Compatibility: ClearModuleList is only available in -Apache 1.2 and later

        - -The server comes with a built-in list of active modules. This -directive clears the list. It is assumed that the list will then be -re-populated using the AddModule directive.


        - -

        ContentDigest directive

        - -Syntax: ContentDigest on|off
        -Default: ContentDigest off
        -Context: server config, virtual host, directory, -.htaccess
        -Override: Options
        -Status: experimental
        -Compatibility: ContentDigest is only 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 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 wild-card string. In a wild-card string, `?' matches any single character, -and `*' matches any sequences of characters. As of Apache 1.3, 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 -behaviour of Unix shells. -Example: -

        -   <Directory /usr/local/httpd/htdocs>
        -   Options Indexes FollowSymLinks
        -   </Directory>
        -
        - -

        Apache 1.2 and above: -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 expression directory sections are handled slightly differently -by Apache 1.2 and 1.3. In Apache 1.2 they are interspersed with the normal -directory sections and applied in the order they appear in the configuration -file. They are applied only once, and apply when the shortest match -possible occurs. In Apache 1.3 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>
        -
        -Suppose that the filename being accessed is -/home/abc/public_html/abc/index.html. The server -considers each of /, /home, /home/abc, -/home/abc/public_html, and /home/abc/public_html/abc -in that order. In Apache 1.2, when -/home/abc is considered, the regular expression will match -and be applied. In Apache 1.3 the regular expression isn't considered -at all at that point in the tree. It 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. -

        - -See also: How Directory, -Location and Files sections work for an explanation of how these -different sections are combined when a request is received - -


        - -

        <DirectoryMatch>

        -Syntax: <DirectoryMatch regex> - ... </DirectoryMatch>
        -Context: server config, virtual host
        -Status: Core.
        -Compatibility: Available in Apache 1.3 and later - -

        <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.

        - -

        See Also: -<Directory> for a description of how -regular expressions are mixed in with normal <Directory>s. -
        -See also: How Directory, -Location and Files sections work for an explanation of how these -different sections are combined when a request is received - -


        - -

        DocumentRoot directive

        - -Syntax: DocumentRoot directory-filename
        -Default: DocumentRoot -/usr/local/apache/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
        -Override: FileInfo
        -Compatibility: The directory and .htaccess contexts -are only available in Apache 1.1 and later. The quoting syntax prior to -Apache 2.0 was different.

        - -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. 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 -
        - -

        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. - -

        See Also: documentation of customizable -responses.


        - -

        ErrorLog directive

        - -Syntax: ErrorLog filename|syslog[:facility] -
        -Default: ErrorLog logs/error_log (Unix)
        -Default: ErrorLog logs/error.log - (Windows and OS/2)
        -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. -If the filename begins with a pipe (|) then it is assumed to be a command to -spawn to handle the error log. - -

        Apache 1.3 and above: -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. - -

        See also: LogLevel -


        - -

        <Files> directive

        -Syntax: <Files filename> -... </Files>
        -Context: server config, virtual host, .htaccess
        -Status: core
        -Compatibility: only available in Apache -1.2 and above.

        - -

        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. - -

        - -See also: How Directory, -Location and Files sections work for an explanation of how these -different sections are combined when a request is received - -


        - -

        <FilesMatch>

        -Syntax: <FilesMatch regex> -... </FilesMatch>
        -Context: server config, virtual host, .htaccess
        -Status: core
        -Compatibility: only available in Apache -1.3 and above.

        - -

        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.

        - -See also: How Directory, -Location and Files sections work for an explanation of how these -different sections are combined when a request is received - -
        - -

        HostNameLookups directive

        - -Syntax: HostNameLookups on|off|double
        -Default: HostNameLookups off
        -Context: server config, virtual host, directory
        -Status: core
        -Compatibility: double available only in -Apache -1.3 and above.
        -Compatibility: Default was on prior to -Apache 1.3.

        - -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 for this directive was previously on in -versions of Apache prior to 1.3. It was changed to 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 directive

        - -Syntax: IdentityCheck on|off
        -Default: IdentityCheck off
        -Context: server config, virtual host, directory
        -Status: core

        - -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. Boolean is either -on or off.

        - -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> directive

        -Syntax: <IfDefine [!]parameter-name> ... -</IfDefine>
        -Default: None
        -Context: all
        -Status: Core
        -Compatibility: <IfDefine> is only available in -1.3.1 and later.

        - -

        - -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> directive

        -Syntax: <IfModule [!]module-name> - ... -</IfModule>
        -Default: None
        -Context: all
        -Status: Core
        -Compatibility: IfModule is only available in 1.2 and -later.

        - -

        - -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 compiled -in to Apache. The second format reverses the test, and only processes -the directives if module name is not compiled in. - -

        The module name argument is a module name as given as 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 directive

        -Syntax: Include filename
        -Context: server config
        -Status: Core
        -Compatibility: Include is only available in Apache 1.3 -and later. -

        -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. - -


        - -

        KeepAlive directive

        -Syntax: KeepAlive on/off
        -Default: KeepAlive On
        -Context: server config
        -Status: Core
        -Compatibility: KeepAlive is only available in Apache -1.1 and later.

        - -

        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.

        - -

        See also MaxKeepAliveRequests.

        - -
        - -

        KeepAliveTimeout directive

        -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.

        - -

        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> directive

        - -Syntax: - <Limit method [method] ... > ... </Limit>
        -Context: any
        -Status: core

        - -Access controls are normally effective for all access -methods, and this is the usual desired behaviour. 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> directive

        - -Syntax: - <LimitExcept method [method] ... > ... </LimitExcept>
        -Context: any
        -Status: core
        -Compatibility: Available in Apache 1.3.5 and later

        - -<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 directive

        - -Syntax: LimitRequestBody bytes
        -Default: LimitRequestBody 0
        -Context: server config, virtual host, directory, -.htaccess
        -Status: core
        -Compatibility: LimitRequestBody is only available in -Apache 1.3.2 and later. -

        - -

        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 directive

        - -Syntax: LimitRequestFields number
        -Default: LimitRequestFields 100
        -Context: server config
        -Status: core
        -Compatibility: LimitRequestFields is only available in -Apache 1.3.2 and later. -

        - -

        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 directive

        - -Syntax: LimitRequestFieldsize bytes
        -Default: LimitRequestFieldsize 8190
        -Context: server config
        -Status: core
        -Compatibility: LimitRequestFieldsize is only available in -Apache 1.3.2 and later. -

        - -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 directive

        - -Syntax: LimitRequestLine bytes
        -Default: LimitRequestLine 8190
        -Context: server config
        -Status: core
        -Compatibility: LimitRequestLine is only available in -Apache 1.3.2 and later. -

        - -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 directive

        -Syntax: LimitXMLRequestBody number
        -Default: LimitXMLRequestBody 1000000
        -Context: server config
        -Status: core
        - -

        Limit (in bytes) on maximum size of an XML-based request body.

        - -


        - -

        <Location> directive

        - -Syntax: <Location URL> -... </Location>
        -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 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. - -

        Apache 1.2 and above: -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>
        -
        - -

        Apache 1.3 and above note about / (slash): The slash -character has special -meaning depending on where in a URL it appears. People may be used -to its behaviour 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. - -

        -See also: How Directory, -Location and Files sections work for an explanation of how these -different sections are combined when a request is received - -


        - -

        <LocationMatch>

        - -Syntax: <LocationMatch regex> -... </LocationMatch>
        -Context: server config, virtual host
        -Status: core
        -Compatibility: LocationMatch is only available in -Apache 1.3 and later.

        - -

        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".

        - -See also: How Directory, -Location and Files sections work for an explanation of how these -different sections are combined when a request is received - -
        - -

        LogLevel directive

        -Syntax: LogLevel level
        -Default: LogLevel error
        -Context: server config, virtual host
        -Status: core
        -Compatibility: LogLevel is only available in 1.3 or -later. - -

        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 directive

        -Syntax: MaxKeepAliveRequests number
        -Default: MaxKeepAliveRequests 100
        -Context: server config
        -Status: core
        -Compatibility: Only available in Apache -1.2 and later. - -

        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 directive

        - -Syntax: NameVirtualHost addr[:port]
        -Context: server config
        -Status: core
        -Compatibility: NameVirtualHost is only available in -Apache 1.3 and later

        - -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
        - -See also: -Apache Virtual Host documentation -
        - -

        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. 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 -#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 -
        - -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.

        -


        - - - -

        Port directive

        - -Syntax: Port number
        -Default: Port 80
        -Context: server config
        -Status: core

        - -Number 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.

        - -The Port directive has two behaviors, the first of which is necessary for -NCSA backwards compatibility (and which is confusing in the context of -Apache).

        - -

          -
        • -In the absence of any Listen -directives specifying a port number, -a Port directive given in the "main server" -(i.e., outside any <VirtualHost> section) -sets the network port on which the server listens. -If there are any Listen directives specifying -:number then Port has no effect on what address the server -listens at. - -
        • The Port directive -sets the SERVER_PORT environment variable (for -CGI and SSI), -and is used when the server must generate a URL that refers to itself -(for example when creating an external redirect to itself). This -behaviour is modified by -UseCanonicalName. -
        - -In no event does a Port setting affect -what ports a VirtualHost responds on, the -VirtualHost directive itself is used for that.

        - -The primary behaviour of Port should be considered to be similar to that of -the ServerName directive. The ServerName -and Port together specify what you consider to be the canonical -address of the server. -(See also UseCanonicalName.)

        - -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-name] ...
        -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. -

        -

        -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

        -

        See also Satisfy and mod_access. -


        - -

        RLimitCPU directive

        - -Syntax: RLimitCPU number|max - [number|max] -
        -Default: Unset; uses operating system defaults -
        -Context: server config, virtual host
        -Status: core
        -Compatibility: RLimitCPU is only available in Apache 1.2 -and later. 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.

        - -See also RLimitMEM or -RLimitNPROC.


        - -

        RLimitMEM directive

        - -Syntax: RLimitMEM number|max - [number|max]
        -Default: Unset; uses operating system defaults -
        -Context: server config, virtual host
        -Status: core
        -Compatibility: RLimitMEM is only available in Apache 1.2 -and later. 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.

        - -See also RLimitCPU or -RLimitNPROC.


        - -

        RLimitNPROC directive

        - -Syntax: RLimitNPROC number|max - [number|max]
        -Default: Unset; uses operating system defaults -
        -Context: server config, virtual host
        -Status: core
        -Compatibility: RLimitNPROC is only available in Apache -1.2 and later. 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.

        - -See also RLimitMEM or -RLimitCPU. - -


        - -

        Satisfy directive

        - -Syntax: Satisfy any|all
        -Default: Satisfy all
        -Context: directory, .htaccess
        -Status: core
        -Compatibility: Satisfy is only available in Apache 1.2 -and later

        - -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. -

        -See also Require and -mod_access. - -


        - -

        ScriptInterpreterSource directive

        - -Syntax: ScriptInterpreterSource registry|script
        -Default: ScriptInterpreterSource script -
        -Context: directory, .htaccess
        -Status: core (Windows only)

        - -This directive is used to control how Apache 1.3.5 and later 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 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 hostname [hostname] ...
        -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 -name-based virtual hosts. - -

        See also: -Apache Virtual Host documentation - -


        - -

        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 -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.example.com
        -would be used if the canonical (main) name of the actual machine -were simple.example.com.

        - -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 Also:
        -DNS Issues
        -Apache virtual host documentation
        -UseCanonicalName
        -NameVirtualHost
        -ServerAlias
        -

        -
        - -

        ServerPath directive

        - -Syntax: ServerPath pathname
        -Context: virtual host
        -Status: core
        -Compatibility: ServerPath is only available in Apache -1.1 and later.

        - -The ServerPath directive sets the legacy URL pathname for a host, for -use with name-based virtual hosts. - -

        See also: -Apache Virtual Host documentation - -


        - -

        ServerRoot directive

        - -Syntax: ServerRoot directory-filename
        -Default: ServerRoot /usr/local/apache
        -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.

        - -See also the -d option to httpd.

        -See also the security tips -for information on how to properly set permissions on the ServerRoot.

        - -


        - -

        ServerSignature directive

        - -Syntax: ServerSignature On|Off|EMail
        -Default: ServerSignature Off
        -Context: server config, virtual host, directory, -.htaccess
        -Status: core
        -Compatibility: ServerSignature is only available in -Apache -1.3 and later.

        - -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 directive

        - -Syntax: ServerTokens Minimal|ProductOnly|OS|Full
        -Default: ServerTokens Full
        -Context: server config
        -Status: core
        -Compatibility: ServerTokens is only available - in Apache 1.3 and later; the ProductOnly keyword is - only available in versions later than 1.3.12 - -

        -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. -

        - -
        - -

        SetInputFilter directive

        -

        Syntax: SetInputFilter filter -[filter] ...
        -Default: none
        -Context: directory
        -Status: core

        - -

        The SetInputFilter directive sets the filters -which will process client requests when they are received by the -server.

        - -

        The order of the arguments determines the order in which the -filters will process the content.

        - -

        See also the Filters documentation.

        - - -


        -

        SetOutputFilter directive

        -

        Syntax: SetOutputFilter filter -[filter] ...
        -Default: none
        -Context: directory
        -Status: core

        - -

        The SetOutputFilter directive sets the filters which -will process responses from the server before they are sent to the -client. For example, the following configuration will process -all files in the /www/data/ directory for -server-side includes.

        - -
        -<Directory /www/data/>
        -  SetOutputFilter INCLUDES
        -</Directory> -
        - -

        The order of the arguments determines the order in which the -filters will process the content.

        - -

        See also the Filters documentation.

        - -


        -

        TimeOut directive

        - -Syntax: TimeOut number
        -Default: TimeOut 300
        -Context: server config
        -Status: core

        - -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. The amount of time between receipt of TCP packets on a POST or - PUT request. -
        3. The amount of time between ACKs on transmissions of TCP packets - in responses. -
        - -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 directive

        - - -Syntax: UseCanonicalName on|off|dns
        - -Default: UseCanonicalName on
        - -Context: server config, virtual host, directory
        - -Override: Options
        - -Compatibility: UseCanonicalName is only available in -Apache 1.3 and later

        - -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 (and in all versions prior to -1.3) Apache will use the ServerName and Port directives 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. - -

        See also: -ServerName, -Port - -


        - -

        <VirtualHost> directive

        - -Syntax: <VirtualHost addr[:port] -[addr[:port]] ...> ... -</VirtualHost>
        -Context: server config
        -Status: Core.
        -Compatibility: Non-IP address-based Virtual Hosting only -available in Apache 1.1 and later.
        -Compatibility: Multiple address support only available in -Apache 1.2 and later.

        - -<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> -
        - -Each VirtualHost 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 -Port 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. - -

        See also: -Apache Virtual Host documentation
        -See also: -Warnings about DNS and Apache
        -See also: -Setting which addresses and ports Apache uses
        -See also: How Directory, -Location and Files sections work for an explanation of how these -different sections are combined when a request is received -

        - - - - - diff --git a/docs/manual/mod/directive-dict.html b/docs/manual/mod/directive-dict.html deleted file mode 100644 index 8b2f6679fb..0000000000 --- a/docs/manual/mod/directive-dict.html +++ /dev/null @@ -1,283 +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, - and is described in detail in the directive's definition. - Generally, the directive name is followed by a series of one or - more arguments. Optional arguments are enclosed in square brackets. - Where an argument can take on more than one possible value, possible - values are separated by a vertical bar. Literal text is presented - in the default font, while argument-types for which substitution - is necessary are emphasized. Directives which can take a variable - number of arguments will end in "..." indicating that the last - argument is repeated. -

        - -
        -

        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>, - <Location>, and <Files> - containers in the server configuration files, subject to the - restrictions outlined in How Directory, - Location and Files sections work. -

        -

        -
        -
        .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 - AllowOverride - directive, and apply to a particular scope (such as a directory) and - all descendants, unless further modified by other - AllowOverride 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. -

        -

        -
        -
        MPM -
        -
        A directive labeled as having "MPM" status is - provided by a Multi-Processing Module. - This type of directive will be available if and only if you are - using one of the MPMs lised on the Module - line of the directive definition. -

        -

        -
        -
        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 8b2f6679fb..0000000000 --- a/docs/manual/mod/directive-dict.html.en +++ /dev/null @@ -1,283 +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, - and is described in detail in the directive's definition. - Generally, the directive name is followed by a series of one or - more arguments. Optional arguments are enclosed in square brackets. - Where an argument can take on more than one possible value, possible - values are separated by a vertical bar. Literal text is presented - in the default font, while argument-types for which substitution - is necessary are emphasized. Directives which can take a variable - number of arguments will end in "..." indicating that the last - argument is repeated. -

        - -
        -

        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>, - <Location>, and <Files> - containers in the server configuration files, subject to the - restrictions outlined in How Directory, - Location and Files sections work. -

        -

        -
        -
        .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 - AllowOverride - directive, and apply to a particular scope (such as a directory) and - all descendants, unless further modified by other - AllowOverride 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. -

        -

        -
        -
        MPM -
        -
        A directive labeled as having "MPM" status is - provided by a Multi-Processing Module. - This type of directive will be available if and only if you are - using one of the MPMs lised on the Module - line of the directive definition. -

        -

        -
        -
        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 40ec1b3cdd..0000000000 --- a/docs/manual/mod/directives.html +++ /dev/null @@ -1,246 +0,0 @@ - - - -Apache directives - - - - - -

        Apache Directives

        -

        -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. -

        - - - - - diff --git a/docs/manual/mod/footer.html b/docs/manual/mod/footer.html deleted file mode 100644 index 4a0991e6fa..0000000000 --- a/docs/manual/mod/footer.html +++ /dev/null @@ -1,8 +0,0 @@ -
        - -

        - Apache HTTP Server Version 2.0 -

        - -Index -Home diff --git a/docs/manual/mod/header.html b/docs/manual/mod/header.html deleted file mode 100644 index 9bc11593a3..0000000000 --- a/docs/manual/mod/header.html +++ /dev/null @@ -1,6 +0,0 @@ -
        - [APACHE DOCUMENTATION] -

        - Apache HTTP Server Version 2.0 -

        -
        diff --git a/docs/manual/mod/index-bytype.html b/docs/manual/mod/index-bytype.html deleted file mode 100644 index 814654c6b7..0000000000 --- a/docs/manual/mod/index-bytype.html +++ /dev/null @@ -1,182 +0,0 @@ - - - -Apache modules - - - - - -

        Apache modules

        - -

        -Below is a list of all of the modules that come as part of the Apache -distribution. See also the list of modules sorted alphabetically and the complete -alphabetical list of all Apache -directives. -

        - -

        Core and Mutli-Processing Modules

        - -
        -
        Core -
        Core Apache features. -
        threaded -
        Multi-Processing Module with Threading via Pthreads; Variable number -of processes, constant number of threads/child -
        mpm_winnt -
        Multi-Processing Module with a single control process and a single -server process with multiple threads for Windows NT -
        perchild -
        Multi-Processing Module with the ability to server different -virtual hosts under different userids. -
        prefork -
        Non-threaded preforking processes model similar to Apache 1.3 -
        - -

        Environment Creation

        - -
        -
        mod_env -
        Passing of environments to CGI scripts -
        mod_setenvif -
        Set environment variables based on client information -
        mod_unique_id -
        Generate unique request identifier for every request -
        - -

        Content Type Decisions

        - -
        -
        mod_mime -
        Determining document types using file extensions. -
        mod_mime_magic -
        Determining document types using "magic numbers". -
        mod_negotiation -
        Content negotiation. -
        mod_charset_lite -
        Configuring character set translation. -
        - -

        URL Mapping

        - -
        -
        mod_alias -
        Mapping different parts of the host filesystem in the document tree, - and URL redirection. -
        mod_rewrite -
        Powerful URI-to-filename mapping using regular expressions -
        mod_userdir -
        User home directories. -
        mod_speling -
        Automatically correct minor typos in URLs -
        mod_vhost_alias -
        Support for dynamically configured mass virtual hosting -
        - -

        Directory Handling

        - -
        -
        mod_dir -
        Basic directory handling. -
        mod_autoindex -
        Automatic directory listings. -
        - -

        Access Control

        - -
        -
        mod_access -
        Access control based on client hostname or IP address. -
        mod_auth -
        User authentication using text files. -
        mod_auth_dbm -
        User authentication using DBM files. -
        mod_auth_db -
        User authentication using Berkeley DB files. -
        mod_auth_anon -
        Anonymous user access to authenticated areas. -
        mod_auth_digest -
        MD5 authentication - -
        - -

        HTTP Response

        - -
        -
        mod_headers -
        Add arbitrary HTTP headers to resources -
        mod_cern_meta -
        Support for HTTP header metafiles. -
        mod_expires -
        Apply Expires: headers to resources -
        mod_asis -
        Sending files which contain their own HTTP headers. -
        - -

        Dynamic Content

        - -
        -
        mod_include -
        Server-parsed documents. -
        mod_cgi -
        Invoking CGI scripts. -
        mod_actions -
        Executing CGI scripts based on media type or request method. -
        mod_isapi -
        Windows ISAPI Extension support -
        mod_ext_filter -
        Filtering content with external programs. -
        - -

        Internal Content Handlers

        - -
        -
        mod_status -
        Server status display -
        mod_info -
        Server configuration information -
        - -

        Logging

        - -
        -
        mod_log_config -
        User-configurable logging replacement for mod_log_common. -
        mod_usertrack -
        User tracking using Cookies -
        - -

        Miscellaneous

        - -
        -
        mod_imap -
        The imagemap file handler. -
        mod_proxy -
        Caching proxy abilities -
        mod_so -
        Support for loading modules at runtime -
        mod_file_cache -
        Caching files in memory for faster serving. -
        mod_dav -
        Class 1,2 WebDAV HTTP extensions -
        - - -

        Development

        - -
        -
        mod_example -
        Demonstrates Apache API -
        - - - - diff --git a/docs/manual/mod/index.html b/docs/manual/mod/index.html deleted file mode 100644 index ee6ea73dd0..0000000000 --- a/docs/manual/mod/index.html +++ /dev/null @@ -1,131 +0,0 @@ - - - -Apache modules - - - - - -

        Apache modules

        - -

        -Below is a list of all of the modules that come as part of the Apache -distribution. See also the list of modules sorted by type and the complete -alphabetical list of all Apache -directives. - -

        - -

        Core Features and Multi-Processing Modules

        - -
        -
        Core -
        Core Apache features. -
        threaded -
        Multi-Processing Module with Threading via Pthreads; Variable number -of processes, constant number of threads/child -
        mpm_winnt -
        Multi-Processing Module with a single control process and a single -server process with multiple threads for Windows NT -
        perchild -
        Multi-Processing Module with the ability to server different -virtual hosts under different userids. -
        prefork -
        Non-threaded preforking processes model similar to Apache 1.3 -
        - -

        Other Modules

        - -
        -
        mod_access -
        Access control based on client hostname or IP address. -
        mod_actions -
        Executing CGI scripts based on media type or request method. -
        mod_alias -
        Mapping different parts of the host filesystem in the document tree, - and URL redirection. -
        mod_asis -
        Sending files which contain their own HTTP headers. -
        mod_auth -
        User authentication using text files. -
        mod_auth_anon -
        Anonymous user access to authenticated areas. -
        mod_auth_db -
        User authentication using Berkeley DB files. -
        mod_auth_dbm -
        User authentication using DBM files. -
        mod_auth_digest -
        MD5 authentication -
        mod_autoindex -
        Automatic directory listings. -
        mod_cern_meta -
        Support for HTTP header metafiles. -
        mod_cgi -
        Invoking CGI scripts. -
        mod_charset_lite -
        Configuring character set translation. -
        mod_dav -
        Class 1,2 WebDAV HTTP extensions -
        mod_dir -
        Basic directory handling. -
        mod_env -
        Passing of environments to CGI scripts -
        mod_example -
        Demonstrates Apache API -
        mod_expires -
        Apply Expires: headers to resources -
        mod_ext_filter -
        Filtering output with external programs. -
        mod_file_cache -
        Caching files in memory for faster serving. -
        mod_headers -
        Add arbitrary HTTP headers to resources -
        mod_imap -
        The imagemap file handler. -
        mod_include -
        Server-parsed documents. -
        mod_info -
        Server configuration information -
        mod_isapi -
        Windows ISAPI Extension support -
        mod_log_config -
        User-configurable logging replacement for mod_log_common. -
        mod_mime -
        Determining document types using file extensions. -
        mod_mime_magic -
        Determining document types using "magic numbers". -
        mod_negotiation -
        Content negotiation. -
        mod_proxy -
        Caching proxy abilities -
        mod_rewrite -
        Powerful URI-to-filename mapping using regular expressions -
        mod_setenvif -
        Set environment variables based on client information -
        mod_so -
        Support for loading modules at runtime -
        mod_speling -
        Automatically correct minor typos in URLs -
        mod_status -
        Server status display -
        mod_userdir -
        User home directories. -
        mod_unique_id -
        Generate unique request identifier for every request -
        mod_usertrack -
        User tracking using Cookies (replacement for mod_cookies.c) -
        mod_vhost_alias -
        Support for dynamically configured mass virtual hosting -
        - - - - diff --git a/docs/manual/mod/mod_access.html b/docs/manual/mod/mod_access.html deleted file mode 100644 index c2a1294ced..0000000000 --- a/docs/manual/mod/mod_access.html +++ /dev/null @@ -1,346 +0,0 @@ - - - -Apache module mod_access - - - - - - -

        Module mod_access

        -

        -This module provides access control based on client hostname, IP -address, or other characteristics of the client request. -

        - -

        Status: Base -
        -Source File: mod_access.c -
        -Module Identifier: access_module -

        - -

        Summary

        - -

        The directives provided by mod_access are used in <Directory>, <Files>, and <Location> sections as -well as .htaccess files -to control access to particular parts of the server. Access -can be controlled based on the client hostname, IP address, -or other characteristics of the client request, as captured -in environment variables. The -Allow and Deny directives are used -to specify which clients are or are not allowed access to the -server, while the Order directive sets the -default access state, and configures how the Allow -and Deny directives interact with each other.

        - -

        Both host-based access restrictions and password-based -authentication may be implemented simultaneously. In -that case, the Satisfy directive -is used to determine how the two sets of restrictions -interact.

        - -

        In general, access restriction directives apply to all access -methods (GET, PUT, POST, etc). -This is the desired behavior in most cases. However, it is possible -to restrict some methods, while leaving other methods unrestricted, by -enclosing the directives in a <Limit> section.

        - -

        Directives

        - - - -

        See also Satisfy - and Require. - -


        - - -

        Allow directive

        -

        - -Syntax: Allow from - all|host|env=variablename - [host|env=variablename] ...
        -Context: directory, .htaccess
        -Override: Limit
        -Status: Base
        -Module: mod_access -

        - -

        -The Allow directive affects which hosts can access an -area of the server. Access can be controlled by hostname, IP Address, -IP Address range, or by other characteristics of the client -request captured in environment variables.

        - -

        The first argument to this directive is always from. -The subsequent arguments can take three different forms. If -Allow from all is specified, then all hosts are allowed -access, subject to the configuration of the Deny and -Order directives as discussed below. To allow only -particular hosts or groups of hosts to access the server, the -host can be specified in any of the following formats:

        -
        - -
        A (partial) domain-name
        Example: Allow from -apache.org
        Hosts whose names match, or end in, this string -are allowed access. Only complete components are matched, so the -above example will match foo.apache.org but it will not -match fooapache.org. This configuration will cause the -server to perform a reverse DNS lookup on the client IP address, -regardless of the setting of the HostNameLookups directive.
        - -
        A full IP address
        -
        Example: Allow from 10.1.2.3
        -An IP address of a host allowed access
        - -
        A partial IP address
        -
        Example: Allow from 10.1
        -The first 1 to 3 bytes of an IP address, for subnet restriction.
        - -
        A network/netmask pair
        -
        Example: Allow from 10.1.0.0/255.255.0.0
        - A network a.b.c.d, and a netmask w.x.y.z. For more fine-grained subnet - restriction.
        - -
        A network/nnn CIDR specification
        Example: Allow -from 10.1.0.0/16
        Similar to the previous case, except the -netmask consists of nnn high-order 1 bits.
        -
        - -

        Note that the last three examples above match exactly the -same set of hosts.

        - -

        The third format of the arguments to the Allow -directive allows access to the server to be controlled based on the -existence of an environment variable. When -Allow from env=variablename is specified, then -the request is allowed access if the environment variable -variablename exists. The server provides the ability to set -environment variables in a flexible way based on characteristics of -the client request using the directives provided by mod_setenvif. Therefore, this directive -can be used to allow access based on such factors as the clients -User-Agent (browser type), Referer, or other -HTTP request header fields.

        - -

        -Example: -

        -
        -SetEnvIf User-Agent ^KnockKnock/2.0 let_me_in
        -<Directory /docroot>
        -    Order Deny,Allow
        -    Deny from all
        -    Allow from env=let_me_in
        -</Directory>
        -
        - -

        In this case, browsers with a user-agent string beginning with -KnockKnock/2.0 will be allowed access, and all others will be -denied.

        -

        -See also Deny, Order -and SetEnvIf. -

        -
        - -

        Deny directive

        -

        - -Syntax: Deny from - all|host|env=variablename - [host|env=variablename] ...
        -Context: directory, .htaccess
        -Override: Limit
        -Status: Base
        -Module: mod_access -

        - -

        This directive allows access to the server to be restricted based -on hostname, IP address, or environment variables. The arguments for -the Deny directive are identical to the arguments for the -Allow directive.

        - -

        See also Allow, Order -and SetEnvIf.

        -
        - -

        Order directive

        -

        - -Syntax: Order ordering
        -Default: Order Deny,Allow
        -Context: directory, .htaccess
        -Override: Limit
        -Status: Base
        -Module: mod_access -

        -

        -The Order directive controls the default access state and -the order in which Allow and Deny directives are evaluated. Ordering is -one of -

        -
        -
        Deny,Allow
        The Deny directives are evaluated -before the Allow directives. Access is allowed -by default. Any client which does not match a Deny -directive or does match an Allow directive will be -allowed access to the server.
        - -
        Allow,Deny
        The Allow directives are -evaluated before the Deny directives. Access is -denied by default. Any client which does not match -an Allow directive or does match a Deny -directive will be denied access to the server.
        - -
        Mutual-failure
        Only those hosts which appear on the -Allow list and do not appear on the Deny -list are granted access. This ordering has the same effect as -Order Allow,Deny and is deprecated in favor of that -configuration.
        -
        - -

        Keywords may only be separated by a comma; no whitespace is allowed -between them. Note that in all cases every Allow -and Deny statement is evaluated.

        - -

        In the following example, all hosts in the apache.org domain are -allowed access; all other hosts are denied access. -

        - -
        - Order Deny,Allow
        - Deny from all
        - Allow from apache.org
        -
        - -

        In the next example, all hosts in the apache.org domain are allowed -access, except for the hosts which are in the foo.apache.org -subdomain, who are denied access. All hosts not in the apache.org -domain are denied access because the default state is to deny access -to the server. -

        - -
        - Order Allow,Deny
        - Allow from apache.org
        - Deny from foo.apache.org
        -
        - -

        On the other hand, if the Order in the last example is -changed to Deny,Allow, all hosts will be allowed access. -This happens because, regardless of the actual ordering of the -directives in the configuration file, the Allow from -apache.org will be evaluated last and will override the -Deny from foo.apache.org. All hosts not in the -apache.org domain will also be allowed access because the -default state will change to allow.

        - -

        The presence of an Order directive can -affect access to a part of the server even in the absence -of accompanying Allow and Deny -directives because of its effect on the default access state. -For example,

        - -
        -<Directory /www>
        -  Order Allow,Deny
        -</Directory> -
        - -

        will deny all access to the /www directory because -the default access state will be set to deny.

        - -

        The Order directive controls the order of access -directive processing only within each phase of the server's -configuration processing. This implies, for example, that an -Allow or Deny directive occurring -in a <Location> section will always be evaluated after -an Allow or Deny directive occurring -in a <Directory> section or .htaccess file, -regardless of the setting of the Order directive. -For details on the merging of configuration sections, -see the documentation on How Directory, -Location and Files sections work.

        - -

        See also: Deny and Allow. - - - diff --git a/docs/manual/mod/mod_actions.html b/docs/manual/mod/mod_actions.html deleted file mode 100644 index 21f503db74..0000000000 --- a/docs/manual/mod/mod_actions.html +++ /dev/null @@ -1,140 +0,0 @@ - - - -Module mod_actions - - - - - -

        Module mod_actions

        - - -

        This module provides for executing CGI scripts based on media type or -request method. -

        - -

        Status: Base -
        -Source File: mod_actions.c -
        -Module Identifier: actions_module -

        - -

        Summary

        -

        -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. -

        - -

        Directives

        - - -
        - -

        Action directive

        -

        -Syntax: Action action-type cgi-script
        -Context: server config, virtual host, directory, - .htaccess
        -Override: FileInfo
        -Status: Base
        -Module: mod_actions -

        -

        -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. -

        -
        - -

        Script directive

        -

        -Syntax: Script method cgi-script
        -Context: server config, virtual host, directory
        -Status: Base
        -Module: mod_actions -

        - -

        -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
        -
        - - - - diff --git a/docs/manual/mod/mod_alias.html b/docs/manual/mod/mod_alias.html deleted file mode 100644 index aa180f338b..0000000000 --- a/docs/manual/mod/mod_alias.html +++ /dev/null @@ -1,415 +0,0 @@ - - - -Apache module mod_alias - - - - - - -

        Module mod_alias

        -

        -This module provides for mapping different parts of the -host filesystem in the document tree, and for URL redirection. -

        - -

        Status: Base -
        -Source File: mod_alias.c -
        -Module Identifier: alias_module -

        - -

        Summary

        - -

        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 to be -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. - - -

        Directives

        - -
        - - -

        Alias directive

        -

        - -Syntax: Alias url-path directory-filename
        -Context: server config, virtual host
        -Status: Base
        -Module: mod_alias -

        -

        -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.) -

        -See also ScriptAlias. -

        -
        - -

        AliasMatch

        -

        -Syntax: AliasMatch regex directory-filename
        -Context: server config, virtual host
        -Status: Base
        -Module: mod_alias -

        - -

        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, -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 directive

        -

        - -Syntax: Redirect [status] - url-path url
        -Context: server config, virtual host, directory, - .htaccess
        -Override: FileInfo
        -Status: Base
        -Module: mod_alias -

        -

        -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

        -

        -Syntax: - RedirectMatch [status] regex url -
        -Context: server config, virtual host, directory, - .htaccess
        -Override: FileInfo
        -Status: Base
        -Module: mod_alias -

        - -

        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, -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 directive

        -

        - -Syntax: RedirectTemp url-path url
        -Context: server config, virtual host, directory, - .htaccess
        -Override: FileInfo
        -Status: Base
        -Module: mod_alias -

        -

        -This directive makes the client know that the Redirect is only -temporary (status 302). Exactly equivalent to Redirect -temp. -

        -
        - -

        RedirectPermanent directive

        -

        - -Syntax: RedirectPermanent url-path url
        -Context: server config, virtual host, directory, - .htaccess
        -Override: FileInfo
        -Status: Base
        -Module: mod_alias -

        -

        -This directive makes the client know that the Redirect is permanent -(status 301). Exactly equivalent to Redirect permanent. -

        -
        - -

        ScriptAlias directive

        -

        - -Syntax: ScriptAlias url-path directory-filename -
        -Context: server config, virtual host
        -Status: Base
        -Module: mod_alias -

        -

        -The ScriptAlias directive has the same behavior 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. -

        - -
        - -

        ScriptAliasMatch

        -

        -Syntax: ScriptAliasMatch - regex directory-filename
        -Context: server config, virtual host
        -Status: Base
        -Module: mod_alias -

        - -

        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, -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 64b1298242..0000000000 --- a/docs/manual/mod/mod_asis.html +++ /dev/null @@ -1,91 +0,0 @@ - - - -Apache module mod_asis - - - - - - -

        Module mod_asis

        - -

        This module provides for sending files which contain their own -HTTP headers. - -

        Status: Base -
        -Source File: mod_asis.c -
        -Module Identifier: asis_module -

        - -

        Summary

        - -

        This module provides the handler send-as-is wich -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. - -

        Directives

        - -

        This module provides no directives. - -

        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.html b/docs/manual/mod/mod_auth.html deleted file mode 100644 index 04508d4468..0000000000 --- a/docs/manual/mod/mod_auth.html +++ /dev/null @@ -1,246 +0,0 @@ - - - -Apache module mod_auth - - - - - - -

        Module mod_auth

        - -

        This module provides for user authentication using text files. - -

        Status: Base -
        -Source File: mod_auth.c -
        -Module Identifier: auth_module -

        - -

        Summary

        - -

        This module allows the use of HTTP Basic Authentication to restrict -access by looking up users in plain text password and group files. -Similar functionality and greater scalability is provided by mod_auth_dbm and mod_auth_db. HTTP Digest Authentication -is provided by mod_auth_digest. - - -

        Directives

        - - - -

        See also: require -and satisfy.

        - -
        - - -

        AuthGroupFile directive

        - -Syntax: AuthGroupFile filename
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Base
        -Module: mod_auth

        - -The AuthGroupFile directive sets the name of a textual file containing the list -of user groups for user authentication. Filename is the path -to the group file. If it is not absolute (i.e., if it -doesn't begin with a slash), it is treated as relative to the ServerRoot. -

        -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; -AuthDBMGroupFile should -be used instead.

        - -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.

        - -See also AuthName, -AuthType and -AuthUserFile.


        - -

        AuthUserFile directive

        - -Syntax: AuthUserFile filename
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Base
        -Module: mod_auth

        - -The AuthUserFile directive sets the name of a textual file containing -the list of users and passwords for user -authentication. Filename is the path to the user -file. If it is not absolute (i.e., if it doesn't begin with a -slash), it is treated as relative to the ServerRoot. -

        Each line of the user file file contains a username followed -by a colon, followed by the crypt() encrypted password. The behavior -of multiple occurrences of the same user is undefined. -

        -The utility htpasswd which is -installed as part of the binary distribution, or which can be found in -src/support, is used to maintain this password file. See -the man page for more details. In short -

        -

        - htpasswd -c Filename username
        - Create a password file 'Filename' with 'username' - as the initial ID. It will prompt for the password. - htpasswd Filename username2
        - Adds or modifies in password file 'Filename' the 'username'. -
        -

        Note that -searching large text files is very inefficient; -AuthDBMUserFile should be -used instead. -

        - -Security: make sure that the AuthUserFile 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 AuthUserFile.

        - -See also AuthName, -AuthType and -AuthGroupFile.

        -


        -

        AuthAuthoritative directive

        - -Syntax: AuthAuthoritative on|off
        -Default: AuthAuthoritative on
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Base
        -Module: mod_auth

        - -Setting the AuthAuthoritative directive explicitly to 'off' -allows for both authentication and authorization to be passed on to -lower level modules (as defined in the Configuration and -modules.c files) if there is no userID or -rule matching the supplied userID. If there is a userID and/or -rule specified; the usual password and access checks will be applied -and a failure will give an Authorization Required reply. - -

        - -So if a userID appears in the database of more than one module; or if -a valid Require directive applies to more than one module; then the -first module will verify the credentials; and no access is passed on; -regardless of the AuthAuthoritative setting. - -

        - -A common use for this is in conjunction with one of the database -modules; such as mod_auth_db.c, mod_auth_dbm.c, -mod_auth_msql.c, and mod_auth_anon.c. These modules -supply the bulk of the user credential checking; but a few -(administrator) related accesses fall through to a lower level with a -well protected AuthUserFile. - -

        - -Default: By default; control is not passed on; and an - unknown -userID or rule will result in an Authorization Required reply. Not -setting it thus keeps the system secure; and forces an NCSA compliant -behaviour. - -

        - -Security: Do consider the implications of allowing a user to allow -fall-through in his .htaccess file; and verify that this is really -what you want; Generally it is easier to just secure a single -.htpasswd file, than it is to secure a database such as mSQL. Make -sure that the AuthUserFile 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 -AuthUserFile. - -

        -See also AuthName, -AuthType and -AuthGroupFile.

        - - - - - diff --git a/docs/manual/mod/mod_auth_anon.html b/docs/manual/mod/mod_auth_anon.html deleted file mode 100644 index d5f28d6db8..0000000000 --- a/docs/manual/mod/mod_auth_anon.html +++ /dev/null @@ -1,322 +0,0 @@ - - - -Apache module mod_auth_anon.c - - - - -

        Module mod_auth_anon

        - -This module allows "anonymous" user access to authenticated areas. - -

        Status: Extension -
        -Source File: mod_auth_anon.c -
        -Module Identifier: anon_auth_module -

        - - -

        Summary

        - -

        This module does access control in a manner similar to -anonymous-ftp sites; i.e. have a 'magic' user id 'anonymous' -and the email address as a password. These email addresses can be -logged.

        - -

        Combined with other (database) access control methods, this allows for -effective user tracking and customization according to a user profile -while still keeping the site open for 'unregistered' users. One advantage -of using Auth-based user tracking is that, unlike magic-cookies and -funny URL pre/postfixes, it is completely browser independent and it -allows users to share URLs.

        - -

        Directives

        - - -

        Example

        - -The example below (when combined with the Auth directives -of a htpasswd-file based (or GDM, mSQL etc.) base access -control system allows users in as 'guests' with the -following properties: -
          -
        • -It insists that the user enters a userId. (Anonymous_NoUserId) -
        • -It insists that the user enters a password. -(Anonymous_MustGiveEmail) -
        • -The password entered must be a valid email address, ie. contain at least one -'@' and a '.'. (Anonymous_VerifyEmail) -
        • -The userID must be one of anonymous guest www test welcome -and comparison is not case sensitive. -
        • -And the Email addresses entered in the passwd field are logged to -the error log file -(Anonymous_LogEmail) -
        -

        -Excerpt of access.conf: -

        -Anonymous_NoUserId off
        -Anonymous_MustGiveEmail on
        -Anonymous_VerifyEmail on
        -Anonymous_LogEmail on
        -Anonymous anonymous guest www test welcome

        -

        -AuthName "Use 'anonymous' & Email address for guest entry"
        -AuthType basic -

        -# An AuthUserFile/AuthDBUserFile/AuthDBMUserFile
        -# directive must be specified, or use
        -# Anonymous_Authoritative for public access.
        -# In the .htaccess for the public directory, add:
        -<Files *>
        -Order Deny,Allow
        -Allow from all
        -

        -Require valid-user
        -</Files>
        -

        - -
        - -

        Anonymous directive

        - -Syntax: Anonymous user [user] ...
        -Default: none
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Extension
        -Module: mod_auth_anon

        - - A list of one or more 'magic' userIDs which are allowed access - without password verification. The userIDs are space separated. - It is possible to use the ' and " quotes to allow a space in - a userID as well as the \ escape character. -

        - Please note that the comparison is case-IN-sensitive. -
        - I strongly suggest that the magic username 'anonymous' - is always one of the allowed userIDs. -

        - Example:
        - - Anonymous anonymous "Not Registered" 'I don\'t know' -

        - This would allow the user to enter without password verification - by using the userId's 'anonymous', 'AnonyMous','Not Registered' and - 'I Don't Know'. -


        - -

        Anonymous_Authoritative directive

        -Syntax: Anonymous_Authoritative on|off
        -Default: Anonymous_Authoritative off
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Extension
        -Module: mod_auth_anon

        - - When set 'on', there is no - fall-through to other authorization methods. So if a - userID does not match the values specified in the - Anonymous directive, access is denied. -

        - Be sure you know what you are doing when you decide to switch - it on. And remember that it is the linking order of the modules - (in the Configuration / Make file) which details the order - in which the Authorization modules are queried. -


        - -

        Anonymous_LogEmail directive

        -Syntax: Anonymous_LogEmail on|off
        -Default: Anonymous_LogEmail on
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Extension
        -Module: mod_auth_anon

        - - When set 'on', the default, the 'password' entered (which hopefully - contains a sensible email address) is logged in the error log. -


        - -

        Anonymous_MustGiveEmail directive

        - -Syntax: Anonymous_MustGiveEmail on|off
        -Default: Anonymous_MustGiveEmail on
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Extension
        -Module: mod_auth_anon

        - - Specifies whether the user must specify an email - address as the password. This prohibits blank passwords. -


        - -

        Anonymous_NoUserID directive

        -Syntax: Anonymous_NoUserID on|off
        -Default: Anonymous_NoUserID off
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Extension
        -Module: mod_auth_anon

        - - When set 'on', users can leave - the userID (and perhaps the password field) empty. This - can be very convenient for MS-Explorer users who can - just hit return or click directly on the OK button; which - seems a natural reaction. - -


        - -

        Anonymous_VerifyEmail directive

        -Syntax: Anonymous_VerifyEmail on|off
        -Default: Anonymous_VerifyEmail off
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Extension
        -Module: mod_auth_anon

        - - When set 'on' the 'password' entered is - checked for at least one '@' and a '.' to encourage users to enter - valid email addresses (see the above Auth_LogEmail). - - - - - - - diff --git a/docs/manual/mod/mod_auth_db.html b/docs/manual/mod/mod_auth_db.html deleted file mode 100644 index 4d57738dcd..0000000000 --- a/docs/manual/mod/mod_auth_db.html +++ /dev/null @@ -1,250 +0,0 @@ - - - -Apache module mod_auth_db - - - - - -

        Module mod_auth_db

        - -

        This module provides for user authentication using Berkeley DB -files.

        - -

        Status: Extension -
        -Source File: mod_auth_db.c -
        -Module Identifier: db_auth_module -

        - -

        Summary

        - -

        This module provides an alternative to DBM files for those systems which support -DB and not DBM. It is only available in Apache 1.1 and later.

        - -

        On some BSD systems (e.g., FreeBSD and NetBSD) dbm is -automatically mapped to Berkeley DB. You can use either mod_auth_dbm or mod_auth_db. The latter -makes it more obvious that it's Berkeley DB. On other platforms where -you want to use the DB library you usually have to install it -first. See http://www.sleepycat.com/ for the -distribution. The interface this module uses is the one from DB -version 1.85 and 1.86, but DB version 2.x can also be used when -compatibility mode is enabled.

        - -

        Directives

        - - - -

        See also: satisfy and -require.

        - -
        - - -

        AuthDBGroupFile directive

        - -Syntax: AuthDBGroupFile filename
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Extension
        -Module: mod_auth_db

        - -The AuthDBGroupFile directive sets the name of a DB file containing the list -of user groups for user authentication. Filename is the absolute path -to the group file.

        - -The group file is keyed on the username. The value for a user is a -comma-separated list of the groups to which the users belongs. There must -be no whitespace within the value, and it must never contain any colons.

        - -Security: make sure that the AuthDBGroupFile 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 -AuthDBGroupFile unless otherwise protected.

        - -Combining Group and Password DB files: In some cases it is easier to -manage a single database which contains both the password and group -details for each user. This simplifies any support programs that need -to be written: they now only have to deal with writing to and locking -a single DBM file. This can be accomplished by first setting the group -and password files to point to the same DB file:

        - -

        -AuthDBGroupFile /www/userbase
        -AuthDBUserFile /www/userbase -
        - -The key for the single DB record is the username. The value consists of

        - -

        -Unix Crypt-ed Password : List of Groups [ : (ignored) ] -
        - -The password section contains the Unix crypt() password as before. This is -followed by a colon and the comma separated list of groups. Other data may -optionally be left in the DB file after another colon; it is ignored by the -authentication module.

        - -See also AuthName, -AuthType and -AuthDBUserFile.


        - -

        AuthDBUserFile directive

        - -Syntax: AuthDBUserFile filename
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Extension
        -Module: mod_auth_db

        - -The AuthDBUserFile directive sets the name of a DB file containing the list -of users and passwords for user authentication. Filename is the -absolute path to the user file.

        - -The user file is keyed on the username. The value for a user is the -crypt() encrypted password, optionally followed by a colon and -arbitrary data. The colon and the data following it will be ignored -by the server.

        - -Security: make sure that the AuthDBUserFile 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 -AuthDBUserFile.

        - -Important compatibility note: The implementation of "dbmopen" in the -apache modules reads the string length of the hashed values from the -DB data structures, rather than relying upon the string being -NULL-appended. Some applications, such as the Netscape web server, -rely upon the string being NULL-appended, so if you are having trouble -using DB files interchangeably between applications this may be a -part of the problem.

        - -

        A perl script called -href="../programs/dbmmanage.html">dbmmanage is included with -Apache. This program can be used to create and update DB format -password files for use with this module.

        - -See also AuthName, -AuthType and -AuthDBGroupFile.

        -


        -

        AuthDBAuthoritative directive

        - -Syntax: AuthDBAuthoritative on|off
        -Default: AuthDBAuthoritative on
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Base
        -Module: mod_auth

        - -Setting the AuthDBAuthoritative directive explicitly to 'off' -allows for both authentication and authorization to be passed on -to lower level modules (as defined in the Configuration -and modules.c file if there is no userID or -rule matching the supplied userID. If there is a userID -and/or rule specified; the usual password and access checks will -be applied and a failure will give an Authorization Required reply. -

        -So if a userID appears in the database of more than one module; or -if a valid Require directive applies to more than one module; then -the first module will verify the credentials; and no access is -passed on; regardless of the AuthAuthoritative setting.

        - -A common use for this is in conjunction with one of the basic auth -modules; such as mod_auth.c. -Whereas this DB module supplies the bulk of the user credential -checking; a few (administrator) related accesses fall through to -a lower level with a well protected .htpasswd file.

        - - -By default, control is not passed on and an unknown -userID or rule will result in an Authorization Required reply. Not -setting it thus keeps the system secure and forces an NCSA compliant -behaviour.

        -Security: Do consider the implications of allowing a user to allow -fall-through in his .htaccess file; and verify that this is really -what you want; Generally it is easier to just secure a single -.htpasswd file, than it is to secure a database which might have -more access interfaces. - -

        -See also AuthName, -AuthType and -AuthDBGroupFile.

        - - - - - diff --git a/docs/manual/mod/mod_auth_dbm.html b/docs/manual/mod/mod_auth_dbm.html deleted file mode 100644 index 43cd444aa6..0000000000 --- a/docs/manual/mod/mod_auth_dbm.html +++ /dev/null @@ -1,242 +0,0 @@ - - - -Apache module mod_auth_dbm - - - - - - -

        Module mod_auth_dbm

        - -

        This module provides for user authentication using DBM files.

        - -

        Status: Extension -
        -Source File: mod_auth_dbm.c -
        -Module Identifier: dbm_auth_module -

        - -

        Summary

        - -

        This module provides for HTTP Basic Authentication, where the -usernames and passwords are stored in DBM type database files. It is -an alternative to the plain text password files provided by mod_auth and the Berkely DB password files -provided by mod_auth_db.

        - -

        Directives

        - - - -

        See also: Satisfy and -Require. -


        - - -

        AuthDBMGroupFile

        - -Syntax: AuthDBMGroupFile filename
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Extension
        -Module: mod_auth_dbm

        - -The AuthDBMGroupFile directive sets the name of a DBM file containing the list -of user groups for user authentication. Filename is the absolute path -to the group file.

        - -The group file is keyed on the username. The value for a user is a -comma-separated list of the groups to which the users belongs. There must -be no whitespace within the value, and it must never contain any colons.

        - -Security: make sure that the AuthDBMGroupFile 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 -AuthDBMGroupFile unless otherwise protected.

        - -Combining Group and Password DBM files: In some cases it is easier to -manage a single database which contains both the password and group -details for each user. This simplifies any support programs that need -to be written: they now only have to deal with writing to and locking -a single DBM file. This can be accomplished by first setting the group -and password files to point to the same DBM:

        - -

        -AuthDBMGroupFile /www/userbase
        -AuthDBMUserFile /www/userbase -
        - -The key for the single DBM is the username. The value consists of

        - -

        -Unix Crypt-ed Password : List of Groups [ : (ignored) ] -
        - -The password section contains the Unix crypt() password as before. This is -followed by a colon and the comma separated list of groups. Other data may -optionally be left in the DBM file after another colon; it is ignored by the -authentication module. This is what www.telescope.org uses for its combined -password and group database.

        - -See also AuthName, -AuthType and -AuthDBMUserFile.


        - -

        AuthDBMUserFile

        - -Syntax: AuthDBMUserFile filename
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Extension
        -Module: mod_auth_dbm

        - -The AuthDBMUserFile directive sets the name of a DBM file containing the list -of users and passwords for user authentication. Filename is the -absolute path to the user file.

        - -The user file is keyed on the username. The value for a user is the -crypt() encrypted password, optionally followed by a colon and -arbitrary data. The colon and the data following it will be ignored -by the server.

        - -Security: make sure that the AuthDBMUserFile 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 -AuthDBMUserFile.

        - -Important compatibility note: The implementation of "dbmopen" in the -apache modules reads the string length of the hashed values from the -DBM data structures, rather than relying upon the string being -NULL-appended. Some applications, such as the Netscape web server, -rely upon the string being NULL-appended, so if you are having trouble -using DBM files interchangeably between applications this may be a -part of the problem.

        - -

        A perl script called -href="../programs/dbmmanage.html">dbmmanage is included with -Apache. This program can be used to create and update DBM format -password files for use with this module.

        - -See also AuthName, -AuthType and -AuthDBMGroupFile.

        - -


        -

        AuthDBMAuthoritative

        - -Syntax: AuthDBMAuthoritative on|off
        -Default: AuthDBMAuthoritative on
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Extension
        -Module: mod_auth_dbm

        - -Setting the AuthDBMAuthoritative directive explicitly to 'off' -allows for both authentication and authorization to be passed on -to lower level modules (as defined in the Configuration -and modules.c file if there is no userID or -rule matching the supplied userID. If there is a userID -and/or rule specified; the usual password and access checks will -be applied and a failure will give an Authorization Required reply. -

        -So if a userID appears in the database of more than one module; or -if a valid Require directive applies to more than one module; then -the first module will verify the credentials; and no access is -passed on; regardless of the AuthAuthoritative setting.

        - -A common use for this is in conjunction with one of the basic auth -modules; such as mod_auth.c. -Whereas this DBM module supplies the bulk of the user credential -checking; a few (administrator) related accesses fall through to -a lower level with a well protected .htpasswd file.

        - - -By default, control is not passed on and an unknown userID or rule -will result in an Authorization Required reply. Not setting it thus -keeps the system secure and forces an NCSA compliant behaviour.

        - -Security: Do consider the implications of allowing a user to allow -fall-through in his .htaccess file; and verify that this is really -what you want; Generally it is easier to just secure a single -.htpasswd file, than it is to secure a database which might have -more access interfaces. - -

        -See also AuthName, -AuthType and -AuthDBMGroupFile.

        - - - - - diff --git a/docs/manual/mod/mod_auth_digest.html b/docs/manual/mod/mod_auth_digest.html deleted file mode 100644 index 5cda2a778b..0000000000 --- a/docs/manual/mod/mod_auth_digest.html +++ /dev/null @@ -1,412 +0,0 @@ - - - -Apache module mod_auth_digest - - - - - -

        Module mod_auth_digest

        - -

        This module provides for user authentication using MD5 Digest -Authentication.

        - -

        Status: Experimental -
        -Source File: mod_auth_digest.c -
        -Module Identifier: digest_auth_module -

        - -

        Summary

        - -

        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). - -

        Directives

        - - - -

        See also: Require and -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 (July 1999), the only major browsers which -support digest authentication are Internet Explorer 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. - - -


        - - - - -

        AuthDigestFile directive

        -Syntax: AuthDigestFile filename
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Experimental
        -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 directive

        -Syntax: AuthDigestGroupFile filename
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Experimental
        -Module: mod_auth_digest - -

        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 directive

        -Syntax: AuthDigestQop none|auth|auth-int -[auth|auth-int]
        -Default: AuthDigestQop auth
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Experimental
        -Module: mod_auth_digest - -

        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 -directive

        -Syntax: AuthDigestNonceLifetime seconds
        -Default: AuthDigestNonceLifetime 300
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Experimental
        -Module: mod_auth_digest - -

        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 directive

        -Syntax: AuthDigestNonceFormat ???
        -Default: AuthDigestNonceFormat ???
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Experimental
        -Module: mod_auth_digest - -

        Not implemented yet. - - -


        -

        AuthDigestNcCheck directive

        -Syntax: AuthDigestNcCheck On|Off
        -Default: AuthDigestNcCheck Off
        -Context: server config
        -Override: Not applicable
        -Status: Experimental
        -Module: mod_auth_digest - -

        Not implemented yet. - - -


        -

        AuthDigestAlgorithm directive

        -Syntax: AuthDigestAlgorithm MD5|MD5-sess
        -Default: AuthDigestAlgorithm MD5
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Experimental
        -Module: mod_auth_digest - -

        The AuthDigestAlgorithm directive selects the algorithm used to calculate -the challenge and response hashes. - -

        MD5-sess is not correctly implemented yet. - - -


        -

        AuthDigestDomain directive

        -Syntax: AuthDigestDomain URI -[URI] ...
        -Context: directory, .htaccess
        -Override: AuthConfig
        -Status: Experimental
        -Module: mod_auth_digest - -

        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 fa6c224e71..0000000000 --- a/docs/manual/mod/mod_autoindex.html +++ /dev/null @@ -1,900 +0,0 @@ - - - -Apache module mod_autoindex - - - - - -

        Module mod_autoindex

        - -This module provides for automatic directory indexing. - -

        Status: Base -
        -Source File: mod_autoindex.c -
        -Module Identifier: autoindex_module -

        - - -

        Summary

        - -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. -

        -If -FancyIndexing -is enabled, or the FancyIndexing keyword is present on 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. -

        -

        -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". -

        - - -

        Directives

        - - - -

        See also: Options and DirectoryIndex.

        - -
        - -

        AddAlt directive

        - -Syntax: AddAlt string file -[file] ...
        -Context: server config, virtual host, directory, - .htaccess
        -Override: Indexes
        -Status: Base
        -Module: mod_autoindex

        - -This sets 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 or has image loading disabled. - -


        -

        AddAltByEncoding directive

        - -Syntax: AddAltByEncoding string MIME-encoding - [MIME-encoding] ...
        -Context: server config, virtual host, directory, - .htaccess
        -Override: Indexes
        -Status: Base
        -Module: mod_autoindex

        - -This sets 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 or has image loading disabled. - -


        -

        AddAltByType directive

        - -Syntax: AddAltByType string MIME-type - [MIME-type] ...
        -Context: server config, virtual host, directory, - .htaccess
        -Override: Indexes
        -Status: Base
        -Module: mod_autoindex

        - -This 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 or has image loading disabled. - -


        - -

        AddDescription directive

        - -Syntax: AddDescription string file - [file] ...
        -Context: server config, virtual host, directory, - .htaccess
        -Override: Indexes
        -Status: Base
        -Module: mod_autoindex

        - -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 description field is 23 bytes wide. 7 more bytes may be -added if the directory is covered by an -IndexOptions SuppressSize, and 19 bytes may be -added if IndexOptions SuppressLastModified is -in effect. The widest this column can be is therefore 49 bytes. -

        -As of Apache 1.3.10, the -DescriptionWidth -IndexOptions keyword allows you to adjust this width -to any arbitrary size. -
        -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 directive

        - -Syntax: AddIcon icon name - [name] ...
        -Context: server config, virtual host, directory, - .htaccess
        -Override: Indexes
        -Status: Base
        -Module: mod_autoindex

        - -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 directive

        - -Syntax: AddIconByEncoding icon MIME-encoding - [MIME-encoding] ...
        -Context: server config, virtual host, directory, - .htaccess
        -Override: Indexes
        -Status: Base
        -Module: mod_autoindex

        - -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 directive

        - -Syntax: AddIconByType icon MIME-type - [MIME-type] ...
        -Context: server config, virtual host, directory, - .htaccess
        -Override: Indexes
        -Status: Base
        -Module: mod_autoindex

        - -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 directive

        - -Syntax: DefaultIcon url
        -Context: server config, virtual host, directory, - .htaccess
        -Override: Indexes
        -Status: Base
        -Module: mod_autoindex

        - -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 -


        - -

        FancyIndexing directive

        - -Syntax: FancyIndexing on|off
        -Context: server config, virtual host, directory, - .htaccess
        -Override: Indexes
        -Status: Base
        -Module: mod_autoindex -

        -The FancyIndexing directive sets the FancyIndexing option for a directory. -The IndexOptions directive should be used in -preference. -

        -
        - Note that in versions of Apache prior to 1.3.2, the - FancyIndexing and - IndexOptions directives will override each other. You - should use IndexOptions FancyIndexing in preference - to the standalone FancyIndexing directive. - As of Apache 1.3.2, a standalone FancyIndexing directive - is combined with any IndexOptions directive already - specified for the current scope. -
        -
        - -

        HeaderName directive

        - -Syntax: HeaderName filename
        -Context: server config, virtual host, directory, - .htaccess
        -Override: Indexes
        -Status: Base
        -Module: mod_autoindex -
        - Compatibility: some features only available after - 1.3.6; see text - -

        -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. -

        -
        Apache 1.3.6 and earlier: -The module first attempts to include filename.html -as an HTML document, otherwise it will try to include filename as -plain text. Filename is treated as a filesystem path relative -to the directory being indexed. In no case is SSI processing done. -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. -
        -
        Apache versions after 1.3.6: -Filename is treated as a URI path relative to the one used -to access the directory being indexed, and 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). -
        -

        -See also ReadmeName. -


        - -

        IndexIgnore directive

        - -Syntax: IndexIgnore file [file] ...
        -Context: server config, virtual host, directory, - .htaccess
        -Override: Indexes
        -Status: Base
        -Module: mod_autoindex

        - -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 directive

        - -Syntax: IndexOptions option - [option] ... (Apache 1.3.2 and earlier) -
        -Syntax: IndexOptions [+|-]option - [[+|-]option] ... (Apache 1.3.3 and later) -
        -Context: server config, virtual host, directory, - .htaccess
        -Override: Indexes
        -Status: Base
        -Module: mod_autoindex -
        -Compatibility: '+/-' syntax and merging of multiple - IndexOptions directives is only available with - Apache 1.3.3 and later; the FoldersFirst and - DescriptionWidth options are only - available with Apache 1.3.10 and later -

        - -The IndexOptions directive specifies the behavior of the directory indexing. -Option can be one of -

        -
        DescriptionWidth=[n | *] - (Apache 1.3.10 and later) -
        -The DescriptionWidth keyword allows you to specify the -width of the description column in characters. If the keyword value -is '*', then the column is automatically sized to the -length of the longest filename in the display. -See the section on AddDescription -for dangers inherent in truncating descriptions.
        -
        FancyIndexing -
        -This turns on fancy indexing of directories. -
        - Note that in versions of Apache prior to 1.3.2, the - FancyIndexing and - IndexOptions directives will override each other. You - should use IndexOptions FancyIndexing in preference - to the standalone FancyIndexing directive. - As of Apache 1.3.2, a standalone FancyIndexing directive - is combined with any IndexOptions directive already - specified for the current scope. -
        -
        FoldersFirst - (Apache 1.3.10 and later)
        -
        -If this option is enabled, subdirectories in a FancyIndexed listing -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.
        -
        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. -
        IconsAreLinks -
        - -This makes the icons part of the anchor for the filename, for -fancy indexing. -
        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. -
        NameWidth=[n | *] (Apache 1.3.2 and later) -
        -The NameWidth keyword allows you to specify the width of the -filename column in bytes. If the keyword value is '*', -then the column is automatically sized to the length of the longest -filename in the display. -
        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
        -
        -
        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 -
        - -If specified, Apache will not make the column headings in a FancyIndexed -directory listing into links for sorting. The default behaviour is -for them to be links; selecting the column heading will sort the directory -listing by the values in that column. -Only available in Apache 1.3 and later. -
        SuppressDescription -
        - -This will suppress the file description in fancy indexing listings. -
        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. -
        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. -
        -

        -There are some noticeable differences in the behaviour of this -directive in recent (post-1.3.0) versions of Apache. -

        -
        -
        Apache 1.3.2 and earlier:
        -
        -

        -The 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. -

        -
        -
        Apache 1.3.3 and later:
        -
        -

        -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 either '+' or '-' prefixes. -

        -
        -
        - -
        - -

        IndexOrderDefault directive

        - -Syntax: IndexOrderDefault - Ascending|Descending Name|Date|Size|Description -
        -Context: server config, virtual host, directory, - .htaccess -
        -Override: Indexes -
        -Status: Base -
        -Module: mod_autoindex -
        -Compatibility: IndexOrderDefault is only available in -Apache 1.3.4 and later. - -

        -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 directive

        - -Syntax: ReadmeName filename
        -Context: server config, virtual host, directory, - .htaccess
        -Override: Indexes
        -Status: Base
        -Module: mod_autoindex -
        - Compatibility: some features only available after - 1.3.6; see text - -

        -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. -

        -
        -The filename argument is treated as a stub filename -in Apache 1.3.6 and earlier, and as a relative URI in later versions. -Details of how it is handled may be found under the description of -the HeaderName directive, which uses the -same mechanism and changed at the same time as ReadmeName. -
        -

        See also HeaderName.

        - - - - - diff --git a/docs/manual/mod/mod_cern_meta.html b/docs/manual/mod/mod_cern_meta.html deleted file mode 100644 index e210c7558e..0000000000 --- a/docs/manual/mod/mod_cern_meta.html +++ /dev/null @@ -1,169 +0,0 @@ - - - -Module mod_cern_meta - - - - - -

        Apache module mod_cern_meta

        - -

        This module provides for CERN httpd metafile semantics.

        - -

        Status: Extension -
        -Source File: mod_cern_meta.c -
        -Module Identifier: cern_meta_module -
        -Compatibility: 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

        - - -
        - -

        MetaFiles directive

        -Syntax: MetaFiles on|off
        -Default: MetaFiles off
        -Context: per-directory config
        -Status: Base
        -Module: mod_cern_meta
        -Compatibility: MetaFiles is only available in Apache 1.3 -and later.

        - -Turns on/off Meta file processing on a per-directory basis. This option was introduced in Apache 1.3. - -


        - -

        MetaDir directive

        -Syntax: MetaDir directory
        -Default: MetaDir .web
        -Context: (Apache prior to 1.3) server config
        -Context: (Apache 1.3) per-directory 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 directive

        -Syntax: MetaSuffix suffix
        -Default: MetaSuffix .meta
        -Context: (Apache prior to 1.3) server config
        -Context: (Apache 1.3) per-directory 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. - -

        - - - - - diff --git a/docs/manual/mod/mod_cgi.html b/docs/manual/mod/mod_cgi.html deleted file mode 100644 index 6571305e43..0000000000 --- a/docs/manual/mod/mod_cgi.html +++ /dev/null @@ -1,242 +0,0 @@ - - - -Apache module mod_cgi - - - - - - -

        Module mod_cgi

        - -

        This module provides for execution of CGI scripts.

        - -

        Status: Base -
        -Source File: mod_cgi.c -
        -Module Identifier: cgi_module -

        - - -

        Summary

        - - - -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. - -

        Directives

        - - - -

        See also: Options, ScriptAlias, AddType and AddHandler. - -

        CGI Environment variables

        -The server will set the CGI environment variables as described in the -CGI specification, with the -following provisions: -
        -
        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 directive

        - -Syntax: ScriptLog filename
        -Default: none
        -Context: server config
        -Status: mod_cgi -

        - -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 directive

        - -Syntax: ScriptLogLength bytes
        -Default: 10385760
        -Context: server config
        -Status: mod_cgi -

        - -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

        - -Syntax: ScriptLogBuffer bytes
        -Default: 1024
        -Context: server config
        -Status: mod_cgi -

        - -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. - - - - - diff --git a/docs/manual/mod/mod_charset_lite.html b/docs/manual/mod/mod_charset_lite.html deleted file mode 100644 index 42a8774cc8..0000000000 --- a/docs/manual/mod/mod_charset_lite.html +++ /dev/null @@ -1,285 +0,0 @@ - - - - Apache module mod_charset_lite - - - - -

        Module mod_charset_lite

        - -

        This module provides the ability to specify character set - translation or recoding.

        - -

        Status: Experimental -
        -Source File: mod_charset_lite.c -
        -Module Identifier: charset_lite_module -

        - -

        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. -

        - -

        This module will only work if APACHE_XLATE is defined - at compile time.

        - -

        - This module provides a small subset of configuration mechanisms - implemented by Russian Apache and its associated mod_charset. -

        - -

        Directives

        - - -

        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

        -

        - Syntax: CharsetSourceEnc charset -
        - Default: None -
        - Context: directory, virtual host -
        - Override: FileInfo -
        - Status: Experimental -
        - Module: mod_charset_lite -
        - -

        - 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 -
        - -

        - 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

        -

        - Syntax: CharsetOptions option - [option] ... -
        - Default: DebugLevel=0 NoImplicitAdd -
        - Context: directory, virtual host -
        - Override: FileInfo -
        - Status: Experimental -
        - Module: mod_charset_lite -
        - -

        - 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. -
        -

        - - - - - diff --git a/docs/manual/mod/mod_dav.html b/docs/manual/mod/mod_dav.html deleted file mode 100644 index 52814c34b2..0000000000 --- a/docs/manual/mod/mod_dav.html +++ /dev/null @@ -1,253 +0,0 @@ - - - -Apache module mod_dav - - - - - -

        Module mod_dav

        - -

        This module provides Distributed Authoring and Versioning -(WebDAV) functionality.

        - -Status: Extension -
        -Source File: mod_dav.c -
        -Module Identifier: dav_module - -

        Summary

        - -

        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 writeable filename, without an extension) -
        - - - -

        Directives

        - - -
        - -

        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 filename
        -Default: - None
        -Context: server config, virtual host
        -Status: extension
        -Module: mod_dav - -

        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 - -

        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 - -

        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_dir.html b/docs/manual/mod/mod_dir.html deleted file mode 100644 index 672f333e16..0000000000 --- a/docs/manual/mod/mod_dir.html +++ /dev/null @@ -1,119 +0,0 @@ - - - -Apache module mod_dir - - - - - -

        Module mod_dir

        - -

        This module provides for "trailing slash" redirects and serving -directory index files.

        - -

        Status: Base -
        -Source File: mod_dir.c -
        -Module Identifier: dir_module -

        - -

        Summary

        -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/. - -

        Directives

        - - -
      • DirectoryIndex -
      • -
        - -

        DirectoryIndex directive

        - -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 / -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.

        - - - - - diff --git a/docs/manual/mod/mod_env.html b/docs/manual/mod/mod_env.html deleted file mode 100644 index 3d6d610fe9..0000000000 --- a/docs/manual/mod/mod_env.html +++ /dev/null @@ -1,159 +0,0 @@ - - - -Apache module mod_env - - - - - -

        Apache module mod_env

        - -

        This module provides for modifying the environment which -is passed to CGI scripts and SSI pages.

        - -

        Status: Base -
        -Source File: mod_env.c -
        -Module Identifier: env_module -
        -Compatibility: Available in Apache 1.1 and later. -

        - -

        Summary

        - -

        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.

        - -

        For additional information, we provide a document on -Environment Variables in Apache.

        - -

        Directives

        - - -
        - -

        PassEnv directive

        -Syntax: PassEnv variable - [variable] ...
        -Context: server config, virtual host
        -Status: Base
        -Module: mod_env
        -Compatibility: PassEnv is only available in -Apache 1.1 and later.

        - -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 directive

        -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 and SSI pages. Example: -

        -    SetEnv SPECIAL_PATH /foo/bin
        -
        - -
        - -

        UnsetEnv directive

        -Syntax: UnsetEnv variable - [variable] ...
        -Context: server config, virtual host
        -Status: Base
        -Module: mod_env
        -Compatibility: UnsetEnv is only available in -Apache 1.1 and later.

        - -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 79d3a8751f..0000000000 --- a/docs/manual/mod/mod_example.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - Apache module mod_example - - - - - -
        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. -
        - -

        Module mod_example

        -

        - This module 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. -

        - -

        Status: Extension -
        -Source File: mod_example.c -
        -Module Identifier: example_module -
        -Compatibility: Available in Apache 1.2 and later. -

        - - -

        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 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. -

        -

        Directives

        -

        -

        -

        - -

        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 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. -

        - -
        -

        - Example directive -

        -

        - Syntax: Example -
        - Default: None -
        - Context: server config, virtual host, directory, - .htaccess -
        - Override: Options -
        - Status: Extension -
        - Module: mod_example -
        - Compatibility: Example is only - available in Apache 1.2 and later. -

        -

        - 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 c80b194ae0..0000000000 --- a/docs/manual/mod/mod_expires.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - Apache module mod_expires - - - - -

        Module mod_expires

        -

        - This module provides for the generation of Expires HTTP - headers according to user-specified criteria. -

        - -

        Status: Extension -
        -Source File: mod_expires.c -
        -Module Identifier: expires_module -
        -Compatibility: Available in Apache 1.2 and later. -

        - - -

        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

        -

        -

        - -

        - 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 directive -

        - -

        - Syntax: ExpiresActive on|off -
        - 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. -

        -

        - You can also specify the expiration time calculation using an - alternate syntax, - described later in this document. -

        -
        -

        - 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, 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 d6f663fdc3..0000000000 --- a/docs/manual/mod/mod_ext_filter.html +++ /dev/null @@ -1,292 +0,0 @@ - - - - Apache module mod_ext_filter - - - - -

        Module mod_ext_filter

        - -

        This module provides the ability to pass the response body - through an external program before delivering to the client.

        - -

        Status: Experimental -
        -Source File: mod_ext_filter.c -
        -Module Identifier: ext_filter_module

        - - -

        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

        - - - -

        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-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
        -  SetOutputFilter 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
        -  SetOutputFilter slowdown slowdown slowdown
        -
        -  </Location>
        -  
        - -
        - -

        ExtFilterDefine

        -

        - Syntax: ExtFilterDefine filtername parameters -
        - Default: None -
        - Context: server -
        - Override: none -
        - Status: Experimental -
        - Module: mod_ext_filter - -

        - 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

        -

        - Syntax: ExtFilterOptions option - [option] ... -
        - Default: DebugLevel=0 NoLogStderr -
        - Context: directory -
        - Override: none -
        - Status: Experimental -
        - Module: mod_ext_filter - -

        - 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. - -

        - - - - diff --git a/docs/manual/mod/mod_file_cache.html b/docs/manual/mod/mod_file_cache.html deleted file mode 100644 index 8e8b34325b..0000000000 --- a/docs/manual/mod/mod_file_cache.html +++ /dev/null @@ -1,268 +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 [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 [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_headers.html b/docs/manual/mod/mod_headers.html deleted file mode 100644 index da1d7e19bc..0000000000 --- a/docs/manual/mod/mod_headers.html +++ /dev/null @@ -1,147 +0,0 @@ - - - -Apache module mod_headers - - - - - -

        Module mod_headers

        - -

        This module provides for the customization of HTTP -response headers.

        - -

        Status: Extension -
        -Source File: mod_headers.c -
        -Module Identifier: headers_module -
        -Compatibility: Available in Apache 1.2 and later. -

        - -

        Summary

        - -This module provides a directive to control the sending of HTTP -headers. Headers can be merged, replaced or removed. - -

        Directives

        - - -
        - -

        Header directive

        -Syntax: Header set|append|add - header value
        -Syntax: Header unset header
        -Context: server config, virtual host, access.conf, - .htaccess
        -Override: FileInfo
        -Status: Extension
        -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 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. -
        - -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_imap.html b/docs/manual/mod/mod_imap.html deleted file mode 100644 index d8e6719feb..0000000000 --- a/docs/manual/mod/mod_imap.html +++ /dev/null @@ -1,349 +0,0 @@ - - - -Apache module mod_imap - - - - - -

        Module mod_imap

        - -

        This module provides for server-side imagemap processing.

        - -

        Status: Base -
        -Source File: mod_imap.c -
        -Module Identifier: imap_module -
        -Compatibility: Available in Apache 1.1 and later. -

        - - - -

        Summary

        - -

        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. - -

        Directives

        - - -

        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 directive

        -Syntax: ImapMenu - none|formatted|semiformatted|unformatted
        -Context: server config, virtual host, directory, .htaccess
        -Override: Indexes
        -Module: mod_imap
        -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 directive

        -Syntax: ImapDefault - error|nocontent|map|referer|URL
        -Context: server config, virtual host, directory, .htaccess
        -Override: Indexes
        -Module: mod_imap
        -Compatibility: ImapDefault is only available in Apache -1.1 and later.

        - - -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 directive

        -Syntax: ImapBase map|referer|URL
        -Context: server config, virtual host, directory, .htaccess
        -Override: Indexes
        -Module: mod_imap
        -Compatibility: ImapBase is only available in Apache -1.1 and later.

        - -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/. - - - - - - - diff --git a/docs/manual/mod/mod_include.html b/docs/manual/mod/mod_include.html deleted file mode 100644 index b296e77c66..0000000000 --- a/docs/manual/mod/mod_include.html +++ /dev/null @@ -1,469 +0,0 @@ - - - -Apache module mod_include - - - - - - -

        Module mod_include

        - -

        This module provides for server-parsed html documents.

        - -

        Status: Base -
        -Source File: mod_include.c -
        -Module Identifier: includes_module -

        - -

        Summary

        - -

        This module provides a handler 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.

        - -

        Directives

        - - -

        See also: Options -and AddHandler.

        - - -

        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
        -<FilesMatch "\.shtml[.$]">
        -  SetOutputFilter INCLUDES
        -</FilesMatch> -
        - -

        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 -
        - -

        Alternatively the XBitHack -directive can be used to parse normal (text/html) files, -based on file permissions.

        - -

        For backwards compatibility, documents with mime type -text/x-server-parsed-html or -text/x-server-parsed-html3 will also be parsed -(and the resulting output given the mime type text/html) -as will documents with the handler server-parsed. - -

        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.

        -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. - -
        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. No attributes. -
        For example: <!--#printenv --> -
        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" --> -
        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, à 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. -

        - -


        - -

        XBitHack directive

        - -Syntax: XBitHack on|off|full
        -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. -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 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 this, for example, when you -#include a CGI that produces different output on each hit -(or potentially depends on the hit). -

        -

        - - - - - diff --git a/docs/manual/mod/mod_info.html b/docs/manual/mod/mod_info.html deleted file mode 100644 index 3fe67d3ce2..0000000000 --- a/docs/manual/mod/mod_info.html +++ /dev/null @@ -1,127 +0,0 @@ - - - -Apache module mod_info - - - - - -

        Module mod_info

        - -

        This module provides a comprehensive overview of the server -configuration including all installed modules and directives in the -configuration files.

        - -

        Status: Extension -
        -Source File: mod_info.c -
        -Module Identifier: info_module -
        -Compatibility: Available in Apache 1.1 and later. -

        - -

        Directives

        - - -

        Using mod_info

        - -

        -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

        -

        - - 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

        -Syntax: AddModuleInfo module-name string
        -Context: server config, virtual host
        -Status: Extension
        -Module: mod_info
        -Compatibility: 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 a81ad4d258..0000000000 --- a/docs/manual/mod/mod_isapi.html +++ /dev/null @@ -1,376 +0,0 @@ - - - -Apache module mod_isapi - - - - - - -

        Module mod_isapi

        - -

        This module supports ISAPI Extensions within Apache for Windows.

        - -

        Status: Base -
        -Source File: mod_isapi.c -
        -Module Identifier: isapi_module -
        -Compatibility: WIN32 only -

        - -

        Summary

        - -

        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.

        - -

        Directives

        - - -

        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.

        - -
        - -

        ISAPIFileCache directive

        - -Syntax: ISAPIFileCache file [file] ...
        -Context: server config
        -Override: None
        -Status: Base
        -Module: mod_isapi
        -Compatibility: Apache 2.0 and later, Win32 only

        - - 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 directive

        - -Syntax: ISAPIReadAheadBuffer size
        -Default: 49152
        -Context: server config
        -Override: None
        -Status: Base
        -Module: mod_isapi
        -Compatibility: Apache 1.3.13 and later, Win32 only

        - - - Defines the maximum size of the Read Ahead Buffer sent to - ISAPI extentions when they are initally 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 extention's - author. -

        -


        - -

        ISAPILogNotSupported directive

        - -Syntax: ISAPILogNotSupported on|off
        -Default: on
        -Context: server config
        -Override: None
        -Status: Base
        -Module: mod_isapi
        -Compatibility: Apache 1.3.13 and later, Win32 only

        - - Logs all requests for unsupported features from ISAPI extentions - 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 directive

        - -Syntax: ISAPIAppendLogToErrors on|off
        -Default: off
        -Context: server config
        -Override: None
        -Status: Base
        -Module: mod_isapi
        -Compatibility: Apache 1.3.13 and later, Win32 only

        - - Record HSE_APPEND_LOG_PARAMETER requests from ISAPI extentions - to the server error log. -

        -


        - -

        ISAPIAppendLogToQuery directive

        - -Syntax: ISAPIAppendLogToQuery on|off
        -Default: off
        -Context: server config
        -Override: None
        -Status: Base
        -Module: mod_isapi
        -Compatibility: Apache 1.3.13 and later, Win32 only

        - - Record HSE_APPEND_LOG_PARAMETER requests from ISAPI extentions - to the query field (appended to the CustomLog %q component). -

        - - - - diff --git a/docs/manual/mod/mod_log_config.html b/docs/manual/mod/mod_log_config.html deleted file mode 100644 index c007eb7281..0000000000 --- a/docs/manual/mod/mod_log_config.html +++ /dev/null @@ -1,476 +0,0 @@ - - - -Apache module mod_log_config - - - - - -

        Module mod_log_config

        -

        -This module provides for logging of the requests made to -the server, using the Common Log Format or a user-specified format. -

        - -

        Status: Base -
        -Source File: mod_log_config.c -
        -Module Identifier: config_log_module -

        - - -

        Summary

        - -

        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. -

        - -

        Directives

        - - - -

        Log File Formats

        - -

        Unless told otherwise with LogFormat, the log files -created by TransferLog will be in standard "Common Log -Format" (CLF). The contents of each line in a CLF file are explained -below. Alternatively, the log file can be customized (and if multiple -log files are used, each can have a different format). Custom formats -are set with LogFormat and CustomLog.

        - -

        Common Log Format

        - -

        The Common Log Format (CLF) file contains a separate line for each -request. A line is composed of several tokens separated by spaces:

        - -
        -host ident authuser date request status bytes -
        -If a token does not have a value then it is represented by a hyphen (-). -The meanings and values of these tokens are as follows: -
        -
        host -
        The fully-qualified domain name of the client, or its IP number if the -name is not available. -
        ident -
        If IdentityCheck is enabled and the -client machine runs identd, then this is the identity information reported -by the client. -
        authuser -
        If the request was for an password protected document, then this is -the userid used in the request. -
        date -
        The date and time of the request, in the following format: -
        date = [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
        -
        request -
        The request line from the client, enclosed in double quotes -("). -
        status -
        The three digit status code returned to the client. -
        bytes -
        The number of bytes in the object returned to the client, not including -any headers. -
        - -

        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.
        -%...c:          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.
        -%...{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
        -%...H		The 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.
        -%...v:          The canonical ServerName of the server serving the request.
        -%...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). 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 Port 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.

        - -

        Using Multiple Log Files

        - -

        The TransferLog and CustomLog directives can -be given more than once to log requests to multiple log files. Unless -the conditional form of CustomLog is used, each -request will be logged to all the log files defined by either of these -directives.

        - -

        Use with Virtual Hosts

        - -

        If a <VirtualHost> section does not contain any -TransferLog or CustomLog directives, the -logs defined for the main server will be used. If it does -contain one or more of these directives, requests serviced by -this virtual host will only be logged in the log files defined -within its definition, not in any of the main server's log files. -See the examples below.

        - -

        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.

        - -

        Resetting the Log Files

        - -

        The access log file typically grows 1MB or more for each 10,000 -requests. It will probably be necessary to move or delete the log -file on a regular basis. This cannot be done while the server is -still running, because Apache will continue writing to the old log -file. Instead, the server must be restarted after the log file is moved or -deleted so that it will open a new log.

        - -

        A typical scenario is:

        - -
        -   mv access_log access_log.old
        -   apachectl graceful
        -   # wait for all requests to the old server to complete
        -   # before doing anything with access_log.old
        -
        - -

        Alternatively, log files can be rotated automatically be writing -them through a pipe to a program designed for that purpose such -as rotatelogs.

        - -
        - - -

        CookieLog directive

        - -

        Syntax: CookieLog filename
        -Context: server config, virtual host
        -Module: mod_cookies
        -Compatibility: 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 -directive

        -

        Syntax: CustomLog file|pipe - format|nickname [env=[!]environment-variable]
        -Context: server config, virtual host
        -Status: Base
        -Compatibility: Nickname only available in Apache 1.3 - or later. Conditional logging available in 1.3.5 or later. -
        -Module: mod_log_config

        - -

        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 directive

        - -

        Syntax: LogFormat format|nickname - [nickname] -
        -Default: LogFormat "%h %l %u %t \"%r\" -%>s %b"
        -Context: server config, virtual host
        -Status: Base
        -Compatibility: Nickname only available in Apache 1.3 - or later -
        -Module: mod_log_config

        - -

        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 directive

        - -

        Syntax: TransferLog file|pipe
        -Default: none
        -Context: server config, virtual host
        -Status: Base
        -Module: mod_log_config

        - -

        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 341c8bd4d4..0000000000 --- a/docs/manual/mod/mod_mime.html +++ /dev/null @@ -1,616 +0,0 @@ - - - -Apache module mod_mime - - - - - -

        Module mod_mime

        - -

        This module provides for determining the types of files -from the filename and for association of handlers with files.

        - -

        Status: Base -
        -Source File: mod_mime.c -
        -Module Identifier: mime_module -

        - -

        Summary

        - -This module is used to determine various bits of "meta information" -about documents. This information relates to the content of the -document and is returned to the browser or used in content-negotiation -within the server. In addition, a "handler" can be set for a document, -which determines how the document will be processed within the server. - -

        - -The directives AddCharset, AddEncoding, AddHandler, AddLanguage and AddType -are all used to map file extensions onto the meta-information for that -file. Respectively they set the character set, content-encoding, -handler, content-language, and MIME-type (content-type) of documents. -The directive TypesConfig is used to -specify a file which also maps extensions onto MIME types. The -directives ForceType and SetHandler are used to associated all the files -in a given location (e.g., a particular directory) onto a -particular MIME type or handler. - -

        - -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. - -

        Directives

        - - -

        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. The only exception to this is if an -extension is given which Apache does not know how to handle. In this -case it will "forget" about any information it obtained from -extensions to the left of the unknown extension. So, for example, if -the extensions fr and html are mapped to the appropriate language and -type but extension xxx is not assigned to anything, then the file -welcome.fr.xxx.html will be associated with content-type -text/html but no language. - -

        - -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. - -


        - -

        AddCharset directive

        -Syntax: AddCharset charset extension - [extension] ...
        -Context: server config, virtual host, directory, .htaccess
        -Override: FileInfo
        -Status: Base
        -Module: mod_mime - -

        -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 directive

        - -Syntax: AddEncoding MIME-enc extension - [extension] ...
        -Context: server config, virtual host, directory, .htaccess
        -Override: FileInfo
        -Status: Base
        -Module: mod_mime

        - -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 directive

        - -Syntax: AddHandler handler-name extension - [extension] ...
        -Context: server config, virtual host, directory, .htaccess
        -Override: FileInfo
        -Status: Base
        -Module: mod_mime - -

        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 - -


        - -

        AddLanguage directive

        - -Syntax: AddLanguage MIME-lang extension - [extension] ...
        -Context: server config, virtual host, directory, .htaccess
        -Override: FileInfo
        -Status: Base
        -Module: mod_mime - -

        -The AddLanguage directive maps the given filename extensions 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 -
        -See also: mod_negotiation -

        - -
        - -

        AddType directive

        - -Syntax: AddType MIME-type extension - [extension] ...
        -Context: server config, virtual host, directory, .htaccess
        -Override: FileInfo
        -Status: Base
        -Module: mod_mime

        - -The AddType directive maps the given filename extensions onto the -specified content type. MIME-enc 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 - -


        - -

        DefaultLanguage directive

        - -Syntax: DefaultLanguage MIME-lang
        -Context: server config, virtual host, directory, .htaccess
        -Override: FileInfo
        -Status: Base
        -Module: mod_mime - -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: mod_negotiation -
        -See also: Files with -multiple extensions - -


        - -

        ForceType directive

        - -Syntax: ForceType media-type
        -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 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 determine -the media type.


        - -

        RemoveHandler directive

        - -Syntax: RemoveHandler extension - [extension] ...
        -Context: directory, .htaccess
        -Status: Base
        -Module: mod_mime - -

        -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.

        - -
        - -

        SetHandler directive

        - -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>
        -
        -
        - -

        TypesConfig directive

        - -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.

        - - - - - diff --git a/docs/manual/mod/mod_mime_magic.html b/docs/manual/mod/mod_mime_magic.html deleted file mode 100644 index cffa5dec46..0000000000 --- a/docs/manual/mod/mod_mime_magic.html +++ /dev/null @@ -1,289 +0,0 @@ - - - - Apache module mod_mime_magic - - - -

        - [APACHE DOCUMENTATION] -
        - -

        Module mod_mime_magic

        - -

        This module provides for determining the MIME type of a file by - looking at a few bytes of its contents.

        - -

        Status: Extension -
        -Source File: mod_mime_magic.c -
        -Module Identifier: mime_magic_module -

        - - - -

        Summary

        - -

        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. - - -

        Directives

        -

        -

        -

        - -

        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
        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. - -

        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 -

        -

        - Syntax: MimeMagicFile magic-file-name -
        - Default: none -
        - Context: server config, virtual host -
        - Status: Extension -
        - Module: mod_mime_magic -

        - - 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_mmap_static.html b/docs/manual/mod/mod_mmap_static.html deleted file mode 100644 index 5a9749c439..0000000000 --- a/docs/manual/mod/mod_mmap_static.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - Apache module mod_mmap_static - - - - -

        Module mod_mmap_static

        - -

        - This module provides mmap()ing of a statically configured list - of frequently requested but not changed files. - -

        Status: Experimental -
        -Source File: mod_mmap_static.c -
        -Module Identifier: mmap_static_module -

        - -

        Summary

        -

        - This is an experimental module and should be used with - care. You can easily create a broken site using this module, read this - document carefully. - mod_mmap_static maps a list of statically configured files (via - MMapFile directives in the main server configuration) 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 by at least sending it a HUP or USR1 signal (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. -

        - -

        Directives

        - - -
        - -

        MMapFile directive

        -

        - Syntax: MMapFile filename - [filename] ... -
        - Default: None -
        - Context: server-config -
        - Override: Not applicable -
        - Status: Experimental -
        - Module: mod_mmap_static -
        - Compatibility: Only available in Apache 1.3 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... it is an experiment after all. -

        - -

        - 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. -

        - - Example: - -
        -  MMapFile /usr/local/apache/htdocs/index.html
        -  
        - -

        - Note: don't bother asking for a for a MMapDir - directive which - recursively maps all the files in a directory. Use Unix the way it was - meant to be used. For example, 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_negotiation.html b/docs/manual/mod/mod_negotiation.html deleted file mode 100644 index d53bb52c87..0000000000 --- a/docs/manual/mod/mod_negotiation.html +++ /dev/null @@ -1,223 +0,0 @@ - - - -Apache module mod_negotiation - - - - - -

        Module mod_negotiation

        - -

        This module provides for content negotiation.

        - -

        Status: Base -
        -Source File: mod_negotiation.c -
        -Module Identifier: negotiation_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 handler 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. -
        - -

        Directives

        - - -See also: -DefaultLanguage, -AddEncoding, -AddLanguage, -AddType, and -Options. - -

        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 -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.

        - - - -


        - - -

        CacheNegotiatedDocs directive

        -Syntax: CacheNegotiatedDocs on|off
        -Default: CacheNegotiatedDocs off
        -Context: server config
        -Status: Base
        -Module: mod_negotiation
        -Compatibility: CacheNegotiatedDocs is only available -in Apache 1.1 and later. 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. - -


        - -

        LanguagePriority directive

        - -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.

        - -

        - -Note that this directive only has an effect if a 'best' language -cannot be determined by any other means. Correctly implemented -HTTP/1.1 requests will mean this directive has no effect. - -

        - -See also: -DefaultLanguage and -AddLanguage - - - - - - diff --git a/docs/manual/mod/mod_proxy.html b/docs/manual/mod/mod_proxy.html deleted file mode 100644 index 61e8216519..0000000000 --- a/docs/manual/mod/mod_proxy.html +++ /dev/null @@ -1,26 +0,0 @@ - - - -Apache module mod_proxy - - - - - - -

        Note: -Mod_proxy has been moved out of the httpd-2.0 tree, but is available -elsewhere <insert location> for building with the httpd-2.0 source -distribution. -
        - - - - - diff --git a/docs/manual/mod/mod_rewrite.html b/docs/manual/mod/mod_rewrite.html deleted file mode 100644 index 812e755ccc..0000000000 --- a/docs/manual/mod/mod_rewrite.html +++ /dev/null @@ -1,1928 +0,0 @@ - - - - - - -Apache module mod_rewrite - - - - -
        - - -
        -

        Module mod_rewrite
        URL Rewriting Engine

        - -

        This module provides a rule-based rewriting engine to rewrite requested -URLs on the fly.

        - -

        Status: Extension -
        -Source File: mod_rewrite.c -
        -Module Identifier: rewrite_module -
        -Compatibility: Available in Apache 1.2 and later. -

        - - -

        -


        - -
        -

        Summary

        - -
        -
        -
        -``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 -
        - -

        -


        - -

        Table Of Contents

        - -

        -Internal Processing -

        -

        -Configuration Directives -

        -Miscellaneous - - -

        -


        - -
        -

        Internal 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. 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. -

        - -

        -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. - -

        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. - -

        -


        - -
        -

        Configuration Directives

        -
        - -

        -


        - -

        RewriteEngine

        -Syntax: - RewriteEngine on|off
        -Default: - RewriteEngine off
        -Context: - server config, virtual host, directory, .htaccess
        -Override: FileInfo
        -Status: Extension
        -Module: mod_rewrite.c
        -Compatibility: Apache 1.2
        - -

        -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

        -Syntax: RewriteOptions Option
        -Default: None
        -Context: server config, virtual host, directory, - .htaccess
        -Override: FileInfo
        -Status: Extension
        -Module: mod_rewrite.c
        -Compatibility: Apache 1.2
        - -

        -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

        -Syntax: RewriteLog Filename
        -Default: None
        -Context: server config, virtual host
        -Override: Not applicable
        -Status: Extension
        -Module: mod_rewrite.c
        -Compatibility: Apache 1.2
        - -

        -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. - -

        - - -
        -Note: 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

        -Syntax: RewriteLogLevel Level
        -Default: RewriteLogLevel 0 -
        -Context: server config, virtual host
        -Override: Not applicable
        -Status: Extension
        -Module: mod_rewrite.c
        -Compatibility: Apache 1.2
        - -

        -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. - -

        - - -
        -Notice: 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

        -Syntax: RewriteLock Filename
        -Default: None
        -Context: server config
        -Override: Not applicable
        -Status: Extension
        -Module: mod_rewrite.c
        -Compatibility: Apache 1.3
        - -

        -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

        -Syntax: RewriteMap MapName - MapType:MapSource
        -Default: not used per default
        -Context: server config, virtual host
        -Override: Not applicable
        -Status: Extension
        -Module: mod_rewrite.c
        -Compatibility: Apache 1.2 (partially), Apache 1.3
        - -

        -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
          -##
          -
          -($txtmap, $dbmmap) = @ARGV;
          -open(TXT, "<$txtmap");
          -dbmopen(%DB, $dbmmap, 0644);
          -while (<TXT>) {
          -    next if (m|^s*#.*| or m|^s*$|);
          -    $DB{$1} = $2 if (m|^\s*(\S+)\s+(\S+)$|);
          -}
          -dbmclose(%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. Avoid one common mistake: never do buffered I/O on stdout! - This will cause a deadloop! Hence the ``$|=1'' in the - above example... -
          3. 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. -
          -
        - -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

        -Syntax: RewriteBase BaseURL
        -Default: default is the physical directory path -
        -Context: directory, .htaccess
        -Override: FileInfo
        -Status: Extension
        -Module: mod_rewrite.c
        -Compatibility: Apache 1.2
        - -

        -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. - -

        - - -
        -Notice: 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 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. - -

        - - -
        - -Note - 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

        -Syntax: RewriteCond TestString - CondPattern
        -Default: None
        -Context: server config, virtual host, directory, - .htaccess
        -Override: FileInfo
        -Status: Extension
        -Module: mod_rewrite.c
        -Compatibility: Apache 1.2 (partially), Apache 1.3
        - -

        -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
          -
          -

          - -

          - - -
          - -

          Notice: 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. 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. - -

          -

        3. 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:''. - -

          -

        4. 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. - -

          -

        5. 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. -
        - -

        -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. -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. -
          -

        - -

        -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

        -Syntax: RewriteRule Pattern Substitution
        -Default: None
        -Context: server config, virtual host, directory, .htaccess
        -Override: FileInfo
        -Status: Extension
        -Module: mod_rewrite.c
        -Compatibility: Apache 1.2 (partially), Apache 1.3
        - -

        -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 no -longer existingany 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. back-references %N to the last matched RewriteCond pattern -
        3. server-variables as in rule condition test-strings (%{VARNAME}) -
        4. mapping-function calls (${mapname:key|default}) -
        - -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. -

          -

        • '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.. -

          - - -
          - - Note - 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
        -
        -
        - -
        - -

        -


        - -
        -

        Miscellaneous

        -
        - -

        -


        - -

        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. - - -
        - - - diff --git a/docs/manual/mod/mod_setenvif.html b/docs/manual/mod/mod_setenvif.html deleted file mode 100644 index 34ee26ce61..0000000000 --- a/docs/manual/mod/mod_setenvif.html +++ /dev/null @@ -1,422 +0,0 @@ - - - - Apache module mod_setenvif - - - - -

        Module mod_setenvif

        -

        - This module provides the ability to set environment variables based - upon attributes of the request. -

        - -

        Status: Base -
        -Source File: mod_setenvif.c -
        -Module Identifier: setenvif_module -
        -Compatibility: Available in Apache 1.3 and later. -

        - -

        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 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
        -  
        -

        - -

        For additional information, we proved a document on - Environment Variables in Apache.

        - -

        Directives

        - - -
        -

        BrowserMatch directive

        -

        - Syntax: BrowserMatch regex - envar[=value] [envar[=value]] ... -
        - Default: none -
        - Context: server config, virtual host, directory, - .htaccess -
        - Override: FileInfo -
        - Status: Base -
        - Module: mod_setenvif -
        - Compatibility: 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 directive - -

        -

        - Syntax: BrowserMatchNoCase regex - envar[=value] [envar[=value]] ... -
        - Default: none -
        - Context: server config, virtual host, directory, - .htaccess -
        - Override: FileInfo -
        - Status: Base -
        - Module: mod_setenvif -
        - Compatibility: 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 directive - -

        -

        - Syntax: SetEnvIf attribute regex - envar[=value] [envar[=value]] ... -
        - Default: none -
        - Context: server config, virtual host, directory, - .htaccess -
        - Override: FileInfo -
        - Status: Base -
        - Module: mod_setenvif -
        - Compatibility: 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. -
        -

        - 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
        -  
        -

        - 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. -

        - -
        -

        - SetEnvIfNoCase directive - -

        -

        - Syntax: SetEnvIfNoCase attribute regex - envar[=value] [envar[=value]] ... -
        - Default: none -
        - Context: server config, virtual host, directory, - .htaccess -
        - Override: FileInfo -
        - 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 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. -

        - - - - diff --git a/docs/manual/mod/mod_so.html b/docs/manual/mod/mod_so.html deleted file mode 100644 index 5850c7b2a8..0000000000 --- a/docs/manual/mod/mod_so.html +++ /dev/null @@ -1,192 +0,0 @@ - - - -Apache module mod_so - - - - - -

        Module mod_so

        - -

        This module provides for loading of executable code and modules into the -server at start-up or restart time.

        - -

        Status: Base (Windows); Optional (Unix) -
        -Source File: mod_so.c -
        -Module Identifier: so_module -
        -Compatibility: Available in Apache 1.3 and later. -

        - - -

        Summary

        - -

        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.

        - -

        Directives

        - - -

        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 directive

        - -Syntax: LoadFile filename - [filename] ...
        -Context: server config
        -Status: Base
        -Module: mod_so

        - -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 and absolute path or relative to ServerRoot.


        - -

        LoadModule directive

        - -Syntax: LoadModule module filename
        -Context: server config
        -Status: Base
        -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, 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 cc294cdcee..0000000000 --- a/docs/manual/mod/mod_speling.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - Apache module mod_speling - - - - -

        Module mod_speling

        -

        - This module attempts to correct misspellings of URLs that users - might have entered, by ignoring capitalization and by allowing up to - one misspelling.

        - -

        Status: Extension -
        -Source File: mod_speling.c -
        -Module Identifier: speling_module -
        -Compatibility: Available in Apache 1.3 and later. Available as an External module in Apache 1.1 and later. -

        - - -

        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 directive

        - - Syntax: CheckSpelling on|off
        - Default: CheckSpelling Off
        - Context: server config, virtual host, - directory, .htaccess
        - Override: Options -
        - 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. 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. 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_status.html b/docs/manual/mod/mod_status.html deleted file mode 100644 index 8ea9d83dbe..0000000000 --- a/docs/manual/mod/mod_status.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - Apache module mod_status - - - - - - -
        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. -
        - -

        Module mod_status

        - -

        This module provides information on server activity and -performance.

        - -

        Status: Base -
        -Source File: mod_status.c -
        -Module Identifier: status_module -
        -Compatibility: Available in Apache 1.1 and later. -

        - - -

        Summary

        - -

        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. - -

        Directives

        - - - - -

        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
        -
        -    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 directive

        - -Syntax: ExtendedStatus On|Off
        -Default: ExtendedStatus Off
        -Context: server config
        -Status: Base
        - Module: mod_status
        -Compatibility: ExtendedStatus is only available - in Apache 1.3.2 and later. - -

        -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. -

        -

        -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_unique_id.html b/docs/manual/mod/mod_unique_id.html deleted file mode 100644 index 9ee0d7adc4..0000000000 --- a/docs/manual/mod/mod_unique_id.html +++ /dev/null @@ -1,205 +0,0 @@ - - - -Apache module mod_unique_id - - - - - -

        Module mod_unique_id

        - -

        This module provides an environment variable with a unique identifier -for each request.

        - -

        Status: Extension -
        -Source File: mod_unique_id.c -
        -Module Identifier: unique_id_module -
        -Compatibility: Available in Apache 1.3 and later. -

        - -

        Summary

        - -

        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.

        - -

        Directives

        - -

        This module has no directives.

        - - -

        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). - - - - diff --git a/docs/manual/mod/mod_userdir.html b/docs/manual/mod/mod_userdir.html deleted file mode 100644 index 98894962c8..0000000000 --- a/docs/manual/mod/mod_userdir.html +++ /dev/null @@ -1,139 +0,0 @@ - - - -Apache module mod_userdir - - - - - -

        Module mod_userdir

        - -

        This module provides for user-specific directories.

        - -

        Status: Base -
        -Source File: mod_userdir.c -
        -Module Identifier: userdir_module -

        - -

        Directives

        - - - -
        - -

        UserDir directive

        - -Syntax: UserDir directory-filename
        -Default: UserDir public_html
        -Context: server config, virtual host
        -Status: Base
        -Module: mod_userdir
        -Compatibility: 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 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 http://www.foo.com/users -> http://www.foo.com/users/bob/one/two.html
        -UserDir http://www.foo.com/*/usr -> http://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 a98875113e..0000000000 --- a/docs/manual/mod/mod_usertrack.html +++ /dev/null @@ -1,224 +0,0 @@ - - - -Apache module mod_usertrack - - - - - -

        Module mod_usertrack

        - -

        This module uses cookies to provide for a clickstream log of user -activity on a site.

        - -

        Status: Extension -
        -Source File: mod_usertrack.c -
        -Module Identifier: usertrack_module -
        -Compatibility: 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.

        - -

        Directives

        - - - -

        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 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".
        -
        - -
        - -

        CookieExpires directive

        -Syntax: CookieExpires expiry-period
        -Context: server config, virtual host
        -Status: optional
        -Module: mod_usertrack

        - -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 directive

        -Syntax: CookieName token -
        -Default: Apache -
        -Context: server config, virtual host, directory, -.htaccess
        -Status: optional
        -Module: mod_usertrack -
        -Compatibility: Apache 1.3.7 and later -

        -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 "-". -

        - -
        -

        CookieTracking directive

        -Syntax: CookieTracking on|off
        -Context: server config, virtual host, directory, -.htaccess
        -Override: FileInfo
        -Status: optional
        -Module: mod_usertrack

        - -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 8051209073..0000000000 --- a/docs/manual/mod/mod_vhost_alias.html +++ /dev/null @@ -1,345 +0,0 @@ - - - -Apache module mod_vhost_alias - - - - - -

        Module mod_vhost_alias

        - -

        -This module provides support for dynamically configured mass virtual -hosting. -

        - -

        Status: Extension -
        -Source File: mod_vhost_alias.c -
        -Module Identifier: vhost_alias_module -
        -Compatibility: Available in Apache 1.3.7 and later. -

        - -

        Summary

        - -

        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.

        - -

        Directives

        - - -

        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 % -
        %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/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 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.7 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.7 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.7 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.7 and later.

        -

        -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. -

        -
        - -

        - Apache HTTP Server Version 1.3 -

        - -Index -Home - - - diff --git a/docs/manual/mod/module-dict.html b/docs/manual/mod/module-dict.html deleted file mode 100644 index 7d99828e81..0000000000 --- a/docs/manual/mod/module-dict.html +++ /dev/null @@ -1,144 +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: -

        -
        -
        MPM -
        -
        A module with status "MPM" is a Multi-Processing Module. Unlike the other - types of modules, Apache must have one and only one MPM in use at - any time. This type of module is responsible for basic request - handling and dispatching. -

        -

        -
        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 7d99828e81..0000000000 --- a/docs/manual/mod/module-dict.html.en +++ /dev/null @@ -1,144 +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: -

        -
        -
        MPM -
        -
        A module with status "MPM" is a Multi-Processing Module. Unlike the other - types of modules, Apache must have one and only one MPM in use at - any time. This type of module is responsible for basic request - handling and dispatching. -

        -

        -
        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 3ac8d0122a..0000000000 --- a/docs/manual/mod/mpm_common.html +++ /dev/null @@ -1,774 +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

        - -
        - -

        ConnectionStatus directive

        -

        Syntax: - ConnectionStatus on|off
        -Default: - ConnectionStatus on
        -Context: server config
        -Status: MPM
        -Module: perchild

        - -

        Whether or not to maintain status information on current -connections. If this is off then mod_status will not work properly.

        - -
        - -

        CoreDumpDirectory directive

        - -

        Syntax: CoreDumpDirectory directory
        -Default: the same location as ServerRoot
        -Context: server config
        -Status: MPM
        -Module: threaded, perchild, prefork, mpm_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 directive

        - -

        Syntax: Group unix-group
        -Default: Group #-1
        -Context: server config, virtual host
        -Status: MPM
        -Module: threaded, perchild, 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> requires a -properly configured suEXEC wrapper. -When used inside a <VirtualHost> in this manner, only the group -that CGIs are run as is affected. Non-CGI requests are still processed -as the group specified in the main Group directive.

        - -SECURITY: See User for a discussion of the security -considerations.


        - -

        PidFile directive

        - -

        Syntax: PidFile filename
        -Default: PidFile logs/httpd.pid
        -Context: server config
        -Status: MPM
        -Module: threaded, perchild, prefork, mpm_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 directive

        -

        Syntax: -Listen [IP-address:]port number
        -Context: server config
        -Status: MPM
        -Module: threaded, perchild, prefork, mpm_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, but only on the port given by the Port directive.

        - -

        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, -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.

        - -Note that you may still require a Port directive so -that URLs that Apache generates that point to your server still -work.

        - -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
        -
        - -

        See Also: -DNS Issues
        -See Also: -Setting which addresses and ports Apache uses
        -See Also: -Known Bugs -

        -
        - -

        ListenBacklog directive

        -

        Syntax: ListenBacklog backlog
        -Default: ListenBacklog 511
        -Context: server config
        -Status: MPM
        -Module: threaded, perchild, prefork, mpm_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 directive

        -

        Syntax: LockFile filename
        -Default: LockFile logs/accept.lock
        -Context: server config
        -Status: MPM
        -Module: threaded, perchild, 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: threaded, 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: threaded, prefork, perchild, mpm_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 directive

        -

        Syntax: MaxSpareThreads number
        -Default: MaxSpareThreads 10 (Perchild) or 500 (threaded)
        -Context: server config
        -Status: core
        -Module: threaded, perchild

        - -

        Maximum number of idle threads. Different MPMs deal with this directive -differently. Perchild monitor 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.

        -

        threaded 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.

        - -

        See also MinSpareThreads and -StartServers. - -


        - -

        MaxThreadsPerChild directive

        -

        Syntax: MaxThreadsPerChild number
        -Default: MaxThreadsPerChild 64 -Context: server config
        -Status: core
        -Module: threaded, perchild

        - -

        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 directive

        - -

        Syntax: MinSpareServers number
        -Default: MaxSpareThreads 5 (Perchild) or 250 (threaded)
        -Context: server config
        -Status: core
        -Module: threaded, perchild

        - -

        Minimum number of idle threads to handle request spikes. Different MPMs -deal with this directive differently. Perchild monitor 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. -

        -

        threaded 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.

        - -See also MaxSpareThreads and -StartServers.


        - - -

        NumServers directive

        -

        Syntax: NumServers number
        -Default: NumServers 2
        -Context: server config
        -Status: MPM
        -Module: 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 directive

        - -

        Syntax: ScoreBoardFile filename
        -Default: ScoreBoardFile logs/apache_status -
        -Context: server config
        -Status: MPM
        - -Module: threaded, perchild, 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

        - - -


        - -

        SendBufferSize directive

        - -

        Syntax: SendBufferSize bytes
        -Context: server config
        -Status: MPM
        -Module: threaded, perchild, prefork, mpm_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) - -


        - -

        StartServers directive

        - -

        Syntax: StartServers number
        -Default: StartServers 5
        -Context: server config
        -Status: MPM
        -Module: threaded, 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.


        - - -

        StartThreads directive

        -

        Syntax: StartThreads number
        -Default: StartThreads 5
        -Context: server config
        -Status: MPM
        -Module: 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.

        - -
        - -

        ThreadsPerChild

        -

        Syntax: ThreadsPerChild number
        -Default: ThreadsPerChild 50
        -Context: server config
        -Status: MPM
        -Module: threaded, mpm_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 threaded, where there are multiple child processes, -the total number of threads should be high enough to handle the common load -on the server.

        - -


        - - -

        User directive

        - -

        Syntax: User unix-userid
        -Default: User #-1
        -Context: server config, virtual host
        -Status: core
        -Module: threaded, perchild, 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 mod_proxy's CacheRoot -directive).

        - -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> requires a -properly configured suEXEC wrapper. -When used inside a <VirtualHost> in this manner, only the user -that CGIs are run as is affected. Non-CGI requests are still processed -with the user specified in the main User directive.

        - -SECURITY: Don't set User (or Group) to -root unless you know exactly what you are doing, and what the -dangers are.

        - - - - diff --git a/docs/manual/mod/mpm_winnt.html b/docs/manual/mod/mpm_winnt.html deleted file mode 100644 index f4a90f03cf..0000000000 --- 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/perchild.html b/docs/manual/mod/perchild.html deleted file mode 100644 index 90a3bfffb2..0000000000 --- a/docs/manual/mod/perchild.html +++ /dev/null @@ -1,170 +0,0 @@ - - - -Apache MPM perchild - - - - - - -

        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

        - -

        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.

        - - - - -

        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/prefork.html b/docs/manual/mod/prefork.html deleted file mode 100644 index 26372a9ed5..0000000000 --- a/docs/manual/mod/prefork.html +++ /dev/null @@ -1,171 +0,0 @@ - - - -Apache MPM prefork - - - - - - -

        Multi-Processing Module prefork

        -

        -This Multi-Processing Module implements a non-threaded, pre-forking -web server. -

        - -

        Status: MPM -
        -Source File: prefork.c -
        -Module Identifier: mpm_prefork_module -

        - -

        Summary

        - -

        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 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). 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.

        - -

        See also: Setting which addresses and ports -Apache uses.

        - -

        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/threaded.html b/docs/manual/mod/threaded.html deleted file mode 100644 index 0d00ff7cab..0000000000 --- a/docs/manual/mod/threaded.html +++ /dev/null @@ -1,105 +0,0 @@ - - - -Apache MPM threaded - - - - - - -

        Multi-Processing Module threaded

        -

        -This Multi-Processing Module implements a hybrid multi-threaded -multi-process web server. -

        - -

        Status: MPM -
        -Source File: threaded.c -
        -Module Identifier: mpm_threaded_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/mpm.html b/docs/manual/mpm.html deleted file mode 100644 index 6e9ada1650..0000000000 --- a/docs/manual/mpm.html +++ /dev/null @@ -1,90 +0,0 @@ - - - -Apache Multi-Processing Modules (MPMs) - - - - - - - -

        Apache Multi-Processing Modules

        - -

        The Apache HTTP Server is designed to be a powerful and flexible -web server that can work on a very wide variety of platforms in a -range of different environments. Different platforms and different -environments often require different features, or may have different -ways of implementing the same feature most efficiently. Apache has -always accommodated a wide variety of environments through its modular -design. This design allows the webmaster to choose which features -will be included in the server by selecting which modules to load -either at compile-time or at run-time.

        - -

        Apache 2.0 extends this modular design to the most basic functions -of a web server. The server ships with a selection of -Multi-Processing Modules (MPMs) which are responsible for binding to -network ports on the machine, accepting requests, and dispatching -children to handle the requests.

        - -

        Extending the modular design to this level of the server -allows two important benefits: -

          -
        • Apache can more cleanly and efficiently support a wide variety of -operating systems. In particular, the Windows version of Apache is -now much more efficient, since mpm_winnt can use native networking -features in place of the POSIX layer used in Apache 1.3. This benefit -also extends to other operating systems that implement specialized -MPMs.
        • -
        • The server can be better customized for the needs of the -particular site. For example, sites that need a great deal of -scalability can choose to use a threaded MPM like threaded, while sites requiring -stability or compatibility with older software can use a preforking MPM. In addition, special -features like serving different hosts under different userids -(perchild) can be provided.
        • -
        - -

        At the user level, MPMs appear much like other Apache modules. -The main difference is that one and only one MPM must be loaded -into the server at any time. The list of available MPMs -appears on the module index page.

        - -

        Choosing an MPM

        - -

        MPMs must be chosen during configuration, and compiled into the server. -Compilers are capable of optimizing a lot of functions if threads are used, -but only if they know that threads are being used. Because some MPMs use -threads on Unix and others don't, Apache will always perform better if the -MPM is chosen at configuration time and built into Apache.

        - -

        To actually choose the desired MPM, use the argument --with-mpm= -NAME with the ./configure script. NAME is the name of -the desired MPM.

        - -

        Once the server has been compiled, it is possible to determine which -MPM was chosen by using ./httpd -l. This command will list -every module that is compiled into the server, including the MPM.

        - -

        MPM Defaults

        - -
          -
        • BeOS: mpmt_beos
        • -
        • OS/2: spmt_os2
        • -
        • Unix: threaded
        • -
        • Windows: winnt
        • -
        - - - - - - diff --git a/docs/manual/mpm.html.en b/docs/manual/mpm.html.en deleted file mode 100644 index 6e9ada1650..0000000000 --- a/docs/manual/mpm.html.en +++ /dev/null @@ -1,90 +0,0 @@ - - - -Apache Multi-Processing Modules (MPMs) - - - - - - - -

        Apache Multi-Processing Modules

        - -

        The Apache HTTP Server is designed to be a powerful and flexible -web server that can work on a very wide variety of platforms in a -range of different environments. Different platforms and different -environments often require different features, or may have different -ways of implementing the same feature most efficiently. Apache has -always accommodated a wide variety of environments through its modular -design. This design allows the webmaster to choose which features -will be included in the server by selecting which modules to load -either at compile-time or at run-time.

        - -

        Apache 2.0 extends this modular design to the most basic functions -of a web server. The server ships with a selection of -Multi-Processing Modules (MPMs) which are responsible for binding to -network ports on the machine, accepting requests, and dispatching -children to handle the requests.

        - -

        Extending the modular design to this level of the server -allows two important benefits: -

          -
        • Apache can more cleanly and efficiently support a wide variety of -operating systems. In particular, the Windows version of Apache is -now much more efficient, since mpm_winnt can use native networking -features in place of the POSIX layer used in Apache 1.3. This benefit -also extends to other operating systems that implement specialized -MPMs.
        • -
        • The server can be better customized for the needs of the -particular site. For example, sites that need a great deal of -scalability can choose to use a threaded MPM like threaded, while sites requiring -stability or compatibility with older software can use a preforking MPM. In addition, special -features like serving different hosts under different userids -(perchild) can be provided.
        • -
        - -

        At the user level, MPMs appear much like other Apache modules. -The main difference is that one and only one MPM must be loaded -into the server at any time. The list of available MPMs -appears on the module index page.

        - -

        Choosing an MPM

        - -

        MPMs must be chosen during configuration, and compiled into the server. -Compilers are capable of optimizing a lot of functions if threads are used, -but only if they know that threads are being used. Because some MPMs use -threads on Unix and others don't, Apache will always perform better if the -MPM is chosen at configuration time and built into Apache.

        - -

        To actually choose the desired MPM, use the argument --with-mpm= -NAME with the ./configure script. NAME is the name of -the desired MPM.

        - -

        Once the server has been compiled, it is possible to determine which -MPM was chosen by using ./httpd -l. This command will list -every module that is compiled into the server, including the MPM.

        - -

        MPM Defaults

        - -
          -
        • BeOS: mpmt_beos
        • -
        • OS/2: spmt_os2
        • -
        • Unix: threaded
        • -
        • Windows: winnt
        • -
        - - - - - - diff --git a/docs/manual/new_features_2_0.html b/docs/manual/new_features_2_0.html deleted file mode 100644 index be30beef75..0000000000 --- a/docs/manual/new_features_2_0.html +++ /dev/null @@ -1,94 +0,0 @@ - - -New features with Apache 2.0 - - - - - -

        Overview of New Features in Apache 2.0

        - -

        Enhancements: Core | Module - -


        - -

        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 is faster and more stable on non-Unix platforms such as BeOS, - OS/2, and Windows. With the introduction of platform-specific multi-processing modules (MPMs) and the Apache - Portable Runtime (APR), these platforms are now implemented in their - native API, avoiding the often buggy and poorly performing - POSIX-emulation layers. - -
        New Apache API -
        The API for modules has changed significantly for 2.0. Many of the - module-ordering problems from 1.3 should be gone. 2.0 does much of - this automatically, and module ordering is now done per-hook to - allow more flexibility. Also, new calls have been added that provide - additional module capabilities without patching the core Apache server. - -
        IPv6 Support
        -
        On systems where IPv6 is supported by the underlying Apache - Portable Runtime library, Apache gets IPv6 listening sockets by - default. Additionally, the Listen, NameVirtualHost, and - <VirtualHost> directives support IPv6 numeric address - strings (e.g., "Listen [fe80::1]:8080").
        - -
        Filtering
        -
        Apache modules may now be written as filters which act on the - stream of content as it is delivered to or from the server. This - allows, for example, the output of CGI scripts to be parsed for - Server Side Include directive by mod_include.
        - -
        - -


        - -

        Module Enhancements:

        - -
        - -
        mod_auth_db -
        Now supports Berkely DB 3.0 - -
        mod_auth_digest -
        Includes additional support for session caching across processes -using shared memory. - -
        mod_charset_lite
        New module in Apache 2.0. -This experimental module allows for character set translation -or recoding. - -
        mod_dav -
        New module in Apache 2.0. This module implements the -HTTP Distributed Authoring and Versioning (DAV) specification for -posting and maintaining web content. - -
        mod_file_cache -
        New module in Apache 2.0. This module includes the functionality -of mod_mmap_static in Apache 1.3, plus adds further caching abilities. - -
        - - - - - 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 be30beef75..0000000000 --- a/docs/manual/new_features_2_0.html.en +++ /dev/null @@ -1,94 +0,0 @@ - - -New features with Apache 2.0 - - - - - -

        Overview of New Features in Apache 2.0

        - -

        Enhancements: Core | Module - -


        - -

        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 is faster and more stable on non-Unix platforms such as BeOS, - OS/2, and Windows. With the introduction of platform-specific multi-processing modules (MPMs) and the Apache - Portable Runtime (APR), these platforms are now implemented in their - native API, avoiding the often buggy and poorly performing - POSIX-emulation layers. - -
        New Apache API -
        The API for modules has changed significantly for 2.0. Many of the - module-ordering problems from 1.3 should be gone. 2.0 does much of - this automatically, and module ordering is now done per-hook to - allow more flexibility. Also, new calls have been added that provide - additional module capabilities without patching the core Apache server. - -
        IPv6 Support
        -
        On systems where IPv6 is supported by the underlying Apache - Portable Runtime library, Apache gets IPv6 listening sockets by - default. Additionally, the Listen, NameVirtualHost, and - <VirtualHost> directives support IPv6 numeric address - strings (e.g., "Listen [fe80::1]:8080").
        - -
        Filtering
        -
        Apache modules may now be written as filters which act on the - stream of content as it is delivered to or from the server. This - allows, for example, the output of CGI scripts to be parsed for - Server Side Include directive by mod_include.
        - -
        - -


        - -

        Module Enhancements:

        - -
        - -
        mod_auth_db -
        Now supports Berkely DB 3.0 - -
        mod_auth_digest -
        Includes additional support for session caching across processes -using shared memory. - -
        mod_charset_lite
        New module in Apache 2.0. -This experimental module allows for character set translation -or recoding. - -
        mod_dav -
        New module in Apache 2.0. This module implements the -HTTP Distributed Authoring and Versioning (DAV) specification for -posting and maintaining web content. - -
        mod_file_cache -
        New module in Apache 2.0. This module includes the functionality -of mod_mmap_static in Apache 1.3, plus adds further caching abilities. - -
        - - - - - 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 a0c550472d..0000000000 --- a/docs/manual/new_features_2_0.html.fr +++ /dev/null @@ -1,89 +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 semblable 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'émulation 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 grâce à 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/footer.html b/docs/manual/platform/footer.html deleted file mode 100644 index 1e5f739ebe..0000000000 --- a/docs/manual/platform/footer.html +++ /dev/null @@ -1,8 +0,0 @@ -
        - -

        - Apache HTTP Server Version 2.0 -

        - -Index -Home diff --git a/docs/manual/platform/header.html b/docs/manual/platform/header.html deleted file mode 100644 index 9533b02bda..0000000000 --- a/docs/manual/platform/header.html +++ /dev/null @@ -1,6 +0,0 @@ -
        - [APACHE DOCUMENTATION] -

        - Apache HTTP Server Version 2.0 -

        -
        diff --git a/docs/manual/platform/netware.html b/docs/manual/platform/netware.html deleted file mode 100644 index 6e3aa68b0a..0000000000 --- a/docs/manual/platform/netware.html +++ /dev/null @@ -1,285 +0,0 @@ - - - -Using Apache with Novell NetWare 5 - - - - - - -
        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. -
        - -

        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-bsd44.html b/docs/manual/platform/perf-bsd44.html deleted file mode 100644 index dd94d677e0..0000000000 --- a/docs/manual/platform/perf-bsd44.html +++ /dev/null @@ -1,262 +0,0 @@ - - - -Running a High-Performance Web Server for BSD - - - - - - - -
        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. -
        - - -

        Running a High-Performance Web Server for BSD

        - -Like other OS's, the listen queue is often the first limit -hit. The -following are comments from "Aaron Gifford <agifford@InfoWest.COM>" -on how to fix this on BSDI 1.x, 2.x, and FreeBSD 2.0 (and earlier): - -

        - -Edit the following two files: -

        /usr/include/sys/socket.h
        - /usr/src/sys/sys/socket.h
        -In each file, look for the following: -
        -    /*
        -     * Maximum queue length specifiable by listen.
        -     */
        -    #define SOMAXCONN       5
        -
        - -Just change the "5" to whatever appears to work. I bumped the two -machines I was having problems with up to 32 and haven't noticed the -problem since. - -

        - -After the edit, recompile the kernel and recompile the Apache server -then reboot. - -

        - -FreeBSD 2.1 seems to be perfectly happy, with SOMAXCONN -set to 32 already. - -

        - - -Addendum for very heavily loaded BSD servers
        -
        -from Chuck Murcko <chuck@telebase.com> - -

        - -If you're running a really busy BSD Apache server, the following are useful -things to do if the system is acting sluggish:

        - -

          - -
        • Run vmstat to check memory usage, page/swap rates, etc. - -
        • Run netstat -m to check mbuf usage - -
        • Run fstat to check file descriptor usage - -
        - -These utilities give you an idea what you'll need to tune in your kernel, -and whether it'll help to buy more RAM. - -Here are some BSD kernel config parameters (actually BSDI, but pertinent to -FreeBSD and other 4.4-lite derivatives) from a system getting heavy usage. -The tools mentioned above were used, and the system memory was increased to -48 MB before these tuneups. Other system parameters remained unchanged. - -

        - -

        -maxusers        256
        -
        - -Maxusers drives a lot of other kernel parameters: - -
          - -
        • Maximum # of processes - -
        • Maximum # of processes per user - -
        • System wide open files limit - -
        • Per-process open files limit - -
        • Maximum # of mbuf clusters - -
        • Proc/pgrp hash table size - -
        - -The actual formulae for these derived parameters are in -/usr/src/sys/conf/param.c. -These calculated parameters can also be overridden (in part) by specifying -your own values in the kernel configuration file: - -
        -# Network options. NMBCLUSTERS defines the number of mbuf clusters and
        -# defaults to 256. This machine is a server that handles lots of traffic,
        -# so we crank that value.
        -options         NMBCLUSTERS=4096        # mbuf clusters at 4096
        -
        -#
        -# Misc. options
        -#
        -options         CHILD_MAX=512           # maximum number of child processes
        -options         OPEN_MAX=512            # maximum fds (breaks RPC svcs)
        -
        - -

        - -In many cases, NMBCLUSTERS must be set much larger than would appear -necessary at first glance. The reason for this is that if the browser -disconnects in mid-transfer, the socket fd associated with that particular -connection ends up in the TIME_WAIT state for several minutes, during -which time its mbufs are not yet freed. Another reason is that, on server -timeouts, some connections end up in FIN_WAIT_2 state forever, because -this state doesn't time out on the server, and the browser never sent -a final FIN. For more details see the -FIN_WAIT_2 page. - -

        - -Some more info on mbuf clusters (from sys/mbuf.h): -

        -/*
        - * Mbufs are of a single size, MSIZE (machine/machparam.h), which
        - * includes overhead.  An mbuf may add a single "mbuf cluster" of size
        - * MCLBYTES (also in machine/machparam.h), which has no additional overhead
        - * and is used instead of the internal data area; this is done when
        - * at least MINCLSIZE of data must be stored.
        - */
        -
        - -

        - -CHILD_MAX and OPEN_MAX are set to allow up to 512 child processes (different -than the maximum value for processes per user ID) and file descriptors. -These values may change for your particular configuration (a higher OPEN_MAX -value if you've got modules or CGI scripts opening lots of connections or -files). If you've got a lot of other activity besides httpd on the same -machine, you'll have to set NPROC higher still. In this example, the NPROC -value derived from maxusers proved sufficient for our load. - -

        - -To increase the size of the listen() queue, you need to -adjust the value of SOMAXCONN. SOMAXCONN is not derived from maxusers, -so you'll always need to increase that yourself. We use a value guaranteed -to be larger than Apache's default for the listen() of 128, currently. -The actual value for SOMAXCONN is set in sys/socket.h. -The best way to adjust this parameter is run-time, rather than changing -it in this header file and thus hardcoding a value in the kernel and -elsewhere. To do this, edit /etc/rc.local and add the -following line: -

        -    /usr/sbin/sysctl -w kern.somaxconn=256
        -
        - -

        - -We used 256 but you can tune it for your own setup. In -many cases, however, even the default value of 128 (for -later versions of FreeBSD) is OK. - -

        - -Caveats - -

        - -Be aware that your system may not boot with a kernel that is configured -to use more resources than you have available system RAM. -ALWAYS -have a known bootable kernel available when tuning your system this way, -and use the system tools beforehand to learn if you need to buy more -memory before tuning. - -

        - -RPC services will fail when the value of OPEN_MAX is larger than 256. -This is a function of the original implementations of the RPC library, -which used a byte value for holding file descriptors. BSDI has partially -addressed this limit in its 2.1 release, but a real fix may well await -the redesign of RPC itself. - -

        - -Finally, there's the hard limit of child processes configured in Apache. - -

        - -For versions of Apache later than 1.0.5 you'll need to change the -definition for HARD_SERVER_LIMIT in httpd.h and -recompile if you need to run more than the default 150 instances of httpd. - -

        - -From conf/httpd.conf-dist: - -

        -# Limit on total number of servers running, i.e., limit on the number
        -# of clients who can simultaneously connect --- if this limit is ever
        -# reached, clients will be LOCKED OUT, so it should NOT BE SET TOO LOW.
        -# It is intended mainly as a brake to keep a runaway server from taking
        -# Unix with it as it spirals down...
        -
        -MaxClients 150
        -
        - -Know what you're doing if you bump this value up, and make sure you've -done your system monitoring, RAM expansion, and kernel tuning beforehand. -Then you're ready to service some serious hits! - -

        - -Thanks to Tony Sanders and Chris Torek at BSDI for their -helpful suggestions and information. - -

        - -"M. Teterin" <mi@ALDAN.ziplink.net> writes:

        -

        It really does help if your kernel and frequently used utilities -are fully optimized. Rebuilding the FreeBSD kernel on an AMD-133 -(486-class CPU) web-server with
        - -m486 -fexpensive-optimizations -fomit-frame-pointer -O2
        -helped reduce the number of "unable" errors, because the CPU was -often maxed out.
        -

        - -


        - -

        More welcome!

        - -If you have tips to contribute, send mail to -apache@apache.org - - - - diff --git a/docs/manual/platform/perf-dec.html b/docs/manual/platform/perf-dec.html deleted file mode 100644 index e2b8c30d2b..0000000000 --- a/docs/manual/platform/perf-dec.html +++ /dev/null @@ -1,286 +0,0 @@ - - - -Performance Tuning Tips for Digital Unix - - - - -

        Performance Tuning Tips for Digital Unix

        - -Below is a set of newsgroup posts made by an engineer from DEC in -response to queries about how to modify DEC's Digital Unix OS for more -heavily loaded web sites. Copied with permission. - -
        - -

        Update

        -From: Jeffrey Mogul <mogul@pa.dec.com>
        -Date: Fri, 28 Jun 96 16:07:56 MDT
        - -
          -
        1. The advice given in the README file regarding the - "tcbhashsize" variable is incorrect. The largest value - this should be set to is 1024. Setting it any higher - will have the perverse result of disabling the hashing - mechanism. - -
        2. Patch ID OSF350-146 has been superseded by -
          - Patch ID OSF350-195 for V3.2C
          - Patch ID OSF360-350195 for V3.2D -
          - Patch IDs for V3.2E and V3.2F should be available soon. - There is no known reason why the Patch ID OSF360-350195 - won't work on these releases, but such use is not officially - supported by Digital. This patch kit will not be needed for - V3.2G when it is released. -
        -
        - - -
        -From           mogul@pa.dec.com (Jeffrey Mogul)
        -Organization   DEC Western Research
        -Date           30 May 1996 00:50:25 GMT
        -Newsgroups     comp.unix.osf.osf1
        -Message-ID     <4oirch$bc8@usenet.pa.dec.com>
        -Subject        Re: Web Site Performance
        -References     1
        -
        -
        -
        -In article <skoogDs54BH.9pF@netcom.com> skoog@netcom.com (Jim Skoog) writes:
        ->Where are the performance bottlenecks for Alpha AXP running the
        ->Netscape Commerce Server 1.12 with high volume internet traffic?
        ->We are evaluating network performance for a variety of Alpha AXP
        ->running DEC UNIX 3.2C, which run DEC's seal firewall and behind
        ->that Alpha 1000 and 2100 webservers.
        -
        -Our experience (running such Web servers as altavista.digital.com
        -and www.digital.com) is that there is one important kernel tuning
        -knob to adjust in order to get good performance on V3.2C.  You
        -need to patch the kernel global variable "somaxconn" (use dbx -k
        -to do this) from its default value of 8 to something much larger.
        -
        -How much larger?  Well, no larger than 32767 (decimal).  And
        -probably no less than about 2048, if you have a really high volume
        -(millions of hits per day), like AltaVista does.
        -
        -This change allows the system to maintain more than 8 TCP
        -connections in the SYN_RCVD state for the HTTP server.  (You
        -can use "netstat -An |grep SYN_RCVD" to see how many such
        -connections exist at any given instant).
        -
        -If you don't make this change, you might find that as the load gets
        -high, some connection attempts take a very long time.  And if a lot
        -of your clients disconnect from the Internet during the process of
        -TCP connection establishment (this happens a lot with dialup
        -users), these "embryonic" connections might tie up your somaxconn
        -quota of SYN_RCVD-state connections.  Until the kernel times out
        -these embryonic connections, no other connections will be accepted,
        -and it will appear as if the server has died.
        -
        -The default value for somaxconn in Digital UNIX V4.0 will be quite
        -a bit larger than it has been in previous versions (we inherited
        -this default from 4.3BSD).
        -
        -Digital UNIX V4.0 includes some other performance-related changes
        -that significantly improve its maximum HTTP connection rate.  However,
        -we've been using V3.2C systems to front-end for altavista.digital.com
        -with no obvious performance bottlenecks at the millions-of-hits-per-day
        -level.
        -
        -We have some Webstone performance results available at
        -        http://www.digital.com/info/alphaserver/news/webff.html
        -
        -[The document referenced above is no longer at that URL -- Ed.]
        -
        -I'm not sure if these were done using V4.0 or an earlier version
        -of Digital UNIX, although I suspect they were done using a test
        -version of V4.0.
        -
        --Jeff
        -
        - -
        - -
        ----------------------------------------------------------------------------
        -
        -From           mogul@pa.dec.com (Jeffrey Mogul)
        -Organization   DEC Western Research
        -Date           31 May 1996 21:01:01 GMT
        -Newsgroups     comp.unix.osf.osf1
        -Message-ID     <4onmmd$mmd@usenet.pa.dec.com>
        -Subject        Digital UNIX V3.2C Internet tuning patch info
        -
        -----------------------------------------------------------------------------
        -
        -Something that probably few people are aware of is that Digital
        -has a patch kit available for Digital UNIX V3.2C that may improve
        -Internet performance, especially for busy web servers.
        -
        -This patch kit is one way to increase the value of somaxconn,
        -which I discussed in a message here a day or two ago.
        -
        -I've included in this message the revised README file for this
        -patch kit below.  Note that the original README file in the patch
        -kit itself may be an earlier version; I'm told that the version
        -below is the right one.
        -
        -Sorry, this patch kit is NOT available for other versions of Digital
        -UNIX.  Most (but not quite all) of these changes also made it into V4.0,
        -so the description of the various tuning parameters in this README
        -file might be useful to people running V4.0 systems.
        -
        -This patch kit does not appear to be available (yet?) from
        -        http://www.service.digital.com/html/patch_service.html
        -so I guess you'll have to call Digital's Customer Support to get it.
        -
        --Jeff
        -
        -DESCRIPTION: Digital UNIX Network tuning patch
        -
        -             Patch ID: OSF350-146
        -
        -             SUPERSEDED PATCHES: OSF350-151, OSF350-158
        -
        -        This set of files improves the performance of the network
        -        subsystem on a system being used as a web server.  There are
        -        additional tunable parameters included here, to be used
        -        cautiously by an informed system administrator.
        -
        -TUNING
        -
        -        To tune the web server, the number of simultaneous socket
        -        connection requests are limited by:
        -
        -        somaxconn               Sets the maximum number of pending requests
        -                                allowed to wait on a listening socket.  The
        -                                default value in Digital UNIX V3.2 is 8.
        -                                This patch kit increases the default to 1024,
        -                                which matches the value in Digital UNIX V4.0.
        -
        -        sominconn               Sets the minimum number of pending connections
        -                                allowed on a listening socket.  When a user
        -                                process calls listen with a backlog less
        -                                than sominconn, the backlog will be set to
        -                                sominconn.  sominconn overrides somaxconn.
        -                                The default value is 1.
        -
        -        The effectiveness of tuning these parameters can be monitored by
        -        the sobacklog variables available in the kernel:
        -
        -        sobacklog_hiwat         Tracks the maximum pending requests to any
        -                                socket.  The initial value is 0.
        -
        -        sobacklog_drops         Tracks the number of drops exceeding the
        -                                socket set backlog limit.  The initial
        -                                value is 0.
        -
        -        somaxconn_drops         Tracks the number of drops exceeding the
        -                                somaxconn limit.  When sominconn is larger
        -                                than somaxconn, tracks the number of drops
        -                                exceeding sominconn.  The initial value is 0.
        -
        -        TCP timer parameters also affect performance. Tuning the following
        -        require some knowledge of the characteristics of the network.
        -
        -        tcp_msl                 Sets the tcp maximum segment lifetime.
        -                                This is the maximum lifetime in half
        -                                seconds that a packet can be in transit
        -                                on the network.  This value, when doubled,
        -                                is the length of time a connection remains
        -                                in the TIME_WAIT state after a incoming
        -                                close request is processed.  The unit is
        -                                specified in 1/2 seconds, the initial
        -                                value is 60.
        -
        -        tcp_rexmit_interval_min
        -                                Sets the minimum TCP retransmit interval.
        -                                For some WAN networks the default value may
        -                                be too short, causing unnecessary duplicate
        -                                packets to be sent.  The unit is specified
        -                                in 1/2 seconds, the initial value is 1.
        -
        -        tcp_keepinit            This is the amount of time a partially
        -                                established connection will sit on the listen
        -                                queue before timing out (e.g., if a client
        -                                sends a SYN but never answers our SYN/ACK).
        -                                Partially established connections tie up slots
        -                                on the listen queue.  If the queue starts to
        -                                fill with connections in SYN_RCVD state,
        -                                tcp_keepinit can be decreased to make those
        -                                partial connects time out sooner.  This should
        -                                be used with caution, since there might be
        -                                legitimate clients that are taking a while
        -                                to respond to SYN/ACK.  The unit is specified
        -                                in 1/2 seconds, the default value is 150
        -                                (ie. 75 seconds).
        -
        -        The hashlist size for the TCP inpcb lookup table is regulated by:
        -
        -        tcbhashsize             The number of hash buckets used for the
        -                                TCP connection table used in the kernel.
        -                                The initial value is 32.  For best results,
        -                                should be specified as a power of 2.  For
        -                                busy Web servers, set this to 2048 or more.
        -
        -        The hashlist size for the interface alias table is regulated by:
        -
        -        inifaddr_hsize          The number of hash buckets used for the
        -                                interface alias table used in the kernel.
        -                                The initial value is 32.  For best results,
        -                                should be specified as a power of 2.
        -
        -        ipport_userreserved     The maximum number of concurrent non-reserved,
        -                                dynamically allocated ports.  Default range
        -                                is 1025-5000.  The maximum value is 65535.
        -                                This limits the number of times you can
        -                                simultaneously telnet or ftp out to connect
        -                                to other systems.
        -
        -        tcpnodelack             Don't delay acknowledging TCP data; this
        -                                can sometimes improve performance of locally
        -                                run CAD packages.  Default is value is 0,
        -                                the enabled value is 1.
        -
        -                           Digital UNIX version:
        -
        -                                  V3.2C
        -Feature                    V3.2C  patch  V4.0
        -=======                    =====  =====  ====
        -somaxconn                   X      X      X
        -sominconn                   -      X      X
        -sobacklog_hiwat             -      X      -
        -sobacklog_drops             -      X      -
        -somaxconn_drops             -      X      -
        -tcpnodelack                 X      X      X
        -tcp_keepidle                X      X      X
        -tcp_keepintvl               X      X      X
        -tcp_keepcnt                 -      X      X
        -tcp_keepinit                -      X      X
        -TCP keepalive per-socket    -      -      X
        -tcp_msl                     -      X      -
        -tcp_rexmit_interval_min     -      X      -
        -TCP inpcb hashing           -      X      X
        -tcbhashsize                 -      X      X
        -interface alias hashing     -      X      X
        -inifaddr_hsize              -      X      X
        -ipport_userreserved         -      X      -
        -sysconfig -q inet           -      -      X
        -sysconfig -q socket         -      -      X
        -
        - - - - diff --git a/docs/manual/platform/perf-hp.html b/docs/manual/platform/perf-hp.html deleted file mode 100644 index ca902a09fe..0000000000 --- a/docs/manual/platform/perf-hp.html +++ /dev/null @@ -1,122 +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. - -Notice that it's critically important that you use "W" to write a 32 bit -quantity, not "w" to write a 16 bit value when patching the disc image because -the tcp_hash_size variable is a 32 bit quantity. - -

        - -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 <BINARY>." The GID of the running executable -must have MLOCK privileges. 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/perf.html b/docs/manual/platform/perf.html deleted file mode 100644 index 73bd5b5b20..0000000000 --- a/docs/manual/platform/perf.html +++ /dev/null @@ -1,175 +0,0 @@ - - - -Hints on Running a High-Performance Web Server - - - - - -

        Hints on Running a High-Performance Web Server

        - -Running Apache on a heavily loaded web server, one often encounters -problems related to the machine and OS configuration. "Heavy" is -relative, of course - but if you are seeing more than a couple hits -per second on a sustained basis you should consult the pointers on -this page. In general the suggestions involve how to tune your kernel -for the heavier TCP load, hardware/software conflicts that arise, etc. - - - -
        - -

        -A/UX (Apple's UNIX) -

        - -If you are running Apache on A/UX, a page that gives some helpful -performance hints (concerning the listen() queue and using -virtual hosts) -can be found here - -


        - -

        -BSD-based (BSDI, FreeBSD, etc) -

        - -Quick and -detailed -performance tuning hints for BSD-derived systems. - -


        - -

        -Digital UNIX -

        - - - -


        - -

        -Linux -

        - -There are no known problems with heavily loaded systems running Linux -kernels 2.0.32 or later. Earlier kernels have some problems, and an -upgrade to the latest 2.0.x is a good idea to eliminate various security -and denial of service attacks. - -


        - -

        -Solaris 2.4 -

        - -The Solaris 2.4 TCP implementation has a few inherent limitations that -only became apparent under heavy loads. This has been fixed to some -extent in 2.5 (and completely revamped in 2.6), but for now consult -the following URL for tips on how to expand the capabilities if you -are finding slowdowns and lags are hurting performance. - -

        - -Other links: - -

        - -


        - -

        -SunOS 4.x -

        - -More information on tuning SOMAXCONN on SunOS can be found at - -http://www.islandnet.com/~mark/somaxconn.html. - -


        - -

        -SVR4 -

        - -Some SVR4 versions waste three system calls on every -gettimeofday() call. Depending on the syntactic -form of the TZ environment variable, these -systems have several different algorithms to determine the -local time zone (presumably compatible with -something). The following example uses the central european -time zone to demonstrate this: -
        -
        TZ=:MET -
        This form delegates the knowledge of the time zone - information to an external compiled zoneinfo file - (à la BSD).
        - Caveat: Each time the gettimeofday() - function is called, the external zone info is read in - again (at least on some SVR4 systems). That results in - three wasted system calls with every apache request - served.
        -     open("/usr/lib/locale/TZ/MET", O_RDONLY) = 3
        -     read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 7944) = 778
        -     close(3)                                = 0
        - -
        TZ=MET-1MDT,M3.5.0/02:00:00,M10.5.0/03:00:00 -
        This syntax form (à la SYSV) contains all the - knowledge about time zone beginning and ending times in - its external representation. It has to be parsed each - time it is evaluated, resulting in a slight computing - overhead, but it requires no system call. Though the - table lookup à la BSD is the more sophisticated - technical solution, the bad SVR4 implementation makes - this the preferred syntax on systems which otherwise - access the external zone info file repeatedly. -
        -You should use the truss utility on a -single-process apache server (started with the -X -debugging switch) to determine whether your system can profit -from the second form of the TZ environment -variable. If it does, you could integrate the setting of the -preferred TZ syntax into the httpd startup -script, which is usually simply a copy of (or symbolic link -to) the apachectl utility script, or into the -system's /etc/TIMEZONE script. - -


        - -

        More welcome!

        - -If you have tips to contribute, send mail to apache@apache.org - - - - diff --git a/docs/manual/platform/readme-tpf.html b/docs/manual/platform/readme-tpf.html deleted file mode 100644 index 6c89faee64..0000000000 --- a/docs/manual/platform/readme-tpf.html +++ /dev/null @@ -1,214 +0,0 @@ - - - -The Apache TPF Port - - - -
        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. -
        -

        Overview of the Apache TPF Port

        -
        -
        Configuration Files -  | What's Available -  | Porting Notes ] -
        -
        -
        - -

        - This version of Apache includes changes allowing it to run on - IBM's EBCDIC-based - TPF - (Transaction Processing Facility) operating system. - Unless otherwise noted TPF version 4.1 PUT09 is required. -

        - Refer to htdocs/manual/install-tpf.html - for step-by-step installation instructions. -

        - As this is the first cut at making Apache run on TPF, - performance tuning has not been done. -

        - This port builds upon the EBCDIC changes - previously made to Apache. -
        -

        - -  -

        Apache Configuration Files

        -

        - The distributed configuration files (httpd.conf-dist and - mime.types, both located in the conf subdirectory) - work on TPF. Performance considerations may dictate setting KeepAlive to "Off" - (the default is "On") or lowering the Timeout value from the default - 300 seconds (5 minutes) in order to reduce the number of active ECBs on your system. -

        - -  -

        What's Available in this Version

        - - (The Apache organization provides - online documentation - describing the various modules and components of the server.) - -

        Components/modules tested on TPF:

        - -
          -
        • alloc.c -
        • ap_base64.c -
        • ap_checkpass.c -
        • ap_cpystrn.c -
        • ap_fnmatch.c -
        • ap_md5c.c -
        • ap_sha1.c -
        • ap_signal.c -
        • ap_slack.c -
        • ap_snprintf.c -
        • buff.c -
        • buildmark.c -
        • ebcdic.c -
        • gen_test.char.c -
        • gen_uri_delims.c -
        • htpasswd.c (requires PUT10) -
        • http_config.c -
        • http_core.c -
        • http_log.c -
        • http_main.c -
        • http_protocol.c -
        • http_request.c -
        • http_vhost.c -
        • logresolve.c (requires PUT10) -
        • mod_access.c (see note 1) -
        • mod_actions.c -
        • mod_alias.c -
        • mod_asis.c -
        • mod_auth.c -
        • mod_auth_anon.c -
        • mod_autoindex.c -
        • mod_cern_meta.c -
        • mod_cgi.c (requires PUT10) -
        • mod_digest.c -
        • mod_dir.c -
        • mod_env.c -
        • mod_example.c -
        • mod_expires.c -
        • mod_headers.c -
        • mod_imap.c -
        • mod_include.c (see note 2) -
        • mod_info.c -
        • mod_log_agent.c -
        • mod_log_config.c -
        • mod_log_referer.c -
        • mod_mime.c -
        • mod_mime_magic.c -
        • mod_negotiation.c -
        • mod_put.c - (third party module) -
        • mod_proxy.c -
        • mod_setenvif.c -
        • mod_speling.c -
        • mod_status.c -
        • mod_tpf_shm_static.c (third party module, requires PUT10) -
        • mod_unique_id.c (requires PUT10) -
        • mod_userdir.c -
        • mod_usertrack.c -
        • os.c -
        • os-inline.c -
        • proxy_cache.c -
        • proxy_connect.c -
        • proxy_ftp.c -
        • proxy_http.c -
        • proxy_util.c -
        • regular expression parser -
        • regular expression test tool (requires PUT10) -
        • rfc1413.c -
        • rotatelogs.c (requires PUT10) -
        • util.c -
        • util_date.c -
        • util_md5.c -
        • util_script.c -
        • util_uri.c -
        - Notes: -
          -
        1. Use of mod_access directives "Allow from" & "Deny from" - with host names (verses ip addresses) requires TPF version 4.1 PUT10 -
        2. CGI execution requires TPF version 4.1 PUT10 -
        - -

        Components/modules not yet supported on TPF:

        - -
          -
        • htdigest.c -
        • lib/expat-lite -
        • mod_auth_digest.c -
        • mod_rewrite.c -
        • mod_vhost_alias.c -
        - -

        Components/modules that don't apply or that probably won't ever be available on TPF:

        - -
          -
        • ab.c -
        • ap_getpass.c -
        • mod_auth_db.c -
        • mod_auth_dbm.c -
        • mod_auth_db.module -
        • mod_mmap_static.c -
        • mod_so.c -
        • suexec.c -
        - -  -

        Porting Notes

        -

        -

        Changes made due to differences between UNIX and - TPF's process models:

        -
          -
        • Signals: On TPF a signal that is sent to a process - remains unhandled until the process explicitly requests that signals - be handled using the tpf_process_signals() function. - Additionally, the default action for an alarm on TPF is to take - an OPR-7777 dump and exit. (On UNIX the default is the equivalent - of exit() with no dump taken.) - These differences necessitated a few modifications: -

          -
            -
          • bypass the use of ap_block_alarms() & - ap_unblock_alarms() -
          • add tpf_process_signals() calls -
          • add select() calls to prevent blocking. -
          -
          -
        - -

        Find that function...

        -

        Some simple functions & definitions initially needed to be added - on TPF, such as FD_SET(). - We've put these in src/os/tpf/os.h for now. -

        - -

        EBCDIC changes:

        -

        TPF-specific conversion tables between US-ASCII and - EBCDIC (character set IBM-1047 to be exact) were created - and put into ebcdic.c in the src/os/tpf directory. -

        - -

        Miscellaneous, minor changes:

        -

        Various minor changes (such as casting) were made due to - differences in how some functions are implemented on TPF. -

        - -
        -
        top -  | Configuration Files -  | What's Available -  | Porting Notes ] -
        - - - diff --git a/docs/manual/platform/unixware.html b/docs/manual/platform/unixware.html deleted file mode 100644 index cdb8c6a6b6..0000000000 --- a/docs/manual/platform/unixware.html +++ /dev/null @@ -1,69 +0,0 @@ - - - -Compiling Apache under UnixWare - - - - - - -
        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. -
        - -

        Compiling Apache under UnixWare

        - -To compile a working copy of Apache under UnixWare, there are several other -steps you may need to take. These prevent such problems as zombie processes, -bind errors, and accept errors, to name a few. - -

        UnixWare 1.x

        - -Make sure that USE_FCNTL_SERIALIZE_ACCEPT is defined (if not -defined by Apache autoconfiguration). If using the UnixWare cc -compiler, and you still see accept() errors, don't use compiler optimization, -or get gcc. - -

        UnixWare 2.0.x

        - -SCO patch tf2163 is required -in order for Apache to work correctly on UnixWare 2.0.x. See -http://www.sco.com -for UnixWare patch information.

        - -In addition, make sure that USE_FCNTL_SERIALIZE_ACCEPT is defined (if not -defined by Apache autoconfiguration). To reduce instances of connections -in FIN_WAIT_2 state, you may also want to define NO_LINGCLOSE (Apache 1.2 -only). - -

        UnixWare 2.1.x

        - -SCO patch ptf3123 is required -in order for Apache to work correctly on UnixWare 2.1.x. See -http://www.sco.com -for UnixWare patch information.

        - -NOTE: Unixware 2.1.2 and later already have patch ptf3123 -included

        - -In addition, make sure that USE_FCNTL_SERIALIZE_ACCEPT is defined (if not -defined by Apache autoconfiguration). To reduce instances of connections -in FIN_WAIT_2 state, you may also want to define NO_LINGCLOSE (Apache 1.2 -only).

        - -Thanks to Joe Doupnik <JRD@cc.usu.edu> and Rich Vaughn -<rvaughn@aad.com> for additional info for UnixWare builds.

        - - - - diff --git a/docs/manual/platform/win_compiling.html b/docs/manual/platform/win_compiling.html deleted file mode 100644 index 0f854bea25..0000000000 --- a/docs/manual/platform/win_compiling.html +++ /dev/null @@ -1,180 +0,0 @@ - - - -Compiling Apache for 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. Be especially aware that the vcvars32.bat file from the - Program Files/DevStudio/VC/bin folder may be required to prepare the - command-line environment for command-line builds!

        - -

        First, unpack the Apache distribution into an appropriate - directory. Open a command-line prompt and cd to that directory.

        - -

        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 VisualStudio development - environment. To simplify this process, a VisualStudio workspace, - Apache.dsw, is provided. This workspace exposes - the entire list of working .dsp projects that are required for the - complete Apache binary release. It includes dependencies between - the projects to assure that they are built in the appropriate order.

        - -

        Notice: The Apache/VisualStudio project files are distributed - in VisualStudio 6.0 (98) format. In fact you may build with - VisualStudio 5.0 (97) but you must first use the perl script command:

        - -
        -    cd srclib\apr\build
        -    cvstodsp5.pl
        -
        - -

        Without running the script you will be able to load and build Apache, - however VisualStudio 97 in particular will not recognize the /ZI flag - to the C compiler for the debugging mode. This script toggles the - new /ZI flag back to /Zi for Debug builds, among other adjustments. - The converse script in srclib\apr\build\dsp5tocvs.pl will - reverse the adjustments, and we ask you to do so before submitting - patches against any .dsp project files.

        - -

        The Apache.dsw workspace and makefile.win nmake script both build the - .dsp projects of the Apache server in the following sequence:

        - -
          -
        1. srclib\apr\aprlib.dsp -
        2. srclib\apr\aprlibdll.dsp requires aprlib -
        3. srclib\pcre\dftables.dsp -
        4. srclib\pcre\pcre.dsp requires dftables -
        5. srclib\pcre\pcreposix.dsp requires dftables and pcre -
        6. srclib\expat-lite\xmltok.dsp -
        7. srclib\expat-lite\xmlparse.dsp requires xmltok -
        8. main\gen_uri_delims.dsp -
        9. main\gen_test_char.dsp -
        10. ApacheCore.dsp requires all of the above -
        11. Apache.dsp requires ApacheCore and aprlibdll -
        - -

        In addition, the os\win32 subdirectory contains - project files for the optional modules.

        - -
          -
        1. os\win32\ApacheModuleAuthAnon.dsp -
        2. os\win32\ApacheModuleAuthDigest.dsp -
        3. os\win32\ApacheModuleCERNMeta.dsp -
        4. os\win32\ApacheModuleExpires.dsp -
        5. os\win32\ApacheModuleFileCache.dsp -
        6. os\win32\ApacheModuleHeaders.dsp -
        7. os\win32\ApacheModuleInfo.dsp -
        8. os\win32\ApacheModuleRewrite.dsp -
        9. os\win32\ApacheModuleSpeling.dsp -
        10. os\win32\ApacheModuleStatus.dsp -
        11. os\win32\ApacheModuleUserTrack.dsp -
        12. modules\proxy\ApacheModuleProxy.dsp -
        - -

        The support\ folder contains project files for additional - programs that are not part of the apache runtime, but are used by - the administrator to test Apache and maintain password and log files.

        - -
          -
        1. support\ab.dsp -
        2. support\htdigest.dsp -
        3. support\htpasswd.dsp -
        4. support\logresolve.dsp -
        5. support\rotatelogs.dsp -
        - -

        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 build and install all the files into the desired folder dir - automatically, use one the following nmake commands:

        - -
          -
        • 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\aprlib.dll - Apache Portable Runtime shared library -
        • dir\ApacheCore.dll - Apache Core application -
        • dir\modules\ApacheModule*.dll - Loadable Apache - modules -
        • dir\bin\*.exe - Administrator support executables -
        • 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, or use the following shortcut.

        - -

        To simplify the process, dependencies between all projects - are defined in the Microsoft VisualStudio workspace file: - -

        -   Apache.dsw
        -
        - -

        This assures that lower-level sources are rebuilt from within - VisualStudio. The top level project is InstallBin, which invokes - Makefile.win to move the compiled executables and dlls. You may - personalize the INSTDIR= setting by changing the Settings for - InstallBin, Build command line entry under the General tab. - INSTDIR defaults to the same directory as the httpd source.

        - -

        Warning about building Apache from the development tree

        - -

        Only the .dsp files are distributed between release builds. The - .mak files are NOT regenerated, due to the tremendous waste of - reviewer's time. Therefore, you cannot rely on the NMAKE commands - above to build revised .dsp project files unless you then export - all .mak files yourself from the project. This is unnecessary if - you build from within the Microsoft DeveloperStudio environment.

        - -

        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/win_service.html b/docs/manual/platform/win_service.html deleted file mode 100644 index de031beb6f..0000000000 --- a/docs/manual/platform/win_service.html +++ /dev/null @@ -1,325 +0,0 @@ - - - -Running Apache for Windows as a Service - - - - - - -

        Running Apache for Windows as a Service

        - -

        Apache can be run as a service on Windows NT/2000. (There is also some - HIGHLY EXPERIMENTAL support for similar behavior on - Windows 95/98, introduced with Apache 1.3.13).

        - -

        Installing Apache as a service should only be done once you can - successfully run it in a console window. See - Using Apache with Microsoft Windows - before you attempt to install or run Apache as a service. Changes to the - httpd.conf file should always be followed by starting Apache as a console - window. If this succeeds, the service should succeed.

        - -

        NOTE: Prior to version 1.3.13, the configuration was not - tested prior to performing the installation, and a lack of - service dependencies often caused the console window to succeed, but the - service would still fail. See below if you are - having problems running a version of Apache prior to 1.3.13 to resolve the - issue. If you have this problem with version 1.3.13 or greater, first try - uninstalling (-u) and re-installing (-i) the Apache service.

        - -
        - -

        To start Apache as a service, you first need to install it as a - service. Multiple Apache services can be installed, each with a - different name and configuration. To install the default Apache - service named "Apache", run the "Install Apache as Service (NT only)" - option from the Start menu. Once this is done you can start the "Apache" - service by opening the Services window (in the Control Panel), selecting - Apache, then clicking on Start. Apache will now be running, hidden in the - background. You can later stop Apache by clicking on Stop. As an - alternative to using the Services window, you can start and stop the - "Apache" service from the command line with

        - -
        -  NET START APACHE
        -  NET STOP APACHE
        -
        - -

        See Controlling Apache as a Service - for more information on installing and controlling Apache services.

        - -

        Apache, unlike many other Windows NT/2000 services, logs any - errors to it's own error.log file in the logs folder within the - Apache server root folder. You will not find Apache error - details in the Windows NT Event Log.

        - -

        After starting Apache as a service (or if you have trouble starting it) - you can test it using the same procedure - as for running in a console window. Remember to use the command:

        - -
        -  apache -n "service name"
        -
        - -

        to assure you are using the service's configuration.

        - - -

        Running Apache for Windows as a Service

        - -

        Note: The -n option to specify a service name is only available - with Apache 1.3.7 and later. Earlier versions of Apache only - support the default service name 'Apache'.

        - -

        You can install Apache as a Windows NT service as follows:

        - -
        -    apache -i -n "service name"
        -
        - -

        To install a service to use a particular configuration, specify the - configuration file when the service is installed:

        - -
        -    apache -i -n "service name" -f "\my server\conf\my.conf"
        -
        - -

        To remove an Apache service, use:

        - -
        -    apache -u -n "service name"
        -
        - -

        The default "service name", if one is not specified, is "Apache".

        - -

        Once a service is installed, you can use the -n option, in - conjunction with other options, to refer to a service's configuration file. - For example:

        - -

        To test a service's configuration file:

        -
        -    apache -n "service name" -t
        -
        - -

        To start a console Apache using a service's configuration file:

        -
        -    apache -n "service name"
        -
        - -

        Important Note on service dependencies:

        - -

        Prior to Apache release 1.3.13, the dependencies required to - successfully start an installed service were not configured. - After installing a service using earlier versions of Apache, - you must follow these steps: - -

        -    Run regedt32
        -    Select Window - "HKEY_LOCAL_MACHINE on Local Machine" from the menu
        -    Double-click to open the SYSTEM, then the CurrentControlSet keys
        -    Scroll down and click on the Apache servicename
        -    Select Edit - Add Value... from the menu
        -    Fill in the Add Value dialog with 
        -        Value Name: DependOnGroup 
        -        Data Type: REG_MULTI_SZ
        -        and click OK
        -    Leave the Multi-String Editor dialog empty and click OK
        -    Select Edit - Add Value... from the menu
        -    Fill in the Add Value dialog with 
        -        Value Name: DependOnService
        -        Data Type: REG_MULTI_SZ
        -        and click OK
        -    Type the following list (one per line) in the Multi-String Editor dialog
        -        Tcpip
        -        Afd
        -        and click OK
        -
        - -

        If you are using COM or DCOM components from a third party module, ISAPI, - or other add-in scripting technologies such as ActiveState Perl, you may - also need to add the entry Rpcss to the DependOnService list. To avoid - exposing the TCP port 135 when it is unnecessary, Apache does not create - that entry upon installation. Follow the directions above to find or - create the DependOnService value, double click that value if it already - exists, and add the Rpcss entry to the list.

        - - -

        User Account for Apache Service to Run As (NT/2000)

        - -

        When Apache is first installed as a service (e.g. with the -i option) - it will run as user "System" (the LocalSystem account). There should - be few issues if all resources for the web server reside on the local - system, but it has broad security privilages to affect the local machine!

        - -
        - LocalSystem is a very privileged account locally, so - you shouldn't run any shareware applications there. - However, it has no network privileges and cannot leave - the machine via any NT-secured mechanism, including - file system, named pipes, DCOM, or secure RPC. -
        - -

        NEVER grant network privilages to the SYSTEM account! - Create a new user account instead, grant the appropriate privilages to - that user, and use the the 'Log On As:' option. Select the Start Menu -> - Settings -> Control Panel -> Services -> apache service ... and click - the "Startup" button to access this setting.

        - -
        - A service that runs in the context of the LocalSystem account - inherits the security context of the SCM. It is not associated with - any logged-on user account and does not have credentials (domain name, - user name, and password) to be used for verification. -
        - -

        The SYSTEM account has no privilages to the network, so shared pages or - a shared installation of Apache is invisible to the service. If you intend - to use any network resources, the following steps should help:

        - -
          -
        • Select Apache from the Control Panel's Service dialog and click Startup. -
        • Verify that the service account is correct. You may wish to create an - account for your Apache services. -
        • Retype the password and password confirmation. -
        • Go to User Manager for Domains. -
        • Click on Policies from the title bar menu, and select User Rights. -
        • Select the option for Advanced User Rights. -
        • In the drop-down list, verify that the following rights have been - granted to the selected account: -
            -
          • Act as part of the operating system -
          • Back up files and directories -
          • Log on as a service -
          • Restore files and directories -
          -
        • Confirm that the selected account is a member of the Users group. -
        • Confirm the selected account has access to all document and script - directories (minimally read and browse access). -
        • Confirm the selected account has read/write/delete access to the Apache - logs directory! -
        - -

        If you allow the account to log in as a user, then you can log in yourself - and test that the account has the privilages to execute the scripts, read - the web pages, and that you can start Apache in a console window. If this - works, and you have followed the steps above, Apache should execute as - a service with no problems.

        -

        Note: error code 2186 is a good indication that you need - to review the 'Log On As' configuration, since the server can't access a - required network resource.

        - - -

        Troubleshooting Apache for Windows as a Service

        - -

        When starting Apache as a service you may encounter an error message from - Windows service manager. For example if you try to start Apache using the Services - applet in Windows Control Panel you may get the following message; -

        -  Could not start the apache service on \\COMPUTER
        -  Error 1067; The process terminated unexpectedly.
        -
        -

        You will get this error if there is any problem starting Apache. In order to see - what is causing the problem you should follow the instructions - for Running Apache for Windows from the Command Line.

        - -

        Also, Apache 1.3.13 now records startup errors in the Application Event Log - under Windows NT/2000, if Apache is run as a service. Run the Event Viewer - and select Log ... Application to see these events. - -

        Check the Application Event Log with the Event Viewer in case of any - problems, even if no error message pops up to warn you that an error - occured.

        - -

        Running Apache for Windows from the Command Line

        - -For details on controlling Apache service from the command line, please refer to -console command line section. - - -

        Controlling Apache as a Service

        - -

        Multiple instances of Apache can be installed and run as services. Signal - an installed Apache service to start, restart, or shutdown/stop - as follows:

        - -
        -    apache -n "service name" -k start
        -    apache -n "service name" -k restart
        -    apache -n "service name" -k shutdown
        -    apache -n "service name" -k stop
        -
        - -

        For the default "Apache" service, the -n Apache option is still required, - since the -k commands without the -n option are directed at Apache running - in a console window. The quotes are only required if the service name - contains spaces.

        - -

        Note: the -k stop alias for the -k shutdown command was introduced - in Apache version 1.3.13. Earlier versions of Apache will only - recognize the -k shutdown option. Prior to 1.3.3, Apache did not recognize - any -k options at all!

        - -

        In addition, you can use the native NT NET command to - start and stop Apache services as follows:

        - -
        -    NET START "service name"
        -    NET STOP "service name"
        -
        - -

        Again, quotes are only required if the service name contains spaces.

        - -

        HIGHLY EXPERIMENTAL Windows 95/98 Service

        - -

        Note: The service options for Windows 95 and 98 are only available - with Apache 1.3.13 and later. Earlier versions of Apache only - supported Apache in a console window for Windows 95/98.

        - -

        There is some support for Apache on Windows 95/98 to behave in a similar - manner as a service on Windows NT/2000. It is highly experimental, - if it works (at all) the Apache Sofware Foundation will not attest to it's - reliability or future support. Proceed at your own risk!

        - -

        Once you have confirmed that Apache runs correctly at the - Command Prompt you can install, control - and uninstall it with the same commands as the Windows NT/2000 version.

        - -

        There are, however, significant differences that you should note:

        - -

        Apache will attempt to start and if successful it will run in the - background. If you run the command

        - -
        -   Apache -n "service name" -k start
        -
        - -

        via a shortcut on your desktop, for example, then if the service starts - successfully a console window will flash up but immediately disappears. - If Apache detects any errors on startup such as a incorrect entries in the - httpd.conf file, then the console window will remain visible. This will - display an error message which will be useful in tracking down the cause of - the problem.

        - -

        Windows 95/98 does not support NET START or NET STOP commands so you must - use Apache's Service Control options at a command prompt. You may wish to - set up a shortcut for each of these commands so that you can just choose - it from the start menu or desktop to perform the required action.

        - -

        Apache and Windows 95/98 offer no support for running the Apache service - as a specific user with network privilages. In fact, Windows 95/98 offers - no security on the local machine, either. This is the simple reason that - the Apache Software Foundation never endorses the use of Windows 95/98 as a - public httpd server. These facilities exist only to assist the user in - developing web content and learning the Apache server, and perhaps as a - intranet server on a secured, private network.

        - - - - diff --git a/docs/manual/platform/windows.html b/docs/manual/platform/windows.html deleted file mode 100644 index 325688ab6a..0000000000 --- a/docs/manual/platform/windows.html +++ /dev/null @@ -1,514 +0,0 @@ - - - -Using Apache with Microsoft Windows - - - - - - -

        Using Apache with Microsoft Windows

        - -

        This document explains how to install, configure and run - Apache 2.0 under Microsoft Windows. If you find any bugs, or wish - to contribute in other ways, please use our - bug reporting page.

        - -

        Most of this document assumes that you are installing Windows from a - binary distribution. If you want to compile Apache yourself (possibly - to help with development, or to track down bugs), see - Compiling Apache for Microsoft Windows. - -


        - - - -
        - -

        Requirements

        - -

        Apache 2.0 is designed to run on Windows NT 4.0 and Windows 2000. The - binary installer will only work with the x86 family of processors, such - as Intel's. Apache may also run on Windows 95 and 98, but these have not - been tested, and are never recommended for production servers. In all - cases TCP/IP networking must be installed.

        - -

        If running on Windows 95, the "Winsock2" upgrade MUST BE INSTALLED. - "Winsock2" for Windows 95 is available - here.

        - -

        If running on NT 4.0, installing Service Pack 3 or 6 is recommended, as - Service Pack 4 created known issues with TCPIP/WinSock integrity that - were resolved in later Service Packs.

        - -

        Warning: as of alpha 2.0a4 Windows 95 (and possibly 98) do not - run at all. Please don't let that stop you, however, from contributing - the fixes required to make that platform run successfully.

        - -

        Downloading Apache for Windows

        - -

        Information on the latest version of Apache can be found on the - Apache web server at - http://www.apache.org/httpd. This will list the current release, - any more recent alpha or beta-test releases, together with details of - mirror web and anonymous ftp sites.

        - -

        You should download the version of Apache for Windows with the - .exe extension. This is a single file containing Apache, - ready to install and run. There may also be a .zip file - containing the source code, to compile Apache yourself. (If there is - no .zip file, the source will be available in a - .tar.gz file but this will contain Unix line endings. You - will have to convert at least the .mak and - .dsp files to have DOS line endings before MSVC will - understand them).

        - -

        Notice: alpha versions are not distributed in binary form (as - an .exe ready-to-run version). You must use the Microsoft Visual C++ - compiler version 5 or 6 (bundled in VisualStudio 97 and 98). Read - Compiling Apache for Microsoft Windows - for compilation/installation instructions.

        - -

        Installing Apache for Windows

        - -

        Run the Apache .exe file you downloaded above. This will - ask for:

        - -
          - -
        • the directory to install Apache into (the default is - \Program Files\Apache Group\Apache although you can - change this to any other directory) - -
        • the start menu name (default is "Apache Web Server") - -
        • the installation type. The "Typical" option installs - everything except the source code. The "Minimum" option does not - install the manuals or source code. Choose the "Custom" install if - you want to install the source code. - -
        - -

        During the installation, Apache will configure the files in the - conf directory for your chosen installation - directory. However if any of the files in this directory already exist - they will not be overwritten. Instead the new copy of - the corresponding file will be left with the extension - .default. So, for example, if - conf\httpd.conf already exists it will not be altered, - but the version which would have been installed will be left in - conf\httpd.conf.default. After the installation has - finished you should manually check to see what in new in the - .default file, and if necessary update your existing - configuration files.

        - -

        Also, if you already have a file called htdocs\index.html - then it will not be overwritten (no index.html.default - file will be installed either). This should mean it a safe to install - Apache over an existing installation (but you will have to stop the - existing server running before doing the installation, then start the - new one after the installation is finished).

        - -

        After installing Apache, you should edit the configuration files in - the conf directory as required. These files will be - configured during the install ready for Apache to be run from the - directory where it was installed, with the documents served from the - subdirectory htdocs. There are lots of other options - which should be set before you start really using Apache. However to - get started quickly the files should work as installed.

        - -

        Running Apache for Windows

        - -There are two ways you can run Apache: - -
          -
        • As a "service" (available on Windows NT/2000 only). - This is the best option if you want Apache to automatically start when you - machine boots, and to keep Apache running when you log-off. -
        • From a console window. This is the only option - available for Windows 95/98 users, and MUST be used by Windows NT/2000 - users before to attempting to run as a service. -
        - -

        To run Apache from a console window, select the "Start Apache as - console app" option from the Start menu (in Apache 1.3.4 and earlier, - this option was called "Apache Server"). This will open a console - window and start Apache running inside it. The window will remain - active until you stop Apache. To stop Apache running, either select - the "Shutdown Apache console app" icon option from the Start menu - (this is not available in Apache 1.3.4 or earlier), or see Signalling Console Apache when Running for how - to control Apache from the command line.

        - -

        If the Apache console window closes immediately (or unexpectedly), - run the "Command Prompt" from the Start Menu - Programs list. Change - to the folder to which you installed Apache, type the command apache, - and read the error message. Then change to the logs folder, and review - the error.log file for configuration mistakes. If you accepted the - defaults when you installed Apache, the commands would be:

        - -
        -  c:
        -  cd "\program files\apache group\apache"
        -  apache
        -  Wait for Apache to exit, or press Ctrl+C
        -  cd logs
        -  more <error.log
        -
        - -

        Complete the steps above before you proceed to attempt to - start Apache as a Window NT/2000 service!

        - -

        To start Apache as a service, you first need to install it as a - service. Multiple Apache services can be installed, each with a - different name and configuration. To install the default Apache - service named "Apache", run the "Install Apache as Service (NT only)" - option from the Start menu. Once this is done you can start the "Apache" - service by opening the Services window (in the Control Panel), selecting Apache, - then clicking on Start. Apache will now be running in the background. You - can later stop Apache by clicking on Stop. As an alternative to using - the Services window, you can start and stop the "Apache" service from the control - line with:

        - -
        -  NET START APACHE
        -  NET STOP APACHE
        -
        - -

        See Signalling Service Apache when Running - for more information on installing and controlling Apache services.

        - -

        Apache, unlike many other Windows NT/2000 services, logs any - errors to it's own error.log file in the logs folder within the - Apache server root folder. You will not find Apache error - details in the Windows NT Event Log.

        - -

        After starting Apache running (either in a console window or as a - service) if 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 this URL:

        - -
        -  http://localhost/
        -
        - -

        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. - If your host isn't connected to the net, you may have to use - this URL:

        - -
        -  http://127.0.0.1/
        -
        - -

        Once your basic installation is working, you should configure it - properly by editing the files in the conf directory. - Again, if you change the configuration of the Windows NT/2000 - service for Apache, first attempt to start it from the command - line to assure that the service starts with no errors.

        - -

        Because Apache CANNOT share the same port with another - TCPIP application, you may need to stop or uninstall certain - services first. These include (but are not limited to) other - web servers, and firewall products such as BlackIce. If you can - only start Apache with these services disabled, reconfigure either - Apache or the other product so that they do not listen on the - same TCPIP ports.

        - -

        Configuring Apache for Windows

        - -

        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 - Windows. See the Apache documentation for all the - available directives.

        - -

        The main differences in Apache for Windows are:

        - -
          -
        • Because Apache for Windows is multithreaded, it does not use a - separate process for each request, as Apache does with - Unix. Instead there are usually only two Apache processes running: - a parent process, 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. - - Warning: The server configuration file is reread when the - new child process is started. If you have modified httpd.conf, - the new child may not start or you may receive unexpected results. - -

          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.

          -
        • 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 loadable - modules is also available.

          -
        • Apache can also load ISAPI Extensions (i.e., Internet Server - Applications), such as those used by Microsoft's IIS, and other - Windows servers. More information - is available. Note that Apache CANNOT load ISAPI - Filters. -

        - -

        Running Apache for Windows as a Service

        - -

        Note: The -n option to specify a service name is only available - with Apache 1.3.7 and later. Earlier versions of Apache only support - the default service name 'Apache'.

        - -

        You can install Apache as a Windows NT service as follows:

        - -
        -    apache -k install -n "service name"
        -
        - -

        To install a service to use a particular configuration, specify the - configuration file when the service is installed:

        - -
        -    apache -k install -n "service name" -f "\my server\conf\my.conf"
        -
        - -

        To remove an Apache service, use

        - -
        -    apache -k uninstall -n "service name"
        -
        - -

        The default "service name", if one is not specified, is "Apache".

        - -

        Once a service is installed, you can use the -n option, in - conjunction with other options, to refer to a service's configuration - file. For example:

        - -

        To test a service's configuration file:

        - -
        -    apache -n "service name" -t
        -
        - -

        To start a console Apache using a service's configuration file:

        - -
        -    apache -n "service name"
        -
        - -

        Important Note on service dependencies:

        - -

        Prior to Apache release 1.3.13, the dependencies required to - successfully start an installed service were not configured. - After installing a service using earlier versions of Apache, - you must follow these steps: - -

        -    Run regedt32
        -    Select Window - "HKEY_LOCAL_MACHINE on Local Machine" from the menu
        -    Double-click to open the SYSTEM, then the CurrentControlSet keys
        -    Scroll down and click on the Apache servicename
        -    Select Edit - Add Value... from the menu
        -    Fill in the Add Value dialog with 
        -        Value Name: DependOnGroup 
        -        Data Type: REG_MULTI_SZ
        -        and click OK
        -    Leave the Multi-String Editor dialog empty and click OK
        -    Select Edit - Add Value... from the menu
        -    Fill in the Add Value dialog with 
        -        Value Name: DependOnService
        -        Data Type: REG_MULTI_SZ
        -        and click OK
        -    Type the following list (one per line) in the Multi-String Editor dialog
        -        Tcpip
        -        Afd
        -        and click OK
        -
        - -

        If you are using COM or DCOM components from a third party module, ISAPI, - or other add-in scripting technologies such as ActiveState Perl, you may - also need to add the entry Rpcss to the DependOnService list. To avoid - exposing the TCP port 135 when it is unnecessary, Apache does not create - that entry upon installation. Follow the directions above to find or - create the DependOnService value, double click that value if it already - exists, and add the Rpcss entry to the list.

        - -

        Running Apache for Windows from the Command Line

        - -

        The Start menu icons and the NT Service manager can provide a simple - interface for administering Apache. But in some cases it is easier to - work from the command line.

        - -

        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 "c:\my server\conf\my.conf"
        -    apache -f test\test.conf
        - -
          -
        • -n specifies the configuration file of an installed Apache service (Apache 1.3.7 and later) -
        - -
            apache -n "service name"
        - -

        In these cases, the proper ServerRoot should be set in the configuration file.

        - -

        If you don't specify a configuration file name with -f or -n, 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 -
        • A registry entry, created if you did a binary install. -
        • The server root compiled into the server. -
        - -

        The server root compiled into the server is usually "/apache". - invoking apache with the -V switch will display this value - labeled as HTTPD_ROOT.

        - -

        When invoked from the start menu, Apache is usually passed no arguments, - so using the registry entry is the preferred technique for console Apache.

        - -

        During a binary installation, a version-specific registry key is created - in the Windows registry: - -

        -  HKEY_LOCAL_MACHINE\Software\Apache Group\Apache\1.3.7
        -
        -  HKEY_LOCAL_MACHINE\Software\Apache Group\Apache\2.0a3
        -
        - -

        This key is compiled into the server and can enable you to test - new versions without affecting the current version. Of course - you must take care not to install the new version on top of the - old version in the file system.

        - -

        If you did not do a binary install then Apache will in some - scenarios complain that about the missing registry key. This - warning can be ignored if it otherwise was able to find its - configuration files.

        - -

        The value of this key is the "ServerRoot" directory, containing the - conf directory. When Apache starts it will read the - httpd.conf file from this directory. If this file - contains a ServerRoot directive which is different from - the directory obtained from the registry key above, Apache will forget - the registry key and use the directory from the configuration file. - If you copy the Apache directory or configuration files to a new - location it is vital that you update the ServerRoot - directory in the httpd.conf file to the new location. - -

        To run Apache from the command line as a console application, use the - following command:

        - -
        -    apache 
        -
        - -

        Apache will execute, and will remain running until it is stopped by pressing - control-C.

        - -

        Signalling Service Apache when running

        - -

        On Windows NT, multiple instances of Apache can be run as services. - Signal an Apache service to start, restart, or shutdown as follows:

        - -
        -    apache -n "service name" -k start
        -    apache -n "service name" -k restart
        -    apache -n "service name" -k shutdown
        -
        - -

        In addition, you can use the native NT NET command to - start and stop Apache services as follows:

        - -
        -    NET START "service name"
        -    NET STOP "service name"
        -
        - -

        Signalling Console Apache when running

        - -

        On Windows 95, Apache runs as a console application. You can tell a - running Apache to stop by opening another console window and typing:

        - -
        -    apache -k shutdown
        -
        - -

        This should be used instead of pressing Control-C in the running - Apache console window, because it lets Apache end any current - transactions and cleanup gracefully.

        - -

        You can also tell Apache to restart. This makes it re-read the - configuration files. Any transactions in progress are allowed to - complete without interruption. To restart Apache, run

        - -
        -    apache -k restart
        -
        - -

        Note for people familiar with the Unix version of Apache: these - commands provide a Windows equivalent to kill -TERM - pid and kill -USR1 pid. The command - line option used, -k, was chosen as a reminder of the - "kill" command used on Unix.

        - - - - - diff --git a/docs/manual/process-model.html b/docs/manual/process-model.html deleted file mode 100644 index cef934f239..0000000000 --- a/docs/manual/process-model.html +++ /dev/null @@ -1,76 +0,0 @@ - - -Server Pool Management - - - - - - -
        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. -
        - -

        Server Pool Management

        - -
        -

        -We found that many people were using values for "MaxServers" either -too high or too low, and were hanging themselves on it. The model we -adopted is still based on long-lived minimal-forking processes, but -instead of specifying one number of persistent processes, the -web-master specifies a maximum and minimum number of processes to be -"spare" - every couple of seconds the parent checks the actual number -of spare servers and adjusts accordingly. This should keep the number -of servers concurrently running relatively low while still ensuring -minimal forking. - -

        - -We renamed the 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. - -

        - -The defaults for each variable are: - -

        -MinSpareServers         5
        -MaxSpareServers         10
        -StartServers            5
        -
        - -There is an absolute maximum number of simultaneous children defined -by a compile-time limit which defaults to 256 and a "MaxClients" -directive which specifies the number of simultaneous children that -will be allowed. MaxClients can be adjusted up to the compile-time -limit (HARD_SERVER_LIMIT, defined in httpd.h). If you need more -than 256 simultaneous children, you need to modify both HARD_SERVER_LIMIT -and MaxClients.

        - -In versions before 1.2, HARD_SERVER_LIMIT defaulted to 150.

        - -We do not recommend changing either of these values unless: - -

          -
        1. You know you have the server resources to handle more -
        2. You use the machine for other purposes and must limit the amount of memory -Apache uses -
        - - - - - diff --git a/docs/manual/programs/ab.html b/docs/manual/programs/ab.html deleted file mode 100644 index eda6305892..0000000000 --- a/docs/manual/programs/ab.html +++ /dev/null @@ -1,124 +0,0 @@ - - -Manual Page: ab - Apache HTTP Server - - -

        Manual Page: ab

        - -
        -NAME
        -     ab - Apache HTTP server benchmarking tool
        -
        -SYNOPSIS
        -     ab [ -k ] [ -n requests ] [ -t timelimit ] [ -c  concurrency
        -     ] [ -p POST file ] [ -A Authentication username:password ] [
        -     -P Proxy Authentication  username:password  ]  [  -H  Custom
        -     header  ]  [ -C Cookie name=value ] [ -T content-type ] [ -v
        -     verbosity ] ] [ -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 of how your current Apache installation performs.
        -     This  especially shows you how many requests per second your
        -     Apache installation is capable of serving.
        -
        -OPTIONS
        -     -k          Enable the HTTP KeepAlive feature, i.e., perform
        -                 multiple   requests  within  one  HTTP  session.
        -                 Default is no KeepAlive.
        -
        -     -n requests Number of requests to perform for the benchmark-
        -                 ing  session.   The default is to just perform a
        -                 single  request  which  usually  leads  to  non-
        -                 representative benchmarking results.
        -
        -     -t timelimit
        -                 Maximum number of seconds to  spend  for  bench-
        -                 marking. 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  to  perform  at  a
        -                 time. Default is one request at a time.
        -
        -     -p POST file
        -                 File containing data to POST.
        -
        -     -A Authentication username:password
        -                 Supply BASIC Authentication credentials  to  the
        -                 server.  The username and password are separated
        -                 by a single ':' and sent on the wire  uuencoded.
        -                 The  string  is  sent  regardless of whether the
        -                 server needs it; (i.e., has sent an 401  authen-
        -                 tication needed).
        -
        -     -p Proxy-Authentication username:password
        -                 Supply BASIC  Authentication  credentials  to  a
        -                 proxy  en-route.  The  username and password are
        -                 separated by a single ':' and sent on  the  wire
        -                 uuencoded.   The  string  is  sent regardless of
        -                 whether the proxy needs it; (i.e., has  sent  an
        -                 407 proxy authentication 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
        -                 Append 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., 'Accept-Encoding: zip/zop;8bit').
        -
        -     -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 15f6b7433a..0000000000 --- a/docs/manual/programs/apachectl.html +++ /dev/null @@ -1,84 +0,0 @@ - - -Manual Page: apachectl - Apache HTTP Server - - -

        Manual Page: apachectl

        - -
        -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://httpd.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 SIGWINCH.  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 38418cac70..0000000000 --- a/docs/manual/programs/apxs.html +++ /dev/null @@ -1,271 +0,0 @@ - - -Manual Page: apxs - Apache HTTP Server - - -

        Manual Page: apxs

        - -
        -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/modules/mod_foo.so
        -       chmod 755 /path/to/apache/modules/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  automatically
        -     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 independent 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 modules 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 "modules" 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/modules/mod_foo.so
        -       chmod 755 /path/to/apache/modules/mod_foo.so
        -       [activating module `foo' in /path/to/apache/etc/httpd.conf]
        -       $ _
        -
        -     This way a line named
        -
        -       LoadModule foo_module modules/mod_foo.so
        -
        -     is added to the configuration file if still not present.  If
        -     you  want  to  have  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/modules/mod_foo.so
        -       chmod 755 /path/to/apache/modules/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 45ec0672d4..0000000000 --- a/docs/manual/programs/dbmmanage.html +++ /dev/null @@ -1,105 +0,0 @@ - - -Manual Page: dbmmanage - Apache HTTP Server - - -

        Manual Page: dbmmanage

        - -
        -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  existence,  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/footer.html b/docs/manual/programs/footer.html deleted file mode 100644 index 1e5f739ebe..0000000000 --- a/docs/manual/programs/footer.html +++ /dev/null @@ -1,8 +0,0 @@ -
        - -

        - Apache HTTP Server Version 2.0 -

        - -Index -Home diff --git a/docs/manual/programs/header.html b/docs/manual/programs/header.html deleted file mode 100644 index 9533b02bda..0000000000 --- a/docs/manual/programs/header.html +++ /dev/null @@ -1,6 +0,0 @@ -
        - [APACHE DOCUMENTATION] -

        - Apache HTTP Server Version 2.0 -

        -
        diff --git a/docs/manual/programs/htdigest.html b/docs/manual/programs/htdigest.html deleted file mode 100644 index c4c00f813e..0000000000 --- a/docs/manual/programs/htdigest.html +++ /dev/null @@ -1,52 +0,0 @@ - - -Manual Page: htdigest - Apache HTTP Server - - -

        Manual Page: htdigest

        - -
        -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 9088b8495f..0000000000 --- a/docs/manual/programs/htpasswd.html +++ /dev/null @@ -1,160 +0,0 @@ - - -Manual Page: htpasswd - Apache HTTP Server - - -

        Manual Page: htpasswd

        - -
        -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. Facilitates migration
        -          from/to  Netscape  servers  using  the  LDAP  Directory
        -          Interchange Format (ldif).
        -
        -     -p   Use plaintext passwords. Though htpasswd  will  support
        -          creation  on  all platforms, the httpd daemon 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 c69a53f2d4..0000000000 --- a/docs/manual/programs/httpd.html +++ /dev/null @@ -1,108 +0,0 @@ - - -Manual Page: httpd - Apache HTTP Server - - -

        Manual Page: httpd

        - -
        -NAME
        -     httpd - Apache hypertext transfer protocol server
        -
        -SYNOPSIS
        -     httpd [ -R libexecdir ] [ -d serverroot ] [ -f config ] [ -C
        -     directive ] [ -c directive ] [ -D parameter ]
        -
        -     httpd [ -h ] [ -l ] [ -L ] [ -v ] [ -V ] [ -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.
        -
        -     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://httpd.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
        -                 reading 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).  If -D DUMP_VHOSTS is also set,  details
        -                 of   the  virtual  host  configuration  will  be
        -                 printed.
        -
        -     -T          Same as option -t but does not check the config-
        -                 ured document roots.
        -
        -     -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/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
        -
        -
        - - diff --git a/docs/manual/programs/index.html b/docs/manual/programs/index.html deleted file mode 100755 index 3e246aae4b..0000000000 --- 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 1c5b1bd67e..0000000000 --- a/docs/manual/programs/logresolve.html +++ /dev/null @@ -1,39 +0,0 @@ - - -Manual Page: logresolve - Apache HTTP Server - - -

        Manual Page: logresolve

        - -
        -NAME
        -     logresolve - resolve hostnames for  IP-addresses  in  Apache
        -     logfiles
        -
        -SYNOPSIS
        -     logresolve  [  -s  filename  ]  [  -c  ]  <   access_log   >
        -     access_log.new
        -
        -DESCRIPTION
        -     logresolve is  a  post-processing  program  to  resolve  IP-
        -     addresses  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 e80e8a2d9b..0000000000 --- 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 60f6a71f98..0000000000 --- a/docs/manual/programs/rotatelogs.html +++ /dev/null @@ -1,43 +0,0 @@ - - -Manual Page: rotatelogs - Apache HTTP Server - - -

        Manual Page: rotatelogs

        - -
        -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 cad00ed48d..0000000000 --- a/docs/manual/programs/suexec.html +++ /dev/null @@ -1,30 +0,0 @@ - - -Manual Page: suexec - Apache HTTP Server - - -

        Manual Page: suexec

        - -
        -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/search/manual-index.cgi b/docs/manual/search/manual-index.cgi deleted file mode 100644 index 3c4c8cada4..0000000000 --- a/docs/manual/search/manual-index.cgi +++ /dev/null @@ -1,256 +0,0 @@ -#!/usr/local/bin/perl5 -w -# ==================================================================== -# 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 -# . -# -# manual-index.cgi script -# originally written by Ken Coar in May 1997 -# -# This script either displays a form in order to find documents in which -# a word appears, or displays the results of such a search. It is -# called as a CGI script. -# -# [FILE]PATH_INFO is the prefix to add to to the files names found in -# the index (URL prefix, not filesystem prefix), and QUERY_STRING is the -# word to be found. -# -#*** -#*** -# You may need to tweak the following line to point to the correct -# location of the index file on your system (it's in the -# apache/htdocs/manual directory of the Apache distribution tree). -#*** -#*** -$INDEX = "/www/apache.org/manual-index-data"; - -#*** -#*** -# You shouldn't have to modify anything else. -#*** -#*** - -$HTML = ""; - -# -# If we have a FILEPATH_INFO or PATH_INFO, it's there to remap the -# documents to the manual root directory. If this script is already in -# that directory, this isn't needed. -# -$prefix = $ENV{'FILEPATH_INFO'} || $ENV{'PATH_INFO'}; -$prefix .= "/" if ($prefix && ($prefix !~ m:/$:)); - -# -# QUERY_STRING, if present, contains the word for which we are to -# search. We also use its [non]presence to determine wha we display. -# -$word = $ENV{'QUERY_STRING'}; - -# -# Make sure our HTTP header makes it to the server by causing Perl to do -# a fflush() after every write to STDOUT. -# -select (STDOUT); -$| = 1; -printf ("Content-type: text/html\n\n"); - -# -# Fine, now buffering can go back to normal. -# -$| = 0; - -# -# Set up the HTML page title -$title = "Apache Documentation Search"; -$title .= ": Results for \"$word\"" if ($word); - -# -# We'll re-use the HTML scalar several times; we use it with here -# documents for multi-line static HTML code. Lets' do the standard page -# header. -# -$HTML = < - - - $title - - - - -
        - -
        -

        - Apache Documentation Search -

        -

        - This script performs a very simple search across the Apache - documentation for any single case-insensitive word. No combinations, - wildcards, regular expressions, word-stubbing, or other fancy options - are supported; this is just to help you find topics quickly. Only - those pages which include the exact word you type will be - listed. -

        -

        - Documents containing the search word are not listed in any - sort of priority order. -

        - -EOHT - -printf ($HTML); - -# -# Now set up the next section, which is only displayed if we've been -# given a word to find. -# -$HTML = < -

        - Results of Search for $word -

        -EOHT - -# -# We enblock the next section so problems can drop out to the common -# closure code. -# -QUERY: - { - if ($word) { - # - # Try and open the index file; complain bitterly if we can't. - # - if (! open (INDEX, "<$INDEX")) { - printf ("Can't find documentation index!"); - last QUERY; - } - # - # Got it; display the search-results header. - # - printf ($HTML); - # - # Read the entire index in and turn it into an hash for the - # lookup. - # - @index = ; - close (INDEX); - chomp (@index); - foreach (@index) { - ($key, $files) = split (/:/, $_); - $Index{$key} = $files; - } - # - # The dictionary is all lowercase words. Smash our query value - # and try to find it. - # - $word = lc ($word); - if (! exists ($Index{$word})) { - printf ("

        \n Sorry, no matches found.\n

        \n"); - last QUERY; - } - # - # Found an entry, so turn the hash value (a comma-separated list - # of relative file names) into an array for display. - # Incidentally, tell the user how many there are. - # - @files = split (/,/, $Index{$word}); - printf ("

        Total of %d match", scalar (@files)); - # - # Be smart about plurals. - # - if (scalar (@files) != 1) { - printf ("es") ; - } - printf (" found.\n

        \n"); - # - # Right. Now display the files as they're listed. - # - printf ("
          \n"); - foreach (@files) { - printf ("
        1. "); - printf ("$_\n"); - printf ("
        2. \n"); - } - printf ("
        \n"); - # - # C'est tout! - # - } - } - -# -# Back to common code - the exit path. Display the page trailer. -# -$HTML = <Home -
        - - -EOHT - -printf ($HTML); -exit (0); diff --git a/docs/manual/sections.html b/docs/manual/sections.html deleted file mode 100644 index 7d91191a6c..0000000000 --- a/docs/manual/sections.html +++ /dev/null @@ -1,163 +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). Semantically, however some things, most -notably AllowOverride and the two options -FollowSymLinks and SymLinksIfOwnerMatch, -make no sense in <Location>, -<LocationMatch> or <DirectoryMatch>. -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, if allowed, 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 were 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.

        - -

        Later sections override earlier ones.

        - -

        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 about .htaccess parsing:

        - -
          -
        • - Modifying .htaccess parsing during Location doesn't do - anything because .htaccess parsing has already occurred. -
        - -

        <Location> and symbolic links:

        - -
          -
        • - It is not possible to use "Options FollowSymLinks" - or "Options SymLinksIfOwnerMatch" inside a - <Location>, <LocationMatch> - or <DirectoryMatch> section - (the options are simply ignored). - Using the options in question is only possible inside a - <Directory> section (or a .htaccess file). -
        - -

        <Files> and Options:

        - -
          -
        • - Apache won't check for it, but using an Options - directive inside a <Files> section has no effect. -
        - -

        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 7d91191a6c..0000000000 --- a/docs/manual/sections.html.en +++ /dev/null @@ -1,163 +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). Semantically, however some things, most -notably AllowOverride and the two options -FollowSymLinks and SymLinksIfOwnerMatch, -make no sense in <Location>, -<LocationMatch> or <DirectoryMatch>. -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, if allowed, 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 were 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.

        - -

        Later sections override earlier ones.

        - -

        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 about .htaccess parsing:

        - -
          -
        • - Modifying .htaccess parsing during Location doesn't do - anything because .htaccess parsing has already occurred. -
        - -

        <Location> and symbolic links:

        - -
          -
        • - It is not possible to use "Options FollowSymLinks" - or "Options SymLinksIfOwnerMatch" inside a - <Location>, <LocationMatch> - or <DirectoryMatch> section - (the options are simply ignored). - Using the options in question is only possible inside a - <Directory> section (or a .htaccess file). -
        - -

        <Files> and Options:

        - -
          -
        • - Apache won't check for it, but using an Options - directive inside a <Files> section has no effect. -
        - -

        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.en b/docs/manual/server-wide.html.en deleted file mode 100644 index bf8fa72a3f..0000000000 --- a/docs/manual/server-wide.html.en +++ /dev/null @@ -1,113 +0,0 @@ - - - -Server-Wide Configuration - - - - - -

        Server-Wide Configuration

        - -

        This document explains some of the directives provided by the -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.

        - -
        -

        Limiting Resource Usage

        - -
        -Related Directives

        - -LimitRequestBody
        -LimitRequestFields
        -LimitRequestFieldsize
        -LimitRequestLine
        -RLimitCPU
        -RLimitMEM
        -RLimitNPROC
        -ThreadStackSize
        -
        - -

        The LimitRequest* 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 stack size.

        - - - - diff --git a/docs/manual/server-wide.html.html b/docs/manual/server-wide.html.html deleted file mode 100644 index 67292afa66..0000000000 --- a/docs/manual/server-wide.html.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/manual/server-wide.html.ja.jis b/docs/manual/server-wide.html.ja.jis deleted file mode 100644 index 1ed7d254ab..0000000000 --- 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/stopping.html b/docs/manual/stopping.html deleted file mode 100644 index eb6502574a..0000000000 --- a/docs/manual/stopping.html +++ /dev/null @@ -1,193 +0,0 @@ - - - -Stopping and Restarting the Server - - - - - -

        Stopping and Restarting the Server

        - -

        This document covers stopping and restarting Apache on Unix-like -systems. Windows users should see Signalling Apache when -running.

        - -

        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/apache/logs/httpd.pid`
        -
        - -You can read about its progress by issuing: - -
        -    tail -f /usr/local/apache/logs/error_log
        -
        - -Modify those examples to match your -ServerRoot and -PidFile settings. - -

        A shell script called apachectl is provided which -automates the processing of signalling Apache. For details about this -script, see the documentation on starting -Apache.

        - -

        Stop Now

        - -

        Signal: TERM
        -apachectl stop

        - -

        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. - -

        Graceful Restart

        - -

        Signal: WINCH
        -apachectl graceful

        - -

        The WINCH 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 -WINCH 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 WINCH 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. - -

        Note: If your configuration file has errors in it -when you issue a restart then your parent will not restart, it will -exit with an error. In the case of graceful restarts it will also -leave children running when it exits. (These are the children which -are "gracefully exiting" by handling their last request.) This will -cause problems if you attempt to restart the server -- it will not be -able to bind to its listening ports. Before doing a restart, you can -check the syntax of the configuration files with the -t -command line argument (see httpd). This still will not guarantee -that the server will restart correctly. To check the semantics of the -configuration files as well as the syntax, you can try starting httpd -as a non-root user. If there are no errors it will attempt to open -its sockets and logs and fail because it's not root (or because the -currently running httpd already has those ports bound). If it fails -for any other reason then it's probably a config file error and the -error should be fixed before issuing the graceful restart. - - -

        Restart Now

        - -

        Signal: HUP
        -apachectl restart

        - -

        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. - -

        Note: If your configuration file has errors in it when -you issue a -restart then your parent will not restart, it will exit with an error. -See below for a method of avoiding this. - - -

        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 corrupt their scoreboards. This can result in -the "bind: Address already in use" (after HUP) or -"long lost child came home!" (after USR1). The former is -a fatal error, while the latter just causes the server to lose a scoreboard -slot. So it might be advisable to use graceful restarts, with -an occasional hard restart. These problems are very difficult to work -around, but fortunately most architectures do not require a scoreboard file. -See the ScoreBoardFile documentation for a -architecture uses it. - -

        NEXT and MACHTEN (68k only) 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 eb6502574a..0000000000 --- a/docs/manual/stopping.html.en +++ /dev/null @@ -1,193 +0,0 @@ - - - -Stopping and Restarting the Server - - - - - -

        Stopping and Restarting the Server

        - -

        This document covers stopping and restarting Apache on Unix-like -systems. Windows users should see Signalling Apache when -running.

        - -

        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/apache/logs/httpd.pid`
        -
        - -You can read about its progress by issuing: - -
        -    tail -f /usr/local/apache/logs/error_log
        -
        - -Modify those examples to match your -ServerRoot and -PidFile settings. - -

        A shell script called apachectl is provided which -automates the processing of signalling Apache. For details about this -script, see the documentation on starting -Apache.

        - -

        Stop Now

        - -

        Signal: TERM
        -apachectl stop

        - -

        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. - -

        Graceful Restart

        - -

        Signal: WINCH
        -apachectl graceful

        - -

        The WINCH 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 -WINCH 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 WINCH 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. - -

        Note: If your configuration file has errors in it -when you issue a restart then your parent will not restart, it will -exit with an error. In the case of graceful restarts it will also -leave children running when it exits. (These are the children which -are "gracefully exiting" by handling their last request.) This will -cause problems if you attempt to restart the server -- it will not be -able to bind to its listening ports. Before doing a restart, you can -check the syntax of the configuration files with the -t -command line argument (see httpd). This still will not guarantee -that the server will restart correctly. To check the semantics of the -configuration files as well as the syntax, you can try starting httpd -as a non-root user. If there are no errors it will attempt to open -its sockets and logs and fail because it's not root (or because the -currently running httpd already has those ports bound). If it fails -for any other reason then it's probably a config file error and the -error should be fixed before issuing the graceful restart. - - -

        Restart Now

        - -

        Signal: HUP
        -apachectl restart

        - -

        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. - -

        Note: If your configuration file has errors in it when -you issue a -restart then your parent will not restart, it will exit with an error. -See below for a method of avoiding this. - - -

        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 corrupt their scoreboards. This can result in -the "bind: Address already in use" (after HUP) or -"long lost child came home!" (after USR1). The former is -a fatal error, while the latter just causes the server to lose a scoreboard -slot. So it might be advisable to use graceful restarts, with -an occasional hard restart. These problems are very difficult to work -around, but fortunately most architectures do not require a scoreboard file. -See the ScoreBoardFile documentation for a -architecture uses it. - -

        NEXT and MACHTEN (68k only) 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/suexec.html b/docs/manual/suexec.html deleted file mode 100644 index 8988cd42b8..0000000000 --- a/docs/manual/suexec.html +++ /dev/null @@ -1,516 +0,0 @@ - - - -Apache suEXEC Support - - - - - -

        Apache suEXEC Support

        - -

        -

          -
        1. CONTENTS
        2. -
        3. What is suEXEC?
        4. -
        5. Before we begin.
        6. -
        7. suEXEC Security Model.
        8. -
        9. Configuring & Installing suEXEC
        10. -
        11. Enabling & Disabling suEXEC
        12. -
        13. Using suEXEC
        14. -
        15. Debugging suEXEC
        16. -
        17. Beware the Jabberwock: Warnings & - Examples
        18. -
        -

        - -

        What is suEXEC?

        -

        -The suEXEC feature -- introduced in Apache 1.2 -- provides -Apache users the ability to run CGI and SSI -programs under user IDs different from the user ID of the calling web-server. -Normally, when a CGI or SSI program executes, it runs as the same user who is -running the web server. -

        - -

        -Used properly, this feature 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. -

        - -

        -BACK TO CONTENTS -

        - -

        Before we begin.

        -

        -Before jumping head-first into this document, you should be aware of the -assumptions made on the part of the Apache Group and this document. -

        - -

        -First, it is assumed that you are using a UNIX derivate operating system that -is capable of setuid and setgid operations. -All command examples are given in this regard. Other platforms, if they are -capable of supporting suEXEC, may differ in their configuration. -

        - -

        -Second, it is assumed you are familiar with some basic concepts of your -computer's security and its administration. This involves an understanding -of setuid/setgid operations and the various effects they -may have on your system and its level of security. -

        - -

        -Third, it is assumed that you are using an unmodified -version of suEXEC code. All code for suEXEC has been carefully scrutinized and -tested by the developers as well as numerous beta testers. Every precaution -has been taken to ensure a simple yet solidly safe base of code. Altering this -code can cause unexpected problems and new security risks. It is -highly recommended you not alter the suEXEC code unless you -are well versed in the particulars of security programming and are willing to -share your work with the Apache Group for consideration. -

        - -

        -Fourth, and last, it has been the decision of the Apache Group to -NOT make suEXEC part of the default installation of Apache. -To this end, suEXEC configuration requires of the administrator careful -attention to details. After due consideration has been given to the various -settings for suEXEC, the administrator may install suEXEC through normal -installation methods. The values for these settings need to be carefully -determined and specified by the administrator to properly maintain system -security during the use of suEXEC functionality. It is through this detailed -process that the Apache Group hopes to limit suEXEC installation only to those -who are careful and determined enough to use it. -

        - -

        -Still with us? Yes? Good. Let's move on! -

        - -

        -BACK TO CONTENTS -

        - -

        suEXEC Security Model

        -

        -Before we begin configuring and installing suEXEC, we will first discuss -the security model you are about to implement. By doing so, you may -better understand what exactly is going on inside suEXEC and what precautions -are taken to ensure your system's security. -

        - -

        -suEXEC is based on a setuid "wrapper" program that is -called by the main Apache web server. This wrapper is called when an HTTP -request is made for a CGI or SSI program that the administrator has designated -to run as a userid other than that of the main server. When such a request -is made, Apache provides the suEXEC wrapper with the program's name and the -user and group IDs under which the program is to execute. -

        - -

        -The wrapper then employs the following process to determine success or -failure -- if any one of these conditions fail, the program logs the failure -and exits with an error, otherwise it will continue: -

          -
        1. Was the wrapper called with the proper number of - arguments? -
          - The wrapper will only execute if it is given the proper number of arguments. - The proper argument format is known to the Apache web server. If the - wrapper - is not receiving the proper number of arguments, it is either being hacked, - or - there is something wrong with the suEXEC portion of your Apache binary. -
          -
        2. -
        3. Is the user executing this wrapper a valid user of this - system? -
          - This is to ensure that the user executing the wrapper is truly a user of the - system. -
          -
        4. -
        5. Is this valid user allowed to run the wrapper? -
          - Is this user the user allowed to run this wrapper? Only one user (the - Apache user) is allowed to execute this program. -
          -
        6. -
        7. Does the target program have an unsafe hierarchical - reference? -
          - Does the target program contain a leading '/' or have a '..' backreference? - These are not allowed; the target program must reside within the Apache - webspace. -
          -
        8. -
        9. Is the target user name valid? -
          - Does the target user exist? -
          -
        10. -
        11. Is the target group name valid? -
          - Does the target group exist? -
          -
        12. -
        13. Is the target user NOT superuser? -
          - Presently, suEXEC does not allow 'root' to execute CGI/SSI programs. -
          -
        14. -
        15. Is the target userid ABOVE the minimum ID - number? -
          - The minimum user ID number is specified during configuration. This allows - you - to set the lowest possible userid that will be allowed to execute CGI/SSI - programs. This is useful to block out "system" accounts. -
          -
        16. -
        17. Is the target group NOT the superuser group? -
          - Presently, suEXEC does not allow the 'root' group to execute CGI/SSI - programs. -
          -
        18. -
        19. Is the target groupid ABOVE the minimum ID - number? -
          - The minimum group ID number is specified during configuration. This allows - you - to set the lowest possible groupid that will be allowed to execute CGI/SSI - programs. This is useful to block out "system" groups. -
          -
        20. -
        21. Can the wrapper successfully become the target user and - group? -
          - Here is where the program becomes the target user and group via setuid and - setgid - calls. The group access list is also initialized with all of the groups - of which - the user is a member. -
          -
        22. -
        23. Does the directory in which the program resides exist? -
          - If it doesn't exist, it can't very well contain files. -
          -
        24. -
        25. Is the directory within the Apache webspace? -
          - If the request is for a regular portion of the server, is the requested - directory - within the server's document root? If the request is for a UserDir, is - the requested - directory within the user's document root? -
          -
        26. -
        27. Is the directory NOT writable by anyone else? -
          - We don't want to open up the directory to others; only the owner user - may be able - to alter this directories contents. -
          -
        28. -
        29. Does the target program exist? -
          - If it doesn't exists, it can't very well be executed. -
          -
        30. -
        31. Is the target program NOT writable by anyone - else? -
          - We don't want to give anyone other than the owner the ability to - change the program. -
          -
        32. -
        33. Is the target program NOT setuid or setgid? -
          - We do not want to execute programs that will then change our UID/GID again. -
          -
        34. -
        35. Is the target user/group the same as the program's - user/group? -
          - Is the user the owner of the file? -
          -
        36. -
        37. Can we successfully clean the process environment to - ensure safe operations? -
          - suEXEC cleans the process' environment by establishing a safe - execution PATH (defined - during configuration), as well as only passing through those - variables whose names - are listed in the safe environment list (also created during - configuration). -
          -
        38. -
        39. Can we successfully become the target program and - execute? -
          - Here is where suEXEC ends and the target program begins. -
          -
        40. -
        -

        - -

        -This is the standard operation of the the suEXEC wrapper's security model. -It is somewhat stringent and can impose new limitations and guidelines for -CGI/SSI design, but it was developed carefully step-by-step with security -in mind. -

        - -

        -For more information as to how this security model can limit your possibilities -in regards to server configuration, as well as what security risks can be -avoided with a proper suEXEC setup, see the -"Beware the Jabberwock" -section of this document. -

        - -

        -BACK TO CONTENTS -

        - -

        Configuring & Installing suEXEC

        -

        -Here's where we begin the fun. If you use Apache 1.2 or prefer to configure -Apache 1.3 with the "src/Configure" script you have to edit -the suEXEC header file and install the binary in its proper location -manually. The following sections describe the configuration and installation -for Apache 1.3 with the AutoConf-style interface (APACI). -

        - -

        -APACI's suEXEC configuration options
        -

        -
        --enable-suexec -
        This option enables the suEXEC feature which is never installed or - activated by default. 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. -
        --suexec-caller=UID -
        The username under which - Apache normally runs. - This is the only user allowed to execute this program. -
        --suexec-docroot=DIR -
        Define as the DocumentRoot set for Apache. - This will be the only hierarchy (aside from UserDirs) - that can be used for suEXEC behavior. - The default directory is the --datadir value with - the suffix "/htdocs", e.g. if you configure with - "--datadir=/home/apache" the directory - "/home/apache/htdocs" is used as document root for - the suEXEC wrapper. -
        --suexec-logfile=FILE -
        This defines the filename to which all suEXEC transactions and - errors are logged (useful for auditing and debugging purposes). - By default the logfile is named "suexec_log" and located in your - standard logfile directory (--logfiledir). -
        --suexec-userdir=DIR -
        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. - Default value is "public_html". -
        - If you have virtual hosts 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! -
        --suexec-uidmin=UID -
        Define this as the lowest UID allowed to be a target user - for suEXEC. For most systems, 500 or 100 is common. - Default value is 100. -
        --suexec-gidmin=GID -
        Define this as the lowest GID allowed to be a target group - for suEXEC. For most systems, 100 is common and therefore - used as default value. -
        --suexec-safepath=PATH -
        Define a safe PATH environment to pass to CGI executables. - Default value is "/usr/local/bin:/usr/bin:/bin". -
        -

        - -

        -Checking your suEXEC setup
        -Before you compile and install the suEXEC wrapper you can check -the configuration with the --layout option. -
        -Example output: -

        -    suEXEC setup:
        -            suexec binary: /usr/local/apache/sbin/suexec
        -            document root: /usr/local/apache/share/htdocs
        -           userdir suffix: public_html
        -                  logfile: /usr/local/apache/var/log/suexec_log
        -                safe path: /usr/local/bin:/usr/bin:/bin
        -                caller ID: www
        -          minimum user ID: 100
        -         minimum group ID: 100
        -
        -

        - -

        -Compiling and installing the suEXEC wrapper
        -If you have enabled the suEXEC feature with the --enable-suexec option -the suexec binary (together with Apache itself) is automatically built -if you execute the command "make". -
        -After all components have been built you can execute the command -"make install" to install them. -The binary image "suexec" is installed in the directory defined by -the --sbindir option. Default location is "/usr/local/apache/sbin/suexec". -
        -Please note that you need root privileges for -the installation step. In order for the wrapper to set the user ID, it -must be installed as owner root and must have the -setuserid execution bit set for file modes. -

        - -

        -BACK TO CONTENTS -

        - -

        Enabling & Disabling suEXEC

        -

        -Upon startup of Apache, it looks for the file "suexec" in the "sbin" -directory (default is "/usr/local/apache/sbin/suexec"). -If Apache finds a properly configured suEXEC wrapper, it will print -the following message to the error log: -

        -    [notice] suEXEC mechanism enabled (wrapper: /path/to/suexec)
        -
        -If you don't see this message at server startup, the server is most -likely not finding the wrapper program where it expects it, or the -executable is not installed setuid root. -
        -If you want to enable the suEXEC mechanism for the first time -and an Apache server is already running you must kill and restart Apache. -Restarting it with a simple HUP or USR1 signal will not be enough. -
        -If you want to disable suEXEC you should kill and restart Apache after -you have removed the "suexec" file. -

        - -

        -BACK TO CONTENTS -

        - -

        Using suEXEC

        -

        -Virtual Hosts:
        -One way to use the suEXEC wrapper is through the -User and -Group directives in -VirtualHost -definitions. By setting these directives to values different from the -main server user ID, all requests for CGI resources will be executed as -the User and Group defined for that -<VirtualHost>. If only one or -neither of these directives are specified for a -<VirtualHost> then the main -server userid is assumed. -

        -User directories:
        -The suEXEC wrapper can also be used to execute CGI programs as -the user to which the request is being directed. This is accomplished by -using the "~" character prefixing the user -ID for whom execution is desired. -The only requirement needed for this feature to work is for CGI -execution to be enabled for the user and that the script must meet the -scrutiny of the security checks above. - -

        -BACK TO CONTENTS -

        - -

        Debugging suEXEC

        -

        -The suEXEC wrapper will write log information to the file defined -with the --suexec-logfile option as indicated above. If you feel you have -configured and installed the wrapper properly, have a look at this log -and the error_log for the server to see where you may have gone astray. -

        - -

        -BACK TO CONTENTS -

        - -

        -Beware the Jabberwock: Warnings & Examples -

        -

        -NOTE! This section may not be complete. For the latest -revision of this section of the documentation, see the Apache Group's -Online Documentation -version. -

        - -

        -There are a few points of interest regarding the wrapper that can cause -limitations on server setup. Please review these before submitting any -"bugs" regarding suEXEC. -

          -
        • suEXEC Points Of Interest
        • -
        • Hierarchy limitations -
          - For security and efficiency reasons, all suexec requests must - remain within either a top-level document root for virtual - host requests, or one top-level personal document root for - userdir requests. For example, if you have four VirtualHosts - configured, you would need to structure all of your VHosts' - document roots off of one main Apache document hierarchy to - take advantage of suEXEC for VirtualHosts. (Example forthcoming.) -
          -
        • -
        • suEXEC's PATH environment variable -
          - This can be a dangerous thing to change. Make certain every - path you include in this define is a trusted - directory. You don't want to open people up to having someone - from across the world running a trojan horse on them. -
          -
        • -
        • Altering the suEXEC code -
          - Again, this can cause Big Trouble if you try - this without knowing what you are doing. Stay away from it - if at all possible. -
          -
        • -
        - -

        -BACK TO CONTENTS -

        - - - - diff --git a/docs/manual/suexec.html.en b/docs/manual/suexec.html.en deleted file mode 100644 index 8988cd42b8..0000000000 --- a/docs/manual/suexec.html.en +++ /dev/null @@ -1,516 +0,0 @@ - - - -Apache suEXEC Support - - - - - -

        Apache suEXEC Support

        - -

        -

          -
        1. CONTENTS
        2. -
        3. What is suEXEC?
        4. -
        5. Before we begin.
        6. -
        7. suEXEC Security Model.
        8. -
        9. Configuring & Installing suEXEC
        10. -
        11. Enabling & Disabling suEXEC
        12. -
        13. Using suEXEC
        14. -
        15. Debugging suEXEC
        16. -
        17. Beware the Jabberwock: Warnings & - Examples
        18. -
        -

        - -

        What is suEXEC?

        -

        -The suEXEC feature -- introduced in Apache 1.2 -- provides -Apache users the ability to run CGI and SSI -programs under user IDs different from the user ID of the calling web-server. -Normally, when a CGI or SSI program executes, it runs as the same user who is -running the web server. -

        - -

        -Used properly, this feature 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. -

        - -

        -BACK TO CONTENTS -

        - -

        Before we begin.

        -

        -Before jumping head-first into this document, you should be aware of the -assumptions made on the part of the Apache Group and this document. -

        - -

        -First, it is assumed that you are using a UNIX derivate operating system that -is capable of setuid and setgid operations. -All command examples are given in this regard. Other platforms, if they are -capable of supporting suEXEC, may differ in their configuration. -

        - -

        -Second, it is assumed you are familiar with some basic concepts of your -computer's security and its administration. This involves an understanding -of setuid/setgid operations and the various effects they -may have on your system and its level of security. -

        - -

        -Third, it is assumed that you are using an unmodified -version of suEXEC code. All code for suEXEC has been carefully scrutinized and -tested by the developers as well as numerous beta testers. Every precaution -has been taken to ensure a simple yet solidly safe base of code. Altering this -code can cause unexpected problems and new security risks. It is -highly recommended you not alter the suEXEC code unless you -are well versed in the particulars of security programming and are willing to -share your work with the Apache Group for consideration. -

        - -

        -Fourth, and last, it has been the decision of the Apache Group to -NOT make suEXEC part of the default installation of Apache. -To this end, suEXEC configuration requires of the administrator careful -attention to details. After due consideration has been given to the various -settings for suEXEC, the administrator may install suEXEC through normal -installation methods. The values for these settings need to be carefully -determined and specified by the administrator to properly maintain system -security during the use of suEXEC functionality. It is through this detailed -process that the Apache Group hopes to limit suEXEC installation only to those -who are careful and determined enough to use it. -

        - -

        -Still with us? Yes? Good. Let's move on! -

        - -

        -BACK TO CONTENTS -

        - -

        suEXEC Security Model

        -

        -Before we begin configuring and installing suEXEC, we will first discuss -the security model you are about to implement. By doing so, you may -better understand what exactly is going on inside suEXEC and what precautions -are taken to ensure your system's security. -

        - -

        -suEXEC is based on a setuid "wrapper" program that is -called by the main Apache web server. This wrapper is called when an HTTP -request is made for a CGI or SSI program that the administrator has designated -to run as a userid other than that of the main server. When such a request -is made, Apache provides the suEXEC wrapper with the program's name and the -user and group IDs under which the program is to execute. -

        - -

        -The wrapper then employs the following process to determine success or -failure -- if any one of these conditions fail, the program logs the failure -and exits with an error, otherwise it will continue: -

          -
        1. Was the wrapper called with the proper number of - arguments? -
          - The wrapper will only execute if it is given the proper number of arguments. - The proper argument format is known to the Apache web server. If the - wrapper - is not receiving the proper number of arguments, it is either being hacked, - or - there is something wrong with the suEXEC portion of your Apache binary. -
          -
        2. -
        3. Is the user executing this wrapper a valid user of this - system? -
          - This is to ensure that the user executing the wrapper is truly a user of the - system. -
          -
        4. -
        5. Is this valid user allowed to run the wrapper? -
          - Is this user the user allowed to run this wrapper? Only one user (the - Apache user) is allowed to execute this program. -
          -
        6. -
        7. Does the target program have an unsafe hierarchical - reference? -
          - Does the target program contain a leading '/' or have a '..' backreference? - These are not allowed; the target program must reside within the Apache - webspace. -
          -
        8. -
        9. Is the target user name valid? -
          - Does the target user exist? -
          -
        10. -
        11. Is the target group name valid? -
          - Does the target group exist? -
          -
        12. -
        13. Is the target user NOT superuser? -
          - Presently, suEXEC does not allow 'root' to execute CGI/SSI programs. -
          -
        14. -
        15. Is the target userid ABOVE the minimum ID - number? -
          - The minimum user ID number is specified during configuration. This allows - you - to set the lowest possible userid that will be allowed to execute CGI/SSI - programs. This is useful to block out "system" accounts. -
          -
        16. -
        17. Is the target group NOT the superuser group? -
          - Presently, suEXEC does not allow the 'root' group to execute CGI/SSI - programs. -
          -
        18. -
        19. Is the target groupid ABOVE the minimum ID - number? -
          - The minimum group ID number is specified during configuration. This allows - you - to set the lowest possible groupid that will be allowed to execute CGI/SSI - programs. This is useful to block out "system" groups. -
          -
        20. -
        21. Can the wrapper successfully become the target user and - group? -
          - Here is where the program becomes the target user and group via setuid and - setgid - calls. The group access list is also initialized with all of the groups - of which - the user is a member. -
          -
        22. -
        23. Does the directory in which the program resides exist? -
          - If it doesn't exist, it can't very well contain files. -
          -
        24. -
        25. Is the directory within the Apache webspace? -
          - If the request is for a regular portion of the server, is the requested - directory - within the server's document root? If the request is for a UserDir, is - the requested - directory within the user's document root? -
          -
        26. -
        27. Is the directory NOT writable by anyone else? -
          - We don't want to open up the directory to others; only the owner user - may be able - to alter this directories contents. -
          -
        28. -
        29. Does the target program exist? -
          - If it doesn't exists, it can't very well be executed. -
          -
        30. -
        31. Is the target program NOT writable by anyone - else? -
          - We don't want to give anyone other than the owner the ability to - change the program. -
          -
        32. -
        33. Is the target program NOT setuid or setgid? -
          - We do not want to execute programs that will then change our UID/GID again. -
          -
        34. -
        35. Is the target user/group the same as the program's - user/group? -
          - Is the user the owner of the file? -
          -
        36. -
        37. Can we successfully clean the process environment to - ensure safe operations? -
          - suEXEC cleans the process' environment by establishing a safe - execution PATH (defined - during configuration), as well as only passing through those - variables whose names - are listed in the safe environment list (also created during - configuration). -
          -
        38. -
        39. Can we successfully become the target program and - execute? -
          - Here is where suEXEC ends and the target program begins. -
          -
        40. -
        -

        - -

        -This is the standard operation of the the suEXEC wrapper's security model. -It is somewhat stringent and can impose new limitations and guidelines for -CGI/SSI design, but it was developed carefully step-by-step with security -in mind. -

        - -

        -For more information as to how this security model can limit your possibilities -in regards to server configuration, as well as what security risks can be -avoided with a proper suEXEC setup, see the -"Beware the Jabberwock" -section of this document. -

        - -

        -BACK TO CONTENTS -

        - -

        Configuring & Installing suEXEC

        -

        -Here's where we begin the fun. If you use Apache 1.2 or prefer to configure -Apache 1.3 with the "src/Configure" script you have to edit -the suEXEC header file and install the binary in its proper location -manually. The following sections describe the configuration and installation -for Apache 1.3 with the AutoConf-style interface (APACI). -

        - -

        -APACI's suEXEC configuration options
        -

        -
        --enable-suexec -
        This option enables the suEXEC feature which is never installed or - activated by default. 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. -
        --suexec-caller=UID -
        The username under which - Apache normally runs. - This is the only user allowed to execute this program. -
        --suexec-docroot=DIR -
        Define as the DocumentRoot set for Apache. - This will be the only hierarchy (aside from UserDirs) - that can be used for suEXEC behavior. - The default directory is the --datadir value with - the suffix "/htdocs", e.g. if you configure with - "--datadir=/home/apache" the directory - "/home/apache/htdocs" is used as document root for - the suEXEC wrapper. -
        --suexec-logfile=FILE -
        This defines the filename to which all suEXEC transactions and - errors are logged (useful for auditing and debugging purposes). - By default the logfile is named "suexec_log" and located in your - standard logfile directory (--logfiledir). -
        --suexec-userdir=DIR -
        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. - Default value is "public_html". -
        - If you have virtual hosts 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! -
        --suexec-uidmin=UID -
        Define this as the lowest UID allowed to be a target user - for suEXEC. For most systems, 500 or 100 is common. - Default value is 100. -
        --suexec-gidmin=GID -
        Define this as the lowest GID allowed to be a target group - for suEXEC. For most systems, 100 is common and therefore - used as default value. -
        --suexec-safepath=PATH -
        Define a safe PATH environment to pass to CGI executables. - Default value is "/usr/local/bin:/usr/bin:/bin". -
        -

        - -

        -Checking your suEXEC setup
        -Before you compile and install the suEXEC wrapper you can check -the configuration with the --layout option. -
        -Example output: -

        -    suEXEC setup:
        -            suexec binary: /usr/local/apache/sbin/suexec
        -            document root: /usr/local/apache/share/htdocs
        -           userdir suffix: public_html
        -                  logfile: /usr/local/apache/var/log/suexec_log
        -                safe path: /usr/local/bin:/usr/bin:/bin
        -                caller ID: www
        -          minimum user ID: 100
        -         minimum group ID: 100
        -
        -

        - -

        -Compiling and installing the suEXEC wrapper
        -If you have enabled the suEXEC feature with the --enable-suexec option -the suexec binary (together with Apache itself) is automatically built -if you execute the command "make". -
        -After all components have been built you can execute the command -"make install" to install them. -The binary image "suexec" is installed in the directory defined by -the --sbindir option. Default location is "/usr/local/apache/sbin/suexec". -
        -Please note that you need root privileges for -the installation step. In order for the wrapper to set the user ID, it -must be installed as owner root and must have the -setuserid execution bit set for file modes. -

        - -

        -BACK TO CONTENTS -

        - -

        Enabling & Disabling suEXEC

        -

        -Upon startup of Apache, it looks for the file "suexec" in the "sbin" -directory (default is "/usr/local/apache/sbin/suexec"). -If Apache finds a properly configured suEXEC wrapper, it will print -the following message to the error log: -

        -    [notice] suEXEC mechanism enabled (wrapper: /path/to/suexec)
        -
        -If you don't see this message at server startup, the server is most -likely not finding the wrapper program where it expects it, or the -executable is not installed setuid root. -
        -If you want to enable the suEXEC mechanism for the first time -and an Apache server is already running you must kill and restart Apache. -Restarting it with a simple HUP or USR1 signal will not be enough. -
        -If you want to disable suEXEC you should kill and restart Apache after -you have removed the "suexec" file. -

        - -

        -BACK TO CONTENTS -

        - -

        Using suEXEC

        -

        -Virtual Hosts:
        -One way to use the suEXEC wrapper is through the -User and -Group directives in -VirtualHost -definitions. By setting these directives to values different from the -main server user ID, all requests for CGI resources will be executed as -the User and Group defined for that -<VirtualHost>. If only one or -neither of these directives are specified for a -<VirtualHost> then the main -server userid is assumed. -

        -User directories:
        -The suEXEC wrapper can also be used to execute CGI programs as -the user to which the request is being directed. This is accomplished by -using the "~" character prefixing the user -ID for whom execution is desired. -The only requirement needed for this feature to work is for CGI -execution to be enabled for the user and that the script must meet the -scrutiny of the security checks above. - -

        -BACK TO CONTENTS -

        - -

        Debugging suEXEC

        -

        -The suEXEC wrapper will write log information to the file defined -with the --suexec-logfile option as indicated above. If you feel you have -configured and installed the wrapper properly, have a look at this log -and the error_log for the server to see where you may have gone astray. -

        - -

        -BACK TO CONTENTS -

        - -

        -Beware the Jabberwock: Warnings & Examples -

        -

        -NOTE! This section may not be complete. For the latest -revision of this section of the documentation, see the Apache Group's -Online Documentation -version. -

        - -

        -There are a few points of interest regarding the wrapper that can cause -limitations on server setup. Please review these before submitting any -"bugs" regarding suEXEC. -

          -
        • suEXEC Points Of Interest
        • -
        • Hierarchy limitations -
          - For security and efficiency reasons, all suexec requests must - remain within either a top-level document root for virtual - host requests, or one top-level personal document root for - userdir requests. For example, if you have four VirtualHosts - configured, you would need to structure all of your VHosts' - document roots off of one main Apache document hierarchy to - take advantage of suEXEC for VirtualHosts. (Example forthcoming.) -
          -
        • -
        • suEXEC's PATH environment variable -
          - This can be a dangerous thing to change. Make certain every - path you include in this define is a trusted - directory. You don't want to open people up to having someone - from across the world running a trojan horse on them. -
          -
        • -
        • Altering the suEXEC code -
          - Again, this can cause Big Trouble if you try - this without knowing what you are doing. Stay away from it - if at all possible. -
          -
        • -
        - -

        -BACK TO CONTENTS -

        - - - - diff --git a/docs/manual/upgrading.html b/docs/manual/upgrading.html deleted file mode 100644 index 31567c8ed3..0000000000 --- a/docs/manual/upgrading.html +++ /dev/null @@ -1,143 +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).
        • -
        - -

        Run-Time Configuration Changes

        - -
          -
        • Many directives that were in the core server in Apache 1.3 -are now in the MPMs. If you wish the behavior of the server -to be as similar as possible to the behavior of Apache 1.3, -you should select the prefork -MPM. Other MPMs will have different directives to control process -creation and request processing.
        • - -
        • The CacheNegotiatedDocs directive now takes -the argument on or off. Existing -instances of CacheNegotiatedDocs should be replaced -with CacheNegotiatedDocs on.
        • - -
        • The ErrorDocument directive no longer uses a 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. In order to -assure that Apache reads the configuration files in the same order as -was implied by the older directives, the Include -directives should be placed at the end of httpd.conf, with the one for -srm.conf preceding the one for -access.conf.
        • - -
        • The BindAddress directive no longer exists. -Equivalent functionality is provided with the more flexible Listen directive. - -
        • The ExtendedStatus directive no longer exists. -Status reporting has been completely rewritten to take advantage -of the new MPM system.
        • - -
        • The ServerType directive no longer exists. -The method used to serve requests is now determined by the selection -of MPM. There is currently no MPM designed to be launched by -inetd.
        • - -
        • The mod_log_agent and mod_log_referer modules which provided the -AgentLog, RefererLog and -RefererIgnore directives have been removed. Agent and -referer logs are still available using the CustomLog directive of -mod_log_config.
        • - -
        • The AddModule and ClearModuleList -directives no longer exist. These directives where used to ensure -that modules could be enabled in the correct order. The new -Apache 2.0 API allows modules to explicitly specify their ordering, -eliminating the need for these directives.
        • - -
        - -

        Misc Changes

        - -
          - -
        • Graceful restarts of the server are now executed by signaling the -parent process with WINCH rather than -USR1.
        • - -
        • The httpd command line option -S -which was used for printing the virtual host configuration has -been replaced by -t -D DUMP_VHOSTS.
        • - -
        • The httpd command line option -X has -been removed. Most MPMs allow the same functionality to be requested -by using the -D ONE_PROCESS command line -option. In addition, a -D NO_DETACH command line -option is available.
        • - -
        • 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.
        • - -
        • The distribution has been completely reorganized so that it no -longer contains an independent src directory. Instead, -the sources are logically organized under the main distribution -directory, and installations of the compiled server should be -directed to a separate directory.
        • - -
        - -

        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 are provided in -the developer documentation.

        - - - - diff --git a/docs/manual/upgrading.html.en b/docs/manual/upgrading.html.en deleted file mode 100644 index 31567c8ed3..0000000000 --- a/docs/manual/upgrading.html.en +++ /dev/null @@ -1,143 +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).
        • -
        - -

        Run-Time Configuration Changes

        - -
          -
        • Many directives that were in the core server in Apache 1.3 -are now in the MPMs. If you wish the behavior of the server -to be as similar as possible to the behavior of Apache 1.3, -you should select the prefork -MPM. Other MPMs will have different directives to control process -creation and request processing.
        • - -
        • The CacheNegotiatedDocs directive now takes -the argument on or off. Existing -instances of CacheNegotiatedDocs should be replaced -with CacheNegotiatedDocs on.
        • - -
        • The ErrorDocument directive no longer uses a 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. In order to -assure that Apache reads the configuration files in the same order as -was implied by the older directives, the Include -directives should be placed at the end of httpd.conf, with the one for -srm.conf preceding the one for -access.conf.
        • - -
        • The BindAddress directive no longer exists. -Equivalent functionality is provided with the more flexible Listen directive. - -
        • The ExtendedStatus directive no longer exists. -Status reporting has been completely rewritten to take advantage -of the new MPM system.
        • - -
        • The ServerType directive no longer exists. -The method used to serve requests is now determined by the selection -of MPM. There is currently no MPM designed to be launched by -inetd.
        • - -
        • The mod_log_agent and mod_log_referer modules which provided the -AgentLog, RefererLog and -RefererIgnore directives have been removed. Agent and -referer logs are still available using the CustomLog directive of -mod_log_config.
        • - -
        • The AddModule and ClearModuleList -directives no longer exist. These directives where used to ensure -that modules could be enabled in the correct order. The new -Apache 2.0 API allows modules to explicitly specify their ordering, -eliminating the need for these directives.
        • - -
        - -

        Misc Changes

        - -
          - -
        • Graceful restarts of the server are now executed by signaling the -parent process with WINCH rather than -USR1.
        • - -
        • The httpd command line option -S -which was used for printing the virtual host configuration has -been replaced by -t -D DUMP_VHOSTS.
        • - -
        • The httpd command line option -X has -been removed. Most MPMs allow the same functionality to be requested -by using the -D ONE_PROCESS command line -option. In addition, a -D NO_DETACH command line -option is available.
        • - -
        • 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.
        • - -
        • The distribution has been completely reorganized so that it no -longer contains an independent src directory. Instead, -the sources are logically organized under the main distribution -directory, and installations of the compiled server should be -directed to a separate directory.
        • - -
        - -

        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 are provided in -the developer documentation.

        - - - - diff --git a/docs/manual/upgrading.html.fr b/docs/manual/upgrading.html.fr deleted file mode 100644 index aaf2b5baee..0000000000 --- a/docs/manual/upgrading.html.fr +++ /dev/null @@ -1,132 +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 47e4873162..0000000000 --- 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 47e4873162..0000000000 --- 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 d481b7ce68..0000000000 --- a/docs/manual/vhosts/details.html +++ /dev/null @@ -1,380 +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. The IP address can also -be the wildcard *. - -

        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 but only one -NameVirtualHost directive should be used for each -specific IP:port pair. - -

        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 and 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 IP address is not found in the hash table then the match -against the port number may also result in an entry corresponding to a -NameVirtualHost *, which is subsequently handled like -other name-based vhosts. - -

        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 in the config file with -the specified IP address) has the highest priority and catches any request -to an unknown server name or a request without a Host: -header field. - -

        If the client provided a Host: header field 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 field 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 field 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 field 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 field 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 caught 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. - This also applies to NameVirtualHost * vhosts. -

          - -

        • 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 - field 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 d00a38a40b..0000000000 --- a/docs/manual/vhosts/examples.html +++ /dev/null @@ -1,628 +0,0 @@ - - -VirtualHost Examples - - - - - -

        Virtual Host examples for common setups

        - - -

        Base configuration

        - - - -

        Additional features

        - - - -
        - -

        Simple name-based vhosting

        - -
          - -
        • Setup: - The server machine has a primary name server.domain.tld. - There are two aliases (CNAMEs) www.domain.tld and - www.sub.domain.tld for the address server.domain.tld. -

          - Server configuration: - -

          -    ...
          -    Port 80
          -    ServerName server.domain.tld
          -
          -    NameVirtualHost *
          -
          -    <VirtualHost *>
          -    DocumentRoot /www/domain
          -    ServerName www.domain.tld
          -    ...
          -    </VirtualHost>
          -    
          -    <VirtualHost *>
          -    DocumentRoot /www/subdomain
          -    ServerName www.sub.domain.tld
          -    ...
          -    </VirtualHost> 
          -    
          - The asterisks match all addresses, so the main server serves no - requests. Due to the fact that www.domain.tld is first - in the configuration file, it has the highest priority and can be - seen as the default or primary server. -
          -

          - -

        - -
        - -

        More complicated name-based vhosts

        - -
          - -
        • 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 another virtual host, - with server name www.sub.domain.tld, should - catch any request to hostnames of the form - *.sub.domain.tld. - 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. -
          - -
        • Setup 3: - The server machine has two IP addresses (192.168.1.1 - and 111.22.33.55). The machine is sitting between - an internal (intranet) network and an external (internet) network. - Outside of the network, the name server1.domain.tld - resolves to the external address (111.22.33.55), but - inside the network, that same name resolves to the internal - address (192.168.1.1).

          - - The server can be made to respond to internal and external - requests with the same content, with just one VirtualHost - section. -

          - - Server configuration: - -

          -    ...
          -    NameVirtualHost 192.168.1.1
          -    NameVirtualHost 111.22.33.55
          -
          -    <VirtualHost 192.168.1.1 111.22.33.55>
          -    DocumentRoot /www/server1
          -    ServerName server1.domain.tld
          -    ServerAlias server1
          -    ...
          -    </VirtualHost>
          -    
          - - Now requests from both networks will be served from the same - VirtualHost - -
        • Setup 4: - You have multiple domains going to the same IP and also want - to serve multiple ports. By defining the - ports in the "NameVirtualHost" tag, you can allow this to - work. If you try using without the - NameVirtualHost name:port or you try to use the Port - directive, your configuration will not work. -

          - - Server configuration: - -

          -    ...   
          -    NameVirtualHost 111.22.33.44:80
          -    NameVirtualHost 111.22.33.44:8080
          -
          -    <VirtualHost 111.22.33.44:80>
          -    ServerName www.domain.tld
          -    DocumentRoot /www/domain-80
          -    </VirtualHost>
          -
          -    <VirtualHost 111.22.33.44:8080>
          -    ServerName www.domain.tld
          -    DocumentRoot /www/domain-8080
          -    </VirtualHost>
          -
          -    <VirtualHost 111.22.33.44:80>
          -    ServerName www.otherdomain.tld
          -    DocumentRoot /www/otherdomain-80
          -    </VirtualHost>
          -
          -    <VirtualHost 111.22.33.44:8080>
          -    ServerName www.otherdomain.tld
          -    DocumentRoot /www/otherdomain-8080
          -    </VirtualHost>
          -
          -    
          - -
        - -
        - -

        IP-based vhosts

        - -
          - -
        • 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 addresses - 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 addresses - (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. -
          -
        - -
        - -

        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. -
          - -
        - -
      • Setup: - - - diff --git a/docs/manual/vhosts/fd-limits.html b/docs/manual/vhosts/fd-limits.html deleted file mode 100644 index 6b9d0f93c4..0000000000 --- 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 6b9d0f93c4..0000000000 --- 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/footer.html b/docs/manual/vhosts/footer.html deleted file mode 100644 index 1e5f739ebe..0000000000 --- a/docs/manual/vhosts/footer.html +++ /dev/null @@ -1,8 +0,0 @@ -
        - -

        - Apache HTTP Server Version 2.0 -

        - -Index -Home diff --git a/docs/manual/vhosts/header.html b/docs/manual/vhosts/header.html deleted file mode 100644 index 9533b02bda..0000000000 --- a/docs/manual/vhosts/header.html +++ /dev/null @@ -1,6 +0,0 @@ -
        - [APACHE DOCUMENTATION] -

        - Apache HTTP Server Version 2.0 -

        -
        diff --git a/docs/manual/vhosts/host.html b/docs/manual/vhosts/host.html deleted file mode 100644 index 248092467b..0000000000 --- a/docs/manual/vhosts/host.html +++ /dev/null @@ -1,172 +0,0 @@ - - -Apache non-IP Virtual Hosts - - - - - -

        Apache non-IP Virtual Hosts

        - -See Also: -Virtual Host Support - -
        - -

        What is a Virtual Host

        - -

        The "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 virtual hosts right -out of the box, but since the base HTTP (HyperText -Transport Protocol) standard does not allow any method for the server -to determine the hostname it is being addressed as, Apache's virtual -host support has required a separate IP address for each -server. Documentation on using this approach (which still works very -well) is available. - -

        While the approach described above works, with the available IP -address space growing smaller, and the number of domains increasing, -it is not the most elegant solution, and 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 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 user's browser must support this part of the protocol. The -latest versions of many browsers (including Netscape Navigator 2.0 and -later) do, but many browsers, especially older ones, 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:

        -
        -    <VirtualHost www.apache.org>
        -    ServerName www.apache.org
        -    DocumentRoot /usr/web/apache
        -    </VirtualHost>
        -
        - -

        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 www.apache.org -DNS entry points to the same IP address as the main -server. Optionally, you could simply use that IP address in the -<VirtualHost> entry.

        - -

        Additionally, many servers may wish to be accessible by more than -one name. For example, the Apache server might want to be accessible -as apache.org, or ftp.apache.org, assuming -the IP addresses pointed to the same server. In fact, one might want it -so that all addresses at apache.org were picked up by the -server. This is possible with the ServerAlias -directive, placed inside the <VirtualHost> section. For -example:

        - -
        -    ServerAlias apache.org *.apache.org
        -
        - -

        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.physics" then you will need to add -ServerAlias www www.physics. 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.

        - -

        Security Considerations

        - -Apache allows all virtual hosts to be made accessible via the -Host: header through all IP interfaces, even those which -are configured to use different IP interfaces. For example, if the -configuration for www.foo.com contained a virtual host -section for www.bar.com, and www.bar.com was -a separate IP interface, such that -non-Host:-header-supporting browsers can use it, as -before with Apache 1.0. If a request is made to -www.foo.com and the request includes the header -Host: www.bar.com, a page from www.bar.com -will be sent. - -

        - -This is a security concern if you are controlling access to a -particular server based on IP-layer controls, such as from within a -firewall or router. Let's say www.bar.com in the above -example was instead an intra-net server called -private.foo.com, and the router used by foo.com only let -internal users access private.foo.com. Obviously, -Host: header functionality now allows someone who has -access to www.foo.com to get -private.foo.com, if they send a Host: -private.foo.com header. It is important to note that this -condition exists only if you only implement this policy at the IP -layer - all security controls used by Apache (i.e., Allow, Deny from, etc.) are -consistently respected. - -

        Compatibility with Older Browsers

        - -

        As mentioned earlier, a majority of browsers do not send the -required data for the new virtual hosts to work properly. These -browsers will always be sent to the main server's pages. There is a -workaround, albeit a slightly cumbersome one:

        - -

        To continue the www.apache.org example (Note: Apache's -web server does not actually function in this manner), we might use the -new ServerPath directive in the www.apache.org -virtual host, for example: - -

        -    ServerPath /apache
        -
        -

        What does this mean? It means that a request for any file beginning -with "/apache" will be looked for in the Apache -docs. This means that the pages can be accessed as -http://www.apache.org/apache/ for all browsers, although -new browsers can also access it as -http://www.apache.org/.

        - -

        In order to make this work, put a link on your main server's page -to http://www.apache.org/apache/ (Note: Do not use -http://www.apache.org/ - this would create an endless -loop). 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 -/apache/ -(e.g., "http://www.apache.org/apache/file.html" or -"/apache/docs/1.1/index.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. When -a new browser contacts http://www.apache.org/, they will -be directly taken to the Apache pages. Older browsers will be able to -click on the link from the main server, go to -http://www.apache.org/apache/, and then access the -pages.

        - - - - diff --git a/docs/manual/vhosts/index.html b/docs/manual/vhosts/index.html deleted file mode 100644 index bb4a0f8931..0000000000 --- a/docs/manual/vhosts/index.html +++ /dev/null @@ -1,65 +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

        - - - -

        Folks trying to debug their virtual host configuration may find the -Apache -S command line switch useful. It will dump out a -description of how Apache parsed the configuration file. Careful -examination of the IP addresses and server names may help uncover -configuration mistakes. - - - - diff --git a/docs/manual/vhosts/index.html.en b/docs/manual/vhosts/index.html.en deleted file mode 100644 index bb4a0f8931..0000000000 --- a/docs/manual/vhosts/index.html.en +++ /dev/null @@ -1,65 +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

        - - - -

        Folks trying to debug their virtual host configuration may find the -Apache -S command line switch useful. It will dump out a -description of how Apache parsed the configuration file. Careful -examination of the IP addresses and server names may help uncover -configuration mistakes. - - - - diff --git a/docs/manual/vhosts/ip-based.html b/docs/manual/vhosts/ip-based.html deleted file mode 100644 index ec759c0e4b..0000000000 --- a/docs/manual/vhosts/ip-based.html +++ /dev/null @@ -1,134 +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, these are -frequently called "ip aliases", and the "ifconfig" command -is most commonly used to set them up). - -

        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: -

          -
        • There are security partitioning issues, such as company1 does not want - anyone at company2 to be able to read their data except via the web. - In this case you would need two daemons, each running with different - User, - Group, - Listen, and - ServerRoot settings. -
        • You can afford the memory and - file descriptor requirements of - listening to every IP alias on the machine. It's only possible to - Listen - to the "wildcard" address, or to specific addresses. So if you have - a need to listen to a specific address for whatever reason, then you - will need to listen to all specific addresses. (Although one httpd - could listen to N-1 of the addresses, and another could listen to - the remaining address.) -
        -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 caveats). - -

        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 caveats). - -

        - -Almost any configuration directive can be put in the -VirtualHost directive, with the exception of directives that control -process creation and a few other directives. To find out if a -directive can be used in the VirtualHost directive, check the -Context using the -directive index. - -

        -User and -Group may be 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 e4caed86d6..0000000000 --- a/docs/manual/vhosts/mass.html +++ /dev/null @@ -1,405 +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. - - - -

        Contents:

        - - - -

        Motivation

        - -

        The techniques described here are of interest if your -httpd.conf contains many -<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 virtual host; however if you have very many virtual hosts -then doing this is dubious anyway because it eats file descriptors. It -is better to log to a pipe or a fifo and arrange for the process at -the other end to distribute the logs to the customers (it can also -accumulate statistics, etc.).

        - - -

        Overview

        - -

        A virtual host is defined by two pieces of information: its IP -address, and the contents of the Host: header in the HTTP -request. The dynamic mass virtual hosting technique is based on -automatically inserting this information into the pathname of the file -that is used to satisfy the request. This is done most easily using -mod_vhost_alias, -but if you are using a version of Apache up to 1.3.6 then you must use -mod_rewrite. Both -of these modules are disabled by default; you must enable one of them -when configuring and building Apache if you want to use this technique.

        - -

        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 -which is used by Apache to generate self-referential URLs, etc. It -is configured with the ServerName directive, and it is -available to CGIs via the SERVER_NAME environment -variable. The actual value used at run time is controlled by the -UseCanonicalName -setting. With UseCanonicalName Off the server name -comes from the contents of the Host: header in the -request. With UseCanonicalName DNS it comes from a -reverse DNS lookup of the virtual host's IP address. The former -setting is used for name-based dynamic virtual hosting, and the latter -is used for IP-based hosting. If Apache cannot work out the server -name because there is no Host: header or the DNS lookup -fails then the value configured with ServerName is used -instead.

        - -

        The other thing to `fake' is the document root (configured -with DocumentRoot and available to CGIs via the -DOCUMENT_ROOT environment variable). In a normal -configuration this setting is used by the core module when mapping -URIs to filenames, but when the server is configured to do dynamic -virtual hosting that job is taken over by another module (either -mod_vhost_alias or mod_rewrite) which has -a different way of doing the mapping. Neither of these modules is -responsible for setting the DOCUMENT_ROOT environment -variable so if any CGIs or SSI documents make use of it they will -get a misleading value.

        - - -

        Simple dynamic virtual hosts

        - -

        This extract from httpd.conf implements the virtual -host arrangement outlined in the Motivation -section above, but in a generic fashion using -mod_vhost_alias.

        - -
        -# get the server name from the Host: header
        -UseCanonicalName Off
        -
        -# this log format can be split per-virtual-host based on the first field
        -LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
        -CustomLog logs/access_log vcommon
        -
        -# include the server name in the filenames used to satisfy requests
        -VirtualDocumentRoot /www/hosts/%0/docs
        -VirtualScriptAlias  /www/hosts/%0/cgi-bin
        -
        - -

        This configuration can be changed into an IP-based virtual hosting -solution by just turning UseCanonicalName Off into -UseCanonicalName DNS. The server name that is inserted -into the filename is then derived from the IP address of the virtual -host.

        - - -

        A virtually hosted homepages system

        - -

        This is an adjustment of the above system tailored for an ISP's -homepages server. Using a slightly more complicated configuration 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.

        - -
        -# all the preliminary stuff is the same as above, then
        -
        -# include part of the server name in the filenames
        -VirtualDocumentRoot /www/hosts/%2/docs
        -
        -# single cgi-bin directory
        -ScriptAlias  /cgi-bin/  /www/std-cgi/
        -
        - -

        There are examples of more complicated -VirtualDocumentRoot settings in -the -mod_vhost_alias documentation.

        - - -

        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 virtual hosting 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 conventional <VirtualHost> configuration -sections.

        - -
        -UseCanonicalName Off
        -
        -LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
        -
        -<Directory /www/commercial>
        -	Options FollowSymLinks
        -	AllowOverride All
        -</Directory>
        -
        -<Directory /www/homepages>
        -	Options FollowSymLinks
        -	AllowOverride None
        -</Directory>
        -
        -<VirtualHost 111.22.33.44>
        -	ServerName www.commercial.isp.com
        -
        -	CustomLog logs/access_log.commercial vcommon
        -
        -	VirtualDocumentRoot /www/commercial/%0/docs
        -	VirtualScriptAlias  /www/commercial/%0/cgi-bin
        -</VirtualHost>
        -
        -<VirtualHost 111.22.33.45>
        -	ServerName www.homepages.isp.com
        -
        -	CustomLog logs/access_log.homepages vcommon
        -
        -	VirtualDocumentRoot /www/homepages/%0/docs
        -	ScriptAlias         /cgi-bin/ /www/std-cgi/
        -</VirtualHost>
        -
        - - -

        More efficient IP-based virtual hosting

        - -

        After the first example I noted that it is -easy to turn it into an IP-based virtual hosting setup. Unfortunately -that configuration is not very efficient because it requires a DNS -lookup for every request. This can be avoided by laying out the -filesystem according to the IP addresses themselves rather than the -corresponding names and changing the logging similarly. Apache will -then usually not need to work out the server name and so incur a DNS -lookup.

        - -
        -# get the server name from the reverse DNS of the IP address
        -UseCanonicalName DNS
        -
        -# include the IP address in the logs so they may be split
        -LogFormat "%A %h %l %u %t \"%r\" %s %b" vcommon
        -CustomLog logs/access_log vcommon
        -
        -# include the IP address in the filenames
        -VirtualDocumentRootIP /www/hosts/%0/docs
        -VirtualScriptAliasIP  /www/hosts/%0/cgi-bin
        -
        - - -

        Using older versions of Apache

        - -

        The examples above rely on mod_vhost_alias which -appeared after version 1.3.6. If you are using a version of Apache -without mod_vhost_alias then you can implement this -technique with mod_rewrite as illustrated below, but -only for Host:-header-based virtual hosts.

        - -

        In addition there are some things to beware of with logging. Apache -1.3.6 is the first version to include the %V log format -directive; in versions 1.3.0 - 1.3.3 the %v option did -what %V does; version 1.3.4 has no equivalent. In -all these versions of Apache the UseCanonicalName -directive can appear in .htaccess files which means that -customers can cause the wrong thing to be logged. Therefore the best -thing to do is use the %{Host}i directive which logs the -Host: header directly; note that this may include -:port on the end which is not the case for -%V.

        - - -

        Simple dynamic virtual hosts -using mod_rewrite

        - -

        This extract from httpd.conf does the same thing as -the first example. The first half is very -similar to the corresponding part above but with some changes for -backward compatibility and to make the mod_rewrite part -work properly; the second half configures mod_rewrite to -do the actual work.

        - -

        There are a couple of especially tricky bits: By default, -mod_rewrite runs before the other URI translation modules -(mod_alias etc.) so if they are used then -mod_rewrite must be configured to accommodate them. -Also, mome magic must be performed to do a per-dynamic-virtual-host -equivalent of ScriptAlias.

        - -
        -# get the server name from the Host: header
        -UseCanonicalName Off
        -
        -# splittable logs
        -LogFormat "%{Host}i %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 homepages system -using mod_rewrite

        - -

        This does the same thing as the -second example.

        - -
        -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:%{SERVER_NAME}}  ^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:%{SERVER_NAME}}$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 more advanced mod_rewrite -features to get the translation from virtual host to document root -from a separate configuration file. This provides more flexibility but -requires more complicated 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
        -
        -

        - - - - diff --git a/docs/manual/vhosts/name-based.html b/docs/manual/vhosts/name-based.html deleted file mode 100644 index 1d834f2989..0000000000 --- a/docs/manual/vhosts/name-based.html +++ /dev/null @@ -1,169 +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

        - -

        Early versions of HTTP (like many other protocols, e.g. FTP) -required a different IP address for each virtual host on the server. -On some platforms this can limit the number of virtual hosts you can -run, and because there are concerns about the availability of IP -addresses it is strongly discouraged by the registraries (ARIN, RIPE, -and APNIC).

        - -

        The HTTP/1.1 protocol, and a common extension to -HTTP/1.0, includes 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 old IP-address-per-hostname method.

        - -

        The benefits of using the name-based virtual hosts is a practically -unlimited number of servers, ease of configuration and use, and it -requires no additional hardware or software. The main disadvantage is -that the client must support this part of the protocol. Almost all -browsers do, but there are still tiny numbers of very old browsers in -use which do not. This can cause problems, although a possible -solution is addressed below.

        - -

        Using name-based virtual hosts

        - -

        Using name-based virtual hosts is quite easy, and superficially looks -like the old method. The notable difference between IP-based and -name-based virtual host configuration is the -NameVirtualHost -directive which specifies an IP address that should be used as a -target for name-based virtual hosts, or the wildcard * to -indicate that the server only does name-based virtual hosting (no -IP-based virtual hosting).

        - -

        For example, suppose that both www.domain.tld and -www.otherdomain.tld point at the IP address of your -server. Then you simply add to one of the Apache configuration files -(most likely httpd.conf or srm.conf) code -similar to the following:

        - -
        -    NameVirtualHost *
        -
        -    <VirtualHost *>
        -    ServerName www.domain.tld
        -    DocumentRoot /www/domain
        -    </VirtualHost>
        -
        -    <VirtualHost *>
        -    ServerName www.otherdomain.tld
        -    DocumentRoot /www/otherdomain
        -    </VirtualHost>
        -
        - -

        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 names -www.domain.tld and www.otherdomain.tld -are pointing to the right IP address. - -

        Note: When you specify an IP address in a NameVirtualHost -directive then requests to that IP address will only ever be served -by matching <VirtualHost>s. The "main server" will -never be served from the specified IP address. -If you specify a wildcard then the "main server" isn't used at all. -If you start to use virtual hosts you should stop using the "main server" -as an independent server and rather use it as a place for -configuration directives that are common for all your virtual hosts. -In other words, you should add a <VirtualHost> section for -every server (hostname) you want to maintain on your server. - -

        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. -The ServerAlias directive is generally a way to have different -hostnames pointing to the same virtual host. -

        - -

        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 -first virtual host listed for that IP address (the -primary name-based virtual host).

        - -

        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 1d834f2989..0000000000 --- a/docs/manual/vhosts/name-based.html.en +++ /dev/null @@ -1,169 +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

        - -

        Early versions of HTTP (like many other protocols, e.g. FTP) -required a different IP address for each virtual host on the server. -On some platforms this can limit the number of virtual hosts you can -run, and because there are concerns about the availability of IP -addresses it is strongly discouraged by the registraries (ARIN, RIPE, -and APNIC).

        - -

        The HTTP/1.1 protocol, and a common extension to -HTTP/1.0, includes 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 old IP-address-per-hostname method.

        - -

        The benefits of using the name-based virtual hosts is a practically -unlimited number of servers, ease of configuration and use, and it -requires no additional hardware or software. The main disadvantage is -that the client must support this part of the protocol. Almost all -browsers do, but there are still tiny numbers of very old browsers in -use which do not. This can cause problems, although a possible -solution is addressed below.

        - -

        Using name-based virtual hosts

        - -

        Using name-based virtual hosts is quite easy, and superficially looks -like the old method. The notable difference between IP-based and -name-based virtual host configuration is the -NameVirtualHost -directive which specifies an IP address that should be used as a -target for name-based virtual hosts, or the wildcard * to -indicate that the server only does name-based virtual hosting (no -IP-based virtual hosting).

        - -

        For example, suppose that both www.domain.tld and -www.otherdomain.tld point at the IP address of your -server. Then you simply add to one of the Apache configuration files -(most likely httpd.conf or srm.conf) code -similar to the following:

        - -
        -    NameVirtualHost *
        -
        -    <VirtualHost *>
        -    ServerName www.domain.tld
        -    DocumentRoot /www/domain
        -    </VirtualHost>
        -
        -    <VirtualHost *>
        -    ServerName www.otherdomain.tld
        -    DocumentRoot /www/otherdomain
        -    </VirtualHost>
        -
        - -

        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 names -www.domain.tld and www.otherdomain.tld -are pointing to the right IP address. - -

        Note: When you specify an IP address in a NameVirtualHost -directive then requests to that IP address will only ever be served -by matching <VirtualHost>s. The "main server" will -never be served from the specified IP address. -If you specify a wildcard then the "main server" isn't used at all. -If you start to use virtual hosts you should stop using the "main server" -as an independent server and rather use it as a place for -configuration directives that are common for all your virtual hosts. -In other words, you should add a <VirtualHost> section for -every server (hostname) you want to maintain on your server. - -

        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. -The ServerAlias directive is generally a way to have different -hostnames pointing to the same virtual host. -

        - -

        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 -first virtual host listed for that IP address (the -primary name-based virtual host).

        - -

        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/vhosts-in-depth.html b/docs/manual/vhosts/vhosts-in-depth.html deleted file mode 100644 index 23d8e919a1..0000000000 --- a/docs/manual/vhosts/vhosts-in-depth.html +++ /dev/null @@ -1,396 +0,0 @@ - - -An In-Depth Discussion of VirtualHost Matching - - - - - -

        An In-Depth Discussion of VirtualHost Matching

        - -

        This is a very rough document that was probably out of date the moment -it was written. It attempts to explain exactly what the code does when -deciding what virtual host to serve a hit from. It's provided on the -assumption that something is better than nothing. The server version -under discussion is Apache 1.2. - -

        If you just want to "make it work" without understanding -how, there's a What Works section at the bottom. - -

        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 ServerName, -ServerPath, or ServerAlias. - -

        In the absence of any -Listen -directives, the (final if there -are multiple) Port directive in the main_server indicates -which port httpd will listen on. - -

        The Port and ServerName directives for -any server main or virtual are used when generating URLs such as during -redirects. - -

        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. - -

        The magic _default_ address has significance during -the matching algorithm. It essentially matches any unspecified address. - -

        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). Note that subsequent Port -statements for this vhost will not affect the ports assigned in the -address set. - -

        -All vhosts are stored in a list which is in the reverse order that -they appeared in the config file. For example, if the config file is: - -

        -    <VirtualHost A>
        -    ...
        -    </VirtualHost>
        -
        -    <VirtualHost B>
        -    ...
        -    </VirtualHost>
        -
        -    <VirtualHost C>
        -    ...
        -    </VirtualHost>
        -
        - -Then the list will be ordered: main_server, C, B, A. Keep this in mind. - -

        -After parsing has completed, the list of servers is scanned, and various -merges and 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. - -

        Now a pass is made through the vhosts to fill in any missing -ServerName fields and to classify the vhost as either -an IP-based vhost or a name-based vhost. A vhost is -considered a name-based vhost if any of its address set overlaps the -main_server (the port associated with each address must match the -main_server's Port). Otherwise it is considered an IP-based -vhost. - -

        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. Otherwise the vhost (which is necessarily an IP-based -vhost) is given a ServerName based on the result of a reverse -DNS lookup on the first address given in the VirtualHost -statement. - -

        - -

        Vhost Matching

        - - -

        Apache 1.3 differs from what is documented -here, and documentation still has to be written. - -

        -The server determines which vhost to use for a request as follows: - -

        find_virtual_server: When the connection is first made -by the client, the local IP address (the IP address to which the client -connected) is looked up in the server list. A vhost is matched if it -is an IP-based vhost, the IP address matches and the port matches -(taking into account wildcards). - -

        If no vhosts are matched then the last occurrence, if it appears, -of a _default_ address (which if you recall the ordering of the -server list mentioned above means that this would be the first occurrence -of _default_ in the config file) is matched. - -

        In any event, if nothing above has matched, then the main_server is -matched. - -

        The vhost resulting from the above search is stored with data -about the connection. We'll call this the connection vhost. -The connection vhost is constant over all requests in a particular TCP/IP -session -- that is, over all requests in a KeepAlive/persistent session. - -

        For each request made on the connection the following sequence of -events further determines the actual vhost that will be used to serve -the request. - -

        check_fulluri: If the requestURI is an absoluteURI, that -is it includes http://hostname/, then an attempt is made to -determine if the hostname's address (and optional port) match that of -the connection vhost. If it does then the hostname portion of the URI -is saved as the request_hostname. If it does not match, then the -URI remains untouched. Note: to achieve this address -comparison, -the hostname supplied goes through a DNS lookup unless it matches the -ServerName or the local IP address of the client's socket. - -

        parse_uri: If the URI begins with a protocol -(i.e., http:, ftp:) then the request is -considered a proxy request. Note that even though we may have stripped -an http://hostname/ in the previous step, this could still -be a proxy request. - -

        read_request: If the request does not have a hostname -from the earlier step, then any Host: header sent by the -client is used as the request hostname. - -

        check_hostalias: If the request now has a hostname, -then an attempt is made to match for this hostname. The first step -of this match is to compare any port, if one was given in the request, -against the Port field of the connection vhost. If there's -a mismatch then the vhost used for the request is the connection vhost. -(This is a bug, see observations.) - -

        -If the port matches, then httpd scans the list of vhosts starting with -the next server after the connection vhost. This scan does not -stop if there are any matches, it goes through all possible vhosts, -and in the end uses the last match it found. The comparisons performed -are as follows: - -

          -
        • Compare the request hostname:port with the vhost - ServerName and Port. - -
        • Compare the request hostname against any and all addresses given in - the VirtualHost directive for this vhost. - -
        • Compare the request hostname against the ServerAlias - given for the vhost. -
        - -

        -check_serverpath: If the request has no hostname -(back up a few paragraphs) then a scan similar to the one -in check_hostalias is performed to match any -ServerPath directives given in the vhosts. Note that the -last match is used regardless (again consider the ordering of -the virtual hosts). - -

        Observations

        - -
          - -
        • It is difficult to define an IP-based vhost for the machine's - "main IP address". You essentially have to create a bogus - ServerName for the main_server that does not match the - machine's IPs. -

          - -

        • During the scans in both check_hostalias and - check_serverpath no check is made that the vhost being - scanned is actually a name-based vhost. This means, for example, that - it's possible to match an IP-based vhost through another address. But - because the scan starts in the vhost list at the first vhost that - matched the local IP address of the connection, not all IP-based vhosts - can be matched. -

          - Consider the config file above with three vhosts A, B, C. Suppose - that B is a named-based vhost, and A and C are IP-based vhosts. If - a request comes in on B or C's address containing a header - "Host: A" then - it will be served from A's config. If a request comes in on A's - address then it will always be served from A's config regardless of - any Host: header. -

          - -
        • Unless you have a _default_ vhost, - it doesn't matter if you mix name-based vhosts in amongst IP-based - vhosts. During the find_virtual_server phase above no - named-based vhost will be matched, so the main_server will remain the - connection vhost. Then scans will cover all vhosts in the vhost list. -

          - If you do have a _default_ vhost, then you cannot place - named-based vhosts after it in the config. This is because on any - connection to the main server IPs the connection vhost will always be - the _default_ vhost since none of the name-based are - considered during find_virtual_server. -

          - -
        • 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. -

          - -

        • A DNS lookup is always required for the main_server's - ServerName (or to generate that if it isn't specified - in the config). -

          - -

        • 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 a vhost that would otherwise be a name-vhost includes a - Port statement that doesn't match the main_server - Port then it will be considered an IP-based vhost. - Then find_virtual_server will match it (because - the ports associated with each address in the address set default - to the port of the main_server) as the connection vhost. Then - check_hostalias will refuse to check any other name-based - vhost because of the port mismatch. The result is that the vhost - will steal all hits going to the main_server address. -

          - -

        • If two IP-based vhosts have an address in common, the vhost appearing - later in the file is always matched. Such a thing might happen - inadvertently. If the config has name-based vhosts and for some reason - the main_server ServerName resolves to the wrong address - then all the name-based vhosts will be parsed as ip-based vhosts. - Then the last of them will steal all the hits. -

          - -

        • The last name-based vhost in the config is always matched for any hit - which doesn't match one of the other name-based vhosts. - -
        - -

        What Works

        - -

        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 -virtualhosts might affect all virtualhosts.) -

          - -

        • Arrange your VirtualHosts such -that all name-based virtual hosts come first, followed by IP-based -virtual hosts, followed by any _default_ virtual host -

          - -

        • 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 /abcdef"). -

          - -

        • Do not use port-based vhosts in the same server as -name-based vhosts. A loose definition for port-based is a vhost which -is determined by the port on the server (i.e., one server with -ports 8000, 8080, and 80 - all of which have different configurations). -

          - -

        - - - - diff --git a/docs/manual/vhosts/virtual-host.html b/docs/manual/vhosts/virtual-host.html deleted file mode 100644 index aa81fad91e..0000000000 --- a/docs/manual/vhosts/virtual-host.html +++ /dev/null @@ -1,208 +0,0 @@ - - - -Apache Server Virtual Host Support - - - - - -

        Virtual Host Support

        - -See Also: -Non-IP based virtual hosts - -

        What are virtual hosts?

        -This is the ability of a single machine to be a web server for multiple -domains. For example, an Internet service provider might have a machine -called www.serve.com which provides Web space for several -organizations including, say, smallco and baygroup. -Ordinarily, these groups would be given parts of the Web tree on www.serve.com. -So smallco's home page would have the URL -
        -http://www.serve.com/smallco/ -
        -and baygroup's home page would have the URL -
        -http://www.serve.com/baygroup/ -
        -

        -For esthetic reasons, however, both organizations would rather their home -pages appeared under their own names rather than that of the service -provider's; but they do not want to set up their own Internet links and -servers. -

        -Virtual hosts are the solution to this problem. smallco and baygroup would -have their own Internet name registrations, www.smallco.com and -www.baygroup.org respectively. These hostnames would both -correspond to the service provider's machine (www.serve.com). Thus -smallco's home page would now have the URL -

        -http://www.smallco.com/ -
        -and baygroup's home page would would have the URL -
        -http://www.baygroup.org/ -
        - -

        System requirements

        -Due to limitations in the HTTP/1.0 protocol, the web server must have a -different IP address for each virtual host. This can be achieved -by the machine having several physical network connections, or by use -of a virtual interface on some operating -systems. - -

        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 -BindAddress directive in the -configuration -file to select which IP address (or virtual host) that daemon services. -E.g., -
        BindAddress www.smallco.com
        -This hostname can also be given as an IP address. - -

        Setting up a single daemon

        -For this case, a single httpd will service requests for all the virtual hosts. -The VirtualHost directive in the - configuration file is used to set the values of -ServerAdmin, -ServerName, -DocumentRoot, -ErrorLog and -TransferLog 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>
        -
        - -This VirtualHost hostnames can also be given as IP addresses. - -

        - -Almost ANY configuration directive can be put -in the VirtualHost directive, with the exception of -ServerType, -User, -Group, -StartServers, -MaxSpareServers, -MinSpareServers, -MaxRequestsPerChild, -BindAddress, -PidFile, -TypesConfig, and -ServerRoot. - -

        - -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. - -

        - -

        File Handle/Resource Limits:

        -When using a large number of Virtual Hosts, Apache may run out of available -file descriptors 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
          -
        - -The have been reports that Apache may start running out of resources allocated -for the root process. This will exhibit itself as errors in the error log like -"unable to fork". There are two ways you can bump this up: - -
          -
        1. Have a csh script wrapper around httpd which sets the -"rlimit" to some large number, like 512. -
        2. Edit http_main.c to add calls to setrlimit() from main(), along the lines -of -
          -        struct rlimit rlp;
          -
          -        rlp.rlim_cur = rlp.rlim_max = 512;
          -        if (setrlimit(RLIMIT_NPROC, &rlp)) {
          -            fprintf(stderr, "setrlimit(RLIMIT_NPROC) failed.\n");
          -            exit(1);
          -        }
          -
          -(thanks to "Aaron Gifford <agifford@InfoWest.COM>" for the patch) -
        - -The latter will probably manifest itself in a later version of Apache. - - - - diff --git a/emacs-style b/emacs-style deleted file mode 100644 index d66f865a09..0000000000 --- a/emacs-style +++ /dev/null @@ -1,11 +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' ++) - (c-set-offset 'statement-case-intro' ++) - (c-set-offset 'inextern-lang' 0) - ))) -(setq c++-mode-hook c-mode-hook) diff --git a/hints.m4 b/hints.m4 deleted file mode 100644 index 4a3969c0fa..0000000000 --- a/hints.m4 +++ /dev/null @@ -1,63 +0,0 @@ -dnl -dnl APR_PRELOAD -dnl -dnl Preload various ENV/makefile paramsm such as CC, CFLAGS, etc -dnl based on outside knowledge -dnl -AC_DEFUN(APACHE_PRELOAD, [ -if test "$DID_APACHE_PRELOAD" = "yes" ; then - - echo "Apache hints file rules for $host already applied" - -else - - DID_APACHE_PRELOAD="yes"; export DID_APACHE_PRELOAD - - echo "Applying Apache hints file rules for $host" - - case "$host" in - *-apple-aux3*) - APR_SETVAR(APACHE_MPM, [prefork]) - APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1]) - ;; - *os2_emx*) - APR_SETVAR(APACHE_MPM, [spmt_os2]) - APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1]) - ;; - *-linux-*) - case `uname -r` in - 2.2* ) APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1]) - ;; - * ) - ;; - esac - ;; - *486-*-bsdi*) - APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1]) - ;; - *-netbsd*) - APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1]) - ;; - *-freebsd*) - APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1]) - ;; -dnl *-apple-rhapsody*) -dnl APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1]) -dnl ;; - *-apple-darwin*) - APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1]) - ;; - *-dec-osf*) - APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1]) - ;; - *-qnx) - APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1]) - ;; - *-beos*) - APR_SETVAR(APACHE_MPM, [beos]) - APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1]) - ;; - esac - -fi -]) diff --git a/include/.cvsignore b/include/.cvsignore deleted file mode 100644 index e46ebcac5d..0000000000 --- a/include/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -ap_config_auto.h -ap_config_auto.h.in diff --git a/include/.indent.pro b/include/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- 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 facc2561a2..0000000000 --- a/include/ap_compat.h +++ /dev/null @@ -1,12 +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 -#define ap_send_http_header(r) ; - -#endif /* APR_COMPAT_H */ diff --git a/include/ap_config.h b/include/ap_config.h deleted file mode 100644 index 3e61ca69f8..0000000000 --- a/include/ap_config.h +++ /dev/null @@ -1,256 +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 AP_CONFIG_H -#define AP_CONFIG_H - -#include "apr.h" -#include "apr_hooks.h" - -/** - * @file ap_config.h - * @brief Symbol Export Macros - */ - -/* Although this file doesn't declare any hooks, declare the hook group here */ -/** @defgroup hooks Apache Hooks */ - -/** - * AP_DECLARE_EXPORT is defined when building the Apache Core dynamic - * library, so that all public symbols are exported. - * - * AP_DECLARE_STATIC is defined when including Apache's Core headers, - * to provide static linkage when the dynamic library may be unavailable. - * - * AP_DECLARE_STATIC and AP_DECLARE_EXPORT are left undefined when - * including Apache's Core headers, to import and link the symbols from the - * dynamic Apache Core library and assure appropriate indirection and calling - * conventions at compile time. - * - * @deffunc AP_DECLARE_EXPORT/AP_DECLARE_STATIC - */ - -#if !defined(WIN32) -/** - * Apache Core dso functions are declared with AP_DECLARE(), so they may - * use the most appropriate calling convention. Hook functions and other - * Core functions with variable arguments must use AP_DECLARE_NONSTD(). - * - * @deffunc AP_DECLARE(rettype) ap_func(args) - */ -#define AP_DECLARE(type) type - -/** - * Apache Core dso variable argument and hook functions are declared with - * AP_DECLARE_NONSTD(), as they must use the C language calling convention. - * - * @deffunc AP_DECLARE_NONSTD(rettype) ap_func(args [...]) - */ -#define AP_DECLARE_NONSTD(type) type - -/** - * Apache Core dso variables are declared with AP_MODULE_DECLARE_DATA. - * This assures the appropriate indirection is invoked at compile time. - * - * @tip extern AP_DECLARE_DATA type apr_variable; syntax is required for - * declarations within headers to properly import the variable. - * @deffunc AP_DECLARE_DATA type apr_variable - */ -#define AP_DECLARE_DATA - -#elif defined(AP_DECLARE_STATIC) -#define AP_DECLARE(type) type __stdcall -#define AP_DECLARE_NONSTD(type) type -#define AP_DECLARE_DATA -#elif defined(AP_DECLARE_EXPORT) -#define AP_DECLARE(type) __declspec(dllexport) type __stdcall -#define AP_DECLARE_NONSTD(type) __declspec(dllexport) type -#define AP_DECLARE_DATA __declspec(dllexport) -#else -#define AP_DECLARE(type) __declspec(dllimport) type __stdcall -#define AP_DECLARE_NONSTD(type) __declspec(dllimport) type -#define AP_DECLARE_DATA __declspec(dllimport) -#endif - -#if !defined(WIN32) || defined(AP_MODULE_DECLARE_STATIC) -/** - * Declare a dso module's exported module structure as AP_MODULE_DECLARE_DATA. - * - * Unless AP_MODULE_DECLARE_STATIC is defined at compile time, symbols - * declared with AP_MODULE_DECLARE_DATA are always exported. - * - * @deffunc module AP_MODULE_DECLARE_DATA mod_tag - */ -#if defined(WIN32) -#define AP_MODULE_DECLARE(type) type __stdcall -#else -#define AP_MODULE_DECLARE(type) type -#endif -#define AP_MODULE_DECLARE_NONSTD(type) type -#define AP_MODULE_DECLARE_DATA -#else -/** - * AP_MODULE_DECLARE_EXPORT is a no-op. Unless contradicted by the - * AP_MODULE_DECLARE_STATIC compile-time symbol, it is assumed and defined. - * - * The old SHARED_MODULE compile-time symbol is now the default behavior, - * so it is no longer referenced anywhere with Apache 2.0. - * - * @deffunc AP_MODULE_DECLARE_EXPORT - */ -#define AP_MODULE_DECLARE_EXPORT -#define AP_MODULE_DECLARE(type) __declspec(dllexport) type __stdcall -#define AP_MODULE_DECLARE_NONSTD(type) __declspec(dllexport) type -#define AP_MODULE_DECLARE_DATA __declspec(dllexport) -#endif - -/** - * @package Hook Functions - */ - -#define AP_DECLARE_HOOK(ret,name,args) \ - APR_DECLARE_EXTERNAL_HOOK(ap,AP,ret,name,args) - -#define AP_IMPLEMENT_HOOK_BASE(name) \ - APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ap,AP,name) - -/** - * Implement an Apache core hook that has no return code, and - * therefore runs all of the registered functions. The implementation - * is called ap_run_name. - * - * @param name The name of the hook - * @param args_decl The declaration of the arguments for the hook, for example - * "(int x,void *y)" - * @param args_use The arguments for the hook as used in a call, for example - * "(x,y)" - * @tip If IMPLEMENTing a hook that is not linked into the Apache core, - * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_VOID. - * @deffunc AP_IMPLEMENT_HOOK_VOID(name, args_decl, args_use) - */ -#define AP_IMPLEMENT_HOOK_VOID(name,args_decl,args_use) \ - APR_IMPLEMENT_EXTERNAL_HOOK_VOID(ap,AP,name,args_decl,args_use) - -/** - * Implement an Apache core hook that runs until one of the functions - * returns something other than ok or decline. That return value is - * then returned from the hook runner. If the hooks run to completion, - * then ok is returned. Note that if no hook runs it would probably be - * more correct to return decline, but this currently does not do - * so. The implementation is called ap_run_name. - * - * @param ret The return type of the hook (and the hook runner) - * @param name The name of the hook - * @param args_decl The declaration of the arguments for the hook, for example - * "(int x,void *y)" - * @param args_use The arguments for the hook as used in a call, for example - * "(x,y)" - * @param ok The "ok" return value - * @param decline The "decline" return value - * @return ok, decline or an error. - * @tip If IMPLEMENTing a hook that is not linked into the Apache core, - * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL. - * @deffunc AP_IMPLEMENT_HOOK_RUN_ALL(ret, name, args_decl, args_use, ok, decline) - */ -#define AP_IMPLEMENT_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok,decline) \ - APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \ - args_use,ok,decline) - -/** - * Implement a hook that runs until the first function that returns - * something other than decline. If all functions return decline, the - * hook runner returns decline. The implementation is called - * ap_run_name. - * - * @param ret The return type of the hook (and the hook runner) - * @param name The name of the hook - * @param args_decl The declaration of the arguments for the hook, for example - * "(int x,void *y)" - * @param args_use The arguments for the hook as used in a call, for example - * "(x,y)" - * @param decline The "decline" return value - * @return decline or an error. - * @tip If IMPLEMENTing a hook that is not linked into the Apache core - * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST. - * @deffunc AP_IMPLEMENT_HOOK_RUN_FIRST(ret, name, args_decl, args_use, decline) - */ -#define AP_IMPLEMENT_HOOK_RUN_FIRST(ret,name,args_decl,args_use,decline) \ - APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ap,AP,ret,name,args_decl, \ - args_use,decline) - -#include "os.h" -#ifndef WIN32 -#include "ap_config_auto.h" -#endif - - -/* TODO - We need to put OS detection back to make all the following work */ - -#if defined(SUNOS4) || defined(IRIX) || defined(NEXT) || defined(AUX3) \ - || defined (UW) || defined(LYNXOS) || defined(TPF) -/* These systems don't do well with any lingering close code; I don't know - * why -- manoj */ -#define NO_LINGCLOSE -#endif - -/* If APR has OTHER_CHILD logic, use reliable piped logs. */ -#if APR_HAS_OTHER_CHILD -#define AP_HAVE_RELIABLE_PIPED_LOGS TRUE -#endif - -#if APR_CHARSET_EBCDIC && !defined(APACHE_XLATE) -#define APACHE_XLATE -#endif - -#endif /* AP_CONFIG_H */ diff --git a/include/ap_listen.h b/include/ap_listen.h deleted file mode 100644 index fa9318f3d8..0000000000 --- a/include/ap_listen.h +++ /dev/null @@ -1,148 +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 AP_LISTEN_H -#define AP_LISTEN_H - -#include "apr_network_io.h" -#include "httpd.h" -#include "http_config.h" -#include "mpm.h" - -/** - * @package Apache Listeners Library - */ - -typedef struct ap_listen_rec ap_listen_rec; - -/** - * Apache's listeners record. These are used in the Multi-Processing Modules - * to setup all of the sockets for the MPM to listen to and accept on. - */ -struct ap_listen_rec { - /** - * The next listener in the list - */ - ap_listen_rec *next; - /** - * The actual socket - */ - apr_socket_t *sd; - /** - * The sockaddr the socket should bind to - */ - apr_sockaddr_t *bind_addr; - /** - * Is this socket currently active - */ - int active; -/* more stuff here, like which protocol is bound to the port */ -}; - -/** - * The global list of ap_listen_rec structures - */ -extern ap_listen_rec *ap_listeners; - -/** - * Setup all of the defaults for the listener list - */ -void ap_listen_pre_config(void); -#if !defined(SPMT_OS2_MPM) -/** - * Loop through the global ap_listen_rec list and create all of the required - * sockets. This executes the listen and bind on the sockets. - * @param s The global server_rec - * @return The number of open sockets. - * @warning This function is not available to Windows platforms, or the - * Prefork or SPMT_OS2 MPMs. - */ -int ap_setup_listeners(server_rec *s); -#endif -/* Split into two #if's to make the exports scripts easier. - */ -#if defined(SPMT_OS2_MPM) -/** - * Create and open a socket on the specified port. This includes listening - * and binding the socket. - * @param process The process record for the currently running server - * @param port The port to open a socket on. - * @return The number of open sockets - * @warning This function is only available to Windows platforms, or the - * Prefork or SPMT_OS2 MPMs. - */ -int ap_listen_open(process_rec *process, apr_port_t port); -#endif - -/* Although these functions are exported from libmain, they are not really - * public functions. These functions are actually called while parsing the - * config file, when one of the LISTEN_COMMANDS directives is read. These - * should not ever be called by external modules. ALL MPMs should include - * LISTEN_COMMANDS in their command_rec table so that these functions are - * called. - */ -const char *ap_set_listenbacklog(cmd_parms *cmd, void *dummy, const char *arg); -const char *ap_set_listener(cmd_parms *cmd, void *dummy, const char *ips); -const char *ap_set_send_buffer_size(cmd_parms *cmd, void *dummy, - const char *arg); - -#define LISTEN_COMMANDS \ -AP_INIT_TAKE1("ListenBacklog", ap_set_listenbacklog, NULL, RSRC_CONF, \ - "Maximum length of the queue of pending connections, as used by listen(2)"), \ -AP_INIT_TAKE1("Listen", ap_set_listener, NULL, RSRC_CONF, \ - "A port number or a numeric IP address and a port number"), \ -AP_INIT_TAKE1("SendBufferSize", ap_set_send_buffer_size, NULL, RSRC_CONF, \ - "Send buffer size in bytes"), - -#endif diff --git a/include/ap_mmn.h b/include/ap_mmn.h deleted file mode 100644 index 9cc35dca36..0000000000 --- a/include/ap_mmn.h +++ /dev/null @@ -1,110 +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 APACHE_AP_MMN_H -#define APACHE_AP_MMN_H - -/** - * @package Module Magic Number - */ - -/* - * 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. - */ - -/* - * 20010224 (2.0.13-dev) MODULE_MAGIC_COOKIE reset to "AP20" - */ - -#define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */ - -#ifndef MODULE_MAGIC_NUMBER_MAJOR -#define MODULE_MAGIC_NUMBER_MAJOR 20010224 -#endif -#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */ -#define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR /* backward compat */ - -/** - * Determine if the server's current MODULE_MAGIC_NUMBER is at least a - * specified value. - *
        - * Useful for testing for features.
        - * For example, suppose you wish to use the apr_table_overlap
        - *    function.  You can do this:
        - * 
        - * #if MODULE_MAGIC_AT_LEAST(19980812,2)
        - *     ... use apr_table_overlap()
        - * #else
        - *     ... alternative code which doesn't use apr_table_overlap()
        - * #endif
        - * 
        - * @param major The major module magic number - * @param minor The minor module magic number - * @deffunc MODULE_MAGIC_AT_LEAST(int major, int minor) - */ -#define MODULE_MAGIC_AT_LEAST(major,minor) \ - ((major) > MODULE_MAGIC_NUMBER_MAJOR \ - || ((major) == MODULE_MAGIC_NUMBER_MAJOR \ - && (minor) >= MODULE_MAGIC_NUMBER_MINOR)) - -#endif /* !APACHE_AP_MMN_H */ diff --git a/include/ap_mpm.h b/include/ap_mpm.h deleted file mode 100644 index 8072c823d8..0000000000 --- a/include/ap_mpm.h +++ /dev/null @@ -1,177 +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 AP_MMN_H -#define AP_MMN_H - -/** - * @package Multi-Processing Module library - */ - -/* - The MPM, "multi-processing model" provides an abstraction of the - interface with the OS for distributing incoming connections to - threads/process for processing. http_main invokes the MPM, and - the MPM runs until a shutdown/restart has been indicated. - The MPM calls out to the apache core via the ap_process_connection - function when a connection arrives. - - The MPM may or may not be multithreaded. In the event that it is - multithreaded, at any instant it guarantees a 1:1 mapping of threads - ap_process_connection invocations. - - Note: In the future it will be possible for ap_process_connection - to return to the MPM prior to finishing the entire connection; and - the MPM will proceed with asynchronous handling for the connection; - in the future the MPM may call ap_process_connection again -- but - does not guarantee it will occur on the same thread as the first call. - - The MPM further guarantees that no asynchronous behaviour such as - longjmps and signals will interfere with the user code that is - invoked through ap_process_connection. The MPM may reserve some - signals for its use (i.e. SIGUSR1), but guarantees that these signals - are ignored when executing outside the MPM code itself. (This - allows broken user code that does not handle EINTR to function - properly.) - - The suggested server restart and stop behaviour will be "graceful". - However the MPM may choose to terminate processes when the user - requests a non-graceful restart/stop. When this occurs, the MPM kills - all threads with extreme prejudice, and destroys the pchild pool. - User cleanups registered in the pchild apr_pool_t will be invoked at - this point. (This can pose some complications, the user cleanups - are asynchronous behaviour not unlike longjmp/signal... but if the - admin is asking for a non-graceful shutdown, how much effort should - we put into doing it in a nice way?) - - unix/posix notes: - - The MPM does not set a SIGALRM handler, user code may use SIGALRM. - But the preferred method of handling timeouts is to use the - timeouts provided by the BUFF abstraction. - - The proper setting for SIGPIPE is SIG_IGN, if user code changes it - for any of their own processing, it must be restored to SIG_IGN - prior to executing or returning to any apache code. - TODO: add SIGPIPE debugging check somewhere to make sure its SIG_IGN -*/ - -/** - * This is the function that MPMs must create. This function is responsible - * for controlling the parent and child processes. It will run until a - * restart/shutdown is indicated. - * @param pconf the configuration pool, reset before the config file is read - * @param plog the log pool, reset after the config file is read - * @param server_conf the global server config. - * @return 1 for shutdown 0 otherwise. - * @deffunc int ap_mpm_run(apr_pool_t *pconf, apr_pool_t *plog, server_rec *server_conf) - */ -AP_DECLARE(int) ap_mpm_run(apr_pool_t *pconf, apr_pool_t *plog, server_rec *server_conf); - -/** - * predicate indicating if a graceful stop has been requested ... - * used by the connection loop - * @return 1 if a graceful stop has been requested, 0 otherwise - * @deffunc int ap_graceful_stop_signalled(*void) - */ -AP_DECLARE(int) ap_graceful_stop_signalled(void); - -/** - * Spawn a process with privileges that another module has requested - * @param r The request_rec of the current request - * @param newproc The resulting process handle. - * @param progname The program to run - * @param const_args the arguments to pass to the new program. The first - * one should be the program name. - * @param env The new environment apr_table_t for the new process. This - * should be a list of NULL-terminated strings. - * @param attr the procattr we should use to determine how to create the new - * process - * @param p The pool to use. - */ -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); - -/* Subtypes/Values for AP_MPMQ_IS_THREADED and AP_MPMQ_IS_FORKED */ -#define AP_MPMQ_NOT_SUPPORTED 0 /* This value specifies whether */ - /* an MPM is capable of */ - /* threading or forking. */ -#define AP_MPMQ_STATIC 1 /* This value specifies whether */ - /* an MPM is using a static # */ - /* threads or daemons. */ -#define AP_MPMQ_DYNAMIC 2 /* This value specifies whether */ - /* an MPM is using a dynamic # */ - /* threads or daemons. */ - -#define AP_MPMQ_MAX_DAEMONS 1 /* Max # of daemons */ -#define AP_MPMQ_IS_THREADED 2 /* MPM can do threading */ -#define AP_MPMQ_IS_FORKED 3 /* MPM can do forking */ -#define AP_MPMQ_HARD_LIMIT_DAEMONS 4 /* The compiled max # deamons */ -#define AP_MPMQ_HARD_LIMIT_THREADS 5 /* The compiled max # threads */ -#define AP_MPMQ_MAX_THREADS 6 /* Max # of threads */ - -/** - * Query a property of the current MPM. - * @param query_code One of APM_MPMQ_* - * @param result A location to place the result of the query - * @return APR_SUCCESS or APR_ENOTIMPL - * @deffunc int ap_mpm_query(int query_code, int *result) - */ -AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result); - -#endif diff --git a/include/ap_release.h b/include/ap_release.h deleted file mode 100644 index 70d1c25270..0000000000 --- a/include/ap_release.h +++ /dev/null @@ -1,80 +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 AP_RELEASE_H -#define AP_RELEASE_H - -/* - * 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 AP_SERVER_BASEVENDOR "Apache Software Foundation" -#define AP_SERVER_BASEPRODUCT "Apache" -#define AP_SERVER_BASEREVISION "2.0.18-dev" -#define AP_SERVER_BASEVERSION AP_SERVER_BASEPRODUCT "/" AP_SERVER_BASEREVISION -#define AP_SERVER_VERSION AP_SERVER_BASEVERSION - -#endif diff --git a/include/http_config.h b/include/http_config.h deleted file mode 100644 index 27b45c3e75..0000000000 --- a/include/http_config.h +++ /dev/null @@ -1,1043 +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_HTTP_CONFIG_H -#define APACHE_HTTP_CONFIG_H - -#include "apr_hooks.h" -#include "util_cfgtree.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package Apache Configuration - */ - -/* - * The central data structures around here... - */ - -/* Command dispatch structures... */ - -/** - * How the directives arguments should be parsed. - * @tip 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	--		 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 
        - * 
        - * @defvar enum cmd_how - */ -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 cmd_parms_struct cmd_parms; - -#ifdef AP_DEBUG - -typedef union { - const char *(*no_args) (cmd_parms *parms, void *mconfig); - const char *(*raw_args) (cmd_parms *parms, void *mconfig, - const char *args); - const char *(*take1) (cmd_parms *parms, void *mconfig, const char *w); - const char *(*take2) (cmd_parms *parms, void *mconfig, const char *w, - const char *w2); - const char *(*take3) (cmd_parms *parms, void *mconfig, const char *w, - const char *w2, const char *w3); - const char *(*flag) (cmd_parms *parms, void *mconfig, int on); -} cmd_func; - -# define AP_NO_ARGS func.no_args -# define AP_RAW_ARGS func.raw_args -# define AP_TAKE1 func.take1 -# define AP_TAKE2 func.take2 -# define AP_TAKE3 func.take3 -# define AP_FLAG func.flag - -# define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \ - { directive, { .no_args=func }, mconfig, where, RAW_ARGS, help } -# define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \ - { directive, { .raw_args=func }, mconfig, where, RAW_ARGS, help } -# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \ - { directive, { .take1=func }, mconfig, where, TAKE1, help } -# define AP_INIT_ITERATE(directive, func, mconfig, where, help) \ - { directive, { .take1=func }, mconfig, where, ITERATE, help } -# define AP_INIT_TAKE2(directive, func, mconfig, where, help) \ - { directive, { .take2=func }, mconfig, where, TAKE2, help } -# define AP_INIT_TAKE12(directive, func, mconfig, where, help) \ - { directive, { .take2=func }, mconfig, where, TAKE12, help } -# define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \ - { directive, { .take2=func }, mconfig, where, ITERATE2, help } -# define AP_INIT_TAKE23(directive, func, mconfig, where, help) \ - { directive, { .take3=func }, mconfig, where, TAKE23, help } -# define AP_INIT_TAKE3(directive, func, mconfig, where, help) \ - { directive, { .take3=func }, mconfig, where, TAKE3, help } -# define AP_INIT_FLAG(directive, func, mconfig, where, help) \ - { directive, { .flag=func }, mconfig, where, FLAG, help } - -#else - -typedef const char *(*cmd_func) (); - -# define AP_NO_ARGS func -# define AP_RAW_ARGS func -# define AP_TAKE1 func -# define AP_TAKE2 func -# define AP_TAKE3 func -# define AP_FLAG func - -# define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \ - { directive, func, mconfig, where, RAW_ARGS, help } -# define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \ - { directive, func, mconfig, where, RAW_ARGS, help } -# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \ - { directive, func, mconfig, where, TAKE1, help } -# define AP_INIT_ITERATE(directive, func, mconfig, where, help) \ - { directive, func, mconfig, where, ITERATE, help } -# define AP_INIT_TAKE2(directive, func, mconfig, where, help) \ - { directive, func, mconfig, where, TAKE2, help } -# define AP_INIT_TAKE12(directive, func, mconfig, where, help) \ - { directive, func, mconfig, where, TAKE12, help } -# define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \ - { directive, func, mconfig, where, ITERATE2, help } -# define AP_INIT_TAKE23(directive, func, mconfig, where, help) \ - { directive, func, mconfig, where, TAKE23, help } -# define AP_INIT_TAKE3(directive, func, mconfig, where, help) \ - { directive, func, mconfig, where, TAKE3, help } -# define AP_INIT_FLAG(directive, func, mconfig, where, help) \ - { directive, func, mconfig, where, FLAG, help } - -#endif - -typedef struct command_struct command_rec; -/** - * The command record structure. Each modules can define a table of these - * to define the directives it will implement. - */ -struct command_struct { - /** Name of this command */ - const char *name; - /** The function to be called when this directive is parsed */ - cmd_func func; - /** Extra data, for functions which implement multiple commands... */ - void *cmd_data; - /** What overrides need to be allowed to enable this command. */ - int req_override; - /** What the command expects as arguments - * @defvar cmd_how args_how*/ - enum cmd_how args_how; - - /** 'usage' message, in case of syntax errors */ - const char *errmsg; -}; - -/* 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 EXEC_ON_READ 256 -#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. - * @defvar DECLINE_CMD "\a\b" - */ -#define DECLINE_CMD "\a\b" - -typedef struct ap_configfile_t ap_configfile_t; -/** Common structure for reading of config files / passwd files etc. */ -struct ap_configfile_t { - /** a getc()-like function - * @deffunc int getch(void *param) */ - int (*getch) (void *param); - /** a fgets()-like function - * @deffunc void *getstr(void *buf, size_t bufsize, void *param)*/ - void *(*getstr) (void *buf, size_t bufsiz, void *param); - /** a close hander function - * @deffunc int close(void *param)*/ - int (*close) (void *param); - /** the argument passed to getch/getstr/close */ - void *param; - /** the filename / description */ - const char *name; - /** current line number, starting at 1 */ - unsigned line_number; -}; - -/** - * 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*... - */ -struct cmd_parms_struct { - /** Argument to command from cmd_table */ - void *info; - /** Which allow-override bits are set */ - int override; - /** Which methods are ed */ - int limited; - apr_array_header_t *limited_xmethods; - ap_method_list_t *xlimited; - - /** Config file structure. */ - ap_configfile_t *config_file; - /** the directive specifying this command */ - ap_directive_t *directive; - - /** Pool to allocate new storage in */ - apr_pool_t *pool; - /** Pool for scratch memory; persists during configuration, but - * wiped before the first request is served... */ - apr_pool_t *temp_pool; - /** Server_rec being configured for */ - server_rec *server; - /** 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). */ - char *path; - /** configuration command */ - const command_rec *cmd; - - /** per_dir_config vector passed to handle_command */ - struct ap_conf_vector_t *context; - /** directive with syntax error */ - const ap_directive_t *err_directive; -}; - -typedef struct module_struct module; -/** - * Module structures. Just about everything is dispatched through - * these, directly or indirectly (through the command and handler - * tables). - */ -struct module_struct { - /** API version, *not* module version; check that module is - * compatible with this version of the server. - */ - int version; - /** API minor version. Provides API feature milestones. Not checked - * during module init */ - int minor_version; - /** Index to this modules structures in config vectors. */ - int module_index; - - /** The name of the module's C file */ - const char *name; - /** The handle for the DSO. Internal use only */ - void *dynamic_load_handle; - - /** A pointer to the next module in the list - * @defvar module_struct *next */ - struct module_struct *next; - - /** Magic Cookie to identify a module structure; It's mainly - * important for the DSO facility (see also mod_so). */ - unsigned long magic; - - /** Function to allow MPMs to re-write command line arguments. This - * hook is only available to MPMs. - * @param The process that the server is running in. - * @deffunc void rewrite_args(process_rec *process); - */ - void (*rewrite_args) (process_rec *process); - /** Function to allow all modules to create per directory configuration - * structures. - * @param p The pool to use for all allocations. - * @param dir The directory currently being processed. - * @return The per-directory structure created - * @deffunc void *create_dir_config(apr_pool_t *p, char *dir) - */ - void *(*create_dir_config) (apr_pool_t *p, char *dir); - /** Function to allow all modules to merge the per directory configuration - * structures for two directories. - * @param p The pool to use for all allocations. - * @param base_conf The directory structure created for the parent directory. - * @param new_conf The directory structure currently being processed. - * @return The new per-directory structure created - * @deffunc void *merge_dir_config(apr_pool_t *p, void *base_conf, void *new_conf) - */ - void *(*merge_dir_config) (apr_pool_t *p, void *base_conf, void *new_conf); - /** Function to allow all modules to create per server configuration - * structures. - * @param p The pool to use for all allocations. - * @param s The server currently being processed. - * @return The per-server structure created - * @deffunc void *create_server_config(apr_pool_t *p, server_rec *dir) - */ - void *(*create_server_config) (apr_pool_t *p, server_rec *s); - /** Function to allow all modules to merge the per server configuration - * structures for two servers. - * @param p The pool to use for all allocations. - * @param base_conf The directory structure created for the parent directory. - * @param new_conf The directory structure currently being processed. - * @return The new per-directory structure created - * @deffunc void *merge_dir_config(apr_pool_t *p, void *base_conf, void *new_conf) - */ - void *(*merge_server_config) (apr_pool_t *p, void *base_conf, void *new_conf); - - /** A command_rec table that describes all of the directives this module - * defines. */ - const command_rec *cmds; - - /** A hook to allow modules to hook other points in the request processing. - * In this function, modules should call the ap_hook_*() functions to - * register an interest in a specific step in processing the current - * request. - * @param p the pool to use for all allocations - * @deffunc void register_hooks(void) - */ - void (*register_hooks) (apr_pool_t *p); -}; - -/* 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 this_module_needs_to_be_ported_to_apache_2_0 - -#define STANDARD20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \ - MODULE_MAGIC_NUMBER_MINOR, \ - -1, \ - __FILE__, \ - NULL, \ - NULL, \ - MODULE_MAGIC_COOKIE, \ - NULL /* rewrite args spot */ - -#define MPM20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \ - MODULE_MAGIC_NUMBER_MINOR, \ - -1, \ - __FILE__, \ - NULL, \ - NULL, \ - MODULE_MAGIC_COOKIE - - -/* CONFIGURATION VECTOR FUNCTIONS */ - -typedef struct ap_conf_vector_t ap_conf_vector_t; - -#ifdef AP_DEBUG -/** - * Generic accessors for other modules to get at their own module-specific - * data - * @param conf_vector The vector in which the modules configuration is stored. - * usually r->per_dir_config or s->module_config - * @param m The module to get the data for. - * @return The module-specific data - * @deffunc void *ap_get_module_config(const ap_conf_vector_t *cv, module *m) - */ -AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv, - const module *m); - -/** - * Generic accessors for other modules to set at their own module-specific - * data - * @param conf_vector The vector in which the modules configuration is stored. - * usually r->per_dir_config or s->module_config - * @param m The module to set the data for. - * @param val The module-specific data to set - * @deffunc void ap_set_module_config(ap_conf_vector_t *cv, const module *m, void *val) - */ -AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m, - void *val); - -#else /* AP_DEBUG */ - -#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)) - -#endif /* AP_DEBUG */ - - -/** - * Generic command handling function for strings - * @param cmd The command parameters for this directive - * @param struct_ptr pointer into a given type - * @param arg The argument to the directive - * @return An error string or NULL on success - * @deffunc const char *ap_set_string_slot(cmd_parms *cmd, void *struct_ptr, const char *arg) - */ -AP_DECLARE_NONSTD(const char *) ap_set_string_slot(cmd_parms *cmd, void *struct_ptr, - const char *arg); - -/** - * Generic command handling function for integers - * @param cmd The command parameters for this directive - * @param struct_ptr pointer into a given type - * @param arg The argument to the directive - * @return An error string or NULL on success - * @deffunc const char *ap_set_int_slot(cmd_parms *cmd, void *struct_ptr, const char *arg) - */ -AP_DECLARE_NONSTD(const char *) ap_set_int_slot(cmd_parms *cmd, - void *struct_ptr, - const char *arg); - -/** - * Return true if the specified method is limited by being listed in - * a container, or by *not* being listed in a - * container. - * - * @param method Pointer to a string specifying the method to check. - * @param cmd Pointer to the cmd_parms structure passed to the - * directive handler. - * @return 0 if the method is not limited in the current scope - * @deffunc ap_method_is_limited(cmd_parms *cmd, const char *method) - */ -AP_DECLARE(int) ap_method_is_limited(cmd_parms *cmd, const char *method); - -/** - * Generic command handling function for strings, always sets the value - * to a lowercase string - * @param cmd The command parameters for this directive - * @param struct_ptr pointer into a given type - * @param arg The argument to the directive - * @return An error string or NULL on success - * @deffunc const char *ap_set_string_slot_lower(cmd_parms *cmd, void *struct_ptr, const char *arg) - */ -AP_DECLARE_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *cmd, - void *struct_ptr, const char *arg); -/** - * Generic command handling function for flags - * @param cmd The command parameters for this directive - * @param struct_ptr pointer into a given type - * @param arg The argument to the directive (either 1 or 0) - * @return An error string or NULL on success - * @deffunc const char *ap_set_flag_slot(cmd_parms *cmd, void *struct_ptr, int arg) - */ -AP_DECLARE_NONSTD(const char *) ap_set_flag_slot(cmd_parms *cmd, void *struct_ptr, int arg); -/** - * Generic command handling function for files - * @param cmd The command parameters for this directive - * @param struct_ptr pointer into a given type - * @param arg The argument to the directive - * @return An error string or NULL on success - * @deffunc const char *ap_set_file_slot(cmd_parms *cmd, void *struct_ptr, const char *arg) - */ -AP_DECLARE_NONSTD(const char *) ap_set_file_slot(cmd_parms *cmd, void *struct_ptr, const char *arg); - -/** - * 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. - * @param p pool to allocate data out of - * @param fname The file name - * @deffunc const char *ap_server_root_relative(apr_pool_t *p, const char *fname) - */ -AP_DECLARE(const char *) ap_server_root_relative(apr_pool_t *p, const char *fname); - -/* Finally, the hook for dynamically loading modules in... */ - -/** - * Add a module to the server - * @param m The module structure of the module to add - * @param p The pool of the same lifetime as the module - * @deffunc void ap_add_module(module *m, apr_pool_t *p) - */ -AP_DECLARE(void) ap_add_module(module *m, apr_pool_t *p); - -/** - * Remove a module from the server. 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. - * @param m the module structure of the module to remove - * @deffunc void ap_remove_module(module *m) - */ -AP_DECLARE(void) ap_remove_module(module *m); -/** - * Add a module to the chained modules list and the list of loaded modules - * @param m The module structure of the module to add - * @param p The pool with the same lifetime as the module - * @deffunc void ap_add_loaded_module(module *m, apr_pool_t *p) - */ -AP_DECLARE(void) ap_add_loaded_module(module *mod, apr_pool_t *p); -/** - * Remove a module fromthe chained modules list and the list of loaded modules - * @param m the module structure of the module to remove - * @deffunc void ap_remove_loaded_module(module *m) - */ -AP_DECLARE(void) ap_remove_loaded_module(module *mod); -/** - * Add a module to the list of loaded module based on the name of the - * module - * @param name The name of the module - * @param p The pool valid for the lifetime of the module - * @return 1 on success, 0 on failure - * @deffunc int ap_add_named_module(const char *name, apr_pool_t *p) - */ -AP_DECLARE(int) ap_add_named_module(const char *name, apr_pool_t *p); -/** - * Find the name of the specified module - * @param m The module to get the name for - * @return the name of the module - * @deffunc const char *ap_find_module_name(module *m) - */ -AP_DECLARE(const char *) ap_find_module_name(module *m); -/** - * Find a module based on the name of the module - * @param name the name of the module - * @return the module structure if found, NULL otherwise - * @deffunc module *ap_find_linked_module(const char *name) - */ -AP_DECLARE(module *) ap_find_linked_module(const char *name); - -/** - * Open a ap_configfile_t as apr_file_t - * @param ret_cfg open ap_configfile_t struct pointer - * @param p The pool to allocate the structure out of - * @param name the name of the file to open - * @deffunc apr_status_t ap_pcfg_openfile(ap_configfile_t **ret_cfg, apr_pool_t *p, const char *name) - */ -AP_DECLARE(apr_status_t) ap_pcfg_openfile(ap_configfile_t **ret_cfg, apr_pool_t *p, const char *name); - -/** - * Allocate a ap_configfile_t handle with user defined functions and params - * @param p The pool to allocate out of - * @param descr The name of the file - * @param param The argument passed to getch/getstr/close - * @param getc_func The getch function - * @param gets_func The getstr function - * @param close_func The close function - * @deffunc ap_configfile_t *ap_pcfg_open_custom(apr_pool_t *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)) - */ -AP_DECLARE(ap_configfile_t *) ap_pcfg_open_custom(apr_pool_t *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 ap_configfile_t, strip LF, increase line number - * @param buf place to store the line read - * @param bufsize size of the buffer - * @param cfp File to read from - * @return 1 on success, 0 on failure - * @deffunc int ap_cfg_getline(char *buf, size_t bufsize, ap_configfile_t *cfp) - */ -AP_DECLARE(int) ap_cfg_getline(char *buf, size_t bufsize, ap_configfile_t *cfp); - -/** - * Read one char from open configfile_t, increase line number upon LF - * @param cfp The file to read from - * @return the character read - * @deffunc int ap_cfg_getc(ap_configfile_t *cfp) - */ -AP_DECLARE(int) ap_cfg_getc(ap_configfile_t *cfp); - -/** - * Detach from open ap_configfile_t, calling the close handler - * @param cfp The file to close - * @return 1 on sucess, 0 on failure - * @deffunc int ap_cfg_closefile(ap_configfile_t *cfp) - */ -AP_DECLARE(int) ap_cfg_closefile(ap_configfile_t *cfp); - -/** - * Read all data between the current and the matching . All - * of this data is forgotten immediately. - * @param cmd The cmd_parms to pass to the directives inside the container - * @param directive The directive name to read until - * @retrn Error string on failure, NULL on success - * @deffunc const char *ap_soak_end_container(cmd_parms *cmd, char *directive) - */ -AP_DECLARE(const char *) ap_soak_end_container(cmd_parms *cmd, char *directive); - -/** - * Read all data between the current and the matching and build - * a config tree out of it - * @param p pool to allocate out of - * @param temp_pool Temporary pool to allocate out of - * @param parms The cmd_parms to pass to all directives read - * @param current The current node in the tree - * @param curr_parent The current parent node - * @param orig_directive The directive to read until hit. - * @return Error string on failure, NULL on success - * @deffunc char *ap_build_cont_config(apr_pool_t *p, apr_pool_t *temp_pool, cmd_parms *parms, ap_directive_t **current, ap_directive_t **curr_parent, char *orig_directive) -*/ -const char * ap_build_cont_config(apr_pool_t *p, apr_pool_t *temp_pool, - cmd_parms *parms, - ap_directive_t **current, - ap_directive_t **curr_parent, - char *orig_directive); - -/** - * Build a config tree from a config file - * @param parms The cmd_parms to pass to all of the directives in the file - * @param conf_pool The pconf pool - * @param temp_pool The temporary pool - * @param conftree Place to store the root node of the config tree - * @return Error string on erro, NULL otherwise - * @deffunc const char *ap_build_config(cmd_parms *parms, apr_pool_t *conf_pool, apr_pool_t *temp_pool, ap_directive_t **conftree) - */ -AP_DECLARE(const char *) ap_build_config(cmd_parms *parms, - apr_pool_t *conf_pool, - apr_pool_t *temp_pool, - ap_directive_t **conftree); - -/** - * Walk a config tree and setup the server's internal structures - * @param conftree The config tree to walk - * @param parms The cmd_parms to pass to all functions - * @param section_vector The per-section config vector. - * @return Error string on error, NULL otherwise - * @deffunc const char *ap_walk_config(ap_directive_t *conftree, cmd_parms *parms, ap_conf_vector_t *section_vector) - */ -AP_DECLARE(const char *) ap_walk_config(ap_directive_t *conftree, - cmd_parms *parms, - ap_conf_vector_t *section_vector); - -/** - * ap_check_cmd_context() definitions: - * @param cmd The cmd_context to check - * @param forbidden Where the command is forbidden. One of: - *
        - *                NOT_IN_VIRTUALHOST
        - *                NOT_IN_LIMIT
        - *                NOT_IN_DIRECTORY
        - *                NOT_IN_LOCATION
        - *                NOT_IN_FILES
        - *                NOT_IN_DIR_LOC_FILE
        - *                GLOBAL_ONLY
        - * 
        - * @return Error string on error, NULL on success - * @deffunc const char *ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden) - */ -AP_DECLARE(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) - - -#ifdef CORE_PRIVATE - -/** - * The topmost module in the list - * @defvar module *ap_top_module - */ -AP_DECLARE_DATA extern module *ap_top_module; - -/** - * Array of all statically linked modules - * @defvar module *ap_prelinked_modules[] - */ -AP_DECLARE_DATA extern module *ap_prelinked_modules[]; -/** - * Array of all preloaded modules - * @defvar module *ap_preloaded_modules[] - */ -AP_DECLARE_DATA extern module *ap_preloaded_modules[]; -/** - * Array of all loaded modules - * @defvar module **ap_loaded_modules - */ -AP_DECLARE_DATA extern module **ap_loaded_modules; - -/* For mod_so.c... */ -/** Run a single module's two create_config hooks - * @param p the pool to allocate out of - * @param s The server to configure for. - * @param m The module to configure - */ -AP_DECLARE(void) ap_single_module_configure(apr_pool_t *p, server_rec *s, - module *m); - -/* For http_main.c... */ -/** - * Add all of the prelinked modules into the loaded module list - * @param process The process that is currently running the server - * @deffunc void ap_setup_prelinked_modules(process_rec *process) - */ -AP_DECLARE(void) ap_setup_prelinked_modules(process_rec *process); - -/** - *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. - * @deffunc void ap_show_directives(void) - */ -AP_DECLARE(void) ap_show_directives(void); - -/** - * Show the preloaded module names. Used for httpd -l. - * @deffunc void ap_show_modules(void) - */ -AP_DECLARE(void) ap_show_modules(void); - -/** - * Show the MPM name. Used in reporting modules such as mod_info to - * provide extra information to the user - * @deffunc const char *ap_show_mpm(void) - */ -AP_DECLARE(const char *) ap_show_mpm(void); - -/** - * Read all config files and setup the server - * @param process The process running the server - * @param temp_pool A pool to allocate temporary data out of. - * @param config_name The name of the config file - * @param conftree Place to store the root of the config tree - * @return The setup server_rec list. - * @deffunc server_rec *ap_read_config(process_rec *process, apr_pool_t *temp_pool, const char *config_name, ap_directive_t **conftree) - */ -AP_DECLARE(server_rec *) ap_read_config(process_rec *process, apr_pool_t *temp_pool, const char *config_name, ap_directive_t **conftree); - -/** - * Run all rewrite args hooks for loaded modules - * @param process The process currently running the server - * @deffunc void ap_run_rewrite_args(process_rec *process) - */ -AP_DECLARE(void) ap_run_rewrite_args(process_rec *process); - -/** - * Run the register hooks function for a specified module - * @param m The module to run the register hooks function fo - * @param p The pool valid for the lifetime of the module - * @deffunc void ap_register_hooks(module *m, apr_pool_t *p) - */ -AP_DECLARE(void) ap_register_hooks(module *m, apr_pool_t *p); - -/** - * Setup all virtual hosts - * @param p The pool to allocate out of - * @param main_server The head of the server_rec list - * @deffunc void ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server) - */ -AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server); - -/* For http_request.c... */ - -/** - * Setup the config vector for a request_rec - * @param p The pool to allocate the config vector out of - * @return The config vector - */ -ap_conf_vector_t *ap_create_request_config(apr_pool_t *p); - -/** - * Setup the config vector for per dir module configs - * @param p The pool to allocate the config vector out of - * @return The config vector - * @deffunc ap_conf_vector_t *ap_create_per_dir_config(apr_pool_t *p) - */ -AP_CORE_DECLARE(ap_conf_vector_t *) ap_create_per_dir_config(apr_pool_t *p); - -/** - * Run all of the modules merge per dir config functions - * @param p The pool to pass to the merge functions - * @param base The base directory config structure - * @param new_conf The new directory config structure - */ -ap_conf_vector_t *ap_merge_per_dir_configs(apr_pool_t *p, - ap_conf_vector_t *base, - ap_conf_vector_t *new_conf); - -/* For http_connection.c... */ -/** - * Setup the config vector for a connection_rec - * @param p The pool to allocate the config vector out of - * @return The config vector - */ -ap_conf_vector_t *ap_create_conn_config(apr_pool_t *p); - -/* For http_core.c... ( command and virtual hosts) */ - -/** - * parse an htaccess file - * @param resulting htaccess_result - * @param r The request currently being served - * @param override Which overrides are active - * @param path The path to the htaccess file - * @param access_name The list of possible names for .htaccess files - * int The status of the current request - */ -int ap_parse_htaccess(ap_conf_vector_t **result, request_rec *r, int override, - const char *path, const char *access_name); - -/** - * Setup a virtual host - * @param p The pool to allocate all memory out of - * @param hostname The hostname of the virtual hsot - * @param main_server The main server for this Apache configuration - * @param ps Place to store the new server_rec - * return Error string on error, NULL on success - * @deffunc const char *ap_init_virtual_host(apr_pool_t *p, const char *hostname, server_rec *main_server, server_rec **ps) - */ -AP_CORE_DECLARE(const char *) ap_init_virtual_host(apr_pool_t *p, const char *hostname, - server_rec *main_server, server_rec **); - -/** - * Process the config file for Apache - * @param s The server rec to use for the command parms - * @param fname The name of the config file - * @param conftree The root node of the created config tree - * @param p Pool for general allocation - * @param ptem Pool for temporary allocation - */ -void ap_process_resource_config(server_rec *s, const char *fname, - ap_directive_t **conftree, apr_pool_t *p, apr_pool_t *ptemp); - -/** - * Process all directives in the config tree - * @param s The server rec to use in the command parms - * @param conftree The config tree to process - * @param p The pool for general allocation - * @param ptemp The pool for temporary allocations - */ -AP_DECLARE(void) ap_process_config_tree(server_rec *s, ap_directive_t *conftree, - apr_pool_t *p, apr_pool_t *ptemp); - -/* Module-method dispatchers, also for http_request.c */ -/** - * Run the handler phase of each module until a module accepts the - * responsibility of serving the request - * @param r The current request - * @return The status of the current request - */ -int ap_invoke_handler(request_rec *r); - -/* for mod_perl */ - -/** - * Find a given directive in a command_rec table - * @param name The directive to search for - * @param cmds The table to search - * @return The directive definition of the specified directive - * @deffunc const command_rec *ap_find_command(const char *name, const command_rec *cmds) - */ -AP_CORE_DECLARE(const command_rec *) ap_find_command(const char *name, const command_rec *cmds); - -/** - * Find a given directive in a list module - * @param cmd_name The directive to search for - * @param mod The module list to search - * @return The directive definition of the specified directive - * @deffunc const command_rec *ap_find_command_in_modules(const char *cmd_name,module **mod) - */ -AP_CORE_DECLARE(const command_rec *) ap_find_command_in_modules(const char *cmd_name, module **mod); - -/** - * Ask a module to create per-server and per-section (dir/loc/file) configs - * (if it hasn't happened already). The results are stored in the server's - * config, and the specified per-section config vector. - * @param server The server to operate upon. - * @param section_vector The per-section config vector. - * @param section Which section to create a config for. - * @param mod The module which is defining the config data. - * @param pconf A pool for all configuration allocations. - * @return The (new) per-section config data. - * @deffunc void *ap_set_config_vectors(server_rec *server, ap_conf_vector_t *section_vector, const char *dir, module *mod, apr_pool_t *pconf) - */ -AP_CORE_DECLARE(void *) ap_set_config_vectors(server_rec *server, - ap_conf_vector_t *section_vector, - const char *section, - module *mod, apr_pool_t *pconf); - -#endif - - /* Hooks */ - -/** - * Run the header parser functions for each module - * @param r The current request - * @return OK or DECLINED - * @deffunc int ap_run_header_parser(request_rec *r) - */ -AP_DECLARE_HOOK(int,header_parser,(request_rec *r)) - -/** - * Run the pre_config function for each module - * @param pconf The config pool - * @param plog The logging streams pool - * @param ptemp The temporary pool - * @deffunc void ap_run_pre_config(apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp) - */ -AP_DECLARE_HOOK(void,pre_config,(apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp)) - -/** - * Run the post_config function for each module - * @param pconf The config pool - * @param plog The logging streams pool - * @param ptemp The temporary pool - * @param s The list of server_recs - * @deffunc void ap_run_post_config(apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp, server_rec *s) - */ -AP_DECLARE_HOOK(void,post_config,(apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp,server_rec *s)) - -/** - * Run the open_logs functions for each module - * @param pconf The config pool - * @param plog The logging streams pool - * @param ptemp The temporary pool - * @param s The list of server_recs - * @deffunc void ap_run_open_logs(apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp, server_rec *s) - */ -AP_DECLARE_HOOK(void,open_logs,(apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp,server_rec *s)) - -/** - * Run the child_init functions for each module - * @param pchild The child pool - * @param s The list of server_recs in this server - * @deffunc void ap_run_child_init(apr_pool_t *pchild, server_rec *s) - */ -AP_DECLARE_HOOK(void,child_init,(apr_pool_t *pchild, server_rec *s)) - -/** - * Run the handler functions for each module - * @param r The request_rec - * @tip non-wildcard handlers should HOOK_MIDDLE, wildcard HOOK_LAST - * @deffunc void ap_run_handler(request_rec *r) - */ -AP_DECLARE_HOOK(int,handler,(request_rec *r)) - -/** - * Run the quick handler functions for each module. The quick_handler - * is run before any other requests hooks are called (location_walk, - * directory_walk, access checking, et. al.). This hook was added - * to provide a quick way to serve content out of a URI keyed cache. - * @param r The request_rec - * @deffunc void ap_run_quick_handler(request_rec *r) - */ -AP_DECLARE_HOOK(int,quick_handler,(request_rec *r)) - -/** - * Retrieve the optional functions for each module. - * This is run immediately before the server starts. Optional functions should - * be registered during the hook registration phase. - * @deffunc void ap_run_optional_fn_retrieve(void) - */ -AP_DECLARE_HOOK(void,optional_fn_retrieve,(void)) - -#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 4636744008..0000000000 --- a/include/http_connection.h +++ /dev/null @@ -1,135 +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 APACHE_HTTP_CONNECTION_H -#define APACHE_HTTP_CONNECTION_H - -#include "apr_hooks.h" -#include "apr_network_io.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package Apache connection library - */ - -#ifdef CORE_PRIVATE -/** - * Create a new connection. - * @param p Pool to allocate data structures out of - * @param server The server to create the connection for - * @param inout The socket to use for all communication with the client - * @param id ID of this connection; unique at any point in time. - * @return new conn_rec, or NULL if the connection has already been reset - */ -conn_rec *ap_new_connection(apr_pool_t *p, server_rec *server, - apr_socket_t *inout, long id); - -/** - * This is the protocol module driver. This calls all of the - * pre-connection and connection hooks for all protocol modules. - * @param c The connection on which the request is read - * @deffunc void ap_process_connection(conn_rec *) - */ -AP_CORE_DECLARE(void) ap_process_connection(conn_rec *); - -AP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c); - -/** - * This function is responsible for the following cases: - *
        - * we now proceed to read from the client until we get EOF, or until
        - * MAX_SECS_TO_LINGER has passed.  the reasons for doing this are
        - * documented in a draft:
        - *
        - * http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-connection-00.txt
        - *
        - * in a nutshell -- if we don't make this effort we risk causing
        - * TCP RST packets to be sent which can tear down a connection before
        - * all the response data has been sent to the client.
        - * 
        - * @param c The connection we are closing - */ -void ap_lingering_close(conn_rec *); -#endif - - /* Hooks */ -/** - * This hook gives protocol modules an opportunity to set everything up - * before calling the protocol handler. All pre-connection hooks are - * run until one returns something other than ok or decline - * @param c The connection on which the request has been received. - * @return OK or DECLINED - * @deffunc int ap_run_pre_connection(conn_rec *c) - */ -AP_DECLARE_HOOK(int,pre_connection,(conn_rec *c)) - -/** - * This hook implements different protocols. After a connection has been - * established, the protocol module must read and serve the request. This - * function does that for each protocol module. The first protocol module - * to handle the request is the last module run. - * @param c The connection on which the request has been received. - * @return OK or DECLINED - * @deffunc int ap_run_process_connection(conn_rec *c) - */ -AP_DECLARE_HOOK(int,process_connection,(conn_rec *c)) - -#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 ccfdca1afe..0000000000 --- a/include/http_core.h +++ /dev/null @@ -1,505 +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_HTTP_CORE_H -#define APACHE_HTTP_CORE_H - -#include "apr.h" - -#if APR_HAVE_STRUCT_RLIMIT -#include -#include -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package CORE HTTP Daemon - */ - -/* **************************************************************** - * - * 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 - -/* Make sure we don't write less than 8192 bytes at any one time. - */ -#define AP_MIN_BYTES_TO_WRITE 8192 - -/** - * Retrieve the value of Options for this request - * @param r The current request - * @return the Options bitmask - * @deffunc int ap_allow_options(request_rec *r) - */ -AP_DECLARE(int) ap_allow_options(request_rec *r); - -/** - * Retrieve the value of the AllowOverride for this request - * @param r The current request - * @return the overrides bitmask - * @deffunc int ap_allow_overrides(request_rec *r) - */ -AP_DECLARE(int) ap_allow_overrides(request_rec *r); - -/** - * Retrieve the value of the DefaultType directive, or text/plain if not set - * @param r The current request - * @return The default type - * @deffunc const char *ap_default_type(request_rec *r) - */ -AP_DECLARE(const char *) ap_default_type(request_rec *r); - -/** - * Retrieve the document root for this server - * @param r The current request - * @warning Don't use this! If your request went through a Userdir, or - * something like that, it'll screw you. But it's back-compatible... - * @return The document root - * @deffunc const char *ap_document_root(request_rec *r) - */ -AP_DECLARE(const char *) ap_document_root(request_rec *r); - -/** - * Lookup the remote client's DNS name or IP address - * @param conn The current connection - * @param dir_config The directory config vector from the request - * @param type The type of lookup to perform. One of: - *
        - *     REMOTE_HOST returns the hostname, or NULL if the hostname
        - *                 lookup fails.  It will force a DNS lookup according to the
        - *                 HostnameLookups setting.
        - *     REMOTE_NAME returns the hostname, or the dotted quad if the
        - *                 hostname lookup fails.  It will force a DNS lookup according
        - *                 to the HostnameLookups setting.
        - *     REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
        - *                     never forced.
        - *     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.
        - * 
        - * @param str_is_ip unless NULL is passed, this will be set to non-zero on output when an IP address - * string is returned - * @return The remote hostname - * @deffunc const char *ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip) - */ -AP_DECLARE(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip); - -/** - * Retrieve the login name of the remote user. Undef if it could not be - * determined - * @param r The current request - * @return The user logged in to the client machine - * @deffunc const char *ap_get_remote_logname(request_rec *r) - */ -AP_DECLARE(const char *) ap_get_remote_logname(request_rec *r); - -/* Used for constructing self-referencing URLs, and things like SERVER_PORT, - * and SERVER_NAME. - */ -/** - * build a fully qualified URL from the uri and information in the request rec - * @param p The pool to allocate the URL from - * @param uri The path to the requested file - * @param r The current request - * @return A fully qualified URL - * @deffunc char *ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r) - */ -AP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r); - -/** - * Get the current server name from the request - * @param r The current request - * @return the server name - * @deffunc const char *ap_get_server_name(request_rec *r) - */ -AP_DECLARE(const char *) ap_get_server_name(request_rec *r); - -/** - * Get the current server port - * @param The current request - * @return The server's port - * @deffunc apr_port_t ap_get_server_port(const request_rec *r) - */ -AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r); - -/** - * Return the limit on bytes in request msg body - * @param r The current request - * @return the maximum number of bytes in the request msg body - * @deffunc unsigned long ap_get_limit_req_body(const request_rec *r) - */ -AP_DECLARE(unsigned long) ap_get_limit_req_body(const request_rec *r); - -/** - * Return the limit on bytes in XML request msg body - * @param r The current request - * @return the maximum number of bytes in XML request msg body - * @deffunc size_t ap_get_limit_xml_body(const request_rec *r) - */ -AP_DECLARE(size_t) ap_get_limit_xml_body(const request_rec *r); - -/** - * Install a custom response handler for a given status - * @param r The current request - * @param status The status for which the custom response should be used - * @param string The custom response. This can be a static string, a file - * or a URL - * @deffunc void ap_custom_response(request_rec *r, int status, char *string) - */ -AP_DECLARE(void) ap_custom_response(request_rec *r, int status, char *string); - -/** - * Check for a definition from the server command line - * @param name The define to check for - * @return 1 if defined, 0 otherwise - * @deffunc int ap_exists_config_define(const char *name) - */ -AP_DECLARE(int) ap_exists_config_define(const char *name); -/* FIXME! See STATUS about how */ -AP_DECLARE_NONSTD(int) ap_core_translate(request_rec *r); - -/* Authentication stuff. This is one of the places where compatibility - * with the old config files *really* hurts; they don't discriminate at - * all between different authentication schemes, meaning that we need - * to maintain common state for all of them in the core, and make it - * available to the other modules through interfaces. - */ -typedef struct require_line require_line; - -/** A structure to keep track of authorization requirements */ -struct require_line { - /** Where the require line is in the config file. */ - int method_mask; - /** The complete string from the command line */ - char *requirement; -}; - -/** - * Return the type of authorization required for this request - * @param r The current request - * @return The authorization required - * @deffunc const char *ap_auth_type(request_rec *r) - */ -AP_DECLARE(const char *) ap_auth_type(request_rec *r); - -/** - * Return the current Authorization realm - * @param r The current request - * @return The current authorization realm - * @deffunc const char *ap_auth_name(request_rec *r) - */ -AP_DECLARE(const char *) ap_auth_name(request_rec *r); - -/** - * How the requires lines must be met. - * @param r The current request - * @return How the requirements must be met. One of: - *
        - *      SATISFY_ANY    -- any of the requirements must be met.
        - *      SATISFY_ALL    -- all of the requirements must be met.
        - *      SATISFY_NOSPEC -- There are no applicable satisfy lines
        - * 
        - * @deffunc int ap_satisfies(request_rec *r) - */ -AP_DECLARE(int) ap_satisfies(request_rec *r); - -/** - * Retrieve information about all of the requires directives for this request - * @param r The current request - * @return An array of all requires directives for this request - * @deffunc const apr_array_header_t *ap_requires(request_rec *r) - */ -AP_DECLARE(const apr_array_header_t *) ap_requires(request_rec *r); - -#if defined(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); -#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. - */ - -AP_DECLARE_DATA extern module core_module; - -/* Per-request configuration */ - -typedef struct { - /* bucket brigade used by getline for look-ahead and - * ap_get_client_block for holding left-over request body */ - struct apr_bucket_brigade *bb; -} core_request_config; - -/* Per-directory configuration */ - -typedef unsigned char allow_options_t; -typedef unsigned char overrides_t; - -typedef enum { - srv_sig_unset, - srv_sig_off, - srv_sig_on, - srv_sig_withmail -} server_signature_e; - -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; - apr_array_header_t *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; - - /* should we force a charset on any outgoing parameterless content-type? - * if so, which charset? - */ -#define ADD_DEFAULT_CHARSET_OFF (0) -#define ADD_DEFAULT_CHARSET_ON (1) -#define ADD_DEFAULT_CHARSET_UNSET (2) - unsigned add_default_charset : 2; - const char *add_default_charset_name; - - /* 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 */ - long limit_xml_body; /* limit on bytes in XML request msg body */ - - /* logging options */ - - server_signature_e server_signature; - - int loglevel; - - /* Access control */ - apr_array_header_t *sec; - regex_t *r; - -#ifdef WIN32 - /* Where to find interpreter to run scripts */ - interpreter_source_e script_interpreter_source; -#endif - - apr_array_header_t *output_filters; - apr_array_header_t *input_filters; -} 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: - */ - const char *ap_document_root; - - /* Access control */ - - char *access_name; - apr_array_header_t *sec; - apr_array_header_t *sec_url; -} core_server_config; - -/* for http_config.c */ -void ap_core_reorder_directories(apr_pool_t *, server_rec *); - -/* for mod_perl */ -AP_CORE_DECLARE(void) ap_add_per_dir_conf(server_rec *s, void *dir_config); -AP_CORE_DECLARE(void) ap_add_per_url_conf(server_rec *s, void *url_config); -AP_CORE_DECLARE(void) ap_add_file_conf(core_dir_config *conf, void *url_config); -AP_CORE_DECLARE_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 71d50a3e50..0000000000 --- a/include/http_log.h +++ /dev/null @@ -1,282 +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_HTTP_LOG_H -#define APACHE_HTTP_LOG_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "apr_thread_proc.h" - -/** - * @package Apache logging library - */ - -#ifdef HAVE_SYSLOG -#include - -#ifndef LOG_PRIMASK -#define LOG_PRIMASK 7 -#endif - -#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) - -/* normal but significant condition on startup, usually printed to stderr */ -#define APLOG_STARTUP ((APLOG_LEVELMASK + 1) * 4) - -#ifndef DEFAULT_LOGLEVEL -#define DEFAULT_LOGLEVEL APLOG_WARNING -#endif - -#define APLOG_MARK __FILE__,__LINE__ - -/** - * Set up for logging to stderr. - * @param p The pool to allocate out of - */ -AP_DECLARE(void) ap_open_stderr_log(apr_pool_t *p); - -/** - * Open the error log and replace stderr with it. - * @param s_main The main server - * @param p The pool to allocate out of - */ -void ap_open_logs (server_rec *s_main, apr_pool_t *p); - -/* - * The three primary logging functions, ap_log_error, ap_log_rerror, and - * ap_log_perror 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. - */ - -/** - * One of the primary logging routines in Apache. This uses a printf-like - * format to log messages to the error_log. - * @param file The file in which this function is called - * @param line The line number on which this function is called - * @param level The level of this error message - * @param status The status code from the previous command - * @param s The server on which we are logging - * @param fmt The format string - * @param ... The arguments to use to fill out fmt. - * @tip Use APLOG_MARK to fill out file and line - * @warning 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. - * @deffunc void ap_log_error(const char *file, int line, int level, apr_status_t status, const server_rec *s, const char *fmt, ...) - */ -AP_DECLARE(void) ap_log_error(const char *file, int line, int level, - apr_status_t status, const server_rec *s, - const char *fmt, ...) - __attribute__((format(printf,6,7))); - -/** - * The second of the primary logging routines in Apache. This uses - * a printf-like format to log messages to the error_log. - * @param file The file in which this function is called - * @param line The line number on which this function is called - * @param level The level of this error message - * @param status The status code from the previous command - * @param p The pool which we are logging for - * @param fmt The format string - * @param ... The arguments to use to fill out fmt. - * @tip Use APLOG_MARK to fill out file and line - * @warning 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. - * @deffunc void ap_log_perror(const char *file, int line, int level, apr_status_t status, apr_pool_t *p, const char *fmt, ...) - */ -AP_DECLARE(void) ap_log_perror(const char *file, int line, int level, - apr_status_t status, apr_pool_t *p, - const char *fmt, ...) - __attribute__((format(printf,6,7))); - -/** - * The last of the primary logging routines in Apache. This uses - * a printf-like format to log messages to the error_log. - * @param file The file in which this function is called - * @param line The line number on which this function is called - * @param level The level of this error message - * @param status The status code from the previous command - * @param s The request which we are logging for - * @param fmt The format string - * @param ... The arguments to use to fill out fmt. - * @tip Use APLOG_MARK to fill out file and line - * @warning 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. - * @deffunc void ap_log_rerror(const char *file, int line, int level, apr_status_t status, request_rec *r, const char *fmt, ...) - */ -AP_DECLARE(void) ap_log_rerror(const char *file, int line, int level, - apr_status_t status, const request_rec *r, - const char *fmt, ...) - __attribute__((format(printf,6,7))); - -/** - * Convert stderr to the error log - * @param s The current server - * @deffunc void ap_error_log2stderr(server_rec *s) - */ -AP_DECLARE(void) ap_error_log2stderr (server_rec *s); - -/** - * Log the current pid of the parent process - * @param p The pool to use for logging - * @param fname The name of the file to log to - */ -void ap_log_pid (apr_pool_t *p, const char *fname); - -typedef struct piped_log piped_log; - -/** - * The piped logging structure. Piped logs are used to move functionality - * out of the main server. For example, log rotation is done with piped logs. - */ -struct piped_log { - /** The pool to use for the piped log */ - apr_pool_t *p; - /** The pipe between the server and the logging process */ - apr_file_t *fds[2]; - /* XXX - an #ifdef that needs to be eliminated from public view. Shouldn't - * be hard */ -#ifdef AP_HAVE_RELIABLE_PIPED_LOGS - /** The name of the program the logging process is running */ - char *program; - /** The pid of the logging process */ - apr_proc_t *pid; -#endif -}; - -/** - * Open the piped log process - * @param p The pool to allocate out of - * @param program The program to run in the logging process - * @return The piped log structure - * @deffunc piped_log *ap_open_piped_log(apr_pool_t *p, const char *program) - */ -AP_DECLARE(piped_log *) ap_open_piped_log(apr_pool_t *p, const char *program); - -/** - * Close the piped log and kill the logging process - * @param pl The piped log structure - * @deffunc void ap_close_piped_log(piped_log *pl) - */ -AP_DECLARE(void) ap_close_piped_log(piped_log *pl); - -/** - * A macro to access the read side of the piped log pipe - * @param pl The piped log structure - * @return The native file descriptor - * @deffunc ap_piped_log_read_fd(pl) - */ -#define ap_piped_log_read_fd(pl) ((pl)->fds[0]) - -/** - * A macro to access the write side of the piped log pipe - * @param pl The piped log structure - * @return The native file descriptor - * @deffunc ap_piped_log_read_fd(pl) - */ -#define ap_piped_log_write_fd(pl) ((pl)->fds[1]) - -#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 cd81404fda..0000000000 --- a/include/http_main.h +++ /dev/null @@ -1,96 +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_HTTP_MAIN_H -#define APACHE_HTTP_MAIN_H - -/* AP_SERVER_BASEARGS is the command argument list parsed by http_main.c - * in apr_getopt() format. Use this for default'ing args that the MPM - * can safely ignore and pass on from its rewrite_args() handler. - */ -#define AP_SERVER_BASEARGS "C:c:D:d:f:vVlLth?" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package Command line options - */ - -/** The name of the Apache executable */ -AP_DECLARE_DATA extern const char *ap_server_argv0; -/** The global server's ServerRoot */ -AP_DECLARE_DATA extern const char *ap_server_root; - -/* for -C, -c and -D switches */ -/** An array of all -C directives. These are processed before the server's - * config file */ -AP_DECLARE_DATA extern apr_array_header_t *ap_server_pre_read_config; -/** An array of all -c directives. These are processed after the server's - * config file */ -AP_DECLARE_DATA extern apr_array_header_t *ap_server_post_read_config; -/** An array of all -D defines on the command line. This allows people to - * effect the server based on command line options */ -AP_DECLARE_DATA extern apr_array_header_t *ap_server_config_defines; - -#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 10250e04e0..0000000000 --- a/include/http_protocol.h +++ /dev/null @@ -1,609 +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_HTTP_PROTOCOL_H -#define APACHE_HTTP_PROTOCOL_H - -#include "httpd.h" -#include "apr_hooks.h" -#include "apr_portable.h" -#include "apr_mmap.h" -#include "apr_buckets.h" -#include "util_filter.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package HTTP protocol handling - */ - -/* - * 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. - * @param c The current connection - * @return The new request_rec - */ -request_rec *ap_read_request(conn_rec *c); - -/* Finish up stuff after a request */ - -/** - * Called at completion of sending the response. It sends the terminating - * protocol information. - * @param r The current request - * @deffunc void ap_finalize_request_protocol(request_rec *r) - */ -AP_DECLARE(void) ap_finalize_request_protocol(request_rec *r); - -/** - * Send error back to client. - * @param r The current request - * @param recursive_error 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. - * @deffunc void ap_send_error_response(request_rec *r, int recursive_error) - */ -AP_DECLARE(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 HTTP_NOT_MODIFIED (that when the - * permit_cache argument is set to one). - */ - -/** - * Set the content length for this request - * @param r The current request - * @param length The new content length - * @deffunc void ap_set_content_length(request_rec *r, apr_off_t length) - */ -AP_DECLARE(void) ap_set_content_length(request_rec *r, apr_off_t length); - -/** - * Set the keepalive status for this request - * @param r The current request - * @return 1 if keepalive can be set, 0 otherwise - * @deffunc int ap_set_keepalive(request_rec *r) - */ -AP_DECLARE(int) ap_set_keepalive(request_rec *r); - -/** - * Return the latest rational time from a request/mtime pair. Mtime is - * returned unless it's in the future, in which case we return the current time. - * @param r The current request - * @param mtime The last modified time - * @return the latest rational time. - * @deffunc apr_time_t ap_rationalize_mtime(request_rec *r, apr_time_t mtime) - */ -AP_DECLARE(apr_time_t) ap_rationalize_mtime(request_rec *r, apr_time_t mtime); - -/** - * Build 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 - * @param r The current request - * @return The content-type - * @deffunc const char *ap_make_content_type(request_rec *r, const char *type); - */ -AP_DECLARE(const char *) ap_make_content_type(request_rec *r, const char *type); - -/** - * Construct an entity tag from the resource information. If it's a real - * file, build in some of the file characteristics. - * @param r The current request - * @param force_weak Force the entity tag to be weak - it could be modified - * again in as short an interval. - * @return The entity tag - * @deffunc char *ap_make_etag(request_rec *r, int force_weak) - */ -AP_DECLARE(char *) ap_make_etag(request_rec *r, int force_weak); - -/** - * Set the E-tag outgoing header - * @param The current request - * @deffunc void ap_set_etag(request_rec *r) - */ -AP_DECLARE(void) ap_set_etag(request_rec *r); - -/** - * Set the last modified time for the file being sent - * @param r The current request - * @deffunc void ap_set_last_modified(request_rec *r) - */ -AP_DECLARE(void) ap_set_last_modified(request_rec *r); - -/** - * Implements condition GET rules for HTTP/1.1 specification. This function - * inspects the client headers and determines if the response fulfills - * the requirements specified. - * @param r The current request - * @return 1 if the response fulfills the condition GET rules, 0 otherwise - * @deffunc int ap_meets_conditions(request_rec *r) - */ -AP_DECLARE(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). - */ - -/** - * Send an entire file to the client, using sendfile if supported by the - * current platform - * @param fd The file to send. - * @param r The current request - * @param offset Offset into the file to start sending. - * @param length Amount of data to send - * @param nbytes Amount of data actually sent - * @deffunc apr_status_t ap_send_fd(apr_file_t *fd, request_rec *r, apr_off_t offset, apr_size_t length, apr_size_t *nbytes); - */ -AP_DECLARE(apr_status_t) ap_send_fd(apr_file_t *fd, request_rec *r, apr_off_t offset, - apr_size_t length, apr_size_t *nbytes); - -#if APR_HAS_MMAP -/** - * Send an MMAP'ed file to the client - * @param mm The MMAP'ed file to send - * @param r The current request - * @param offset The offset into the MMAP to start sending - * @param length The amount of data to send - * @return The number of bytes sent - * @deffunc size_t ap_send_mmap(apr_mmap_t *mm, request_rec *r, size_t offset, size_t length) - */ -AP_DECLARE(size_t) ap_send_mmap(apr_mmap_t *mm, request_rec *r, size_t offset, - size_t length); -#endif - -/** - * Create a new method list with the specified number of preallocated - * slots for extension methods. - * - * @param p Pointer to a pool in which the structure should be - * allocated. - * @param nelts Number of preallocated extension slots - * @return Pointer to the newly created structure. - * @deffunc ap_method_list_t ap_make_method_list(apr_pool_t *p, int nelts) - */ -AP_DECLARE(ap_method_list_t *) ap_make_method_list(apr_pool_t *p, int nelts); -AP_DECLARE(void) ap_copy_method_list(ap_method_list_t *dest, - ap_method_list_t *src); -AP_DECLARE_NONSTD(void) ap_method_list_do(int (*comp) (void *urec, const char *mname, - int mnum), - void *rec, - const ap_method_list_t *ml, ...); -AP_DECLARE(void) ap_method_list_vdo(int (*comp) (void *urec, const char *mname, - int mnum), - void *rec, const ap_method_list_t *ml, - va_list vp); -/** - * Search for an HTTP method name in an ap_method_list_t structure, and - * return true if found. - * - * @param method String containing the name of the method to check. - * @param l Pointer to a method list, such as cmd->methods_limited. - * @return 1 if method is in the list, otherwise 0 - * @deffunc int ap_method_in_list(const char *method, ap_method_list_t *l) - */ -AP_DECLARE(int) ap_method_in_list(ap_method_list_t *l, const char *method); - -/** - * Add an HTTP method name to an ap_method_list_t structure if it isn't - * already listed. - * - * @param method String containing the name of the method to check. - * @param l Pointer to a method list, such as cmd->methods_limited. - * @return None. - * @deffunc void ap_method_in_list(ap_method_list_t *l, const char *method) - */ -AP_DECLARE(void) ap_method_list_add(ap_method_list_t *l, const char *method); - -/** - * Remove an HTTP method name from an ap_method_list_t structure. - * - * @param l Pointer to a method list, such as cmd->methods_limited. - * @param method String containing the name of the method to remove. - * @return None. - * @deffunc void ap_method_list_remove(ap_method_list_t *l, const char *method) - */ -AP_DECLARE(void) ap_method_list_remove(ap_method_list_t *l, - const char *method); - -/** - * Reset a method list to be completely empty. - * - * @param l Pointer to a method list, such as cmd->methods_limited. - * @return None. - * @deffunc void ap_clear_method_list(ap_method_list_t *l) - */ -AP_DECLARE(void) ap_clear_method_list(ap_method_list_t *l); - -/* Hmmm... could macrofy these for now, and maybe forever, though the - * definitions of the macros would get a whole lot hairier. - */ - -/** - * Output one character for this request - * @param c the character to output - * @param r the current request - * @return The number of bytes sent - * @deffunc int ap_rputc(int c, request_rec *r) - */ -AP_DECLARE(int) ap_rputc(int c, request_rec *r); - -/** - * Output a string for the current request - * @param str The string to output - * @param r The current request - * @return The number of bytes sent - * @deffunc int ap_rputs(const char *str, request_rec *r) - */ -AP_DECLARE(int) ap_rputs(const char *str, request_rec *r); - -/** - * Write a buffer for the current request - * @param buf The buffer to write - * @param nbyte The number of bytes to send from the buffer - * @param r The current request - * @return The number of bytes sent - * @deffunc int ap_rwrite(const void *buf, int nbyte, request_rec *r) - */ -AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r); - -/** - * Write an unspecified number of strings to the request - * @param r The current request - * @param ... The strings to write - * @return The number of bytes sent - * @deffunc int ap_rvputs(request_rec *r, ...) - */ -AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r,...); - -/** - * Output data to the client in a printf format - * @param r The current request - * @param fmt The format string - * @param vlist The arguments to use to fill out the format string - * @return The number of bytes sent - * @deffunc int ap_vrprintf(request_rec *r, const char *fmt, va_list vlist) - */ -AP_DECLARE(int) ap_vrprintf(request_rec *r, const char *fmt, va_list vlist); - -/** - * Output data to the client in a printf format - * @param r The current request - * @param fmt The format string - * @param ... The arguments to use to fill out the format string - * @return The number of bytes sent - * @deffunc int ap_rprintf(request_rec *r, const char *fmt, ...) - */ -AP_DECLARE_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt,...) - __attribute__((format(printf,2,3))); -/** - * Flush all of the data for the current request to the client - * @param r The current request - * @return The number of bytes sent - * @deffunc int ap_rflush(request_rec *r) - */ -AP_DECLARE(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). - * @param status HTTP status code - * @return The index of the response - * @deffunc int ap_index_of_response(int status) - */ -AP_DECLARE(int) ap_index_of_response(int status); - -/** - * Return the Status-Line for a given status code (excluding the - * HTTP-Version field). If an invalid or unknown status code is - * passed, "500 Internal Server Error" will be returned. - * @param status The HTTP status code - * @return The Status-Line - * @deffunc const char *ap_get_status_line(int status) - */ -AP_DECLARE(const char *) ap_get_status_line(int status); - -/* Reading a block of data from the client connection (e.g., POST arg) */ - -/** - * Setup the client to allow Apache to read the request body. - * @param r The current request - * @param read_policy How the server should interpret a chunked - * transfer-encoding. 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.
        - * 
        - * @return either OK or an error code - * @deffunc int ap_setup_cleint_block(request_rec *r, int read_policy) - */ -AP_DECLARE(int) ap_setup_client_block(request_rec *r, int read_policy); - -/** - * Determine if the client has sent any data. This also sends a - * 100 Continue resposne to HTTP/1.1 clients, so modules should not be called - * until the module is ready to read content. - * @warning Never call this function more than once. - * @param r The current request - * @return 0 if there is no message to read, 1 otherwise - * @deffunc int ap_should_client_block(request_rec *r) - */ -AP_DECLARE(int) ap_should_client_block(request_rec *r); - -/** - * Call this in a loop. It will put data into a buffer and return the length - * of the input block - * @param r The current request - * @param buffer The buffer in which to store the data - * @param bufsiz The size of the buffer - * @return Number of bytes inserted into the buffer. When done reading, 0 - * if EOF, or -1 if there was an error - * @deffunc long ap_get_client_block(request_rec *r, char *buffer, int bufsiz) - */ -AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz); - -/** - * 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. - * @param r The current request - * @return error status if request is malformed, OK otherwise - * @deffunc int ap_discard_request_body(request_rec *r) - */ -AP_DECLARE(int) ap_discard_request_body(request_rec *r); - - -/** - * Setup the output headers so that the client knows how to authenticate - * itself the next time, if an authentication request failed. This function - * works for both basic and digest authentication - * @param r The current request - * @deffunc void ap_note_auth_failure(request_rec *r) - */ -AP_DECLARE(void) ap_note_auth_failure(request_rec *r); - -/** - * Setup the output headers so that the client knows how to authenticate - * itself the next time, if an authentication request failed. This function - * works only for basic authentication - * @param r The current request - * @deffunc void ap_note_basic_auth_failure(request_rec *r) - */ -AP_DECLARE(void) ap_note_basic_auth_failure(request_rec *r); - -/** - * Setup the output headers so that the client knows how to authenticate - * itself the next time, if an authentication request failed. This function - * works only for digest authentication - * @param r The current request - * @deffunc void ap_note_digest_auth_failure(request_rec *r) - */ -AP_DECLARE(void) ap_note_digest_auth_failure(request_rec *r); - -/** - * Get the password from the request headers - * @param r The current request - * @param pw The password as set in the headers - * @return 0 (OK) if it set the 'pw' argument (and assured - * a correct value in r->connection->user); otherwise it returns - * an error code, either HTTP_INTERNAL_SERVER_ERROR if things are - * really confused, HTTP_UNAUTHORIZED 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). - * @deffunc int ap_get_basic_auth_pw(request_rec *r, const char **pw) - */ -AP_DECLARE(int) ap_get_basic_auth_pw(request_rec *r, const char **pw); - -/** - * parse_uri: break apart the uri - * @warning 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)
        - * 
        - * @param r The current request - * @param uri The uri to break apart - * @deffunc void ap_parse_uri(request_rec *r, const char *uri) - */ -AP_CORE_DECLARE(void) ap_parse_uri(request_rec *r, const char *uri); - -AP_CORE_DECLARE(int) ap_getline(char *s, int n, request_rec *r, int fold); - -/** - * Get the method number associated with the given string, assumed to - * contain an HTTP method. Returns M_INVALID if not recognized. - * @param method A string containing a valid HTTP method - * @return The method number - * @deffunc int ap_method_number_of(const char *method) - */ -AP_DECLARE(int) ap_method_number_of(const char *method); - -/** - * Get the method name associated with the given internal method - * number. Returns NULL if not recognized. - * @param methnum An integer value corresponding to an internal method number - * @return The name corresponding to the method number - * @deffunc const char *ap_method_name_of(int methnum) - */ -AP_DECLARE(const char *) ap_method_name_of(int methnum); - - - /* Hooks */ - /* - * post_read_request --- run right after read_request or internal_redirect, - * and not run during any subrequests. - */ -/** - * This hook allows modules to affect the request immediately after the request - * has been read, and before any other phases have been processes. This allows - * modules to make decisions based upon the input header fields - * @param r The current request - * @return OK or DECLINED - * @deffunc ap_run_post_read_request(request_rec *r) - */ -AP_DECLARE_HOOK(int,post_read_request,(request_rec *r)) - -/** - * This hook allows modules to perform any module-specific logging activities - * over and above the normal server things. - * @param r The current request - * @return OK, DECLINED, or HTTP_... - * @deffunc int ap_run_log_transaction(request_rec *r) - */ -AP_DECLARE_HOOK(int,log_transaction,(request_rec *r)) - -/** - * This hook allows modules to retrieve the http method from a request. This - * allows Apache modules to easily extend the methods that Apache understands - * @param r The current request - * @return The http method from the request - * @deffunc const char *ap_run_http_method(const request_rec *r) - */ -AP_DECLARE_HOOK(const char *,http_method,(const request_rec *r)) - -/** - * Return the default port from the current request - * @param r The current request - * @return The current port - * @deffunc apr_port_t ap_run_default_port(const request_rec *r) - */ -AP_DECLARE_HOOK(apr_port_t,default_port,(const request_rec *r)) - -typedef struct ap_bucket_error ap_bucket_error; - -/** - * A bucket referring to an HTTP error - * This bucket can be passed down the filter stack to indicate that an - * HTTP error occurred while running a filter. In order for this bucket - * to be used successfully, it MUST be sent as the first bucket in the - * first brigade to be sent from a given filter. - */ -struct ap_bucket_error { - /** The error code */ - int status; - /** The error string */ - const char *data; -}; - -AP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_error; - -/** - * Make the bucket passed in an error bucket - * @param b The bucket to make into an error bucket - * @param error The HTTP error code to put in the bucket. - * @param buf An optional error string to put in the bucket. - * @param p A pool to allocate out of. - * @return The new bucket, or NULL if allocation failed - * @deffunc apr_bucket *ap_bucket_error_make(apr_bucket *b, int error, const char *buf, apr_pool_t *p) - */ -AP_DECLARE(apr_bucket *) ap_bucket_error_make(apr_bucket *b, int error, - const char *buf, apr_pool_t *p); - -/** - * Create a bucket referring to an HTTP error. - * @param error The HTTP error code to put in the bucket. - * @param buf An optional error string to put in the bucket. - * @param p A pool to allocate out of. - * @return The new bucket, or NULL if allocation failed - * @deffunc apr_bucket *ap_bucket_error_create(int error, const char *buf, apr_pool_t *p) - */ -AP_DECLARE(apr_bucket *) ap_bucket_error_create(int error, - const char *buf, apr_pool_t *p); - -AP_DECLARE_NONSTD(apr_status_t) ap_byterange_filter(ap_filter_t *f, apr_bucket_brigade *b); -AP_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, apr_bucket_brigade *b); -AP_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *, - apr_bucket_brigade *); -AP_DECLARE_NONSTD(apr_status_t) ap_old_write_filter(ap_filter_t *f, apr_bucket_brigade *b); - -/* - * 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); - -#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 662d11beb4..0000000000 --- a/include/http_request.h +++ /dev/null @@ -1,329 +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_HTTP_REQUEST_H -#define APACHE_HTTP_REQUEST_H - -#include "apr_hooks.h" -#include "util_filter.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @file http_request.h - * @brief Apache Request library - */ - -/* 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 apr_pool_t elsewhere before doing this. - */ - -/** - * Create a sub request from the given URI. This sub request can be - * inspected to find information about the requested URI - * @param new_file The URI to lookup - * @param r The current request - * @param next_filter The first filter the sub_request should use. If this is - * NULL, it defaults to the first filter for the main request - * @return The new request record - * @deffunc request_rec * ap_sub_req_lookup_uri(const char *new_file, const request_rec *r) - */ -AP_DECLARE(request_rec *) ap_sub_req_lookup_uri(const char *new_file, - const request_rec *r, - ap_filter_t *next_filter); - -/** - * Create a sub request for the given file. This sub request can be - * inspected to find information about the requested file - * @param new_file The URI to lookup - * @param r The current request - * @param next_filter The first filter the sub_request should use. If this is - * NULL, it defaults to the first filter for the main request - * @return The new request record - * @deffunc request_rec * ap_sub_req_lookup_file(const char *new_file, const request_rec *r) - */ -AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file, - const request_rec *r, - ap_filter_t *next_filter); -/** - * Create a sub request for the given URI using a specific method. This - * sub request can be inspected to find information about the requested URI - * @param method The method to use in the new sub request - * @param new_file The URI to lookup - * @param r The current request - * @param next_filter The first filter the sub_request should use. If this is - * NULL, it defaults to the first filter for the main request - * @return The new request record - * @deffunc request_rec * ap_sub_req_method_uri(const char *method, const char *new_file, const request_rec *r) - */ -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); -/** - * An output filter to strip EOS buckets from sub-requests. This always - * has to be inserted at the end of a sub-requests filter stack. - * @param f The current filter - * @param bb The brigade to filter - * @deffunc apr_status_t ap_sub_req_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) - */ -AP_CORE_DECLARE_NONSTD(apr_status_t) ap_sub_req_output_filter(ap_filter_t *f, - apr_bucket_brigade *bb); - -/** - * Run the handler for the sub request - * @param r The sub request to run - * @return The return code for the sub request - * @deffunc int ap_run_sub_req(request_rec *r) - */ -AP_DECLARE(int) ap_run_sub_req(request_rec *r); - -/** - * Free the memory associated with a sub request - * @param r The sub request to finish - * @deffunc void ap_destroy_sub_req(request_rec *r) - */ -AP_DECLARE(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. - */ - -/** - * Redirect the current request to some other uri - * @param new_uri The URI to replace the current request with - * @param r The current request - * @deffunc void ap_internal_redirect(const char *new_uri, request_rec *r) - */ -AP_DECLARE(void) ap_internal_redirect(const char *new_uri, request_rec *r); - -/** - * 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. - * @param new_uri The URI to replace the current request with. - * @param r The current request - * @deffunc void ap_internal_redirect_handler(const char *new_uri, request_rec *r) - */ -AP_DECLARE(void) ap_internal_redirect_handler(const char *new_uri, request_rec *r); - -/** - * Can be used within any handler to determine if any authentication - * is required for the current request - * @param r The current request - * @return 1 if authentication is required, 0 otherwise - * @deffunc int ap_some_auth_required(request_rec *r) - */ -AP_DECLARE(int) ap_some_auth_required(request_rec *r); - -/** - * Determine if the current request is the main request or a sub requests - * @param r The current request - * @retrn 1 if this is a main request, 0 otherwise - * @deffunc int ap_is_initial_req(request_rec *r) - */ -AP_DECLARE(int) ap_is_initial_req(request_rec *r); - -/** - * Function to set the r->mtime field to the specified value if it's later - * than what's already there. - * @param r The current request - * @param dependency_time Time to set the mtime to - * @deffunc void ap_update_mtime(request_rec *r, apr_time_t dependency_mtime) - */ -AP_DECLARE(void) ap_update_mtime(request_rec *r, apr_time_t dependency_mtime); - -/** - * Add one or more methods to the list permitted to access the resource. - * Usually executed by the content handler before the response header is - * sent, but sometimes invoked at an earlier phase if a module knows it - * can set the list authoritatively. Note that the methods are ADDED - * to any already permitted unless the reset flag is non-zero. The - * list is used to generate the Allow response header field when it - * is needed. - * @param r The pointer to the request identifying the resource. - * @param reset Boolean flag indicating whether this list should - * completely replace any current settings. - * @param ... A NULL-terminated list of strings, each identifying a - * method name to add. - * @return None. - * @deffunc void ap_allow_methods(request_rec *r, int reset, ...) - */ -AP_DECLARE(void) ap_allow_methods(request_rec *r, int reset, ...); - -#define MERGE_ALLOW 0 -#define REPLACE_ALLOW 1 - -#ifdef CORE_PRIVATE -/* Function called by main.c to handle first-level request */ -void ap_process_request(request_rec *); -/** - * Kill the current request - * @param type Why the request is dieing - * @param r The current request - * @deffunc void ap_die(int type, request_rec *r) - */ -AP_DECLARE(void) ap_die(int type, request_rec *r); -#endif - -/* Hooks */ - -/* XXX: doxygen grouping doesn't appear to work, but it should. Checking with - * doxygen (Ben). - */ - -/** - * Gives modules a chance to create their request_config entry when the - * request is created. - * @param r The current request - * @ingroup hooks - */ -AP_DECLARE_HOOK(int,create_request,(request_rec *r)) - -/** - * This hook allow modules an opportunity to translate the URI into an - * actual filename. If no modules do anything special, the server's default - * rules will be followed. - * @param r The current request - * @return OK, DECLINED, or HTTP_... - * @ingroup hooks - */ -AP_DECLARE_HOOK(int,translate_name,(request_rec *r)) - -/** - * This hook allows modules to check the authentication information sent with - * the request. - * @param r The current request - * @return OK, DECLINED, or HTTP_... - * @ingroup hooks - */ -AP_DECLARE_HOOK(int,check_user_id,(request_rec *r)) - -/** - * Allows modules to perform module-specific fixing of header fields. This - * is invoked just before any content-handler - * @param r The current request - * @return OK, DECLINED, or HTTP_... - * @ingroup hooks - */ -AP_DECLARE_HOOK(int,fixups,(request_rec *r)) - -/** - * 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. - * @param r the current request - * @return OK, DECLINED, or HTTP_... - * @ingroup hooks - */ -AP_DECLARE_HOOK(int,type_checker,(request_rec *r)) - -/** - * This routine is called to check for any module-specific restrictions placed - * upon the requested resource. - * @param r the current request - * @return OK, DECLINED, or HTTP_... - * @ingroup hooks - */ -AP_DECLARE_HOOK(int,access_checker,(request_rec *r)) - -/** - * This routine is called to check to see if the resource being requested - * requires authorisation. - * @param r the current request - * @return OK, DECLINED, or HTTP_... - * @ingroup hooks - */ -AP_DECLARE_HOOK(int,auth_checker,(request_rec *r)) - -/** - * This hook allows modules to insert filters for the current request - * @param r the current request - * @ingroup hooks - */ -AP_DECLARE_HOOK(void,insert_filter,(request_rec *r)) - -AP_DECLARE(int) directory_walk(request_rec *r); -AP_DECLARE(int) location_walk(request_rec *r); -AP_DECLARE(int) file_walk(request_rec *r); - -#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 493d27f38f..0000000000 --- a/include/http_vhost.h +++ /dev/null @@ -1,123 +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 APACHE_HTTP_VHOST_H -#define APACHE_HTTP_VHOST_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package Virtual Host package - */ - -/** - * called before any config is read - * @param p Pool to allocate out of - */ -void ap_init_vhost_config(apr_pool_t *p); - -/** - * called after the config has been read to compile the tables needed to do - * the run-time vhost lookups - * @param p The pool to allocate out of - * @param main_server The start of the virtual host list - * @deffunc ap_fini_vhost_config(apr_pool_t *p, server_rec *main_server) - */ -AP_DECLARE(void) ap_fini_vhost_config(apr_pool_t *p, server_rec *main_server); - -/** - * handle addresses in statement - * @param p The pool to allocate out of - * @param hostname The hostname in the VirtualHost statement - * @param s The list of Virtual Hosts. - */ -const char *ap_parse_vhost_addrs(apr_pool_t *p, const char *hostname, server_rec *s); - -/* handle NameVirtualHost directive */ -const char *ap_set_name_virtual_host (cmd_parms *cmd, void *dummy, - const char *arg); - -/** - * given an ip address only, give our best guess as to what vhost it is - * @param conn The current connection - */ -void ap_update_vhost_given_ip(conn_rec *conn); - -/** - * ap_update_vhost_given_ip is never enough, and this is always called after - * the headers have been read. It may change r->server. - * @param r The current request - */ -void ap_update_vhost_from_headers(request_rec *r); - -/** - * Match the host in the header with the hostname of the server for this - * request. - * @param r The current request - * @param host The hostname in the headers - * @param port The port from the headers - * @return return 1 if the host:port matches any of the aliases of r->server, - * return 0 otherwise - * @deffunc int ap_matches_request_vhost(request_rec *r, const char *host, apr_port_t port) - */ -AP_DECLARE(int) ap_matches_request_vhost(request_rec *r, const char *host, - apr_port_t port); - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_HTTP_VHOST_H */ diff --git a/include/httpd.h b/include/httpd.h deleted file mode 100644 index ca3fe2043b..0000000000 --- a/include/httpd.h +++ /dev/null @@ -1,1544 +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_HTTPD_H -#define APACHE_HTTPD_H - -/** - * @file httpd.h - * @brief HTTP Daemon routines - */ - -/* XXX - We need to push more stuff to other .h files, or even .c files, to - * make this file smaller - */ - -/* Headers in which EVERYONE has an interest... */ -#include "ap_config.h" -#include "ap_mmn.h" - -#include "ap_release.h" -#include "os.h" - -#include "apr_general.h" -#include "apr_tables.h" -#include "apr_pools.h" -#include "apr_time.h" -#include "apr_network_io.h" - -#include "pcreposix.h" - -/* Note: util_uri.h is also included, see below */ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef CORE_PRIVATE - -/* ----------------------------- 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) -/* Set the default for BeOS */ -#define HTTPD_ROOT "/boot/home/apache" -#else -#define HTTPD_ROOT "/usr/local/apache" -#endif -#endif /* HTTPD_ROOT */ - -/* - * --------- You shouldn't have to edit anything below this line ---------- - * - * Any modifications to any defaults not defined above should be done in the - * respective configuration file. - * - */ - -/* 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 */ - -/* Maximum 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 name of the log files */ -#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 */ - -/* 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 - -/* Whether we should enable rfc1413 identity checking */ -#ifndef DEFAULT_RFC1413 -#define DEFAULT_RFC1413 0 -#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 suExec wrapper, can be overridden in Configuration */ -#ifndef SUEXEC_BIN -#define SUEXEC_BIN HTTPD_ROOT "/sbin/suexec" -#endif - -/* 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 - -/* 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 default default character set name to add if AddDefaultCharset is - * enabled. Overridden with AddDefaultCharsetName. - */ -#define DEFAULT_ADD_DEFAULT_CHARSET_NAME "iso-8859-1" - -#endif /* CORE_PRIVATE */ - -#define AP_SERVER_PROTOCOL "HTTP/1.1" - - -/* ------------------ stuff that modules are allowed to look at ----------- */ - -/* Define this to be what your HTML directory content files are called */ -#ifndef AP_DEFAULT_INDEX -#define AP_DEFAULT_INDEX "index.html" -#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 - -/* The name of the MIME types file */ -#ifndef AP_TYPES_CONFIG_FILE -#define AP_TYPES_CONFIG_FILE "conf/mime.types" -#endif - -/* - * 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" - -/* -- 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 -/** - * Check whether @a port is the default port for the request @a r. - * @param port The port number - * @param r The request - * @see #ap_default_port - */ -#define ap_is_default_port(port,r) ((port) == ap_default_port(r)) -/** - * Get the default port for a request (which depends on the scheme). - * @param r The request - */ -#define ap_default_port(r) ap_run_default_port(r) -/** - * Get the scheme for a request. - * @param r The request - * @bug This should be called ap_http_scheme! - */ -#define ap_http_method(r) ap_run_http_method(r) - -/* The default string lengths */ -#define MAX_STRING_LEN HUGE_STRING_LEN -#define HUGE_STRING_LEN 8192 - -/* The size of the server's internal read-write buffers */ -#define AP_IOBUFSIZE 8192 - -/* - * 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 - - -#ifndef AP_DECLARE -/** - * Stuff marked #AP_DECLARE is part of the API, and intended for use - * by modules. Its purpose is to allow us to add attributes that - * particular platforms or compilers require to every exported function. - */ -# define AP_DECLARE(type) type -#endif - -#ifndef AP_DECLARE_NONSTD -/** - * Stuff marked #AP_DECLARE_NONSTD is part of the API, and intended for - * use by modules. The difference between #AP_DECLARE and - * #AP_DECLARE_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. - */ -# define AP_DECLARE_NONSTD(type) type -#endif -#ifndef AP_DECLARE_DATA -# define AP_DECLARE_DATA -#endif - -#ifndef AP_MODULE_DECLARE -# define AP_MODULE_DECLARE(type) type -#endif -#ifndef AP_MODULE_DECLARE_NONSTD -# define AP_MODULE_DECLARE_NONSTD(type) type -#endif -#ifndef AP_MODULE_DECLARE_DATA -# define AP_MODULE_DECLARE_DATA -#endif - -/* modules should not used functions marked AP_CORE_DECLARE - * or AP_CORE_DECLARE_NONSTD */ -#ifndef AP_CORE_DECLARE -# define AP_CORE_DECLARE AP_DECLARE -#endif -#ifndef AP_CORE_DECLARE_NONSTD -# define AP_CORE_DECLARE_NONSTD AP_DECLARE_NONSTD -#endif - -/** - * Get the server version string - * @return The server version string - */ -AP_DECLARE(const char *) ap_get_server_version(void); - -/** - * Add a component to the version string - * @param pconf The pool to allocate the component from - * @param component The string to add - */ -AP_DECLARE(void) ap_add_version_component(apr_pool_t *pconf, const char *component); - -/** - * Get the date a time that the server was built - * @return The server build time string - */ -AP_DECLARE(const char *) ap_get_server_built(void); - -#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 apr_table_t 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 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. - * This list must be tracked by the list in http_protocol.c in routine - * ap_method_name_of(). - */ -#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 - -typedef struct ap_method_list_t ap_method_list_t; -/** - * Structure for handling HTTP methods. Methods known to the server are - * accessed via a bitmask shortcut; extension methods are handled by - * an array. - */ -struct ap_method_list_t { - /* The bitmask used for known methods */ - int method_mask; - /* The array used for extension methods */ - apr_array_header_t *method_list; -}; - -#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" -#define DIR_MAGIC_TYPE "httpd/unix-directory" - -/* Just in case your linefeed isn't the one the other end is expecting. */ -#if !APR_CHARSET_EBCDIC -#define LF 10 -#define CR 13 -#define CRLF "\015\012" -#else /* APR_CHARSET_EBCDIC */ -/* For platforms using the EBCDIC charset, the transition ASCII->EBCDIC is done - * in the buff package (bread/bputs/bwrite). Everywhere else, we use - * "native EBCDIC" CR and NL characters. These are therefore - * defined as - * '\r' and '\n'. - */ -#define CR '\r' -#define LF '\n' -#define CRLF "\r\n" -#endif /* APR_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. - */ -#define REQUEST_NO_BODY 0 -#define REQUEST_CHUNKED_ERROR 1 -#define REQUEST_CHUNKED_DECHUNK 2 - -/* 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 { - /** the directory to which this applies */ - const char *dir; - /** the overrides allowed for the .htaccess file */ - int override; - /** the configuration directives */ - struct ap_conf_vector_t *htaccess; - /** the next one, or NULL if no more; N.B. never change this */ - const struct htaccess_result *next; -}; - -/* The following four types define a hierarchy of activities, so that - * given a request_rec r you can write r->connection->server->process - * to get to the process_rec. While this reduces substantially the - * number of arguments that various hooks require beware that in - * threaded versions of the server you must consider multiplexing - * issues. */ - -typedef struct process_rec process_rec; -typedef struct server_rec server_rec; -typedef struct conn_rec conn_rec; -typedef struct request_rec request_rec; - -/* ### would be nice to not include this from httpd.h ... */ -/* This comes after we have defined the request_rec type */ -#include "util_uri.h" - -/** A structure that represents one process */ -struct process_rec { - /** Global pool. Please try to cleared on _all_ exits */ - apr_pool_t *pool; - /** aka configuration pool, cleared on restarts */ - apr_pool_t *pconf; - /** How many command line arguments were pass to the program */ - int argc; - /** The command line arguments */ - const char * const *argv; - /** The program name used to execute the program */ - const char *short_name; -}; - -/** A structure that represents the current request */ -struct request_rec { - /** The pool associated with the request */ - apr_pool_t *pool; - /** The connection over which this connection has been read */ - conn_rec *connection; - /** The virtual host this request is for */ - server_rec *server; - - /** If we wind up getting redirected, pointer to the request we - * redirected to. */ - request_rec *next; - /** If this is an internal redirect, pointer to where we redirected - * *from*. */ - request_rec *prev; - - /** If this is a sub_request (see request.h) pointer back to the - * main request. */ - request_rec *main; - - /* Info about the request itself... we begin with stuff that only - * protocol.c should ever touch... - */ - /** First line of request, so we can log it */ - char *the_request; - /** HTTP/0.9, "simple" request */ - int assbackwards; - /** A proxy request (calculated during post_read_request/translate_name) - * possible values PROXYREQ_NONE, PROXYREQ_PROXY, PROXYREQ_REVERSE - */ - int proxyreq; - /** HEAD request, as opposed to GET */ - int header_only; - /** Protocol, as given to us, or HTTP/0.9 */ - char *protocol; - /** Number version of protocol; 1.1 = 1001 */ - int proto_num; - /** Host, as set by full URI or Host: */ - const char *hostname; - - /** When the request started */ - apr_time_t request_time; - - /** Status line, if set by script */ - const char *status_line; - /** In any case */ - int status; - - /* Request method, two ways; also, protocol, etc.. Outside of protocol.c, - * look, but don't touch. - */ - - /** GET, HEAD, POST, etc. */ - const char *method; - /** M_GET, M_POST, etc. */ - int method_number; - - /**
        -     *  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 HTTP_METHOD_NOT_ALLOWED and HTTP_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
        -     *  HTTP_METHOD_NOT_ALLOWED.  Unfortunately this means that a Script GET
        -     *  handler can't be installed by mod_actions. 
        - */ - /** Allowed methods - for 405, OPTIONS, etc */ - int allowed; - /** Array of extension methods */ - apr_array_header_t *allowed_xmethods; - /** List of allowed methods */ - ap_method_list_t *allowed_methods; - - /** byte count in stream is for body */ - int sent_bodyct; - /** body byte count, for easy access */ - long bytes_sent; - /** Time the resource was last modified */ - apr_time_t mtime; - - /* HTTP/1.1 connection-level features */ - - /** sending chunked transfer-coding */ - int chunked; - /** multipart/byteranges boundary */ - const char *boundary; - /** The Range: header */ - const char *range; - /** The "real" content length */ - apr_off_t clength; - - /** bytes left to read */ - apr_size_t remaining; - /** bytes that have been read */ - long read_length; - /** how the request body should be read */ - int read_body; - /** reading chunked transfer-coding */ - int read_chunked; - /** is client waiting for a 100 response? */ - unsigned expecting_100; - - /* 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' apr_table_t is for notes from one module to another, with no - * other set purpose in mind... - */ - - /** MIME header environment from the request */ - apr_table_t *headers_in; - /** MIME header environment for the response */ - apr_table_t *headers_out; - /** MIME header environment for the response, printed even on errors and - * persist across internal redirects */ - apr_table_t *err_headers_out; - /** Array of environment variables to be used for sub processes */ - apr_table_t *subprocess_env; - /** Notes from one module to another */ - apr_table_t *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. - */ - /** The content-type for the current request */ - const char *content_type; /* Break these out --- we dispatch on 'em */ - /** The handler string that we use to call a handler function */ - const char *handler; /* What we *really* dispatch on */ - - /** How to encode the data */ - const char *content_encoding; - /** for back-compat. only -- do not use */ - const char *content_language; - /** array of (char*) representing the content languages */ - apr_array_header_t *content_languages; - - /** variant list validator (if negotiated) */ - char *vlist_validator; - - /** If an authentication check was made, this gets set to the user name. */ - char *user; - /** If an authentication check was made, this gets set to the auth type. */ - char *ap_auth_type; - - /** This response is non-cache-able */ - int no_cache; - /** There is no local copy of this response */ - int no_local_copy; - - /* What object is being requested (either directly, or via include - * or content-negotiation mapping). - */ - - /** the uri without any parsing performed */ - char *unparsed_uri; - /** the path portion of the URI */ - char *uri; - /** The filename on disk that this response corresponds to */ - char *filename; - /** The path_info for this request if there is any. */ - char *path_info; - /** QUERY_ARGS, if any */ - char *args; - /** ST_MODE set to zero if no such file */ - apr_finfo_t finfo; - /** components of uri, dismantled */ - uri_components parsed_uri; - - /* 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). - */ - - /** Options set in config files, etc. */ - struct ap_conf_vector_t *per_dir_config; - /** Notes on *this* request */ - struct ap_conf_vector_t *request_config; - -/** - * 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 - * @defvar const htaccess_result *htaccess - */ - const struct htaccess_result *htaccess; - - /** A list of output filters to be used for this request - * @defvar ap_filter_t *output_filters */ - struct ap_filter_t *output_filters; - /** A list of input filters to be used for this request - * @defvar ap_filter_t *input_filters */ - struct ap_filter_t *input_filters; - /** A flag to determine if the eos bucket has been sent yet - * @defvar int eos_sent */ - int eos_sent; - -/* 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. - */ -}; - -/** Possible values of request_rec->proxyreq. A request could be normal, - * proxied or reverse proxied. Normally proxied and reverse proxied are - * grouped together as just "proxied", but sometimes it's necessary to - * tell the difference between the two, such as for authentication. - */ - -#define PROXYREQ_NONE 0 -#define PROXYREQ_PROXY 1 -#define PROXYREQ_REVERSE 2 - - -/** Structure to store things which are per connection */ -struct conn_rec { - /** Pool associated with this connection */ - apr_pool_t *pool; - /** Physical vhost this conn came in on */ - server_rec *base_server; - /** used by http_vhost.c */ - void *vhost_lookup_data; - - /* Information about the connection itself */ - - /** Connection to the client */ - apr_socket_t *client_socket; - - /* Who is the client? */ - - /** local address */ - apr_sockaddr_t *local_addr; - /** remote address */ - apr_sockaddr_t *remote_addr; - /** Client's IP address */ - char *remote_ip; - /** 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_host; - /** Only ever set if doing rfc1413 lookups. N.B. Only access this through - * get_remote_logname() */ - char *remote_logname; - - /** Are we still talking? */ - unsigned aborted:1; - - /** Are we going to keep the connection alive for another request? - * -1 fatal error, 0 undecided, 1 yes */ - signed int keepalive:2; - - /** have we done double-reverse DNS? -1 yes/failure, 0 not yet, - * 1 yes/success */ - signed int double_reverse:2; - - /** How many times have we used it? */ - int keepalives; - /** server IP address */ - char *local_ip; - /** used for ap_get_server_name when UseCanonicalName is set to DNS - * (ignores setting of HostnameLookups) */ - char *local_host; - - /** ID of this connection; unique at any point in time */ - long id; - /** Notes on *this* connection */ - struct ap_conf_vector_t *conn_config; - /** send note from one module to another, must remain valid for all - * requests on this conn */ - apr_table_t *notes; - /** A list of input filters to be used for this connection - * @defvar ap_filter_t *input_filters */ - struct ap_filter_t *input_filters; - /** A list of output filters to be used for this connection - * @defvar ap_filter_t *filters */ - struct ap_filter_t *output_filters; -}; - -/* 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; - -/** A structure to be used for Per-vhost config */ -struct server_addr_rec { - /** The next server in the list */ - server_addr_rec *next; - /** The bound address, for this server */ - apr_sockaddr_t *host_addr; - /** The bound port, for this server */ - apr_port_t host_port; - /** The name given in */ - char *virthost; -}; - -/** A structure to store information for each virtual server */ -struct server_rec { - /** The process this server is running in */ - process_rec *process; - /** The next server in the list */ - server_rec *next; - - /** The name of the server */ - const char *defn_name; - /** The line of the config file that the server was defined on */ - unsigned defn_line_number; - - /* Contact information */ - - /** The admin's contact information */ - char *server_admin; - /** The server hostname */ - char *server_hostname; - /** for redirects, etc. */ - apr_port_t port; - - /* Log files --- note that transfer log is now in the modules... */ - - /** The name of the error log */ - char *error_fname; - /** A file descriptor that references the error log */ - apr_file_t *error_log; - /** The log level for this server */ - int loglevel; - - /* Module-specific configuration for server, and defaults... */ - - /** true if this is the virtual server */ - int is_virtual; - /** Config vector containing pointers to modules' per-server config - * structures. */ - struct ap_conf_vector_t *module_config; - /** MIME type info, etc., before we start checking per-directory info */ - struct ap_conf_vector_t *lookup_defaults; - - /* Transaction handling */ - - /** I haven't got a clue */ - server_addr_rec *addrs; - /** Timeout, in seconds, before we give up */ - int timeout; - /** Seconds we'll wait for another request */ - int keep_alive_timeout; - /** Maximum requests per connection */ - int keep_alive_max; - /** Use persistent connections? */ - int keep_alive; - - /** Pathname for ServerPath */ - const char *path; - /** Length of path */ - int pathlen; - - /** Normal names for ServerAlias servers */ - apr_array_header_t *names; - /** Wildcarded names for ServerAlias servers */ - apr_array_header_t *wild_names; - - /** limit on size of the HTTP request line */ - int limit_req_line; - /** limit on size of any request header field */ - int limit_req_fieldsize; - /** limit on number of request header fields */ - int limit_req_fields; -}; - -/** - * 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. - * @param p Pool to allocate memory from - * @param intype The field to examine - * @return A copy of the field minus any parameters - */ -AP_DECLARE(char *) ap_field_noparam(apr_pool_t *p, const char *intype); - -/** - * Convert a time from an integer into a string in a specified format - * @param p The pool to allocate memory from - * @param t The time to convert - * @param fmt The format to use for the conversion - * @param gmt Convert the time for GMT? - * @return The string that represents the specified time - */ -AP_DECLARE(char *) ap_ht_time(apr_pool_t *p, apr_time_t t, const char *fmt, int gmt); - -/* 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 **) */ - -/** - * Get the characters until the first occurance of a specified character - * @param p The pool to allocate memory from - * @param line The string to get the characters from - * @param stop The character to stop at - * @return A copy of the characters up to the first stop character - */ -AP_DECLARE(char *) ap_getword(apr_pool_t *p, const char **line, char stop); -/** - * Get the characters until the first occurance of a specified character - * @param p The pool to allocate memory from - * @param line The string to get the characters from - * @param stop The character to stop at - * @return A copy of the characters up to the first stop character - * @note This is the same as ap_getword(), except it doesn't use const char **. - */ -AP_DECLARE(char *) ap_getword_nc(apr_pool_t *p, char **line, char stop); - -/** - * Get the first word from a given string. A word is defined as all characters - * up to the first whitespace. - * @param p The pool to allocate memory from - * @param line The string to traverse - * @return The first word in the line - */ -AP_DECLARE(char *) ap_getword_white(apr_pool_t *p, const char **line); -/** - * Get the first word from a given string. A word is defined as all characters - * up to the first whitespace. - * @param p The pool to allocate memory from - * @param line The string to traverse - * @return The first word in the line - * @note The same as ap_getword_white(), except it doesn't use const char **. - */ -AP_DECLARE(char *) ap_getword_white_nc(apr_pool_t *p, char **line); - -/** - * Get all characters from the first occurance of @a stop to the first '\0' - * @param p The pool to allocate memory from - * @param line The line to traverse - * @param stop The character to start at - * @return A copy of all caracters after the first occurance of the specified - * character - */ -AP_DECLARE(char *) ap_getword_nulls(apr_pool_t *p, const char **line, - char stop); -/** - * Get all characters from the first occurance of @a stop to the first '\0' - * @param p The pool to allocate memory from - * @param line The line to traverse - * @param stop The character to start at - * @return A copy of all caracters after the first occurance of the specified - * character - * @note The same as ap_getword_nulls(), except it doesn't use const char **. - */ -AP_DECLARE(char *) ap_getword_nulls_nc(apr_pool_t *p, char **line, char stop); - -/** - * Get the second word in the string paying attention to quoting - * @param p The pool to allocate from - * @param line The line to traverse - * @return A copy of the string - */ -AP_DECLARE(char *) ap_getword_conf(apr_pool_t *p, const char **line); -/** - * Get the second word in the string paying attention to quoting - * @param p The pool to allocate from - * @param line The line to traverse - * @return A copy of the string - * @note The same as ap_getword_conf(), except it doesn't use const char **. - */ -AP_DECLARE(char *) ap_getword_conf_nc(apr_pool_t *p, char **line); - -/** - * Check a string for any ${ENV} environment variable construct and replace - * each them by the value of that environment variable, if it exists. If the - * environment value does not exist, leave the ${ENV} construct alone; it - * means something else. - * @param p The pool to allocate from - * @param word The string to check - * @return The string with the replaced environment variables - */ -AP_DECLARE(const char *) ap_resolve_env(apr_pool_t *p, const char * word); - -/** - * Size an HTTP header field list item, as separated by a comma. - * @param field The field to size - * @param len The length of the field - * @return 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. - */ -AP_DECLARE(const char *) ap_size_list_item(const char **field, int *len); - -/** - * 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. - * @param p The pool to allocate from - * @param field The field to retrieve - * @return 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. - */ -AP_DECLARE(char *) ap_get_list_item(apr_pool_t *p, const char **field); - -/** - * Find an item in canonical form (lowercase, no extra spaces) within - * an HTTP field value list. - * @param p The pool to allocate from - * @param line The field value list to search - * @param tok The token to search for - * @return 1 if found, 0 if not found. - */ -AP_DECLARE(int) ap_find_list_item(apr_pool_t *p, const char *line, const char *tok); - -/** - * 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. - * @param p The pool to allocate from - * @param accept_line The line to retrieve the token from - * @param accept_white Is it delimited by whitespace - * @return the first non-white byte after the token - */ -AP_DECLARE(char *) ap_get_token(apr_pool_t *p, const char **accept_line, int accept_white); - -/** - * Find http tokens, see the definition of token from RFC2068 - * @param p The pool to allocate from - * @param line The line to find the token - * @param tok The token to find - * @return 1 if the token is found, 0 otherwise - */ -AP_DECLARE(int) ap_find_token(apr_pool_t *p, const char *line, const char *tok); - -/** - * find http tokens from the end of the line - * @param p The pool to allocate from - * @param line The line to find the token - * @param tok The token to find - * @return 1 if the token is found, 0 otherwise - */ -AP_DECLARE(int) ap_find_last_token(apr_pool_t *p, const char *line, const char *tok); - -/** - * Check for an Absolute URI syntax - * @param u The string to check - * @return 1 if URI, 0 otherwise - */ -AP_DECLARE(int) ap_is_url(const char *u); - -/** - * Unescape a URL - * @param url The url to unescapte - * @return 0 on success, non-zero otherwise - */ -AP_DECLARE(int) ap_unescape_url(char *url); -/** - * Convert all double slashes to single slashes - * @param name The string to convert - */ -AP_DECLARE(void) ap_no2slash(char *name); - -/** - * Remove all ./ and xx/../ substrings from a file name. Also remove - * any leading ../ or /../ substrings. - * @param name the file name to parse - */ -AP_DECLARE(void) ap_getparents(char *name); - -/** - * Escape a path segment, as defined in RFC 1808 - * @param p The pool to allocate from - * @param s The path to convert - * @return The converted URL - */ -AP_DECLARE(char *) ap_escape_path_segment(apr_pool_t *p, const char *s); -/** - * convert an OS path to a URL in an OS dependant way. - * @param p The pool to allocate from - * @param path The path to convert - * @param partial if set, assume that the path will be appended to something - * with a '/' in it (and thus does not prefix "./") - * @return The converted URL - */ -AP_DECLARE(char *) ap_os_escape_path(apr_pool_t *p, const char *path, int partial); -#define ap_escape_uri(ppool,path) ap_os_escape_path(ppool,path,1) - -/** - * Escape an html string - * @param p The pool to allocate from - * @param s The html to escape - * @return The escaped string - */ -AP_DECLARE(char *) ap_escape_html(apr_pool_t *p, const char *s); - -/** - * Construct a full hostname - * @param p The pool to allocate from - * @param hostname The hostname of the server - * @param port The port the server is running on - * @param r The current request - * @return The server's hostname - */ -AP_DECLARE(char *) ap_construct_server(apr_pool_t *p, const char *hostname, - apr_port_t port, const request_rec *r); -/** - * Escape a shell command - * @param p The pool to allocate from - * @param s The command to escape - * @return The escaped shell command - */ -AP_DECLARE(char *) ap_escape_shell_cmd(apr_pool_t *p, const char *s); - -/** - * Count the number of directories in a path - * @param path The path to count - * @return The number of directories - */ -AP_DECLARE(int) ap_count_dirs(const char *path); - -/** - * Copy at most @a n leading directories of @a s into @a d. @a d - * should be at least as large as @a s plus 1 extra byte - * - * @param d The location to copy to - * @param s The location to copy from - * @param n The number of directories to copy - * @return value is the ever useful pointer to the trailing \0 of d - * @note on platforms with drive letters, n = 0 returns the "/" root, - * whereas n = 1 returns the "d:/" root. On all other platforms, n = 0 - * returns the empty string. */ -AP_DECLARE(char *) ap_make_dirstr_prefix(char *d, const char *s, int n); - -/** - * Return the parent directory name (including trailing /) of the file - * @a s - * @param p The pool to allocate from - * @param s The file to get the parent of - * @return A copy of the file's parent directory - */ -AP_DECLARE(char *) ap_make_dirstr_parent(apr_pool_t *p, const char *s); - -/** - * Given a directory and filename, create a single path from them. This - * function is smart enough to ensure that there is a sinlge '/' between the - * directory and file names - * @param a The pool to allocate from - * @param dir The directory name - * @param f The filename - * @return A copy of the full path - */ -AP_DECLARE(char *) ap_make_full_path(apr_pool_t *a, const char *dir, const char *f); - -/** - * Does the provided string contain wildcard characters? This is useful - * for determining if the string should be passed to strcmp_match or to strcmp. - * The only wildcard characters recognized are '?' and '*' - * @param str The string to check - * @return 1 if the string has wildcards, 0 otherwise - */ -AP_DECLARE(int) ap_is_matchexp(const char *str); - -/** - * Determine if a string matches a patterm containing the wildcards '?' or '*' - * @param str The string to check - * @param exp The pattern to match against - * @return 1 if the two strings match, 0 otherwise - */ -AP_DECLARE(int) ap_strcmp_match(const char *str, const char *exp); -/** - * Determine if a string matches a patterm containing the wildcards '?' or '*', - * ignoring case - * @param str The string to check - * @param exp The pattern to match against - * @return 1 if the two strings match, 0 otherwise - */ -AP_DECLARE(int) ap_strcasecmp_match(const char *str, const char *exp); - -/** - * Find the first occurrence of the substring s2 in s1, regardless of case - * @param s1 The string to search - * @param s2 The substring to search for - * @return A pointer to the beginning of the substring - */ -AP_DECLARE(char *) ap_strcasestr(const char *s1, const char *s2); - -/** - * Return a pointer to the location inside of bigstring immediately after prefix - * @param bigstring The input string - * @param prefix The prefix to strip away - * @return A pointer relative to bigstring after prefix - */ -AP_DECLARE(const char *) ap_stripprefix(const char *bigstring, - const char *prefix); - -/** - * Decode a base64 encoded string into memory allocated from a pool - * @param p The pool to allocate from - * @param bufcoded The encoded string - * @return The decoded string - */ -AP_DECLARE(char *) ap_pbase64decode(apr_pool_t *p, const char *bufcoded); - -/** - * Encode a string into memory allocated from a pool in base 64 format - * @param p The pool to allocate from - * @param strin The plaintext string - * @return The encoded string - */ -AP_DECLARE(char *) ap_pbase64encode(apr_pool_t *p, char *string); - - -/** - * Compile a regular expression to be used later - * @param p The pool to allocate from - * @param pattern the regular expression to compile - * @param cflags The bitwise or of one or more of the following: - * @li #REG_EXTENDED - Use POSIX extended Regular Expressions - * @li #REG_ICASE - Ignore case - * @li #REG_NOSUB - Support for substring addressing of matches - * not required - * @li #REG_NEWLINE - Match-any-character operators don't match new-line - * @return The compiled regular expression - */ -AP_DECLARE(regex_t *) ap_pregcomp(apr_pool_t *p, const char *pattern, - int cflags); - -/** - * Free the memory associated with a compiled regular expression - * @param p The pool the regex was allocated from - * @param reg The regular expression to free - */ -AP_DECLARE(void) ap_pregfree(apr_pool_t *p, regex_t *reg); - -/** - * Match a null-terminated string against a pre-compiled regex. - * @param preg The pre-compiled regex - * @param string The string to match - * @param nmatch Provide information regarding the location of any matches - * @param pmatch Provide information regarding the location of any matches - * @param eflags Bitwise or of any of: - * @li #REG_NOTBOL - match-beginning-of-line operator always - * fails to match - * @li #REG_NOTEOL - match-end-of-line operator always fails to match - * @return 0 for successful match, #REG_NOMATCH otherwise - */ -AP_DECLARE(int) ap_regexec(regex_t *preg, const char *string, - size_t nmatch, regmatch_t pmatch[], int eflags); - -/** - * Return the error code returned by regcomp or regexec into error messages - * @param errcode the error code returned by regexec or regcomp - * @param preg The precompiled regex - * @param errbuf A buffer to store the error in - * @param errbuf_size The size of the buffer - */ -AP_DECLARE(size_t) ap_regerror(int errcode, const regex_t *preg, - char *errbuf, size_t errbuf_size); - -/** - * After performing a successful regex match, you may use this function to - * perform a series of string substitutions based on subexpressions that were - * matched during the call to ap_regexec - * @param p The pool to allocate from - * @param input An arbitrary string containing $1 through $9. These are - * replaced with the corresponding matched sub-expressions - * @param source The string that was originally matched to the regex - * @param nmatch the nmatch returned from ap_pregex - * @param pmatch the pmatch array returned from ap_pregex - */ -AP_DECLARE(char *) ap_pregsub(apr_pool_t *p, const char *input, const char *source, - size_t nmatch, regmatch_t pmatch[]); - -/** - * We want to downcase the type/subtype for comparison purposes - * but nothing else because ;parameter=foo values are case sensitive. - * @param s The content-type to convert to lowercase - */ -AP_DECLARE(void) ap_content_type_tolower(char *s); - -/** - * convert a string to all lowercase - * @param s The string to convert to lowercase - */ -AP_DECLARE(void) ap_str_tolower(char *s); - -/** - * Search a string from left to right for the first occurrence of a - * specific character - * @param str The string to search - * @param c The character to search for - * @return The index of the first occurrence of c in str - */ -AP_DECLARE(int) ap_ind(const char *str, char c); /* Sigh... */ - -/** - * Search a string from right to left for the first occurrence of a - * specific character - * @param str The string to search - * @param c The character to search for - * @return The index of the first occurrence of c in str - */ -AP_DECLARE(int) ap_rind(const char *str, char c); - -/** - * Given a string, replace any bare " with \" . - * @param p The pool to allocate memory from - * @param instring The string to search for " - * @return A copy of the string with escaped quotes - */ -AP_DECLARE(char *) ap_escape_quotes(apr_pool_t *p, const char *instring); - -/* Misc system hackery */ -/** - * Given the name of an object in the file system determine if it is a directory - * @param p The pool to allocate from - * @param name The name of the object to check - * @return 1 if it is a directory, 0 otherwise - */ -AP_DECLARE(int) ap_is_rdirectory(apr_pool_t *p, const char *name); - -/** - * Given the name of an object in the file system determine if it is a directory - this version is symlink aware - * @param p The pool to allocate from - * @param name The name of the object to check - * @return 1 if it is a directory, 0 otherwise - */ -AP_DECLARE(int) ap_is_directory(apr_pool_t *p, const char *name); - -#ifdef _OSD_POSIX -extern const char *os_set_account(apr_pool_t *p, const char *account); -extern int os_init_job_environment(server_rec *s, const char *user_name, int one_process); -#endif /* _OSD_POSIX */ - -/** - * Determine the local host name for the current machine - * @param p The pool to allocate from - * @return A copy of the local host name - */ -char *ap_get_local_host(apr_pool_t *p); - -/* - * Redefine assert() to something more useful for an Apache... - * - * Use ap_assert() if the condition should always be checked. - * Use AP_DEBUG_ASSERT() if the condition should only be checked when AP_DEBUG - * is defined. - */ -/** - * Log an assertion to the error log - * @param szExp The assertion that failed - * @param szFile The file the assertion is in - * @param nLine The line the assertion is defined on - */ -AP_DECLARE(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__)) - -#ifdef AP_DEBUG -#define AP_DEBUG_ASSERT(exp) ap_assert(exp) -#else -#define AP_DEBUG_ASSERT(exp) ((void)0) -#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 - -AP_DECLARE(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 - - /* The C library has functions that allow const to be silently dropped ... - these macros detect the drop in maintainer mode, but use the native - methods for normal builds - - Note that on some platforms (e.g., AIX with gcc, Solaris with gcc), string.h needs - to be included before the macros are defined or compilation will fail. - */ -#include - -#ifdef AP_DEBUG - -#undef strchr -# define strchr(s, c) ap_strchr(s,c) -#undef strrchr -# define strrchr(s, c) ap_strrchr(s,c) -#undef strstr -# define strstr(s, c) ap_strstr(s,c) - -char *ap_strchr(char *s, int c); -const char *ap_strchr_c(const char *s, int c); -char *ap_strrchr(char *s, int c); -const char *ap_strrchr_c(const char *s, int c); -char *ap_strstr(char *s, char *c); -const char *ap_strstr_c(const char *s, const char *c); - -#else - -# define ap_strchr(s, c) strchr(s, c) -# define ap_strchr_c(s, c) strchr(s, c) -# define ap_strrchr(s, c) strrchr(s, c) -# define ap_strrchr_c(s, c) strrchr(s, c) -# define ap_strstr(s, c) strstr(s, c) -# define ap_strstr_c(s, c) strstr(s, c) - -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_HTTPD_H */ diff --git a/include/mpm_common.h b/include/mpm_common.h deleted file mode 100644 index 1873dd9778..0000000000 --- a/include/mpm_common.h +++ /dev/null @@ -1,171 +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. - */ - -/* 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 - -#include "ap_config.h" - -#if APR_HAVE_NETINET_TCP_H -#include /* for TCP_NODELAY */ -#endif - -#include "mpm.h" /* for AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES setting */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package Multi-Processing Modules functions - */ - -/* 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 - -/** - * Make sure all child processes that have been spawned by the parent process - * have died. This includes process registered as "other_children". - * @warning This is only defined if the MPM defines - * MPM_NEEDS_RECLAIM_CHILD_PROCESS - * @param terminate Either 1 or 0. If 1, send the child processes SIGTERM - * each time through the loop. If 0, give the process time to die - * on its own before signalling it. - * @tip This function requires that some macros are defined by the MPM:
        - *  MPM_SYNC_CHILD_TABLE -- sync the scoreboard image between child and parent
        - *  MPM_CHILD_PID -- Get the pid from the specified spot in the scoreboard
        - *  MPM_NOTE_CHILD_KILLED -- Note the child died in the scoreboard
        - * 
        - */ -#if AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES -void ap_reclaim_child_processes(int terminate); -#endif - -/** - * Determine if any child process has died. If no child process died, then - * this process sleeps for the amount of time specified by the MPM defined - * macro SCOREBOARD_MAINTENANCE_INTERVAL. - * @param status The return code if a process has died - * @param ret The process id of the process that died - * @param p The pool to allocate out of - */ -void ap_wait_or_timeout(apr_wait_t *status, apr_proc_t *ret, apr_pool_t *p); - -/** - * Log why a child died to the error log, if the child died without the - * parent signalling it. - * @param pid The child that has died - * @param status The status returned from ap_wait_or_timeout - */ -void ap_process_child_status(apr_proc_t *pid, apr_wait_t status); - -#if defined(TCP_NODELAY) && !defined(MPE) && !defined(TPF) -/** - * Turn off the nagle algorithm for the specified socket. The nagle algorithm - * says that we should delay sending partial packets in the hopes of getting - * more data. There are bad interactions between persistent connections and - * Nagle's algorithm that have severe performance penalties. - * @param s The socket to disable nagle for. - */ -void ap_sock_disable_nagle(apr_socket_t *s); -#else -#define ap_sock_disable_nagle(s) /* NOOP */ -#endif - -/** - * Convert a username to a numeric ID - * @param name The name to convert - * @return The user id corresponding to a name - * @deffunc uid_t ap_uname2id(const char *name) - */ -AP_DECLARE(uid_t) ap_uname2id(const char *name); -/** - * Convert a group name to a numeric ID - * @param name The name to convert - * @return The group id corresponding to a name - * @deffunc gid_t ap_gname2id(const char *name) - */ -AP_DECLARE(gid_t) ap_gname2id(const char *name); - -#define AP_MPM_HARD_LIMITS_FILE APACHE_MPM_DIR "/mpm_default.h" - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_MPM_COMMON_H */ diff --git a/include/pcreposix.h b/include/pcreposix.h deleted file mode 100644 index a847421fce..0000000000 --- a/include/pcreposix.h +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************* -* Perl-Compatible Regular Expressions * -*************************************************/ - -/* Copyright (c) 1997-2000 University of Cambridge */ - -/** - * @file include/pcreposix.h - * @brief PCRE definitions - */ - -#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. */ - - /** Ignore case */ -#define REG_ICASE 0x01 - /** Don't match newlines with wildcards */ -#define REG_NEWLINE 0x02 - /** Don't match BOL */ -#define REG_NOTBOL 0x04 - /** Don't match EOL */ -#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. */ - - /** UNUSED! */ -#define REG_EXTENDED 0 - /** UNUSED! */ -#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/rfc1413.h b/include/rfc1413.h deleted file mode 100644 index a96dd7ed6d..0000000000 --- a/include/rfc1413.h +++ /dev/null @@ -1,84 +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_RFC1413_H -#define APACHE_RFC1413_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package RFC1413 package - */ - -/** - * Retrieve the remote user name, given socket structures. This implements - * RFC1413, which involves querying the client's identd or auth daemon. - * @param conn The current connection - * @param srv The current server - * @return The remote user name - * @deffunc char *ap_rfc1413(conn_rec *conn, server_rec *srv) - */ -extern char *ap_rfc1413(conn_rec *conn, server_rec *srv); - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_RFC1413_H */ diff --git a/include/scoreboard.h b/include/scoreboard.h deleted file mode 100644 index 81238495f2..0000000000 --- a/include/scoreboard.h +++ /dev/null @@ -1,263 +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_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" -#include "apr_portable.h" - -/* The optimized timeouts only work if we're not using a scoreboard file */ -#if !APR_FILE_BASED_SHM -#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_IDLE_KILL 11 /* Server is cleaning up idle children. */ -#define SERVER_NUM_STATUS 12 /* 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; - -/* Is the scoreboard shared between processes or not? - * Set by the MPM when the scoreboard is created. - */ -typedef enum { - SB_SHARED = 1, - SB_NOT_SHARED = 2 -} ap_scoreboard_e; - -#define SB_WORKING 0 /* The server is busy and the child is useful. */ -#define SB_IDLE_DIE 1 /* The server is idle and the child is superfluous. */ - /* The child should check for this and exit gracefully. */ - -/* 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; -#if APR_HAS_THREADS - apr_os_thread_t tid; -#endif - 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; - unsigned short life_status; /* Either SB_WORKING or SB_IDLE_DIE */ - 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_scoreboard_e sb_type; - 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); -AP_DECLARE(void) ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e t); -AP_DECLARE(void) ap_increment_counts(int child_num, int thread_num, request_rec *r); - -apr_status_t ap_cleanup_scoreboard(void *d); - -AP_DECLARE(void) reopen_scoreboard(apr_pool_t *p); - -void ap_sync_scoreboard_image(void); - -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 extern 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 36b967bb95..0000000000 --- a/include/util_cfgtree.h +++ /dev/null @@ -1,117 +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 AP_CONFTREE_H -#define AP_CONFTREE_H - -#include "ap_config.h" - -/** - * @package Config Tree Package - */ - -typedef struct ap_directive_t ap_directive_t; - -/** - * Structure used to build the config tree. The config tree only stores - * the directives that will be active in the running server. Directives - * that contain other directions, such as cause a sub-level - * to be created, where the included directives are stored. The closing - * directive () is not stored in the tree. - */ -struct ap_directive_t { - /** The current directive */ - const char *directive; - /** The arguments for the current directive, stored as a space - * separated list */ - const char *args; - /** The next directive node in the tree - * @defvar ap_directive_t *next */ - struct ap_directive_t *next; - /** The first child node of this directive - * @defvar ap_directive_t *first_child */ - struct ap_directive_t *first_child; - /** The parent node of this directive - * @defvar ap_directive_t *parent */ - struct ap_directive_t *parent; - - /** directive's module can store add'l data here */ - void *data; - - /* ### these may go away in the future, but are needed for now */ - /** The name of the file this directive was found in */ - const char *filename; - /** The line number the directive was on */ - int line_num; -}; - -/** - * The root of the configuration tree - * @defvar ap_directive_t *conftree - */ -AP_DECLARE_DATA extern ap_directive_t *ap_conftree; - -/** - * Add a node to the configuration tree. - * @param parent The current parent node. If the added node is a first_child, - then this is changed to the current node - * @param current The current node - * @param toadd The node to add to the tree - * @param child Is the node to add a child node - * @return the added node - */ -ap_directive_t *ap_add_node(ap_directive_t **parent, ap_directive_t *current, - ap_directive_t *toadd, int child); - -#endif diff --git a/include/util_charset.h b/include/util_charset.h deleted file mode 100644 index 22b6ff1880..0000000000 --- a/include/util_charset.h +++ /dev/null @@ -1,96 +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_UTIL_CHARSET_H -#define APACHE_UTIL_CHARSET_H - -#ifdef APACHE_XLATE - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package charset conversion - */ -#include "apr_xlate.h" - -/** On EBCDIC machine this is a translation handle used to translate the - * headers from the local machine format to ASCII for network transmission. - * On an ASCII machine this is NULL */ -extern apr_xlate_t *ap_hdrs_to_ascii; -/** On EBCDIC machine this is a translation handle used to translate the - * headers from ASCII to the local machine format after network transmission. - * On an ASCII machine this is NULL */ -extern apr_xlate_t *ap_hdrs_from_ascii; -/** On EBCDIC machine this is a translation handle used to translate the - * content from the local machine format to ASCII for network transmission. - * On an ASCII machine this is NULL */ -extern apr_xlate_t *ap_locale_to_ascii; -/** On EBCDIC machine this is a translation handle used to translate the - * content from ASCII to the local machine format after network transmission. - * On an ASCII machine this is NULL */ -extern apr_xlate_t *ap_locale_from_ascii; - -#ifdef __cplusplus -} -#endif - -#endif /* APACHE_XLATE */ - -#endif /* !APACHE_UTIL_CHARSET_H */ diff --git a/include/util_date.h b/include/util_date.h deleted file mode 100644 index 46dbb6bbf5..0000000000 --- a/include/util_date.h +++ /dev/null @@ -1,114 +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_UTIL_DATE_H -#define APACHE_UTIL_DATE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package Apache date routines - */ - -/* - * util_date.h: prototypes for date parsing utility routines - */ - -#include "apr_time.h" - -#define BAD_DATE (apr_time_t)0 - -/** - * Compare a string to a mask - * @param data The string to compare - * @mask Mask characters (arbitrary maximum is 256 characters, just in case): - *
        - *   @ - uppercase letter
        - *   $ - lowercase letter
        - *   & - hex digit
        - *   # - digit
        - *   ~ - digit or space
        - *   * - swallow remaining characters
        - *   - exact match for any other character
        - * 
        - * @return 1 if the string matches, 0 otherwise - * @deffunc int ap_checkmask(const char *data, const char *mask) - */ -AP_DECLARE(int) ap_checkmask(const char *data, const char *mask); - -/** - * Parses an HTTP date in one of three standard forms: - *
        - *     Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123
        - *     Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
        - *     Sun Nov  6 08:49:37 1994       ; ANSI C's asctime() format
        - * 
        - * @param date The date in one of the three formats above - * @return the apr_time_t number of microseconds since 1 Jan 1970 GMT, or - * 0 if this would be out of range or if the date is invalid. - * @deffunc apr_time_t ap_parseHTTPdate(const char *date) - */ -AP_DECLARE(apr_time_t) ap_parseHTTPdate(const char *date); - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_UTIL_DATE_H */ diff --git a/include/util_ebcdic.h b/include/util_ebcdic.h deleted file mode 100644 index 6dae00b4ed..0000000000 --- a/include/util_ebcdic.h +++ /dev/null @@ -1,120 +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_UTIL_EBCDIC_H -#define APACHE_UTIL_EBCDIC_H - - -#ifdef __cplusplus -extern "C" { -#endif - -#include "apr_xlate.h" -#include "httpd.h" -#include "util_charset.h" - -/** - * @package Utilities for EBCDIC conversion - */ - -#if APR_CHARSET_EBCDIC - -/** - * Setup all of the global translation handlers - * @param pool pool to allocate out of - */ -apr_status_t ap_init_ebcdic(apr_pool_t *pool); - -/** - * Convert protocol data from the implementation character - * set to ASCII. - * @param buffer buffer to translate - * @param len number of bytes to translate - */ -void ap_xlate_proto_to_ascii(char *buffer, apr_size_t len); - -/** - * Convert protocol data to the implementation character - * set from ASCII. - * @param buffer buffer to translate - * @param len number of bytes to translate - */ -void ap_xlate_proto_from_ascii(char *buffer, apr_size_t len); - -/** - * Convert protocol data from the implementation charater - * set to ASCII, then send it. - * @param r the current request - * @param ... the strings to write, followed by a NULL pointer - */ -int ap_rvputs_proto_in_ascii(request_rec *r, ...); - -#ifdef __cplusplus -} -#endif - -#else /* APR_CHARSET_EBCDIC */ - -#define ap_xlate_proto_to_ascii(x,y) /* NOOP */ -#define ap_xlate_proto_from_ascii(x,y) /* NOOP */ - -#define ap_rvputs_proto_in_ascii ap_rvputs - -#endif /* APR_CHARSET_EBCDIC */ - -#endif /* !APACHE_UTIL_EBCDIC_H */ diff --git a/include/util_filter.h b/include/util_filter.h deleted file mode 100644 index 17e5c0acad..0000000000 --- a/include/util_filter.h +++ /dev/null @@ -1,450 +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 AP_FILTER_H -#define AP_FILTER_H - -#include "apr.h" -#include "apr_buckets.h" - -#include "httpd.h" - -#if APR_HAVE_STDARG_H -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @file util_filter.h - * @brief Apache filter library - */ - -/** Returned by the bottom-most filter if no data was written. - * @see ap_pass_brigade(). */ -#define AP_NOBODY_WROTE -1 -/** Returned by the bottom-most filter if no data was read. - * @see ap_get_brigade(). */ -#define AP_NOBODY_READ -2 -/** Returned when?? @bug find out when! */ -#define AP_FILTER_ERROR -3 - -/** - * input filtering modes - */ -typedef enum { - /** The filter shouldn't return until data is received or EOF is hit - * or an error occurs. */ - AP_MODE_BLOCKING, - /** The filter should process any available data/status as normal, - * but will not wait for additional data. */ - AP_MODE_NONBLOCKING, - /** The filter should return ::APR_SUCCESS if data is available or - * ::APR_EOF otherwise. The filter must not return any buckets of - * data. Data returned on a subsequent call, when mode is - * ::AP_MODE_BLOCKING or ::AP_MODE_NONBLOCKING. */ - AP_MODE_PEEK -} ap_input_mode_t; - -/** - * @defgroup filter 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; - -/** - * @name Filter callbacks - * - * 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_input_filter() and ap_register_output_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. - * - * The return value of a filter should be an APR status value. - * - * @ingroup filter - * @{ - */ -typedef apr_status_t (*ap_out_filter_func)(ap_filter_t *f, apr_bucket_brigade *b); -typedef apr_status_t (*ap_in_filter_func)(ap_filter_t *f, apr_bucket_brigade *b, - ap_input_mode_t mode, apr_size_t *readbytes); - -typedef union ap_filter_func { - ap_out_filter_func out_func; - ap_in_filter_func in_func; -} ap_filter_func; - -/** @} */ - -/** - * Filters have different types/classifications. These are used to group - * and sort the filters to properly sequence their operation. - * - * 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 { - /** These filters are used to alter the content that is passed through - * them. Examples are SSI or PHP. */ - AP_FTYPE_CONTENT = 10, - /** (XXX somebody rename me or get rid of me please) - * This special type ensures that the HTTP header filter ends up in - * the proper location in the filter chain. */ - AP_FTYPE_HTTP_HEADER = 20, - /** These filters implement transport encodings (e.g., chunking). */ - AP_FTYPE_TRANSCODE = 30, - /** These filters will alter the content, but in ways that are - * more strongly associated with the connection. Examples are - * splitting * an HTTP connection into multiple requests and - * buffering HTTP * responses across multiple requests. - * - * It is important to note that these types of filters are not - * allowed in a sub-request. A sub-request's output can certainly - * be filtered by ::AP_FTYPE_CONTENT filters, but all of the "final - * processing" is determined by the main request. */ - AP_FTYPE_CONNECTION = 40, - /** These filters don't alter the content. They are responsible for - * sending/receiving data to/from the client. */ - AP_FTYPE_NETWORK = 50 -} ap_filter_type; - -/** - * 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. - */ - -typedef struct ap_filter_rec_t ap_filter_rec_t; - -/** - * This 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. - */ -struct ap_filter_rec_t { - /** The registered name for this filter */ - const char *name; - /** The function to call when this filter is invoked. */ - ap_filter_func filter_func; - /** The type of filter, either AP_FTYPE_CONTENT or AP_FTYPE_CONNECTION. - * An AP_FTYPE_CONTENT filter modifies the data based on information - * found in the content. An AP_FTYPE_CONNECTION filter modifies the - * data based on the type of connection. - */ - ap_filter_type ftype; - - /** The next filter_rec in the list */ - struct ap_filter_rec_t *next; -}; - -/** - * The representation of a filter chain. Each request has a list - * of these structures which are called in turn to filter the data. Sub - * requests get an exact copy of the main requests filter chain. - */ -struct ap_filter_t { - /** The internal representation of this filter. This includes - * the filter's name, type, and the actual function pointer. - */ - ap_filter_rec_t *frec; - - /** A place to store any data associated with the current filter */ - void *ctx; - - /** The next filter in the chain */ - ap_filter_t *next; - - /** The request_rec associated with the current filter. If a sub-request - * adds filters, then the sub-request is the request associated with the - * filter. - */ - request_rec *r; - - /** The conn_rec associated with the current filter. This is analogous - * to the request_rec, except that it is used for input filtering. - */ - conn_rec *c; -}; - -/** - * Get the current bucket brigade from the next filter on the filter - * stack. The filter should return an apr_status_t value. If the bottom-most - * filter doesn't write to the network, then ::AP_NOBODY_READ is returned. - * @param filter The next filter in the chain - * @param bucket The current bucket brigade - * @param mode ::AP_MODE_BLOCKING, ::AP_MODE_NONBLOCKING, or ::AP_MODE_PEEK - * @param readbytes How many bytes to read from the next filter. 0 means that - * a single line should be read. - */ -AP_DECLARE(apr_status_t) ap_get_brigade(ap_filter_t *filter, apr_bucket_brigade *bucket, - ap_input_mode_t mode, apr_size_t *readbytes); - -/** - * Pass the current bucket brigade down to the next filter on the filter - * stack. The filter should return an apr_status_t value. If the bottom-most - * filter doesn't write to the network, then ::AP_NOBODY_WROTE is returned. - * @param filter The next filter in the chain - * @param bucket The current bucket brigade - */ -AP_DECLARE(apr_status_t) ap_pass_brigade(ap_filter_t *filter, apr_bucket_brigade *bucket); - -/** - * This function is used to register an input filter with the system. - * After this registration is performed, then a filter may be added - * into the filter chain by using ap_add_input_filter() and simply - * specifying the name. - * - * @param name The name to attach to the filter function - * @param filter_func The filter function to name - * @param ftype The type of filter function, either ::AP_FTYPE_CONTENT or :: - * AP_FTYPE_CONNECTION - * @see add_input_filter() - */ -AP_DECLARE(void) ap_register_input_filter(const char *name, - ap_in_filter_func filter_func, - ap_filter_type ftype); -/** - * This function is used to register an output filter with the system. - * After this registration is performed, then a filter may be added - * into the filter chain by using ap_add_output_filter() and simply - * specifying the name. - * - * @param name The name to attach to the filter function - * @param filter_func The filter function to name - * @param ftype The type of filter function, either ::AP_FTYPE_CONTENT or - * ::AP_FTYPE_CONNECTION - * @see ap_add_output_filter() - */ -AP_DECLARE(void) ap_register_output_filter(const char *name, - ap_out_filter_func filter_func, - ap_filter_type ftype); - -/** - * 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. - * - * To re-iterate that last comment. This function is building a FIFO - * list of filters. Take note of that when adding your filter to the chain. - * - * @param name The name of the filter to add - * @param r The request to add this filter for (or NULL if it isn't associated with a request) - * @param c The connection to add the fillter for - */ -AP_DECLARE(ap_filter_t *) ap_add_input_filter(const char *name, void *ctx, - request_rec *r, conn_rec *c); - -/** - * Add a filter to the current request. Filters are added in a FIFO manner. - * The first filter added will be the first filter called. - * @param name The name of the filter to add - * @param ctx Context data to set in the filter - * @param r The request to add this filter for (or NULL if it isn't associated with a request) - * @param c The connection to add this filter for - */ -AP_DECLARE(ap_filter_t *) ap_add_output_filter(const char *name, void *ctx, - request_rec *r, conn_rec *c); - -/** - * Remove an output filter from either the request or connection stack - * it is associated with. - * @param f The filter to remove - */ - -AP_DECLARE(void) ap_remove_output_filter(ap_filter_t *f); - -/* The next two filters are for abstraction purposes only. They could be - * done away with, but that would require that we break modules if we ever - * want to change our filter registration method. The basic idea, is that - * all filters have a place to store data, the ctx pointer. These functions - * fill out that pointer with a bucket brigade, and retrieve that data on - * the next call. The nice thing about these functions, is that they - * automatically concatenate the bucket brigades together for you. This means - * that if you have already stored a brigade in the filters ctx pointer, then - * when you add more it will be tacked onto the end of that brigade. When - * you retrieve data, if you pass in a bucket brigade to the get function, - * it will append the current brigade onto the one that you are retrieving. - */ - -/** - * prepare a bucket brigade to be setaside. If a different brigade was - * set-aside earlier, then the two brigades are concatenated together. - * @param f The current filter - * @param save_to The brigade that was previously set-aside. Regardless, the - * new bucket brigade is returned in this location. - * @param b The bucket brigade to save aside. This brigade is always empty - * on return - */ -AP_DECLARE(apr_status_t) ap_save_brigade(ap_filter_t *f, apr_bucket_brigade **save_to, - apr_bucket_brigade **b); - -/** - * Flush function for apr_brigade_* calls. This calls ap_pass_brigade - * to flush the brigade if the brigade buffer overflows. - * @param bb The brigade to flush - * @param ctx The filter to pass the brigade to - */ -AP_DECLARE_NONSTD(apr_status_t) ap_filter_flush(apr_bucket_brigade *bb, void *ctx); - -/** - * Flush the current brigade down the filter stack. - * @param f The current filter - * @param bb The brigade to flush - */ -AP_DECLARE(apr_status_t) ap_fflush(ap_filter_t *f, apr_bucket_brigade *bb); - -/** - * Write a buffer for the current filter, buffering if possible. - * @param f the filter doing the writing - * @param bb The brigade to buffer into - * @param data The data to write - * @param nbyte The number of bytes in the data - */ -#define ap_fwrite(f, bb, data, nbyte) \ - apr_brigade_write(bb, ap_filter_flush, f, data, nbyte) - -/** - * Write a buffer for the current filter, buffering if possible. - * @param f the filter doing the writing - * @param bb The brigade to buffer into - * @param str The string to write - */ -#define ap_fputs(f, bb, str) \ - apr_brigade_puts(bb, ap_filter_flush, f, str) - -/** - * Write a character for the current filter, buffering if possible. - * @param f the filter doing the writing - * @param bb The brigade to buffer into - * @param c The character to write - */ -#define ap_fputc(f, bb, c) \ - apr_brigade_putc(bb, ap_filter_flush, f, c) - -/** - * Write an unspecified number of strings to the current filter - * @param f the filter doing the writing - * @param bb The brigade to buffer into - * @param ... The strings to write - */ -AP_DECLARE_NONSTD(int) ap_fputstrs(ap_filter_t *f, apr_bucket_brigade *bb, ...); - -/** - * Output data to the filter in printf format - * @param f the filter doing the writing - * @param bb The brigade to buffer into - * @param fmt The format string - * @param ... The argumets to use to fill out the format string - */ -AP_DECLARE_NONSTD(int) ap_fprintf(ap_filter_t *f, apr_bucket_brigade *bb, const char *fmt, ...) - __attribute__((format(printf,3,4))); - -#ifdef __cplusplus -} -#endif - -#endif /* !AP_FILTER_H */ diff --git a/include/util_md5.h b/include/util_md5.h deleted file mode 100644 index 4e3a189ecd..0000000000 --- a/include/util_md5.h +++ /dev/null @@ -1,112 +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_UTIL_MD5_H -#define APACHE_UTIL_MD5_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package Apache MD5 library - */ - -#include "apr_md5.h" - -/** - * Create an MD5 checksum of a given string - * @param a Pool to allocate out of - * @param string String to get the checksum of - * @return The checksum - * @deffunc char *ap_md5(apr_pool_t *a, const unsigned char *string) - */ -AP_DECLARE(char *) ap_md5(apr_pool_t *a, const unsigned char *string); - -/** - * Create an MD5 checksum of a string of binary data - * @param a Pool to allocate out of - * @param buf Buffer to generate checksum for - * @param len The length of the buffer - * @return The checksum - * @deffunc char *ap_md5_binary(apr_pool_t *a, const unsigned char *buf, int len) - */ -AP_DECLARE(char *) ap_md5_binary(apr_pool_t *a, const unsigned char *buf, int len); - -/** - * Convert an MD5 checksum into a base64 encoding - * @param p The pool to allocate out of - * @param context The context to convert - * @return The converted encoding - * @deffunc char *ap_md5contextTo64(apr_pool_t *p, apr_md5_ctx_t *context) - */ -AP_DECLARE(char *) ap_md5contextTo64(apr_pool_t *p, apr_md5_ctx_t *context); - -/** - * Create an MD5 Digest for a given file - * @param p The pool to allocate out of - * @param infile The file to create the digest for - * @deffunc char *ap_md5digest(apr_pool_t *p, apr_file_t *infile) - */ -AP_DECLARE(char *) ap_md5digest(apr_pool_t *p, apr_file_t *infile); - -#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 4e436bf0b1..0000000000 --- a/include/util_script.h +++ /dev/null @@ -1,178 +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_UTIL_SCRIPT_H -#define APACHE_UTIL_SCRIPT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package Apache script tools - */ - -#ifndef APACHE_ARG_MAX -#ifdef _POSIX_ARG_MAX -#define APACHE_ARG_MAX _POSIX_ARG_MAX -#else -#define APACHE_ARG_MAX 512 -#endif -#endif - -/** - * Create an environment variable out of an Apache table of key-value pairs - * @param p pool to allocate out of - * @param t Apache table of key-value pairs - * @return An array containing the same key-value pairs suitable for - * use with an exec call. - * @deffunc char **ap_create_environment(apr_pool_t *p, apr_table_t *t) - */ -AP_DECLARE(char **) ap_create_environment(apr_pool_t *p, apr_table_t *t); - -/** - * 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. - * @param uri The uri we are currently parsing - * @param path_info The current path info - * @return The length of the path info - * @deffunc int ap_fine_path_info(const char *uri, const char *path_info) - */ -AP_DECLARE(int) ap_find_path_info(const char *uri, const char *path_info); - -/** - * Add CGI environment variables required by HTTP/1.1 to the request's - * environment table - * @param r the current request - * @deffunc void ap_add_cgi_vars(request_rec *r) - */ -AP_DECLARE(void) ap_add_cgi_vars(request_rec *r); - -/** - * Add common CGI environment variables to the requests environment table - * @param r The current request - * @deffunc void ap_add_common_vars(request_rec *r) - */ -AP_DECLARE(void) ap_add_common_vars(request_rec *r); - -/** - * Read headers output from a script, ensuring that the output is valid. If - * the output is valid, then the headers are added to the headers out of the - * current request - * @param r The current request - * @param f The file to read from - * @param buffer Empty when calling the function. On output, if there was an - * error, the string that cause the error is stored here. - * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise - * @deffunc int ap_scan_script_header_err(request_rec *r, apr_file_t *f, char *buffer) - */ -AP_DECLARE(int) ap_scan_script_header_err(request_rec *r, apr_file_t *f, char *buffer); - -/** - * Read headers strings from a script, ensuring that the output is valid. If - * the output is valid, then the headers are added to the headers out of the - * current request - * @param r The current request - * @param buffer Empty when calling the function. On output, if there was an - * error, the string that cause the error is stored here. - * @param termch Pointer to the last character parsed. - * @param termarg Pointer to an int to capture the last argument parsed. - * @param args String arguments to parse consecutively for headers, - * a NULL argument terminates the list. - * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise - * @deffunc int ap_scan_script_header_err_core(request_rec *r, char *buffer, int (*getsfunc)(char *, int, void *), void *getsfunc_data) - */ -AP_DECLARE_NONSTD(int) ap_scan_script_header_err_strs(request_rec *r, - char *buffer, - const char **termch, - int *termarg, ...); - -/** - * Read headers output from a script, ensuring that the output is valid. If - * the output is valid, then the headers are added to the headers out of the - * current request - * @param r The current request - * @param buffer Empty when calling the function. On output, if there was an - * error, the string that cause the error is stored here. - * @param getsfunc Function to read the headers from. This function should - act like gets() - * @param getsfunc_data The place to read from - * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise - * @deffunc int ap_scan_script_header_err_core(request_rec *r, char *buffer, int (*getsfunc)(char *, int, void *), void *getsfunc_data) - */ -AP_DECLARE(int) ap_scan_script_header_err_core(request_rec *r, char *buffer, - int (*getsfunc) (char *, int, void *), - void *getsfunc_data); - -/** - * Convert the file size given in size into a formatted string and send the - * string to the client. The size should always be in bytes, although the - * string sent to the client may be in bytes, kb, or MB, depending on the size - * of the file. - * @param size The size of the file - * @param r The currnt request - * @deffunc void ap_send_size(apr_ssize_t size, request_rec *r) - */ -AP_DECLARE(void) ap_send_size(apr_ssize_t size, request_rec *r); - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_UTIL_SCRIPT_H */ diff --git a/include/util_uri.h b/include/util_uri.h deleted file mode 100644 index b2b91201ab..0000000000 --- a/include/util_uri.h +++ /dev/null @@ -1,207 +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. - */ - -/* - * util_uri.h: External Interface of util_uri.c - */ - -#ifndef UTIL_URI_H -#define UTIL_URI_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package Apache URI library - */ - -typedef struct schemes_t schemes_t; - -/** Structure to store various schemes and their default ports */ -struct schemes_t { - /** The name of the scheme */ - const char *name; - /** The default port for the scheme */ - apr_port_t default_port; -}; - -#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_SNEWS_PORT 563 -#define DEFAULT_PROSPERO_PORT 1525 /* WARNING: conflict w/Oracle */ - -/* Flags passed to unparse_uri_components(): */ -#define UNP_OMITSITEPART (1U<<0) /* suppress "scheme://user@site:port" */ -#define UNP_OMITUSER (1U<<1) /* Just omit user */ -#define UNP_OMITPASSWORD (1U<<2) /* Just omit password */ -#define UNP_OMITUSERINFO (UNP_OMITUSER|UNP_OMITPASSWORD) /* omit "user:password@" part */ -#define UNP_REVEALPASSWORD (1U<<3) /* Show plain text password (default: show XXXXXXXX) */ -#define UNP_OMITPATHINFO (1U<<4) /* Show "scheme://user@site:port" only */ -#define UNP_OMITQUERY (1U<<5) /* Omit the "?queryarg" from the path */ - -typedef struct uri_components uri_components; - -/** - * A structure to encompass all of the fields in a uri - */ -struct uri_components { - /** scheme ("http"/"ftp"/...) */ - char *scheme; - /** combined [user[:password]@]host[:port] */ - char *hostinfo; - /** user name, as in http://user:passwd@host:port/ */ - char *user; - /** password, as in http://user:passwd@host:port/ */ - char *password; - /** hostname from URI (or from Host: header) */ - char *hostname; - /** port string (integer representation is in "port") */ - char *port_str; - /** the request path (or "/" if only scheme://host was given) */ - char *path; - /** Everything after a '?' in the path, if present */ - char *query; - /** Trailing "#fragment" string, if present */ - char *fragment; - - /** structure returned from gethostbyname() - * @defvar struct hostent *hostent */ - struct hostent *hostent; - - /** The port number, numeric, valid only if port_str != NULL */ - apr_port_t port; - - /** has the structure been initialized */ - unsigned is_initialized:1; - - /** has the DNS been looked up yet */ - unsigned dns_looked_up:1; - /** has the dns been resolved yet */ - unsigned dns_resolved:1; -}; - -/* util_uri.c */ -/** - * Return the default port for a given scheme. The schemes recognized are - * http, ftp, https, gopher, wais, nntp, snews, and prospero - * @param scheme_str The string that contains the current scheme - * @return The default port for this scheme - * @deffunc apr_port_t ap_default_port_for_scheme(const char *scheme_str) - */ -AP_DECLARE(apr_port_t) ap_default_port_for_scheme(const char *scheme_str); - -/** - * Return the default for the current request - * @param r The current request - * @return The default port - * @deffunc apr_port_t ap_default_port_for_request(const request_rec *r) - */ -AP_DECLARE(apr_port_t) ap_default_port_for_request(const request_rec *r); - -/** - * Unparse a uri_components structure to an URI string. Optionally suppress - * the password for security reasons. - * @param p The pool to allocate out of - * @param uri_components All of the parts of the uri - * @param flags How to unparse the uri. One of: - *
        - *    UNP_OMITSITEPART        suppress "scheme://user@site:port" 
        - *    UNP_OMITUSER            Just omit user 
        - *    UNP_OMITPASSWORD        Just omit password 
        - *    UNP_OMITUSERINFO        omit "user:password@" part 
        - *    UNP_REVEALPASSWORD      Show plain text password (default: show XXXXXXXX) 
        - *    UNP_OMITPATHINFO        Show "scheme://user@site:port" only 
        - *    UNP_OMITQUERY           Omit the "?queryarg" from the path 
        - * 
        - * @return The uri as a string - * @deffunc char * ap_unparse_uri_components(apr_pool_t *p, const uri_components *uptr, unsigned flags) - */ -AP_DECLARE(char *) ap_unparse_uri_components(apr_pool_t *p, const uri_components *uptr, - unsigned flags); - -/** - * Parse a given URI, fill in all supplied fields of a uri_components - * structure. This eliminates the necessity of extracting host, port, - * path, query info repeatedly in the modules. - * @param p The pool to allocate out of - * @param uri The uri to parse - * @param uptr The uri_components to fill out - * @return An HTTP status code - * @deffunc int ap_parse_uri_components(apr_pool_t *p, const char *uri, uri_components *uptr) - */ -AP_DECLARE(int) ap_parse_uri_components(apr_pool_t *p, const char *uri, uri_components *uptr); - -/** - * Special case for CONNECT parsing: it comes with the hostinfo part only - * @param p The pool to allocate out of - * @param hostinfo The hostinfo string to parse - * @param uptr The uri_components to fill out - * @return An HTTP status code - * @deffunc int ap_parse_hostinfo_components(apr_pool_t *p, const char *hostinfo, uri_components *uptr) - */ -AP_DECLARE(int) ap_parse_hostinfo_components(apr_pool_t *p, const char *hostinfo, uri_components *uptr); - -#ifdef __cplusplus -} -#endif - -#endif /*UTIL_URI_H*/ diff --git a/include/util_xml.h b/include/util_xml.h deleted file mode 100644 index 42b7f1d3ec..0000000000 --- a/include/util_xml.h +++ /dev/null @@ -1,85 +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_XML_H -#define UTIL_XML_H - -#include "apr_xml.h" -#include "apu_compat.h" - -#include "httpd.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package Apache XML library - */ - -/** - * Get XML post data and parse it - * @param r The current request - * @param pdoc The XML post data - * @return HTTP status code - * @deffunc int ap_xml_parse_input(request_rec *r, apr_xml_doc **pdoc) - */ -AP_DECLARE(int) ap_xml_parse_input(request_rec *r, apr_xml_doc **pdoc); - - -#ifdef __cplusplus -} -#endif - -#endif /* UTIL_XML_H */ diff --git a/libhttpd.dsp b/libhttpd.dsp deleted file mode 100644 index d771060613..0000000000 --- a/libhttpd.dsp +++ /dev/null @@ -1,497 +0,0 @@ -# Microsoft Developer Studio Project File - Name="libhttpd" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=libhttpd - 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 "libhttpd.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 "libhttpd.mak" CFG="libhttpd - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libhttpd - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "libhttpd - 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)" == "libhttpd - 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 /I ".\include" /I ".\srclib\apr\include" /I ".\srclib\apr-util\include" /I "./server/mpm/winnt" /I "./srclib/expat-lite" /I "./os/win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "AP_DECLARE_EXPORT" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I ".\include" /I ".\srclib\apr\include" /I ".\srclib\apr-util\include" /I "./server/mpm/winnt" /I "./srclib/expat-lite" /I "./os/win32" /I "./modules/http" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "AP_DECLARE_EXPORT" /Fd"Release\libhttpd" /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",libhttpd -# ADD LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /machine:I386 /base:@"os\win32\BaseAddr.ref",libhttpd - -!ELSEIF "$(CFG)" == "libhttpd - 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 /I ".\include" /I ".\srclib\apr\include" /I ".\srclib\apr-util\include" /I "./server/mpm/winnt" /I "./srclib/expat-lite" /I "./os/win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "AP_DECLARE_EXPORT" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I ".\include" /I ".\srclib\apr\include" /I ".\srclib\apr-util\include" /I "./server/mpm/winnt" /I "./srclib/expat-lite" /I "./os/win32" /I "./modules/http" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "AP_DECLARE_EXPORT" /Fd"Debug\libhttpd" /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 advapi32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /base:@"os\win32\BaseAddr.ref",libhttpd -# ADD LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /base:@"os\win32\BaseAddr.ref",libhttpd - -!ENDIF - -# Begin Target - -# Name "libhttpd - Win32 Release" -# Name "libhttpd - Win32 Debug" -# Begin Group "Configuration" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=.\include\ap_config.h -# End Source File -# Begin Source File - -SOURCE=.\include\ap_mmn.h -# End Source File -# Begin Source File - -SOURCE=.\include\ap_release.h -# End Source File -# Begin Source File - -SOURCE=.\server\buildmark.c -# End Source File -# Begin Source File - -SOURCE=.\include\http_conf_globals.h -# End Source File -# Begin Source File - -SOURCE=.\os\win32\modules.c -# End Source File -# Begin Source File - -SOURCE=.\os\win32\os.h -# End Source File -# End Group -# Begin Group "Generated Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\server\gen_test_char.exe - -!IF "$(CFG)" == "libhttpd - Win32 Release" - -# Begin Custom Build - Generating test_char.h -InputPath=.\server\gen_test_char.exe - -".\server\test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - .\server\gen_test_char.exe >.\server\test_char.h - echo Generated test_char.h from gen_test_char.exe - -# End Custom Build - -!ELSEIF "$(CFG)" == "libhttpd - Win32 Debug" - -# Begin Custom Build - Generating test_char.h -InputPath=.\server\gen_test_char.exe - -".\server\test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - .\server\gen_test_char.exe >.\server\test_char.h - echo Generated test_char.h from gen_test_char.exe - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\server\gen_uri_delims.exe - -!IF "$(CFG)" == "libhttpd - Win32 Release" - -# Begin Custom Build - Generating uri_delims.h -InputPath=.\server\gen_uri_delims.exe - -".\server\uri_delims.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - .\server\gen_uri_delims.exe >.\server\uri_delims.h - echo Generated uri_delims.h from gen_uri_delims.exe - -# End Custom Build - -!ELSEIF "$(CFG)" == "libhttpd - Win32 Debug" - -# Begin Custom Build - Generating uri_delims.h -InputPath=.\server\gen_uri_delims.exe - -".\server\uri_delims.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - .\server\gen_uri_delims.exe >.\server\uri_delims.h - echo Generated uri_delims.h from gen_uri_delims.exe - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\server\test_char.h -# End Source File -# Begin Source File - -SOURCE=.\server\uri_delims.h -# End Source File -# End Group -# Begin Group "httpd" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\server\config.c -# End Source File -# Begin Source File - -SOURCE=.\server\connection.c -# End Source File -# Begin Source File - -SOURCE=.\include\http_config.h -# End Source File -# Begin Source File - -SOURCE=.\include\http_connection.h -# End Source File -# Begin Source File - -SOURCE=.\include\http_log.h -# End Source File -# Begin Source File - -SOURCE=.\include\http_main.h -# End Source File -# Begin Source File - -SOURCE=.\include\http_vhost.h -# End Source File -# Begin Source File - -SOURCE=.\include\httpd.h -# End Source File -# Begin Source File - -SOURCE=.\server\log.c -# End Source File -# Begin Source File - -SOURCE=.\server\scoreboard.c -# End Source File -# Begin Source File - -SOURCE=.\server\vhost.c -# End Source File -# End Group -# Begin Group "modules" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\modules\http\http_core.c -# End Source File -# Begin Source File - -SOURCE=.\include\http_core.h -# End Source File -# Begin Source File - -SOURCE=.\modules\http\http_protocol.c -# End Source File -# Begin Source File - -SOURCE=.\include\http_protocol.h -# End Source File -# Begin Source File - -SOURCE=.\modules\http\http_request.c -# End Source File -# Begin Source File - -SOURCE=.\include\http_request.h -# End Source File -# Begin Source File - -SOURCE=.\modules\aaa\mod_access.c -# End Source File -# Begin Source File - -SOURCE=.\modules\mappers\mod_actions.c -# End Source File -# Begin Source File - -SOURCE=.\modules\mappers\mod_alias.c -# End Source File -# Begin Source File - -SOURCE=.\modules\generators\mod_asis.c -# End Source File -# Begin Source File - -SOURCE=.\modules\aaa\mod_auth.c -# End Source File -# Begin Source File - -SOURCE=.\modules\generators\mod_autoindex.c -# End Source File -# Begin Source File - -SOURCE=.\modules\generators\mod_cgi.c -# End Source File -# Begin Source File - -SOURCE=.\modules\http\mod_core.h -# End Source File -# Begin Source File - -SOURCE=.\modules\mappers\mod_dir.c -# End Source File -# Begin Source File - -SOURCE=.\modules\metadata\mod_env.c -# End Source File -# Begin Source File - -SOURCE=.\modules\mappers\mod_imap.c -# End Source File -# Begin Source File - -SOURCE=.\modules\filters\mod_include.c -# End Source File -# Begin Source File - -SOURCE=.\modules\filters\mod_include.h -# End Source File -# Begin Source File - -SOURCE=.\modules\arch\win32\mod_isapi.c -# End Source File -# Begin Source File - -SOURCE=.\modules\loggers\mod_log_config.c -# End Source File -# Begin Source File - -SOURCE=.\modules\http\mod_mime.c -# End Source File -# Begin Source File - -SOURCE=.\modules\mappers\mod_negotiation.c -# End Source File -# Begin Source File - -SOURCE=.\modules\metadata\mod_setenvif.c -# End Source File -# Begin Source File - -SOURCE=.\modules\mappers\mod_so.c -# End Source File -# Begin Source File - -SOURCE=.\modules\mappers\mod_userdir.c -# End Source File -# End Group -# Begin Group "util" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\server\error_bucket.c -# End Source File -# Begin Source File - -SOURCE=.\server\core.c -# End Source File -# Begin Source File - -SOURCE=.\server\request.c -# End Source File -# Begin Source File - -SOURCE=.\server\protocol.c -# End Source File -# Begin Source File - -SOURCE=.\server\rfc1413.c -# End Source File -# Begin Source File - -SOURCE=.\include\rfc1413.h -# End Source File -# Begin Source File - -SOURCE=.\server\util.c -# End Source File -# Begin Source File - -SOURCE=.\server\util_cfgtree.c -# End Source File -# Begin Source File - -SOURCE=.\include\util_cfgtree.h -# End Source File -# Begin Source File - -SOURCE=.\include\util_charset.h -# End Source File -# Begin Source File - -SOURCE=.\server\util_date.c -# End Source File -# Begin Source File - -SOURCE=.\include\util_date.h -# End Source File -# Begin Source File - -SOURCE=.\include\util_ebcdic.h -# End Source File -# Begin Source File - -SOURCE=.\server\util_filter.c -# End Source File -# Begin Source File - -SOURCE=.\include\util_filter.h -# End Source File -# Begin Source File - -SOURCE=.\server\util_md5.c -# End Source File -# Begin Source File - -SOURCE=.\include\util_md5.h -# End Source File -# Begin Source File - -SOURCE=.\server\util_script.c -# End Source File -# Begin Source File - -SOURCE=.\include\util_script.h -# End Source File -# Begin Source File - -SOURCE=.\server\util_uri.c -# End Source File -# Begin Source File - -SOURCE=.\include\util_uri.h -# End Source File -# Begin Source File - -SOURCE=.\os\win32\util_win32.c -# End Source File -# Begin Source File - -SOURCE=.\server\util_xml.c -# End Source File -# Begin Source File - -SOURCE=.\include\util_xml.h -# End Source File -# End Group -# Begin Group "mpm_winnt" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\include\ap_listen.h -# End Source File -# Begin Source File - -SOURCE=.\include\ap_mpm.h -# End Source File -# Begin Source File - -SOURCE=.\server\listen.c -# End Source File -# Begin Source File - -SOURCE=.\server\mpm\winnt\mpm.h -# End Source File -# Begin Source File - -SOURCE=.\include\mpm_common.h -# End Source File -# Begin Source File - -SOURCE=.\server\mpm\winnt\mpm_default.h -# End Source File -# Begin Source File - -SOURCE=.\include\mpm_status.h -# End Source File -# Begin Source File - -SOURCE=.\server\mpm\winnt\mpm_winnt.c -# End Source File -# Begin Source File - -SOURCE=.\server\mpm\winnt\mpm_winnt.h -# End Source File -# Begin Source File - -SOURCE=.\server\mpm\winnt\registry.c -# End Source File -# Begin Source File - -SOURCE=.\server\mpm\winnt\service.c -# End Source File -# End Group -# End Target -# End Project diff --git a/libhttpd.mak b/libhttpd.mak deleted file mode 100644 index 36f775d19f..0000000000 --- a/libhttpd.mak +++ /dev/null @@ -1,2673 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on libhttpd.dsp -!IF "$(CFG)" == "" -CFG=libhttpd - Win32 Release -!MESSAGE No configuration specified. Defaulting to libhttpd - Win32 Release. -!ENDIF - -!IF "$(CFG)" != "libhttpd - Win32 Release" && "$(CFG)" !=\ - "libhttpd - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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 "libhttpd.mak" CFG="libhttpd - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libhttpd - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "libhttpd - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "libhttpd - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\libhttpd.dll" - -!ELSE - -ALL : "gen_uri_delims - Win32 Release" "gen_test_char - Win32 Release"\ - "pcreposix - Win32 Release" "pcre - Win32 Release" "libaprutil - Win32 Release"\ - "libapr - Win32 Release" "$(OUTDIR)\libhttpd.dll" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 ReleaseCLEAN" "libaprutil - Win32 ReleaseCLEAN"\ - "pcre - Win32 ReleaseCLEAN" "pcreposix - Win32 ReleaseCLEAN"\ - "gen_test_char - Win32 ReleaseCLEAN" "gen_uri_delims - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\buildmark.obj" - -@erase "$(INTDIR)\config.obj" - -@erase "$(INTDIR)\connection.obj" - -@erase "$(INTDIR)\core.obj" - -@erase "$(INTDIR)\error_bucket.obj" - -@erase "$(INTDIR)\http_core.obj" - -@erase "$(INTDIR)\http_protocol.obj" - -@erase "$(INTDIR)\http_request.obj" - -@erase "$(INTDIR)\libhttpd.idb" - -@erase "$(INTDIR)\listen.obj" - -@erase "$(INTDIR)\log.obj" - -@erase "$(INTDIR)\mod_access.obj" - -@erase "$(INTDIR)\mod_actions.obj" - -@erase "$(INTDIR)\mod_alias.obj" - -@erase "$(INTDIR)\mod_asis.obj" - -@erase "$(INTDIR)\mod_auth.obj" - -@erase "$(INTDIR)\mod_autoindex.obj" - -@erase "$(INTDIR)\mod_cgi.obj" - -@erase "$(INTDIR)\mod_dir.obj" - -@erase "$(INTDIR)\mod_env.obj" - -@erase "$(INTDIR)\mod_imap.obj" - -@erase "$(INTDIR)\mod_include.obj" - -@erase "$(INTDIR)\mod_isapi.obj" - -@erase "$(INTDIR)\mod_log_config.obj" - -@erase "$(INTDIR)\mod_mime.obj" - -@erase "$(INTDIR)\mod_negotiation.obj" - -@erase "$(INTDIR)\mod_setenvif.obj" - -@erase "$(INTDIR)\mod_so.obj" - -@erase "$(INTDIR)\mod_userdir.obj" - -@erase "$(INTDIR)\modules.obj" - -@erase "$(INTDIR)\mpm_winnt.obj" - -@erase "$(INTDIR)\protocol.obj" - -@erase "$(INTDIR)\registry.obj" - -@erase "$(INTDIR)\request.obj" - -@erase "$(INTDIR)\rfc1413.obj" - -@erase "$(INTDIR)\scoreboard.obj" - -@erase "$(INTDIR)\service.obj" - -@erase "$(INTDIR)\util.obj" - -@erase "$(INTDIR)\util_cfgtree.obj" - -@erase "$(INTDIR)\util_date.obj" - -@erase "$(INTDIR)\util_filter.obj" - -@erase "$(INTDIR)\util_md5.obj" - -@erase "$(INTDIR)\util_script.obj" - -@erase "$(INTDIR)\util_uri.obj" - -@erase "$(INTDIR)\util_win32.obj" - -@erase "$(INTDIR)\util_xml.obj" - -@erase "$(INTDIR)\vhost.obj" - -@erase "$(OUTDIR)\libhttpd.dll" - -@erase "$(OUTDIR)\libhttpd.exp" - -@erase "$(OUTDIR)\libhttpd.lib" - -@erase "$(OUTDIR)\libhttpd.map" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I ".\include" /I ".\srclib\apr\include" /I\ - ".\srclib\apr-util\include" /I "./server/mpm/winnt" /I "./srclib/expat-lite" /I\ - "./os/win32" /I "./modules/http" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\ - "AP_DECLARE_EXPORT" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libhttpd" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\libhttpd.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib\ - /nologo /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libhttpd.pdb"\ - /map:"$(INTDIR)\libhttpd.map" /machine:I386 /out:"$(OUTDIR)\libhttpd.dll"\ - /implib:"$(OUTDIR)\libhttpd.lib" /base:@"os\win32\BaseAddr.ref",libhttpd -LINK32_OBJS= \ - "$(INTDIR)\buildmark.obj" \ - "$(INTDIR)\config.obj" \ - "$(INTDIR)\connection.obj" \ - "$(INTDIR)\core.obj" \ - "$(INTDIR)\error_bucket.obj" \ - "$(INTDIR)\http_core.obj" \ - "$(INTDIR)\http_protocol.obj" \ - "$(INTDIR)\http_request.obj" \ - "$(INTDIR)\listen.obj" \ - "$(INTDIR)\log.obj" \ - "$(INTDIR)\mod_access.obj" \ - "$(INTDIR)\mod_actions.obj" \ - "$(INTDIR)\mod_alias.obj" \ - "$(INTDIR)\mod_asis.obj" \ - "$(INTDIR)\mod_auth.obj" \ - "$(INTDIR)\mod_autoindex.obj" \ - "$(INTDIR)\mod_cgi.obj" \ - "$(INTDIR)\mod_dir.obj" \ - "$(INTDIR)\mod_env.obj" \ - "$(INTDIR)\mod_imap.obj" \ - "$(INTDIR)\mod_include.obj" \ - "$(INTDIR)\mod_isapi.obj" \ - "$(INTDIR)\mod_log_config.obj" \ - "$(INTDIR)\mod_mime.obj" \ - "$(INTDIR)\mod_negotiation.obj" \ - "$(INTDIR)\mod_setenvif.obj" \ - "$(INTDIR)\mod_so.obj" \ - "$(INTDIR)\mod_userdir.obj" \ - "$(INTDIR)\modules.obj" \ - "$(INTDIR)\mpm_winnt.obj" \ - "$(INTDIR)\protocol.obj" \ - "$(INTDIR)\registry.obj" \ - "$(INTDIR)\request.obj" \ - "$(INTDIR)\rfc1413.obj" \ - "$(INTDIR)\scoreboard.obj" \ - "$(INTDIR)\service.obj" \ - "$(INTDIR)\util.obj" \ - "$(INTDIR)\util_cfgtree.obj" \ - "$(INTDIR)\util_date.obj" \ - "$(INTDIR)\util_filter.obj" \ - "$(INTDIR)\util_md5.obj" \ - "$(INTDIR)\util_script.obj" \ - "$(INTDIR)\util_uri.obj" \ - "$(INTDIR)\util_win32.obj" \ - "$(INTDIR)\util_xml.obj" \ - "$(INTDIR)\vhost.obj" \ - ".\srclib\apr-util\Release\libaprutil.lib" \ - ".\srclib\apr\Release\libapr.lib" \ - ".\srclib\pcre\LibR\pcre.lib" \ - ".\srclib\pcre\LibR\pcreposix.lib" - -"$(OUTDIR)\libhttpd.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "libhttpd - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\libhttpd.dll" - -!ELSE - -ALL : "gen_uri_delims - Win32 Debug" "gen_test_char - Win32 Debug"\ - "pcreposix - Win32 Debug" "pcre - Win32 Debug" "libaprutil - Win32 Debug"\ - "libapr - Win32 Debug" "$(OUTDIR)\libhttpd.dll" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 DebugCLEAN" "libaprutil - Win32 DebugCLEAN"\ - "pcre - Win32 DebugCLEAN" "pcreposix - Win32 DebugCLEAN"\ - "gen_test_char - Win32 DebugCLEAN" "gen_uri_delims - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\buildmark.obj" - -@erase "$(INTDIR)\config.obj" - -@erase "$(INTDIR)\connection.obj" - -@erase "$(INTDIR)\core.obj" - -@erase "$(INTDIR)\error_bucket.obj" - -@erase "$(INTDIR)\http_core.obj" - -@erase "$(INTDIR)\http_protocol.obj" - -@erase "$(INTDIR)\http_request.obj" - -@erase "$(INTDIR)\libhttpd.idb" - -@erase "$(INTDIR)\listen.obj" - -@erase "$(INTDIR)\log.obj" - -@erase "$(INTDIR)\mod_access.obj" - -@erase "$(INTDIR)\mod_actions.obj" - -@erase "$(INTDIR)\mod_alias.obj" - -@erase "$(INTDIR)\mod_asis.obj" - -@erase "$(INTDIR)\mod_auth.obj" - -@erase "$(INTDIR)\mod_autoindex.obj" - -@erase "$(INTDIR)\mod_cgi.obj" - -@erase "$(INTDIR)\mod_dir.obj" - -@erase "$(INTDIR)\mod_env.obj" - -@erase "$(INTDIR)\mod_imap.obj" - -@erase "$(INTDIR)\mod_include.obj" - -@erase "$(INTDIR)\mod_isapi.obj" - -@erase "$(INTDIR)\mod_log_config.obj" - -@erase "$(INTDIR)\mod_mime.obj" - -@erase "$(INTDIR)\mod_negotiation.obj" - -@erase "$(INTDIR)\mod_setenvif.obj" - -@erase "$(INTDIR)\mod_so.obj" - -@erase "$(INTDIR)\mod_userdir.obj" - -@erase "$(INTDIR)\modules.obj" - -@erase "$(INTDIR)\mpm_winnt.obj" - -@erase "$(INTDIR)\protocol.obj" - -@erase "$(INTDIR)\registry.obj" - -@erase "$(INTDIR)\request.obj" - -@erase "$(INTDIR)\rfc1413.obj" - -@erase "$(INTDIR)\scoreboard.obj" - -@erase "$(INTDIR)\service.obj" - -@erase "$(INTDIR)\util.obj" - -@erase "$(INTDIR)\util_cfgtree.obj" - -@erase "$(INTDIR)\util_date.obj" - -@erase "$(INTDIR)\util_filter.obj" - -@erase "$(INTDIR)\util_md5.obj" - -@erase "$(INTDIR)\util_script.obj" - -@erase "$(INTDIR)\util_uri.obj" - -@erase "$(INTDIR)\util_win32.obj" - -@erase "$(INTDIR)\util_xml.obj" - -@erase "$(INTDIR)\vhost.obj" - -@erase "$(OUTDIR)\libhttpd.dll" - -@erase "$(OUTDIR)\libhttpd.exp" - -@erase "$(OUTDIR)\libhttpd.lib" - -@erase "$(OUTDIR)\libhttpd.map" - -@erase "$(OUTDIR)\libhttpd.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Zi /Od /I ".\include" /I ".\srclib\apr\include"\ - /I ".\srclib\apr-util\include" /I "./server/mpm/winnt" /I "./srclib/expat-lite"\ - /I "./os/win32" /I "./modules/http" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D\ - "AP_DECLARE_EXPORT" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libhttpd" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\libhttpd.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib\ - /nologo /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libhttpd.pdb"\ - /map:"$(INTDIR)\libhttpd.map" /debug /machine:I386\ - /out:"$(OUTDIR)\libhttpd.dll" /implib:"$(OUTDIR)\libhttpd.lib"\ - /base:@"os\win32\BaseAddr.ref",libhttpd -LINK32_OBJS= \ - "$(INTDIR)\buildmark.obj" \ - "$(INTDIR)\config.obj" \ - "$(INTDIR)\connection.obj" \ - "$(INTDIR)\core.obj" \ - "$(INTDIR)\error_bucket.obj" \ - "$(INTDIR)\http_core.obj" \ - "$(INTDIR)\http_protocol.obj" \ - "$(INTDIR)\http_request.obj" \ - "$(INTDIR)\listen.obj" \ - "$(INTDIR)\log.obj" \ - "$(INTDIR)\mod_access.obj" \ - "$(INTDIR)\mod_actions.obj" \ - "$(INTDIR)\mod_alias.obj" \ - "$(INTDIR)\mod_asis.obj" \ - "$(INTDIR)\mod_auth.obj" \ - "$(INTDIR)\mod_autoindex.obj" \ - "$(INTDIR)\mod_cgi.obj" \ - "$(INTDIR)\mod_dir.obj" \ - "$(INTDIR)\mod_env.obj" \ - "$(INTDIR)\mod_imap.obj" \ - "$(INTDIR)\mod_include.obj" \ - "$(INTDIR)\mod_isapi.obj" \ - "$(INTDIR)\mod_log_config.obj" \ - "$(INTDIR)\mod_mime.obj" \ - "$(INTDIR)\mod_negotiation.obj" \ - "$(INTDIR)\mod_setenvif.obj" \ - "$(INTDIR)\mod_so.obj" \ - "$(INTDIR)\mod_userdir.obj" \ - "$(INTDIR)\modules.obj" \ - "$(INTDIR)\mpm_winnt.obj" \ - "$(INTDIR)\protocol.obj" \ - "$(INTDIR)\registry.obj" \ - "$(INTDIR)\request.obj" \ - "$(INTDIR)\rfc1413.obj" \ - "$(INTDIR)\scoreboard.obj" \ - "$(INTDIR)\service.obj" \ - "$(INTDIR)\util.obj" \ - "$(INTDIR)\util_cfgtree.obj" \ - "$(INTDIR)\util_date.obj" \ - "$(INTDIR)\util_filter.obj" \ - "$(INTDIR)\util_md5.obj" \ - "$(INTDIR)\util_script.obj" \ - "$(INTDIR)\util_uri.obj" \ - "$(INTDIR)\util_win32.obj" \ - "$(INTDIR)\util_xml.obj" \ - "$(INTDIR)\vhost.obj" \ - ".\srclib\apr-util\Debug\libaprutil.lib" \ - ".\srclib\apr\Debug\libapr.lib" \ - ".\srclib\pcre\LibD\pcre.lib" \ - ".\srclib\pcre\LibD\pcreposix.lib" - -"$(OUTDIR)\libhttpd.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "libhttpd - Win32 Release" || "$(CFG)" ==\ - "libhttpd - Win32 Debug" -SOURCE=.\server\buildmark.c -DEP_CPP_BUILD=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_BUILD=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\buildmark.obj" : $(SOURCE) $(DEP_CPP_BUILD) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\os\win32\modules.c -DEP_CPP_MODUL=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MODUL=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\modules.obj" : $(SOURCE) $(DEP_CPP_MODUL) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\gen_test_char.exe - -!IF "$(CFG)" == "libhttpd - Win32 Release" - -InputPath=.\server\gen_test_char.exe - -".\server\test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - .\server\gen_test_char.exe >.\server\test_char.h - echo Generated test_char.h from gen_test_char.exe - - -!ELSEIF "$(CFG)" == "libhttpd - Win32 Debug" - -InputPath=.\server\gen_test_char.exe - -".\server\test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - .\server\gen_test_char.exe >.\server\test_char.h - echo Generated test_char.h from gen_test_char.exe - - -!ENDIF - -SOURCE=.\server\gen_uri_delims.exe - -!IF "$(CFG)" == "libhttpd - Win32 Release" - -InputPath=.\server\gen_uri_delims.exe - -".\server\uri_delims.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - .\server\gen_uri_delims.exe >.\server\uri_delims.h - echo Generated uri_delims.h from gen_uri_delims.exe - - -!ELSEIF "$(CFG)" == "libhttpd - Win32 Debug" - -InputPath=.\server\gen_uri_delims.exe - -".\server\uri_delims.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - .\server\gen_uri_delims.exe >.\server\uri_delims.h - echo Generated uri_delims.h from gen_uri_delims.exe - - -!ENDIF - -SOURCE=.\server\config.c -DEP_CPP_CONFI=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.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\http_vhost.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_CONFI=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\config.obj" : $(SOURCE) $(DEP_CPP_CONFI) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\connection.c -DEP_CPP_CONNE=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_mpm.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_connection.h"\ - ".\include\http_log.h"\ - ".\include\http_protocol.h"\ - ".\include\http_request.h"\ - ".\include\http_vhost.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\scoreboard.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\server\mpm\winnt\mpm_default.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_CONNE=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\connection.obj" : $(SOURCE) $(DEP_CPP_CONNE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\log.c -DEP_CPP_LOG_C=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_core.h"\ - ".\include\http_log.h"\ - ".\include\http_main.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_signal.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_LOG_C=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\log.obj" : $(SOURCE) $(DEP_CPP_LOG_C) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\scoreboard.c -DEP_CPP_SCORE=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_mpm.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_core.h"\ - ".\include\http_log.h"\ - ".\include\http_main.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\scoreboard.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\server\mpm\winnt\mpm.h"\ - ".\server\mpm\winnt\mpm_default.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_shmem.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_SCORE=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\scoreboard.obj" : $(SOURCE) $(DEP_CPP_SCORE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\vhost.c -DEP_CPP_VHOST=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_core.h"\ - ".\include\http_log.h"\ - ".\include\http_protocol.h"\ - ".\include\http_vhost.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_VHOST=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\vhost.obj" : $(SOURCE) $(DEP_CPP_VHOST) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\http\http_core.c -DEP_CPP_HTTP_=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_mpm.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_connection.h"\ - ".\include\http_protocol.h"\ - ".\include\http_request.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\scoreboard.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_charset.h"\ - ".\include\util_ebcdic.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\modules\http\mod_core.h"\ - ".\os\win32\os.h"\ - ".\server\mpm\winnt\mpm_default.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - ".\srclib\apr\include\apr_xlate.h"\ - -NODEP_CPP_HTTP_=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\http_core.obj" : $(SOURCE) $(DEP_CPP_HTTP_) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\http\http_protocol.c -DEP_CPP_HTTP_P=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.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\http_vhost.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_charset.h"\ - ".\include\util_date.h"\ - ".\include\util_ebcdic.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\modules\http\mod_core.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_signal.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - ".\srclib\apr\include\apr_xlate.h"\ - -NODEP_CPP_HTTP_P=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\http_protocol.obj" : $(SOURCE) $(DEP_CPP_HTTP_P) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\http\http_request.c -DEP_CPP_HTTP_R=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.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\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_charset.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\modules\http\mod_core.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_fnmatch.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - ".\srclib\apr\include\apr_xlate.h"\ - -NODEP_CPP_HTTP_R=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\http_request.obj" : $(SOURCE) $(DEP_CPP_HTTP_R) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\aaa\mod_access.c -DEP_CPP_MOD_A=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_core.h"\ - ".\include\http_log.h"\ - ".\include\http_request.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_A=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_access.obj" : $(SOURCE) $(DEP_CPP_MOD_A) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\mappers\mod_actions.c -DEP_CPP_MOD_AC=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.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\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_script.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_AC=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_actions.obj" : $(SOURCE) $(DEP_CPP_MOD_AC) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\mappers\mod_alias.c -DEP_CPP_MOD_AL=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_request.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_AL=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_alias.obj" : $(SOURCE) $(DEP_CPP_MOD_AL) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\generators\mod_asis.c -DEP_CPP_MOD_AS=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_log.h"\ - ".\include\http_main.h"\ - ".\include\http_protocol.h"\ - ".\include\http_request.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_script.h"\ - ".\include\util_uri.h"\ - ".\modules\http\mod_core.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_AS=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_asis.obj" : $(SOURCE) $(DEP_CPP_MOD_AS) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\aaa\mod_auth.c -DEP_CPP_MOD_AU=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_core.h"\ - ".\include\http_log.h"\ - ".\include\http_protocol.h"\ - ".\include\http_request.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_AU=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_auth.obj" : $(SOURCE) $(DEP_CPP_MOD_AU) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\generators\mod_autoindex.c -DEP_CPP_MOD_AUT=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.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\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_script.h"\ - ".\include\util_uri.h"\ - ".\modules\http\mod_core.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_fnmatch.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_AUT=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_autoindex.obj" : $(SOURCE) $(DEP_CPP_MOD_AUT) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\generators\mod_cgi.c -DEP_CPP_MOD_C=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_mpm.h"\ - ".\include\ap_release.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\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_script.h"\ - ".\include\util_uri.h"\ - ".\modules\filters\mod_include.h"\ - ".\modules\http\mod_core.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_optional.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_C=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_cgi.obj" : $(SOURCE) $(DEP_CPP_MOD_C) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\mappers\mod_dir.c -DEP_CPP_MOD_D=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.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\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_script.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_D=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_dir.obj" : $(SOURCE) $(DEP_CPP_MOD_D) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\metadata\mod_env.c -DEP_CPP_MOD_E=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_request.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_E=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_env.obj" : $(SOURCE) $(DEP_CPP_MOD_E) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\mappers\mod_imap.c -DEP_CPP_MOD_I=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.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\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_script.h"\ - ".\include\util_uri.h"\ - ".\modules\http\mod_core.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_I=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_imap.obj" : $(SOURCE) $(DEP_CPP_MOD_I) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\filters\mod_include.c -DEP_CPP_MOD_IN=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.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\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_charset.h"\ - ".\include\util_ebcdic.h"\ - ".\include\util_filter.h"\ - ".\include\util_script.h"\ - ".\include\util_uri.h"\ - ".\modules\filters\mod_include.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_optional.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_hash.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - ".\srclib\apr\include\apr_xlate.h"\ - -NODEP_CPP_MOD_IN=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_include.obj" : $(SOURCE) $(DEP_CPP_MOD_IN) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\arch\win32\mod_isapi.c -DEP_CPP_MOD_IS=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_core.h"\ - ".\include\http_log.h"\ - ".\include\http_protocol.h"\ - ".\include\http_request.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_script.h"\ - ".\include\util_uri.h"\ - ".\modules\http\mod_core.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_IS=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_isapi.obj" : $(SOURCE) $(DEP_CPP_MOD_IS) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\loggers\mod_log_config.c -DEP_CPP_MOD_L=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_core.h"\ - ".\include\http_log.h"\ - ".\include\http_protocol.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_L=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_log_config.obj" : $(SOURCE) $(DEP_CPP_MOD_L) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\http\mod_mime.c -DEP_CPP_MOD_M=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_log.h"\ - ".\include\http_request.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_M=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_mime.obj" : $(SOURCE) $(DEP_CPP_MOD_M) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\mappers\mod_negotiation.c -DEP_CPP_MOD_N=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_core.h"\ - ".\include\http_log.h"\ - ".\include\http_protocol.h"\ - ".\include\http_request.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_script.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_N=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_negotiation.obj" : $(SOURCE) $(DEP_CPP_MOD_N) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\metadata\mod_setenvif.c -DEP_CPP_MOD_S=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_core.h"\ - ".\include\http_log.h"\ - ".\include\http_protocol.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_S=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_setenvif.obj" : $(SOURCE) $(DEP_CPP_MOD_S) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\mappers\mod_so.c -DEP_CPP_MOD_SO=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_log.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_SO=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_so.obj" : $(SOURCE) $(DEP_CPP_MOD_SO) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\modules\mappers\mod_userdir.c -DEP_CPP_MOD_U=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_request.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_U=\ - ".\include\ap_config_auto.h"\ - ".\modules\mappers\unixd.h"\ - - -"$(INTDIR)\mod_userdir.obj" : $(SOURCE) $(DEP_CPP_MOD_U) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\core.c -DEP_CPP_CORE_=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.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\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\rfc1413.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_charset.h"\ - ".\include\util_ebcdic.h"\ - ".\include\util_filter.h"\ - ".\include\util_md5.h"\ - ".\include\util_uri.h"\ - ".\modules\http\mod_core.h"\ - ".\os\win32\os.h"\ - ".\server\mpm\winnt\mpm.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_fnmatch.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_md5.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - ".\srclib\apr\include\apr_xlate.h"\ - -NODEP_CPP_CORE_=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\core.obj" : $(SOURCE) $(DEP_CPP_CORE_) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\error_bucket.c -DEP_CPP_ERROR=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_protocol.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_ERROR=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\error_bucket.obj" : $(SOURCE) $(DEP_CPP_ERROR) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\protocol.c -DEP_CPP_PROTO=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.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\http_vhost.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_charset.h"\ - ".\include\util_date.h"\ - ".\include\util_ebcdic.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_signal.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - ".\srclib\apr\include\apr_xlate.h"\ - -NODEP_CPP_PROTO=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\protocol.obj" : $(SOURCE) $(DEP_CPP_PROTO) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\request.c -DEP_CPP_REQUE=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.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\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_charset.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\modules\http\mod_core.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_fnmatch.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - ".\srclib\apr\include\apr_xlate.h"\ - -NODEP_CPP_REQUE=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\request.obj" : $(SOURCE) $(DEP_CPP_REQUE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\rfc1413.c -DEP_CPP_RFC14=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_log.h"\ - ".\include\http_main.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\rfc1413.h"\ - ".\include\util_charset.h"\ - ".\include\util_ebcdic.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - ".\srclib\apr\include\apr_xlate.h"\ - -NODEP_CPP_RFC14=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\rfc1413.obj" : $(SOURCE) $(DEP_CPP_RFC14) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\util.c -DEP_CPP_UTIL_=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_log.h"\ - ".\include\http_main.h"\ - ".\include\http_protocol.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_charset.h"\ - ".\include\util_ebcdic.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\server\test_char.h"\ - ".\srclib\apr-util\include\apr_base64.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - ".\srclib\apr\include\apr_xlate.h"\ - -NODEP_CPP_UTIL_=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\util.obj" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)"\ - ".\server\test_char.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\util_cfgtree.c -DEP_CPP_UTIL_C=\ - ".\include\ap_config.h"\ - ".\include\util_cfgtree.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_tables.h"\ - -NODEP_CPP_UTIL_C=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\util_cfgtree.obj" : $(SOURCE) $(DEP_CPP_UTIL_C) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\util_date.c -DEP_CPP_UTIL_D=\ - ".\include\ap_config.h"\ - ".\include\util_date.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_UTIL_D=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\util_date.obj" : $(SOURCE) $(DEP_CPP_UTIL_D) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\util_filter.c -DEP_CPP_UTIL_F=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_log.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_UTIL_F=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\util_filter.obj" : $(SOURCE) $(DEP_CPP_UTIL_F) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\util_md5.c -DEP_CPP_UTIL_M=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_charset.h"\ - ".\include\util_ebcdic.h"\ - ".\include\util_md5.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_md5.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - ".\srclib\apr\include\apr_xlate.h"\ - -NODEP_CPP_UTIL_M=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\util_md5.obj" : $(SOURCE) $(DEP_CPP_UTIL_M) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\util_script.c -DEP_CPP_UTIL_S=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.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\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_charset.h"\ - ".\include\util_date.h"\ - ".\include\util_ebcdic.h"\ - ".\include\util_filter.h"\ - ".\include\util_script.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - ".\srclib\apr\include\apr_xlate.h"\ - -NODEP_CPP_UTIL_S=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\util_script.obj" : $(SOURCE) $(DEP_CPP_UTIL_S) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\util_uri.c -DEP_CPP_UTIL_U=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_log.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\server\uri_delims.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_UTIL_U=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\util_uri.obj" : $(SOURCE) $(DEP_CPP_UTIL_U) "$(INTDIR)"\ - ".\server\uri_delims.h" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\os\win32\util_win32.c -DEP_CPP_UTIL_W=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_log.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_UTIL_W=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\util_win32.obj" : $(SOURCE) $(DEP_CPP_UTIL_W) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\util_xml.c -DEP_CPP_UTIL_X=\ - ".\include\ap_config.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_core.h"\ - ".\include\http_log.h"\ - ".\include\http_protocol.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_filter.h"\ - ".\include\util_uri.h"\ - ".\include\util_xml.h"\ - ".\os\win32\os.h"\ - ".\srclib\apr-util\include\apr_buckets.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apr_ring.h"\ - ".\srclib\apr-util\include\apr_xml.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr-util\include\apu_compat.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_compat.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_mmap.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_UTIL_X=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\util_xml.obj" : $(SOURCE) $(DEP_CPP_UTIL_X) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\listen.c -DEP_CPP_LISTE=\ - ".\include\ap_config.h"\ - ".\include\ap_listen.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_log.h"\ - ".\include\httpd.h"\ - ".\include\mpm_common.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\server\mpm\winnt\mpm.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_LISTE=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\listen.obj" : $(SOURCE) $(DEP_CPP_LISTE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\mpm\winnt\mpm_winnt.c -DEP_CPP_MPM_W=\ - ".\include\ap_config.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\httpd.h"\ - ".\include\mpm_common.h"\ - ".\include\pcreposix.h"\ - ".\include\scoreboard.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\server\mpm\winnt\mpm.h"\ - ".\server\mpm\winnt\mpm_default.h"\ - ".\server\mpm\winnt\mpm_winnt.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_dso.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_getopt.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_lock.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_portable.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MPM_W=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\mpm_winnt.obj" : $(SOURCE) $(DEP_CPP_MPM_W) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\mpm\winnt\registry.c -DEP_CPP_REGIS=\ - ".\include\ap_config.h"\ - ".\include\ap_listen.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_log.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\server\mpm\winnt\mpm.h"\ - ".\server\mpm\winnt\mpm_winnt.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_REGIS=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\registry.obj" : $(SOURCE) $(DEP_CPP_REGIS) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\server\mpm\winnt\service.c -DEP_CPP_SERVI=\ - ".\include\ap_config.h"\ - ".\include\ap_listen.h"\ - ".\include\ap_mmn.h"\ - ".\include\ap_release.h"\ - ".\include\http_config.h"\ - ".\include\http_log.h"\ - ".\include\httpd.h"\ - ".\include\pcreposix.h"\ - ".\include\util_cfgtree.h"\ - ".\include\util_uri.h"\ - ".\os\win32\os.h"\ - ".\server\mpm\winnt\mpm.h"\ - ".\server\mpm\winnt\mpm_winnt.h"\ - ".\srclib\apr-util\include\apr_hooks.h"\ - ".\srclib\apr-util\include\apu.h"\ - ".\srclib\apr\include\apr.h"\ - ".\srclib\apr\include\apr_errno.h"\ - ".\srclib\apr\include\apr_file_info.h"\ - ".\srclib\apr\include\apr_file_io.h"\ - ".\srclib\apr\include\apr_general.h"\ - ".\srclib\apr\include\apr_lib.h"\ - ".\srclib\apr\include\apr_network_io.h"\ - ".\srclib\apr\include\apr_pools.h"\ - ".\srclib\apr\include\apr_strings.h"\ - ".\srclib\apr\include\apr_tables.h"\ - ".\srclib\apr\include\apr_thread_proc.h"\ - ".\srclib\apr\include\apr_time.h"\ - ".\srclib\apr\include\apr_user.h"\ - ".\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_SERVI=\ - ".\include\ap_config_auto.h"\ - - -"$(INTDIR)\service.obj" : $(SOURCE) $(DEP_CPP_SERVI) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!IF "$(CFG)" == "libhttpd - Win32 Release" - -"libapr - Win32 Release" : - cd ".\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Release" - cd "..\.." - -"libapr - Win32 ReleaseCLEAN" : - cd ".\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\.." - -!ELSEIF "$(CFG)" == "libhttpd - Win32 Debug" - -"libapr - Win32 Debug" : - cd ".\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Debug" - cd "..\.." - -"libapr - Win32 DebugCLEAN" : - cd ".\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\.." - -!ENDIF - -!IF "$(CFG)" == "libhttpd - Win32 Release" - -"libaprutil - Win32 Release" : - cd ".\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\libaprutil.mak" CFG="libaprutil - Win32 Release"\ - - cd "..\.." - -"libaprutil - Win32 ReleaseCLEAN" : - cd ".\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libaprutil.mak"\ - CFG="libaprutil - Win32 Release" RECURSE=1 - cd "..\.." - -!ELSEIF "$(CFG)" == "libhttpd - Win32 Debug" - -"libaprutil - Win32 Debug" : - cd ".\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\libaprutil.mak" CFG="libaprutil - Win32 Debug" - cd "..\.." - -"libaprutil - Win32 DebugCLEAN" : - cd ".\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libaprutil.mak"\ - CFG="libaprutil - Win32 Debug" RECURSE=1 - cd "..\.." - -!ENDIF - -!IF "$(CFG)" == "libhttpd - Win32 Release" - -"pcre - Win32 Release" : - cd ".\srclib\pcre" - $(MAKE) /$(MAKEFLAGS) /F .\pcre.mak CFG="pcre - Win32 Release" - cd "..\.." - -"pcre - Win32 ReleaseCLEAN" : - cd ".\srclib\pcre" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\pcre.mak CFG="pcre - Win32 Release"\ - RECURSE=1 - cd "..\.." - -!ELSEIF "$(CFG)" == "libhttpd - Win32 Debug" - -"pcre - Win32 Debug" : - cd ".\srclib\pcre" - $(MAKE) /$(MAKEFLAGS) /F .\pcre.mak CFG="pcre - Win32 Debug" - cd "..\.." - -"pcre - Win32 DebugCLEAN" : - cd ".\srclib\pcre" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\pcre.mak CFG="pcre - Win32 Debug" RECURSE=1\ - - cd "..\.." - -!ENDIF - -!IF "$(CFG)" == "libhttpd - Win32 Release" - -"pcreposix - Win32 Release" : - cd ".\srclib\pcre" - $(MAKE) /$(MAKEFLAGS) /F .\pcreposix.mak CFG="pcreposix - Win32 Release" - cd "..\.." - -"pcreposix - Win32 ReleaseCLEAN" : - cd ".\srclib\pcre" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\pcreposix.mak\ - CFG="pcreposix - Win32 Release" RECURSE=1 - cd "..\.." - -!ELSEIF "$(CFG)" == "libhttpd - Win32 Debug" - -"pcreposix - Win32 Debug" : - cd ".\srclib\pcre" - $(MAKE) /$(MAKEFLAGS) /F .\pcreposix.mak CFG="pcreposix - Win32 Debug" - cd "..\.." - -"pcreposix - Win32 DebugCLEAN" : - cd ".\srclib\pcre" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\pcreposix.mak CFG="pcreposix - Win32 Debug"\ - RECURSE=1 - cd "..\.." - -!ENDIF - -!IF "$(CFG)" == "libhttpd - Win32 Release" - -"gen_test_char - Win32 Release" : - cd ".\server" - $(MAKE) /$(MAKEFLAGS) /F .\gen_test_char.mak\ - CFG="gen_test_char - Win32 Release" - cd ".." - -"gen_test_char - Win32 ReleaseCLEAN" : - cd ".\server" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\gen_test_char.mak\ - CFG="gen_test_char - Win32 Release" RECURSE=1 - cd ".." - -!ELSEIF "$(CFG)" == "libhttpd - Win32 Debug" - -"gen_test_char - Win32 Debug" : - cd ".\server" - $(MAKE) /$(MAKEFLAGS) /F .\gen_test_char.mak\ - CFG="gen_test_char - Win32 Debug" - cd ".." - -"gen_test_char - Win32 DebugCLEAN" : - cd ".\server" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\gen_test_char.mak\ - CFG="gen_test_char - Win32 Debug" RECURSE=1 - cd ".." - -!ENDIF - -!IF "$(CFG)" == "libhttpd - Win32 Release" - -"gen_uri_delims - Win32 Release" : - cd ".\server" - $(MAKE) /$(MAKEFLAGS) /F .\gen_uri_delims.mak\ - CFG="gen_uri_delims - Win32 Release" - cd ".." - -"gen_uri_delims - Win32 ReleaseCLEAN" : - cd ".\server" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\gen_uri_delims.mak\ - CFG="gen_uri_delims - Win32 Release" RECURSE=1 - cd ".." - -!ELSEIF "$(CFG)" == "libhttpd - Win32 Debug" - -"gen_uri_delims - Win32 Debug" : - cd ".\server" - $(MAKE) /$(MAKEFLAGS) /F .\gen_uri_delims.mak\ - CFG="gen_uri_delims - Win32 Debug" - cd ".." - -"gen_uri_delims - Win32 DebugCLEAN" : - cd ".\server" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\gen_uri_delims.mak\ - CFG="gen_uri_delims - Win32 Debug" RECURSE=1 - cd ".." - -!ENDIF - - -!ENDIF - diff --git a/modules/.cvsignore b/modules/.cvsignore deleted file mode 100644 index 59d7d334c8..0000000000 --- a/modules/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -.deps -Debug -Release diff --git a/modules/Makefile.in b/modules/Makefile.in deleted file mode 100644 index ecb043547b..0000000000 --- a/modules/Makefile.in +++ /dev/null @@ -1,5 +0,0 @@ - -SUBDIRS = $(MODULE_DIRS) - -include $(top_srcdir)/build/rules.mk - diff --git a/modules/README b/modules/README deleted file mode 100644 index 51624a67f7..0000000000 --- a/modules/README +++ /dev/null @@ -1,55 +0,0 @@ -The directory structure for this level is as follows: - -aaa/ - This directory contains modules dealing with authorization and - authentication. - -arch/ - -cache/ - This directory houses modules that implement file and data caching - capability. - -dav/ - This directory houses modules that implement WebDAV functionality. - -echo/ - -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. - -filters/ - This directory houses modules that perform general inline data filtering. - -generators/ - This directory houses modules that perform data generation functions. - -http/ - This directory houses modules that basic HTTP protocol implementation. - -loggers/ - This directory houses modules that handle logging functions. - -mappers/ - This directory houses modules that handle URL mapping and - rewriting. - -metadata/ - This directory houses modules that deal with Header metadata. - -proxy/ - This houses the code for the proxy module for Apache. - -ssl/ - -test/ - This directory houses modules which test various components - of Apache. You should not compile these into a production - server. - -tls/ - This directory houses code for OpenSSL functionality. diff --git a/modules/aaa/.cvsignore b/modules/aaa/.cvsignore deleted file mode 100644 index 65f0cc30cf..0000000000 --- a/modules/aaa/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -Debug -Release diff --git a/modules/aaa/.indent.pro b/modules/aaa/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- 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 167b343d0d..0000000000 --- a/modules/aaa/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ - -include $(top_srcdir)/build/special.mk - diff --git a/modules/aaa/config.m4 b/modules/aaa/config.m4 deleted file mode 100644 index b8b359f9b1..0000000000 --- a/modules/aaa/config.m4 +++ /dev/null @@ -1,21 +0,0 @@ -dnl modules enabled in this directory by default - -dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]]) - -APACHE_MODPATH_INIT(aaa) - -APACHE_MODULE(access, host-based access control, , , yes) -APACHE_MODULE(auth, user-based access control, , , yes) -APACHE_MODULE(auth_anon, anonymous user access, , , most) -APACHE_MODULE(auth_dbm, DBM-based access databases, , , most) - -APACHE_MODULE(auth_db, DB-based access databases, , , , [ - AC_CHECK_HEADERS(db.h) - AC_CHECK_LIB(db,main) -]) - -APACHE_MODULE(auth_digest, RFC2617 Digest authentication, , , most) - -APR_ADDTO(LTFLAGS,-export-dynamic) - -APACHE_MODPATH_FINISH diff --git a/modules/aaa/mod_access.c b/modules/aaa/mod_access.c deleted file mode 100644 index d51df93a40..0000000000 --- a/modules/aaa/mod_access.c +++ /dev/null @@ -1,345 +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. - */ - -/* - * Security options etc. - * - * Module derived from code originally written by Rob McCool - * - */ - -#include "apr_strings.h" -#include "apr_network_io.h" -#include "apr_lib.h" - -#define APR_WANT_STRFUNC -#define APR_WANT_BYTEFUNC -#include "apr_want.h" - -#include "ap_config.h" -#include "httpd.h" -#include "http_core.h" -#include "http_config.h" -#include "http_log.h" -#include "http_request.h" - -#if APR_HAVE_NETINET_IN_H -#include -#endif - -enum allowdeny_type { - T_ENV, - T_ALL, - T_IP, - T_HOST, - T_FAIL -}; - -typedef struct { - int limited; - union { - char *from; - apr_ipsubnet_t *ip; - } x; - enum allowdeny_type type; -} allowdeny; - -/* things in the 'order' array */ -#define DENY_THEN_ALLOW 0 -#define ALLOW_THEN_DENY 1 -#define MUTUAL_FAILURE 2 - -typedef struct { - int order[METHODS]; - apr_array_header_t *allows; - apr_array_header_t *denys; -} access_dir_conf; - -module AP_MODULE_DECLARE_DATA access_module; - -static void *create_access_dir_config(apr_pool_t *p, char *dummy) -{ - access_dir_conf *conf = - (access_dir_conf *) apr_pcalloc(p, sizeof(access_dir_conf)); - int i; - - for (i = 0; i < METHODS; ++i) - conf->order[i] = DENY_THEN_ALLOW; - conf->allows = apr_array_make(p, 1, sizeof(allowdeny)); - conf->denys = apr_array_make(p, 1, sizeof(allowdeny)); - - return (void *) conf; -} - -static const char *order(cmd_parms *cmd, void *dv, const char *arg) -{ - access_dir_conf *d = (access_dir_conf *) dv; - int i, o; - - if (!strcasecmp(arg, "allow,deny")) - o = ALLOW_THEN_DENY; - else if (!strcasecmp(arg, "deny,allow")) - o = DENY_THEN_ALLOW; - else if (!strcasecmp(arg, "mutual-failure")) - o = MUTUAL_FAILURE; - else - return "unknown order"; - - for (i = 0; i < METHODS; ++i) - if (cmd->limited & (1 << i)) - d->order[i] = o; - - return NULL; -} - -static const char *allow_cmd(cmd_parms *cmd, void *dv, const char *from, - const char *where_c) -{ - access_dir_conf *d = (access_dir_conf *) dv; - allowdeny *a; - char *where = apr_pstrdup(cmd->pool, where_c); - char *s; - char msgbuf[120]; - apr_status_t rv; - - if (strcasecmp(from, "from")) - return "allow and deny must be followed by 'from'"; - - a = (allowdeny *) apr_array_push(cmd->info ? d->allows : d->denys); - a->x.from = where; - a->limited = cmd->limited; - - if (!strncasecmp(where, "env=", 4)) { - a->type = T_ENV; - a->x.from += 4; - - } - else if (!strcasecmp(where, "all")) { - a->type = T_ALL; - } - else if ((s = strchr(where, '/'))) { - *s++ = '\0'; - rv = apr_ipsubnet_create(&a->x.ip, where, s, cmd->pool); - if(APR_STATUS_IS_EINVAL(rv)) { - /* looked nothing like an IP address */ - return "An IP address was expected"; - } - else if (rv != APR_SUCCESS) { - apr_strerror(rv, msgbuf, sizeof msgbuf); - return apr_pstrdup(cmd->pool, msgbuf); - } - a->type = T_IP; - } - else if (!APR_STATUS_IS_EINVAL(rv = apr_ipsubnet_create(&a->x.ip, where, NULL, cmd->pool))) { - if (rv != APR_SUCCESS) { - apr_strerror(rv, msgbuf, sizeof msgbuf); - return apr_pstrdup(cmd->pool, msgbuf); - } - a->type = T_IP; - } - else { /* no slash, didn't look like an IP address => must be a host */ - a->type = T_HOST; - } - - return NULL; -} - -static char its_an_allow; - -static const command_rec access_cmds[] = -{ - AP_INIT_TAKE1("order", order, NULL, OR_LIMIT, - "'allow,deny', 'deny,allow', or 'mutual-failure'"), - AP_INIT_ITERATE2("allow", allow_cmd, &its_an_allow, OR_LIMIT, - "'from' followed by hostnames or IP-address wildcards"), - AP_INIT_ITERATE2("deny", allow_cmd, NULL, OR_LIMIT, - "'from' followed by hostnames or IP-address wildcards"), - {NULL} -}; - -static int in_domain(const char *domain, const char *what) -{ - int dl = strlen(domain); - int wl = strlen(what); - - if ((wl - dl) >= 0) { - if (strcasecmp(domain, &what[wl - dl]) != 0) - return 0; - - /* Make sure we matched an *entire* subdomain --- if the user - * said 'allow from good.com', we don't want people from nogood.com - * to be able to get in. - */ - - if (wl == dl) - return 1; /* matched whole thing */ - else - return (domain[0] == '.' || what[wl - dl - 1] == '.'); - } - else - return 0; -} - -static int find_allowdeny(request_rec *r, apr_array_header_t *a, int method) -{ - allowdeny *ap = (allowdeny *) a->elts; - int mmask = (1 << method); - int i; - int gothost = 0; - const char *remotehost = NULL; - - for (i = 0; i < a->nelts; ++i) { - if (!(mmask & ap[i].limited)) - continue; - - switch (ap[i].type) { - case T_ENV: - if (apr_table_get(r->subprocess_env, ap[i].x.from)) { - return 1; - } - break; - - case T_ALL: - return 1; - - case T_IP: - if (apr_ipsubnet_test(ap[i].x.ip, r->connection->remote_addr)) { - return 1; - } - break; - - case T_HOST: - if (!gothost) { - int remotehost_is_ip; - - remotehost = ap_get_remote_host(r->connection, r->per_dir_config, - REMOTE_DOUBLE_REV, &remotehost_is_ip); - - if ((remotehost == NULL) || remotehost_is_ip) - gothost = 1; - else - gothost = 2; - } - - if ((gothost == 2) && in_domain(ap[i].x.from, remotehost)) - return 1; - break; - - case T_FAIL: - /* do nothing? */ - break; - } - } - - return 0; -} - -static int check_dir_access(request_rec *r) -{ - int method = r->method_number; - access_dir_conf *a = - (access_dir_conf *) - ap_get_module_config(r->per_dir_config, &access_module); - int ret = OK; - - if (a->order[method] == ALLOW_THEN_DENY) { - ret = HTTP_FORBIDDEN; - if (find_allowdeny(r, a->allows, method)) - ret = OK; - if (find_allowdeny(r, a->denys, method)) - ret = HTTP_FORBIDDEN; - } - else if (a->order[method] == DENY_THEN_ALLOW) { - if (find_allowdeny(r, a->denys, method)) - ret = HTTP_FORBIDDEN; - if (find_allowdeny(r, a->allows, method)) - ret = OK; - } - else { - if (find_allowdeny(r, a->allows, method) - && !find_allowdeny(r, a->denys, method)) - ret = OK; - else - ret = HTTP_FORBIDDEN; - } - - if (ret == HTTP_FORBIDDEN - && (ap_satisfies(r) != SATISFY_ANY || !ap_some_auth_required(r))) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "client denied by server configuration: %s", - r->filename); - } - - return ret; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_access_checker(check_dir_access,NULL,NULL,APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA access_module = -{ - STANDARD20_MODULE_STUFF, - create_access_dir_config, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - access_cmds, - register_hooks /* register hooks */ -}; diff --git a/modules/aaa/mod_access.exp b/modules/aaa/mod_access.exp deleted file mode 100644 index f8aff339da..0000000000 --- a/modules/aaa/mod_access.exp +++ /dev/null @@ -1 +0,0 @@ -access_module diff --git a/modules/aaa/mod_auth.c b/modules/aaa/mod_auth.c deleted file mode 100644 index c3768a45fb..0000000000 --- a/modules/aaa/mod_auth.c +++ /dev/null @@ -1,338 +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_auth: authentication - * - * Rob McCool - * - * Adapted to Apache by rst. - * - * dirkx - Added Authoritative control to allow passing on to lower - * modules if and only if the userid is not known to this - * module. A known user with a faulty or absent password still - * causes an AuthRequired. The default is 'Authoritative', i.e. - * no control is passed along. - */ - -#include "apr_strings.h" -#include "apr_lib.h" /* for apr_password_validate */ - -#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" - - -typedef struct { - char *auth_pwfile; - char *auth_grpfile; - int auth_authoritative; -} auth_config_rec; - -static void *create_auth_dir_config(apr_pool_t *p, char *d) -{ - auth_config_rec *conf = apr_pcalloc(p, sizeof(*conf)); - - conf->auth_pwfile = NULL; /* just to illustrate the default really */ - conf->auth_grpfile = NULL; /* unless you have a broken HP cc */ - conf->auth_authoritative = 1; /* keep the fortress secure by default */ - return conf; -} - -static const char *set_auth_slot(cmd_parms *cmd, void *offset, const char *f, - const char *t) -{ - if (t && strcmp(t, "standard")) - return apr_pstrcat(cmd->pool, "Invalid auth file type: ", t, NULL); - - return ap_set_file_slot(cmd, offset, f); -} - -static const command_rec auth_cmds[] = -{ - AP_INIT_TAKE12("AuthUserFile", set_auth_slot, - (void *) XtOffsetOf(auth_config_rec, auth_pwfile), OR_AUTHCFG, - "text file containing user IDs and passwords"), - AP_INIT_TAKE12("AuthGroupFile", set_auth_slot, - (void *) XtOffsetOf(auth_config_rec, auth_grpfile), OR_AUTHCFG, - "text file containing group names and member user IDs"), - AP_INIT_FLAG("AuthAuthoritative", ap_set_flag_slot, - (void *) XtOffsetOf(auth_config_rec, auth_authoritative), - OR_AUTHCFG, - "Set to 'no' to allow access control to be passed along to lower " - "modules if the UserID is not known to this module"), - {NULL} -}; - -module AP_MODULE_DECLARE_DATA auth_module; - -static char *get_pw(request_rec *r, char *user, char *auth_pwfile) -{ - ap_configfile_t *f; - char l[MAX_STRING_LEN]; - const char *rpw, *w; - apr_status_t status; - - if ((status = ap_pcfg_openfile(&f, r->pool, auth_pwfile)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, - "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, ':'); - - if (!strcmp(user, w)) { - ap_cfg_closefile(f); - return ap_getword(r->pool, &rpw, ':'); - } - } - ap_cfg_closefile(f); - return NULL; -} - -static apr_table_t *groups_for_user(apr_pool_t *p, char *user, char *grpfile) -{ - ap_configfile_t *f; - apr_table_t *grps = apr_table_make(p, 15); - apr_pool_t *sp; - char l[MAX_STRING_LEN]; - const char *group_name, *ll, *w; - apr_status_t status; - - if ((status = ap_pcfg_openfile(&f, p, grpfile)) != APR_SUCCESS) { -/*add? aplog_error(APLOG_MARK, APLOG_ERR, NULL, - "Could not open group file: %s", grpfile);*/ - return NULL; - } - - apr_pool_create(&sp, p); - - while (!(ap_cfg_getline(l, MAX_STRING_LEN, f))) { - if ((l[0] == '#') || (!l[0])) - continue; - ll = l; - apr_pool_clear(sp); - - group_name = ap_getword(sp, &ll, ':'); - - while (ll[0]) { - w = ap_getword_conf(sp, &ll); - if (!strcmp(w, user)) { - apr_table_setn(grps, apr_pstrdup(p, group_name), "in"); - break; - } - } - } - ap_cfg_closefile(f); - apr_pool_destroy(sp); - return grps; -} - -/* These functions return 0 if client is OK, and proper error status - * if not... either HTTP_UNAUTHORIZED, if we made a check, and it failed, or - * HTTP_INTERNAL_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 it really is that user, for HTTP - * basic authentication... - */ - -static int authenticate_basic_user(request_rec *r) -{ - auth_config_rec *conf = ap_get_module_config(r->per_dir_config, - &auth_module); - const char *sent_pw; - char *real_pw; - apr_status_t invalid_pw; - int res; - - if ((res = ap_get_basic_auth_pw(r, &sent_pw))) - return res; - - if (!conf->auth_pwfile) - return DECLINED; - - if (!(real_pw = get_pw(r, r->user, conf->auth_pwfile))) { - if (!(conf->auth_authoritative)) - return DECLINED; - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "user %s not found: %s", r->user, r->uri); - ap_note_basic_auth_failure(r); - return HTTP_UNAUTHORIZED; - } - invalid_pw = apr_password_validate(sent_pw, real_pw); - if (invalid_pw != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "user %s: authentication failure for \"%s\": " - "Password Mismatch", - r->user, r->uri); - ap_note_basic_auth_failure(r); - return HTTP_UNAUTHORIZED; - } - return OK; -} - -/* Checking ID */ - -static int check_user_access(request_rec *r) -{ - auth_config_rec *conf = ap_get_module_config(r->per_dir_config, - &auth_module); - char *user = r->user; - int m = r->method_number; - int method_restricted = 0; - register int x; - const char *t, *w; - apr_table_t *grpstatus; - const apr_array_header_t *reqs_arr = ap_requires(r); - require_line *reqs; - - /* BUG FIX: tadc, 11-Nov-1995. If there is no "requires" directive, - * then any user will do. - */ - if (!reqs_arr) - return (OK); - reqs = (require_line *) reqs_arr->elts; - - if (conf->auth_grpfile) - grpstatus = groups_for_user(r->pool, user, conf->auth_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 (!strcmp(w, "valid-user")) - return OK; - if (!strcmp(w, "user")) { - while (t[0]) { - w = ap_getword_conf(r->pool, &t); - if (!strcmp(user, w)) - return OK; - } - } - else if (!strcmp(w, "group")) { - if (!grpstatus) - return DECLINED; /* DBM group? Something else? */ - - while (t[0]) { - w = ap_getword_conf(r->pool, &t); - if (apr_table_get(grpstatus, w)) - return OK; - } - } else if (conf->auth_authoritative) { - /* if we aren't authoritative, any require directive could be - * valid even if we don't grok it. However, if we are - * authoritative, we can warn the user they did something wrong. - * That something could be a missing "AuthAuthoritative off", but - * more likely is a typo in the require directive. - */ - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "access to %s failed, reason: unknown require directive:" - "\"%s\"", r->uri, reqs[x].requirement); - } - } - - if (!method_restricted) - return OK; - - if (!(conf->auth_authoritative)) - return DECLINED; - - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "access to %s failed, reason: user %s not allowed access", - r->uri, user); - - ap_note_basic_auth_failure(r); - return HTTP_UNAUTHORIZED; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_check_user_id(authenticate_basic_user,NULL,NULL,APR_HOOK_MIDDLE); - ap_hook_auth_checker(check_user_access,NULL,NULL,APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA auth_module = -{ - STANDARD20_MODULE_STUFF, - create_auth_dir_config, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - auth_cmds, /* command apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/aaa/mod_auth.exp b/modules/aaa/mod_auth.exp deleted file mode 100644 index 76adad0a66..0000000000 --- a/modules/aaa/mod_auth.exp +++ /dev/null @@ -1 +0,0 @@ -auth_module diff --git a/modules/aaa/mod_auth_anon.c b/modules/aaa/mod_auth_anon.c deleted file mode 100644 index 5b008ae6ce..0000000000 --- a/modules/aaa/mod_auth_anon.c +++ /dev/null @@ -1,313 +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_auth: authentication - * - * Rob McCool & Brian Behlendorf. - * - * Adapted to Apache by rst. - * - * Version 0.5 May 1996 - * - * Modified by Dirk.vanGulik@jrc.it to - * - * Adapted to allow anonymous logins, just like with Anon-FTP, when - * one gives the magic user name 'anonymous' and ones email address - * as the password. - * - * Just add the following tokes to your setup: - * - * Anonymous magic-userid [magic-userid]... - * - * Anonymous_MustGiveEmail [ on | off ] default = on - * Anonymous_LogEmail [ on | off ] default = on - * Anonymous_VerifyEmail [ on | off ] default = off - * Anonymous_NoUserId [ on | off ] default = off - * Anonymous_Authoritative [ on | off ] default = off - * - * The magic user id is something like 'anonymous', it is NOT case sensitive. - * - * The MustGiveEmail flag can be used to force users to enter something - * in the password field (like an email address). Default is on. - * - * Furthermore the 'NoUserID' flag can be set to allow completely empty - * usernames in as well; this can be is convenient as a single return - * in broken GUIs like W95 is often given by the user. The Default is off. - * - * Dirk.vanGulik@jrc.it; http://ewse.ceo.org; http://me-www.jrc.it/~dirkx - * - */ - -#include "apr_strings.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_log.h" -#include "http_request.h" -#include "http_protocol.h" - - -typedef struct anon_auth { - char *password; - struct anon_auth *next; -} anon_auth; - -typedef struct { - - anon_auth *anon_auth_passwords; - int anon_auth_nouserid; - int anon_auth_logemail; - int anon_auth_verifyemail; - int anon_auth_mustemail; - int anon_auth_authoritative; - -} anon_auth_config_rec; - - -static void *create_anon_auth_dir_config(apr_pool_t *p, char *d) -{ - anon_auth_config_rec *conf = apr_pcalloc(p, sizeof(*conf)); - - /* just to illustrate the defaults really. */ - conf->anon_auth_passwords = NULL; - - conf->anon_auth_nouserid = 0; - conf->anon_auth_logemail = 1; - conf->anon_auth_verifyemail = 0; - conf->anon_auth_mustemail = 1; - conf->anon_auth_authoritative = 0; - return conf; -} - -static const char *anon_set_passwd_flag(cmd_parms *cmd, - void *my_config, int arg) -{ - anon_auth_config_rec *conf = my_config; - conf->anon_auth_mustemail = arg; - return NULL; -} - -static const char *anon_set_userid_flag(cmd_parms *cmd, - void *my_config, int arg) -{ - anon_auth_config_rec *conf = my_config; - conf->anon_auth_nouserid = arg; - return NULL; -} - -static const char *anon_set_logemail_flag(cmd_parms *cmd, - void *my_config, int arg) -{ - anon_auth_config_rec *conf = my_config; - conf->anon_auth_logemail = arg; - return NULL; -} - -static const char *anon_set_verifyemail_flag(cmd_parms *cmd, - void *my_config, int arg) -{ - anon_auth_config_rec *conf = my_config; - conf->anon_auth_verifyemail = arg; - return NULL; -} -static const char *anon_set_authoritative_flag(cmd_parms *cmd, - void *my_config, int arg) -{ - anon_auth_config_rec *conf = my_config; - conf->anon_auth_authoritative = arg; - return NULL; -} - -static const char *anon_set_string_slots(cmd_parms *cmd, - void *my_config, const char *arg) -{ - anon_auth_config_rec *conf = my_config; - anon_auth *first; - - if (!(*arg)) - return "Anonymous string cannot be empty, use Anonymous_NoUserId instead"; - - /* squeeze in a record */ - first = conf->anon_auth_passwords; - - if (!(conf->anon_auth_passwords = apr_palloc(cmd->pool, sizeof(anon_auth))) || - !(conf->anon_auth_passwords->password = apr_pstrdup(cmd->pool, arg))) - return "Failed to claim memory for an anonymous password..."; - - /* and repair the next */ - conf->anon_auth_passwords->next = first; - - return NULL; -} - -static const command_rec anon_auth_cmds[] = -{ - AP_INIT_ITERATE("Anonymous", anon_set_string_slots, NULL, OR_AUTHCFG, - "a space-separated list of user IDs"), - AP_INIT_FLAG("Anonymous_MustGiveEmail", anon_set_passwd_flag, NULL, - OR_AUTHCFG, "Limited to 'on' or 'off'"), - AP_INIT_FLAG("Anonymous_NoUserId", anon_set_userid_flag, NULL, OR_AUTHCFG, - "Limited to 'on' or 'off'"), - AP_INIT_FLAG("Anonymous_VerifyEmail", anon_set_verifyemail_flag, NULL, - OR_AUTHCFG, "Limited to 'on' or 'off'"), - AP_INIT_FLAG("Anonymous_LogEmail", anon_set_logemail_flag, NULL, OR_AUTHCFG, - "Limited to 'on' or 'off'"), - AP_INIT_FLAG("Anonymous_Authoritative", anon_set_authoritative_flag, NULL, - OR_AUTHCFG, "Limited to 'on' or 'off'"), - {NULL} -}; - -module AP_MODULE_DECLARE_DATA auth_anon_module; - -static int anon_authenticate_basic_user(request_rec *r) -{ - anon_auth_config_rec *conf = ap_get_module_config(r->per_dir_config, - &auth_anon_module); - const char *sent_pw; - int res = DECLINED; - - if ((res = ap_get_basic_auth_pw(r, &sent_pw))) - return res; - - /* Ignore if we are not configured */ - if (!conf->anon_auth_passwords) - return DECLINED; - - /* Do we allow an empty userID and/or is it the magic one - */ - - if ((!(r->user[0])) && (conf->anon_auth_nouserid)) { - res = OK; - } - else { - anon_auth *p = conf->anon_auth_passwords; - res = DECLINED; - while ((res == DECLINED) && (p != NULL)) { - if (!(strcasecmp(r->user, p->password))) - res = OK; - p = p->next; - } - } - if ( - /* username is OK */ - (res == OK) - /* password been filled out ? */ - && ((!conf->anon_auth_mustemail) || strlen(sent_pw)) - /* does the password look like an email address ? */ - && ((!conf->anon_auth_verifyemail) - || ((strpbrk("@", sent_pw) != NULL) - && (strpbrk(".", sent_pw) != NULL)))) { - if (conf->anon_auth_logemail && ap_is_initial_req(r)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, APR_SUCCESS, r, - "Anonymous: Passwd <%s> Accepted", - sent_pw ? sent_pw : "\'none\'"); - } - return OK; - } - else { - if (conf->anon_auth_authoritative) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, APR_SUCCESS, r, - "Anonymous: Authoritative, Passwd <%s> not accepted", - sent_pw ? sent_pw : "\'none\'"); - return HTTP_UNAUTHORIZED; - } - /* Drop out the bottom to return DECLINED */ - } - - return DECLINED; -} - -static int check_anon_access(request_rec *r) -{ -#ifdef NOTYET - conn_rec *c = r->connection; - anon_auth_config_rec *conf = ap_get_module_config(r->per_dir_config, - &auth_anon_module); - - if (!conf->anon_auth) - return DECLINED; - - if (strcasecmp(r->connection->user, conf->anon_auth)) - return DECLINED; - - return OK; -#endif - return DECLINED; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_check_user_id(anon_authenticate_basic_user,NULL,NULL,APR_HOOK_MIDDLE); - ap_hook_auth_checker(check_anon_access,NULL,NULL,APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA auth_anon_module = -{ - STANDARD20_MODULE_STUFF, - create_anon_auth_dir_config,/* dir config creater */ - NULL, /* dir merger ensure strictness */ - NULL, /* server config */ - NULL, /* merge server config */ - anon_auth_cmds, /* command apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/aaa/mod_auth_anon.dsp b/modules/aaa/mod_auth_anon.dsp deleted file mode 100644 index 9971dac259..0000000000 --- a/modules/aaa/mod_auth_anon.dsp +++ /dev/null @@ -1,95 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_auth_anon" - 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_auth_anon - 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_auth_anon.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_auth_anon.mak" CFG="mod_auth_anon - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_auth_anon - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_auth_anon - 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_auth_anon - 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_auth_anon" /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_auth_anon.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_auth_anon -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_auth_anon.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_auth_anon - -!ELSEIF "$(CFG)" == "mod_auth_anon - 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_auth_anon" /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_auth_anon.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_auth_anon -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_auth_anon.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_auth_anon - -!ENDIF - -# Begin Target - -# Name "mod_auth_anon - Win32 Release" -# Name "mod_auth_anon - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_auth_anon.c -# End Source File -# End Target -# End Project diff --git a/modules/aaa/mod_auth_anon.exp b/modules/aaa/mod_auth_anon.exp deleted file mode 100644 index 63282532a9..0000000000 --- a/modules/aaa/mod_auth_anon.exp +++ /dev/null @@ -1 +0,0 @@ -auth_anon_module diff --git a/modules/aaa/mod_auth_anon.mak b/modules/aaa/mod_auth_anon.mak deleted file mode 100644 index cc7fba0b46..0000000000 --- a/modules/aaa/mod_auth_anon.mak +++ /dev/null @@ -1,330 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on mod_auth_anon.dsp -!IF "$(CFG)" == "" -CFG=mod_auth_anon - Win32 Release -!MESSAGE No configuration specified. Defaulting to mod_auth_anon - Win32\ - Release. -!ENDIF - -!IF "$(CFG)" != "mod_auth_anon - Win32 Release" && "$(CFG)" !=\ - "mod_auth_anon - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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_auth_anon.mak" CFG="mod_auth_anon - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_auth_anon - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_auth_anon - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "mod_auth_anon - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_auth_anon.so" - -!ELSE - -ALL : "libhttpd - Win32 Release" "libapr - Win32 Release"\ - "$(OUTDIR)\mod_auth_anon.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 ReleaseCLEAN" "libhttpd - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_auth_anon.idb" - -@erase "$(INTDIR)\mod_auth_anon.obj" - -@erase "$(OUTDIR)\mod_auth_anon.exp" - -@erase "$(OUTDIR)\mod_auth_anon.lib" - -@erase "$(OUTDIR)\mod_auth_anon.map" - -@erase "$(OUTDIR)\mod_auth_anon.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I\ - "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D\ - "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_auth_anon" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_auth_anon.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_auth_anon.pdb" /map:"$(INTDIR)\mod_auth_anon.map"\ - /machine:I386 /out:"$(OUTDIR)\mod_auth_anon.so"\ - /implib:"$(OUTDIR)\mod_auth_anon.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_auth_anon -LINK32_OBJS= \ - "$(INTDIR)\mod_auth_anon.obj" \ - "..\..\Release\libhttpd.lib" \ - "..\..\srclib\apr\Release\libapr.lib" - -"$(OUTDIR)\mod_auth_anon.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "mod_auth_anon - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_auth_anon.so" - -!ELSE - -ALL : "libhttpd - Win32 Debug" "libapr - Win32 Debug"\ - "$(OUTDIR)\mod_auth_anon.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 DebugCLEAN" "libhttpd - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_auth_anon.idb" - -@erase "$(INTDIR)\mod_auth_anon.obj" - -@erase "$(OUTDIR)\mod_auth_anon.exp" - -@erase "$(OUTDIR)\mod_auth_anon.lib" - -@erase "$(OUTDIR)\mod_auth_anon.map" - -@erase "$(OUTDIR)\mod_auth_anon.pdb" - -@erase "$(OUTDIR)\mod_auth_anon.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_auth_anon" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_auth_anon.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_auth_anon.pdb" /map:"$(INTDIR)\mod_auth_anon.map" /debug\ - /machine:I386 /out:"$(OUTDIR)\mod_auth_anon.so"\ - /implib:"$(OUTDIR)\mod_auth_anon.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_auth_anon -LINK32_OBJS= \ - "$(INTDIR)\mod_auth_anon.obj" \ - "..\..\Debug\libhttpd.lib" \ - "..\..\srclib\apr\Debug\libapr.lib" - -"$(OUTDIR)\mod_auth_anon.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "mod_auth_anon - Win32 Release" || "$(CFG)" ==\ - "mod_auth_anon - Win32 Debug" - -!IF "$(CFG)" == "mod_auth_anon - Win32 Release" - -"libapr - Win32 Release" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Release" - cd "..\..\modules\aaa" - -"libapr - Win32 ReleaseCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\..\modules\aaa" - -!ELSEIF "$(CFG)" == "mod_auth_anon - Win32 Debug" - -"libapr - Win32 Debug" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Debug" - cd "..\..\modules\aaa" - -"libapr - Win32 DebugCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\..\modules\aaa" - -!ENDIF - -!IF "$(CFG)" == "mod_auth_anon - Win32 Release" - -"libhttpd - Win32 Release" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Release" - cd ".\modules\aaa" - -"libhttpd - Win32 ReleaseCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Release"\ - RECURSE=1 - cd ".\modules\aaa" - -!ELSEIF "$(CFG)" == "mod_auth_anon - Win32 Debug" - -"libhttpd - Win32 Debug" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Debug" - cd ".\modules\aaa" - -"libhttpd - Win32 DebugCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Debug"\ - RECURSE=1 - cd ".\modules\aaa" - -!ENDIF - -SOURCE=.\mod_auth_anon.c -DEP_CPP_MOD_A=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.h"\ - "..\..\include\ap_release.h"\ - "..\..\include\http_config.h"\ - "..\..\include\http_core.h"\ - "..\..\include\http_log.h"\ - "..\..\include\http_protocol.h"\ - "..\..\include\http_request.h"\ - "..\..\include\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\srclib\apr-util\include\apu.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_dso.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_lock.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_portable.h"\ - "..\..\srclib\apr\include\apr_strings.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\include\apr_user.h"\ - "..\..\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_A=\ - "..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_auth_anon.obj" : $(SOURCE) $(DEP_CPP_MOD_A) "$(INTDIR)" - - - -!ENDIF - diff --git a/modules/aaa/mod_auth_db.c b/modules/aaa/mod_auth_db.c deleted file mode 100644 index a1925a8298..0000000000 --- a/modules/aaa/mod_auth_db.c +++ /dev/null @@ -1,419 +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. - */ - -/* - * mod_auth_db: authentication - * - * Original work by Rob McCool & Brian Behlendorf. - * - * Adapted to Apache by rst (mod_auth_dbm) - * - * Adapted for Berkeley DB by Andrew Cohen - * - * apache 2 port by Brian Martin - * - * mod_auth_db was based on mod_auth_dbm. - * - * Warning, this is not a drop in replacement for mod_auth_dbm, - * for people wanting to switch from dbm to Berkeley DB. - * It requires the use of AuthDBUserFile and AuthDBGroupFile - * instead of AuthDBMUserFile AuthDBMGroupFile - * - * Also, in the configuration file you need to specify - * auth_db_module rather than auth_dbm_module - * - * On some BSD systems (e.g. FreeBSD and NetBSD) dbm is automatically - * mapped to Berkeley DB. You can use either mod_auth_dbm or - * mod_auth_db. The latter makes it more obvious that it's Berkeley. - * On other platforms where you want to use the DB library you - * usually have to install it first. See http://www.sleepycat.com/ - * for the distribution. The interface this module uses is the - * one from DB version 1.85 and 1.86, but DB version 2.x - * can also be used when compatibility mode is enabled. - * - * dirkx - Added Authoritative control to allow passing on to lower - * modules if and only if the userid is not known to this - * module. A known user with a faulty or absent password still - * causes an AuthRequired. The default is 'Authoritative', i.e. - * no control is passed along. - */ - -#include "apr_lib.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#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" /* for ap_hook_(check_user_id | auth_check) */ - -#ifdef HAVE_DB_H -#include -#endif - -#if defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 3) -#define DB_VER 3 -#elif defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 2) -#define DB_VER 2 -#else -#define DB_VER 1 -#endif - -typedef struct { - - char *auth_dbpwfile; - char *auth_dbgrpfile; - int auth_dbauthoritative; -} db_auth_config_rec; - -static void *create_db_auth_dir_config(apr_pool_t *p, char *d) -{ - db_auth_config_rec *conf = apr_pcalloc(p, sizeof(*conf)); - - conf->auth_dbpwfile = NULL; - conf->auth_dbgrpfile = NULL; - conf->auth_dbauthoritative = 1; /* fortress is secure by default */ - return conf; -} - -static const char *set_db_slot(cmd_parms *cmd, void *offset, const char *f, const char *t) -{ - if (!t || strcmp(t, "db")) - return DECLINE_CMD; - - return ap_set_file_slot(cmd, offset, f); -} - -static const command_rec db_auth_cmds[] = -{ - AP_INIT_TAKE1("AuthDBUserFile", ap_set_file_slot, - (void *) XtOffsetOf(db_auth_config_rec, auth_dbpwfile), - OR_AUTHCFG, NULL), - AP_INIT_TAKE1("AuthDBGroupFile", ap_set_file_slot, - (void *) XtOffsetOf(db_auth_config_rec, auth_dbgrpfile), - OR_AUTHCFG, NULL), - AP_INIT_TAKE12("AuthUserFile", set_db_slot, - (void *) XtOffsetOf(db_auth_config_rec, auth_dbpwfile), - OR_AUTHCFG, NULL), - AP_INIT_TAKE12("AuthGroupFile", set_db_slot, - (void *) XtOffsetOf(db_auth_config_rec, auth_dbgrpfile), - OR_AUTHCFG, NULL), - AP_INIT_FLAG("AuthDBAuthoritative", ap_set_flag_slot, - (void *) XtOffsetOf(db_auth_config_rec, auth_dbauthoritative), - OR_AUTHCFG, - "Set to 'no' to allow access control to be passed along to lower modules if the userID is not known to this module"), - {NULL} -}; - -module auth_db_module; - -static char *get_db_pw(request_rec *r, char *user, const char *auth_dbpwfile) -{ - DB *f; - DBT d, q; - char *pw = NULL; -#if DB_VER > 1 - int retval; -#endif - - memset(&d, 0, sizeof(d)); - memset(&q, 0, sizeof(q)); - - q.data = user; - q.size = strlen(q.data); - -#if DB_VER == 3 - db_create(&f, NULL, 0); - if ((retval = f->open(f, auth_dbpwfile, NULL, DB_HASH, DB_RDONLY, 0664)) != 0) { - char * reason; - switch(retval) { - case DB_OLD_VERSION: - reason = "Old database version. Upgrade to version 3"; - break; - - case EEXIST: - reason = "DB_CREATE and DB_EXCL were specified and the file exists"; - break; - - case EINVAL: - reason = "An invalid flag value or parameter was specified"; - break; - - case ENOENT: - reason = "A non-existent re_source file was specified"; - break; - - default: - reason = "And I don't know why"; - break; - } - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, - "could not open db auth file %s: %s", - auth_dbpwfile, reason); - return NULL; - } -#elif DB_VER == 2 - if ((retval = db_open(auth_dbpwfile, DB_HASH, DB_RDONLY, 0664, NULL, NULL, &f)) != 0) { - char * reason; - switch(retval) { - - case EEXIST: - reason = "DB_CREATE and DB_EXCL were specified and the file exists."; - break; - - case EINVAL: - reason = "An invalid flag value or parameter was specified"; - break; - - case ENOENT: - reason = "A non-existent re_source file was specified"; - break; - - default: - reason = "And I don't know why"; - break; - } - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, - "could not open db auth file %s: %s", - auth_dbpwfile, reason); - return NULL; - } -#else - if (!(f = dbopen(auth_dbpwfile, O_RDONLY, 0664, DB_HASH, NULL))) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, - "could not open db auth file: %s", auth_dbpwfile); - return NULL; - } -#endif - -#if DB_VER == 3 || DB_VER == 2 - if (!((f->get) (f, NULL, &q, &d, 0))) { -#else - if (!((f->get) (f, &q, &d, 0))) { -#endif - pw = apr_palloc(r->pool, d.size + 1); - strncpy(pw, d.data, d.size); - pw[d.size] = '\0'; /* Terminate the string */ - } - -#if DB_VER == 3 || DB_VER == 2 - (f->close) (f, 0); -#else - (f->close) (f); -#endif - return pw; -} - -/* We do something strange with the group file. If the group file - * contains any : we assume the format is - * key=username value=":"groupname [":"anything here is ignored] - * otherwise we now (0.8.14+) assume that the format is - * key=username value=groupname - * The first allows the password and group files to be the same - * physical DB file; key=username value=password":"groupname[":"anything] - * - * mark@telescope.org, 22Sep95 - */ - -static char *get_db_grp(request_rec *r, char *user, const char *auth_dbgrpfile) -{ - char *grp_data = get_db_pw(r, user, auth_dbgrpfile); - char *grp_colon; - char *grp_colon2; - - if (grp_data == NULL) - return NULL; - - if ((grp_colon = strchr(grp_data, ':')) != NULL) { - grp_colon2 = strchr(++grp_colon, ':'); - if (grp_colon2) - *grp_colon2 = '\0'; - return grp_colon; - } - return grp_data; -} - -static int db_authenticate_basic_user(request_rec *r) -{ - db_auth_config_rec *conf = ap_get_module_config(r->per_dir_config, - &auth_db_module); - const char *sent_pw; - char *real_pw, *colon_pw; - apr_status_t invalid_pw; - int res; - - if ((res = ap_get_basic_auth_pw(r, &sent_pw))) - return res; - - if (!conf->auth_dbpwfile) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "DB file %s not found", conf->auth_dbpwfile); - return DECLINED; - } - - if (!(real_pw = get_db_pw(r, r->user, conf->auth_dbpwfile))) { - if (!(conf->auth_dbauthoritative)) - return DECLINED; - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "DB user %s not found: %s", r->user, r->filename); - ap_note_basic_auth_failure(r); - return HTTP_UNAUTHORIZED; - } - /* Password is up to first : if exists */ - colon_pw = strchr(real_pw, ':'); - if (colon_pw) { - *colon_pw = '\0'; - } - - invalid_pw = apr_password_validate(sent_pw, real_pw); - - if (invalid_pw != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "DB user %s: authentication failure for \"%s\": " - "Password Mismatch", - r->user, r->uri); - ap_note_basic_auth_failure(r); - return HTTP_UNAUTHORIZED; - } - return OK; -} - -/* Checking ID */ - -static int db_check_auth(request_rec *r) -{ - db_auth_config_rec *conf = ap_get_module_config(r->per_dir_config, - &auth_db_module); - char *user = r->user; - 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; - - if (!conf->auth_dbgrpfile) - return DECLINED; - if (!reqs_arr) - return DECLINED; - - for (x = 0; x < reqs_arr->nelts; x++) { - - if (!(reqs[x].method_mask & (1 << m))) - continue; - - t = reqs[x].requirement; - w = ap_getword_white(r->pool, &t); - - if (!strcmp(w, "group") && conf->auth_dbgrpfile) { - const char *orig_groups, *groups; - char *v; - - if (!(groups = get_db_grp(r, user, conf->auth_dbgrpfile))) { - if (!(conf->auth_dbauthoritative)) - return DECLINED; - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "user %s not in DB group file %s: %s", - user, conf->auth_dbgrpfile, r->filename); - ap_note_basic_auth_failure(r); - return HTTP_UNAUTHORIZED; - } - orig_groups = groups; - while (t[0]) { - w = ap_getword_white(r->pool, &t); - groups = orig_groups; - while (groups[0]) { - v = ap_getword(r->pool, &groups, ','); - if (!strcmp(v, w)) - return OK; - } - } - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "user %s not in right group: %s", user, r->filename); - ap_note_basic_auth_failure(r); - return HTTP_UNAUTHORIZED; - } - } - - return DECLINED; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_check_user_id(db_authenticate_basic_user, NULL, NULL, - APR_HOOK_MIDDLE); - ap_hook_auth_checker(db_check_auth, NULL, NULL, APR_HOOK_MIDDLE); -} - -module auth_db_module = -{ - STANDARD20_MODULE_STUFF, - create_db_auth_dir_config, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - db_auth_cmds, /* command apr_table_t */ - register_hooks /* register hooks */ -}; - diff --git a/modules/aaa/mod_auth_db.module b/modules/aaa/mod_auth_db.module deleted file mode 100644 index 525075c3f1..0000000000 --- a/modules/aaa/mod_auth_db.module +++ /dev/null @@ -1,37 +0,0 @@ -Name: db_auth_module -ConfigStart - # XXX: this needs updating for apache-2.0 configuration method - DB_VERSION='' - DB_LIB='' - if ./build/TestCompile func db_open; then - DB_VERSION='Berkeley-DB/2.x' - else - if ./build/TestCompile lib db db_open; then - DB_VERSION='Berkeley-DB/2.x' - DB_LIB='-ldb' - else - if ./build/TestCompile func dbopen; then - DB_VERSION='Berkeley-DB/1.x' - else - if ./build/TestCompile lib db dbopen; then - DB_VERSION='Berkeley-DB/1.x' - DB_LIB='-ldb' - fi - fi - fi - fi - if [ ".$DB_VERSION" != . ]; then - if [ ".$DB_LIB" != . ]; then - LIBS="$LIBS $DB_LIB" - echo " using $DB_VERSION for mod_auth_db ($DB_LIB)" - else - echo " using $DB_VERSION for mod_auth_db (-lc)" - fi - else - echo "Error: Neither Berkeley-DB/1.x nor Berkeley-DB/2.x library found." - echo " Either disable mod_auth_db or provide us with the paths" - echo " to the Berkeley-DB include and library files." - echo " (Hint: INCLUDES, LDFLAGS, LIBS)" - exit 1 - fi -ConfigEnd diff --git a/modules/aaa/mod_auth_dbm.c b/modules/aaa/mod_auth_dbm.c deleted file mode 100644 index 0b9fcb4273..0000000000 --- a/modules/aaa/mod_auth_dbm.c +++ /dev/null @@ -1,358 +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_auth: authentication - * - * Rob McCool & Brian Behlendorf. - * - * Adapted to Apache by rst. - * - * dirkx - Added Authoritative control to allow passing on to lower - * modules if and only if the userid is not known to this - * module. A known user with a faulty or absent password still - * causes an AuthRequired. The default is 'Authoritative', i.e. - * no control is passed along. - */ - -#include "apr_lib.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if defined(AP_AUTH_DBM_USE_APR) -#include "apr_dbm.h" -#define DBM apr_dbm_t -#define datum apr_datum_t -#define dbm_open apr_dbm_open -#define dbm_fetch apr_dbm_fetch -#define dbm_close apr_dbm_close -#elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) \ - && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 -#include -#else -#include -#endif - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_log.h" -#include "http_protocol.h" -#include "http_request.h" /* for ap_hook_(check_user_id | auth_checker)*/ - - -/* - * Module definition information - the part between the -START and -END - * lines below is used by Configure. This could be stored in a separate - * instead. - * - * XXX: this needs updating for apache-2.0 configuration method - * MODULE-DEFINITION-START - * Name: auth_dbm_module - * ConfigStart - . ./build/find-dbm-lib - * ConfigEnd - * MODULE-DEFINITION-END - */ - -typedef struct { - - char *auth_dbmpwfile; - char *auth_dbmgrpfile; - int auth_dbmauthoritative; - -} dbm_auth_config_rec; - -static void *create_dbm_auth_dir_config(apr_pool_t *p, char *d) -{ - dbm_auth_config_rec *conf = apr_pcalloc(p, sizeof(*conf)); - - conf->auth_dbmpwfile = NULL; - conf->auth_dbmgrpfile = NULL; - conf->auth_dbmauthoritative = 1; /* fortress is secure by default */ - - return conf; -} - -static const char *set_dbm_slot(cmd_parms *cmd, void *offset, - const char *f, const char *t) -{ - if (!t || strcmp(t, "dbm")) - return DECLINE_CMD; - - return ap_set_file_slot(cmd, offset, f); -} - -static const command_rec dbm_auth_cmds[] = -{ - AP_INIT_TAKE1("AuthDBMUserFile", ap_set_file_slot, - (void *) XtOffsetOf(dbm_auth_config_rec, auth_dbmpwfile), - OR_AUTHCFG, NULL), - AP_INIT_TAKE1("AuthDBMGroupFile", ap_set_file_slot, - (void *) XtOffsetOf(dbm_auth_config_rec, auth_dbmgrpfile), - OR_AUTHCFG, NULL), - AP_INIT_TAKE12("AuthUserFile", set_dbm_slot, - (void *) XtOffsetOf(dbm_auth_config_rec, auth_dbmpwfile), - OR_AUTHCFG, NULL), - AP_INIT_TAKE12("AuthGroupFile", set_dbm_slot, - (void *) XtOffsetOf(dbm_auth_config_rec, auth_dbmgrpfile), - OR_AUTHCFG, NULL), - AP_INIT_FLAG("AuthDBMAuthoritative", ap_set_flag_slot, - (void *) XtOffsetOf(dbm_auth_config_rec, auth_dbmauthoritative), - OR_AUTHCFG, "Set to 'no' to allow access control to be passed along to lower modules, if the UserID is not known in this module"), - {NULL} -}; - -module AP_MODULE_DECLARE_DATA auth_dbm_module; - -static char *get_dbm_pw(request_rec *r, char *user, char *auth_dbmpwfile) -{ - DBM *f; - datum d, q; - char *pw = NULL; -#ifdef AP_AUTH_DBM_USE_APR - apr_status_t retval; -#endif - q.dptr = user; -#ifndef NETSCAPE_DBM_COMPAT - q.dsize = strlen(q.dptr); -#else - q.dsize = strlen(q.dptr) + 1; -#endif - -#ifdef AP_AUTH_DBM_USE_APR - if (!(retval = dbm_open(&f, auth_dbmpwfile, APR_DBM_READONLY, APR_OS_DEFAULT, r->pool))) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, retval, r, - "could not open sdbm auth file: %s", auth_dbmpwfile); - return NULL; - } - if (dbm_fetch(f, q, &d) == APR_SUCCESS) - /* sorry for the obscurity ... falls through to the - * if (d.dptr) { block ... - */ - -#else - if (!(f = dbm_open(auth_dbmpwfile, O_RDONLY, 0664))) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, - "could not open dbm auth file: %s", auth_dbmpwfile); - return NULL; - } - d = dbm_fetch(f, q); - -#endif - - if (d.dptr) { - pw = apr_palloc(r->pool, d.dsize + 1); - strncpy(pw, d.dptr, d.dsize); - pw[d.dsize] = '\0'; /* Terminate the string */ - } - - dbm_close(f); - return pw; -} - -/* We do something strange with the group file. If the group file - * contains any : we assume the format is - * key=username value=":"groupname [":"anything here is ignored] - * otherwise we now (0.8.14+) assume that the format is - * key=username value=groupname - * The first allows the password and group files to be the same - * physical DBM file; key=username value=password":"groupname[":"anything] - * - * mark@telescope.org, 22Sep95 - */ - -static char *get_dbm_grp(request_rec *r, char *user, char *auth_dbmgrpfile) -{ - char *grp_data = get_dbm_pw(r, user, auth_dbmgrpfile); - char *grp_colon; - char *grp_colon2; - - if (grp_data == NULL) - return NULL; - - if ((grp_colon = strchr(grp_data, ':')) != NULL) { - grp_colon2 = strchr(++grp_colon, ':'); - if (grp_colon2) - *grp_colon2 = '\0'; - return grp_colon; - } - return grp_data; -} - -static int dbm_authenticate_basic_user(request_rec *r) -{ - dbm_auth_config_rec *conf = ap_get_module_config(r->per_dir_config, - &auth_dbm_module); - const char *sent_pw; - char *real_pw, *colon_pw; - apr_status_t invalid_pw; - int res; - - if ((res = ap_get_basic_auth_pw(r, &sent_pw))) - return res; - - if (!conf->auth_dbmpwfile) - return DECLINED; - - if (!(real_pw = get_dbm_pw(r, r->user, conf->auth_dbmpwfile))) { - if (!(conf->auth_dbmauthoritative)) - return DECLINED; - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "DBM user %s not found: %s", r->user, r->filename); - ap_note_basic_auth_failure(r); - return HTTP_UNAUTHORIZED; - } - /* Password is up to first : if exists */ - colon_pw = strchr(real_pw, ':'); - if (colon_pw) { - *colon_pw = '\0'; - } - invalid_pw = apr_password_validate(sent_pw, real_pw); - if (invalid_pw != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "DBM user %s: authentication failure for \"%s\": " - "Password Mismatch", - r->user, r->uri); - ap_note_basic_auth_failure(r); - return HTTP_UNAUTHORIZED; - } - return OK; -} - -/* Checking ID */ - -static int dbm_check_auth(request_rec *r) -{ - dbm_auth_config_rec *conf = ap_get_module_config(r->per_dir_config, - &auth_dbm_module); - char *user = r->user; - 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; - - if (!conf->auth_dbmgrpfile) - return DECLINED; - if (!reqs_arr) - return DECLINED; - - for (x = 0; x < reqs_arr->nelts; x++) { - - if (!(reqs[x].method_mask & (1 << m))) - continue; - - t = reqs[x].requirement; - w = ap_getword_white(r->pool, &t); - - if (!strcmp(w, "group") && conf->auth_dbmgrpfile) { - const char *orig_groups, *groups; - char *v; - - if (!(groups = get_dbm_grp(r, user, conf->auth_dbmgrpfile))) { - if (!(conf->auth_dbmauthoritative)) - return DECLINED; - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "user %s not in DBM group file %s: %s", - user, conf->auth_dbmgrpfile, r->filename); - ap_note_basic_auth_failure(r); - return HTTP_UNAUTHORIZED; - } - orig_groups = groups; - while (t[0]) { - w = ap_getword_white(r->pool, &t); - groups = orig_groups; - while (groups[0]) { - v = ap_getword(r->pool, &groups, ','); - if (!strcmp(v, w)) - return OK; - } - } - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "user %s not in right group: %s", - user, r->filename); - ap_note_basic_auth_failure(r); - return HTTP_UNAUTHORIZED; - } - } - - return DECLINED; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_check_user_id(dbm_authenticate_basic_user, NULL, NULL, - APR_HOOK_MIDDLE); - ap_hook_auth_checker(dbm_check_auth, NULL, NULL, APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA auth_dbm_module = -{ - STANDARD20_MODULE_STUFF, - create_dbm_auth_dir_config, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - dbm_auth_cmds, /* command apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/aaa/mod_auth_dbm.dsp b/modules/aaa/mod_auth_dbm.dsp deleted file mode 100644 index 93fa4abc6d..0000000000 --- a/modules/aaa/mod_auth_dbm.dsp +++ /dev/null @@ -1,95 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_auth_dbm" - 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_auth_dbm - 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_auth_dbm.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_auth_dbm.mak" CFG="mod_auth_dbm - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_auth_dbm - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_auth_dbm - 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_auth_dbm - 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" /I "..\..\srclib\sdbm" /I "..\..\os\win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "AP_AUTH_DBM_USE_APR" /Fd"Release\mod_auth_dbm" /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_auth_dbm.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_auth_dbm -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_auth_dbm.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_auth_dbm - -!ELSEIF "$(CFG)" == "mod_auth_dbm - 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" /I "..\..\srclib\sdbm" /I "..\..\os\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "AP_AUTH_DBM_USE_APR" /Fd"Debug\mod_auth_dbm" /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_auth_dbm.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_auth_dbm -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_auth_dbm.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_auth_dbm - -!ENDIF - -# Begin Target - -# Name "mod_auth_dbm - Win32 Release" -# Name "mod_auth_dbm - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_auth_dbm.c -# End Source File -# End Target -# End Project diff --git a/modules/aaa/mod_auth_dbm.exp b/modules/aaa/mod_auth_dbm.exp deleted file mode 100644 index 7038e8047d..0000000000 --- a/modules/aaa/mod_auth_dbm.exp +++ /dev/null @@ -1 +0,0 @@ -auth_dbm_module diff --git a/modules/aaa/mod_auth_dbm.mak b/modules/aaa/mod_auth_dbm.mak deleted file mode 100644 index 11d7970042..0000000000 --- a/modules/aaa/mod_auth_dbm.mak +++ /dev/null @@ -1,366 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on mod_auth_dbm.dsp -!IF "$(CFG)" == "" -CFG=mod_auth_dbm - Win32 Release -!MESSAGE No configuration specified. Defaulting to mod_auth_dbm - Win32\ - Release. -!ENDIF - -!IF "$(CFG)" != "mod_auth_dbm - Win32 Release" && "$(CFG)" !=\ - "mod_auth_dbm - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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_auth_dbm.mak" CFG="mod_auth_dbm - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_auth_dbm - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_auth_dbm - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "mod_auth_dbm - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_auth_dbm.so" - -!ELSE - -ALL : "libhttpd - Win32 Release" "libaprutil - Win32 Release"\ - "libapr - Win32 Release" "$(OUTDIR)\mod_auth_dbm.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 ReleaseCLEAN" "libaprutil - Win32 ReleaseCLEAN"\ - "libhttpd - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_auth_dbm.idb" - -@erase "$(INTDIR)\mod_auth_dbm.obj" - -@erase "$(OUTDIR)\mod_auth_dbm.exp" - -@erase "$(OUTDIR)\mod_auth_dbm.lib" - -@erase "$(OUTDIR)\mod_auth_dbm.map" - -@erase "$(OUTDIR)\mod_auth_dbm.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\srclib\apr\include"\ - /I "../../srclib/apr-util/include" /I "..\..\srclib\sdbm" /I "..\..\os\win32"\ - /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "AP_AUTH_DBM_USE_APR" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\mod_auth_dbm" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_auth_dbm.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_auth_dbm.pdb" /map:"$(INTDIR)\mod_auth_dbm.map"\ - /machine:I386 /out:"$(OUTDIR)\mod_auth_dbm.so"\ - /implib:"$(OUTDIR)\mod_auth_dbm.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_auth_dbm -LINK32_OBJS= \ - "$(INTDIR)\mod_auth_dbm.obj" \ - "..\..\Release\libhttpd.lib" \ - "..\..\srclib\apr-util\Release\libaprutil.lib" \ - "..\..\srclib\apr\Release\libapr.lib" - -"$(OUTDIR)\mod_auth_dbm.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "mod_auth_dbm - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_auth_dbm.so" - -!ELSE - -ALL : "libhttpd - Win32 Debug" "libaprutil - Win32 Debug"\ - "libapr - Win32 Debug" "$(OUTDIR)\mod_auth_dbm.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 DebugCLEAN" "libaprutil - Win32 DebugCLEAN"\ - "libhttpd - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_auth_dbm.idb" - -@erase "$(INTDIR)\mod_auth_dbm.obj" - -@erase "$(OUTDIR)\mod_auth_dbm.exp" - -@erase "$(OUTDIR)\mod_auth_dbm.lib" - -@erase "$(OUTDIR)\mod_auth_dbm.map" - -@erase "$(OUTDIR)\mod_auth_dbm.pdb" - -@erase "$(OUTDIR)\mod_auth_dbm.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Zi /Od /I "..\..\include" /I\ - "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /I\ - "..\..\srclib\sdbm" /I "..\..\os\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D\ - "AP_AUTH_DBM_USE_APR" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_auth_dbm" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_auth_dbm.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_auth_dbm.pdb" /map:"$(INTDIR)\mod_auth_dbm.map" /debug\ - /machine:I386 /out:"$(OUTDIR)\mod_auth_dbm.so"\ - /implib:"$(OUTDIR)\mod_auth_dbm.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_auth_dbm -LINK32_OBJS= \ - "$(INTDIR)\mod_auth_dbm.obj" \ - "..\..\Debug\libhttpd.lib" \ - "..\..\srclib\apr-util\Debug\libaprutil.lib" \ - "..\..\srclib\apr\Debug\libapr.lib" - -"$(OUTDIR)\mod_auth_dbm.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "mod_auth_dbm - Win32 Release" || "$(CFG)" ==\ - "mod_auth_dbm - Win32 Debug" - -!IF "$(CFG)" == "mod_auth_dbm - Win32 Release" - -"libapr - Win32 Release" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Release" - cd "..\..\modules\aaa" - -"libapr - Win32 ReleaseCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\..\modules\aaa" - -!ELSEIF "$(CFG)" == "mod_auth_dbm - Win32 Debug" - -"libapr - Win32 Debug" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Debug" - cd "..\..\modules\aaa" - -"libapr - Win32 DebugCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\..\modules\aaa" - -!ENDIF - -!IF "$(CFG)" == "mod_auth_dbm - Win32 Release" - -"libaprutil - Win32 Release" : - cd "..\..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\libaprutil.mak" CFG="libaprutil - Win32 Release"\ - - cd "..\..\modules\aaa" - -"libaprutil - Win32 ReleaseCLEAN" : - cd "..\..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libaprutil.mak"\ - CFG="libaprutil - Win32 Release" RECURSE=1 - cd "..\..\modules\aaa" - -!ELSEIF "$(CFG)" == "mod_auth_dbm - Win32 Debug" - -"libaprutil - Win32 Debug" : - cd "..\..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\libaprutil.mak" CFG="libaprutil - Win32 Debug" - cd "..\..\modules\aaa" - -"libaprutil - Win32 DebugCLEAN" : - cd "..\..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libaprutil.mak"\ - CFG="libaprutil - Win32 Debug" RECURSE=1 - cd "..\..\modules\aaa" - -!ENDIF - -!IF "$(CFG)" == "mod_auth_dbm - Win32 Release" - -"libhttpd - Win32 Release" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Release" - cd ".\modules\aaa" - -"libhttpd - Win32 ReleaseCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Release"\ - RECURSE=1 - cd ".\modules\aaa" - -!ELSEIF "$(CFG)" == "mod_auth_dbm - Win32 Debug" - -"libhttpd - Win32 Debug" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Debug" - cd ".\modules\aaa" - -"libhttpd - Win32 DebugCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Debug"\ - RECURSE=1 - cd ".\modules\aaa" - -!ENDIF - -SOURCE=.\mod_auth_dbm.c -DEP_CPP_MOD_A=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.h"\ - "..\..\include\ap_release.h"\ - "..\..\include\http_config.h"\ - "..\..\include\http_core.h"\ - "..\..\include\http_log.h"\ - "..\..\include\http_protocol.h"\ - "..\..\include\http_request.h"\ - "..\..\include\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\srclib\apr-util\include\apr_dbm.h"\ - "..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\srclib\apr-util\include\apu.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_dso.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_lib.h"\ - "..\..\srclib\apr\include\apr_lock.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_portable.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\include\apr_user.h"\ - "..\..\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_A=\ - "..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_auth_dbm.obj" : $(SOURCE) $(DEP_CPP_MOD_A) "$(INTDIR)" - - - -!ENDIF - diff --git a/modules/aaa/mod_auth_digest.c b/modules/aaa/mod_auth_digest.c deleted file mode 100644 index 2b0e233172..0000000000 --- a/modules/aaa/mod_auth_digest.c +++ /dev/null @@ -1,2083 +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. - */ - -/* - * 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 - * It is still fairly new and problems may turn up - submit problem - * reports to the Apache bug-database, or send them directly to me - * at 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 - * - The source of the secret should be run-time directive (with server - * scope: RSRC_CONF). However, that could be tricky when trying to - * choose truerand vs. file... - * - shared-mem not completely tested yet. Seems to work ok for me, - * but... (definitely won't work on Windoze) - * - Sharing a realm among multiple servers has following problems: - * o Server name and port can't be included in nonce-hash - * (we need two nonce formats, which must be configured explicitly) - * o Nonce-count check can't be for equal, or then nonce-count checking - * must be disabled. What we could do is the following: - * (expected < received) ? set expected = received : issue error - * The only problem is that it allows replay attacks when somebody - * captures a packet sent to one server and sends it to another - * one. Should we add "AuthDigestNcCheck Strict"? - * - expired nonces give amaya fits. - */ - -#include "apr_sha1.h" -#include "apr_base64.h" -#include "apr_lib.h" -#include "apr_time.h" -#include "apr_errno.h" -#include "apr_lock.h" -#include "apr_strings.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_request.h" -#include "http_log.h" -#include "http_protocol.h" -#include "util_uri.h" -#include "util_md5.h" - -#if APR_HAS_SHARED_MEMORY -#include "apr_shmem.h" -#else -/* just provide dummies - the code does run-time checks anyway */ -typedef void apr_shmem_t; -typedef void apr_shm_name_t; - -apr_status_t apr_shm_init(apr_shmem_t **m, apr_size_t reqsize, const char *file, apr_pool_t *cont) { - return APR_ENOTIMPL; -} -apr_status_t apr_shm_destroy(apr_shmem_t *m) { - return APR_ENOTIMPL; -} -void *apr_shm_malloc(apr_shmem_t *c, apr_size_t reqsize) { - return NULL; -} -void *apr_shm_calloc(apr_shmem_t *shared, apr_size_t size) { - return NULL; -} -apr_status_t apr_shm_free(apr_shmem_t *shared, void *free) { - return APR_ENOTIMPL; -} -apr_status_t apr_shm_name_get(apr_shmem_t *c, apr_shm_name_t **name) { - return APR_ENOTIMPL; -} -apr_status_t apr_shm_name_set(apr_shmem_t *c, apr_shm_name_t *name) { - return APR_ENOTIMPL; -} -apr_status_t apr_shm_open(apr_shmem_t *c) { - return APR_ENOTIMPL; -} -apr_status_t apr_shm_avail(apr_shmem_t *c, apr_size_t *avail) { - return APR_ENOTIMPL; -} -#endif /* APR_HAS_SHARED_MEMORY */ - - -/* struct to hold the configuration info */ - -typedef struct digest_config_struct { - const char *dir_name; - const char *pwfile; - const char *grpfile; - const char *realm; - char **qop_list; - apr_sha1_ctx_t nonce_ctx; - apr_time_t 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 (300*APR_USEC_PER_SEC) -#define NEXTNONCE_DELTA (30*APR_USEC_PER_SEC) - - -#define NONCE_TIME_LEN (((sizeof(apr_time_t)+2)/3)*4) -#define NONCE_HASH_LEN (2*APR_SHA1_DIGESTSIZE) -#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[2*MD5_DIGESTSIZE+1]; /* 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 */ - apr_time_t nonce_time; - enum hdr_sts auth_hdr_sts; - const char *raw_request_uri; - uri_components *psd_request_uri; - int needed_auth; - client_entry *client; -} digest_header_rec; - - -/* (mostly) nonce stuff */ - -typedef union time_union { - apr_time_t time; - unsigned char arr[sizeof(apr_time_t)]; -} time_rec; - - -static unsigned char secret[SECRET_LEN]; -static int call_cnt = 0; - - -/* client-list, opaque, and one-time-nonce stuff */ - -static apr_shmem_t *client_shm = NULL; -static unsigned long *opaque_cntr; -static apr_time_t *otn_counter; /* one-time-nonce counter */ -static apr_lock_t *client_lock = NULL; -static apr_lock_t *opaque_lock = NULL; -static char client_lock_name[L_tmpnam]; -static char opaque_lock_name[L_tmpnam]; - -#define DEF_SHMEM_SIZE 1000L /* ~ 12 entries */ -#define DEF_NUM_BUCKETS 15L -#define HASH_DEPTH 5 - -static long shmem_size = DEF_SHMEM_SIZE; -static long num_buckets = DEF_NUM_BUCKETS; - - -module AP_MODULE_DECLARE_DATA auth_digest_module; - -/* - * initialization code - */ - -static apr_status_t cleanup_tables(void *not_used) -{ - ap_log_rerror(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Digest: cleaning up shared memory"); - fflush(stderr); - - if (client_shm) { - apr_shm_destroy(client_shm); - client_shm = NULL; - } - - if (client_lock) { - apr_lock_destroy(client_lock); - client_lock = NULL; - } - - if (opaque_lock) { - apr_lock_destroy(opaque_lock); - opaque_lock = NULL; - } - - return APR_SUCCESS; -} - -static void initialize_secret(server_rec *s) -{ - apr_status_t status; - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, s, - "Digest: generating secret for digest authentication ..."); - -#if APR_HAS_RANDOM - status = apr_generate_random_bytes(secret, sizeof(secret)); -#else -#error APR random number support is missing; you probably need to install the truerand library. -#endif - - if(!(status == APR_SUCCESS)) { - char buf[120]; - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_CRIT, 0, s, - "Digest: error generating secret: %s", - apr_strerror(status, buf, sizeof(buf))); - exit(1); - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, s, "Digest: done"); -} - -static void log_error_and_cleanup(char *msg, apr_status_t sts, server_rec *s) -{ - ap_log_error(APLOG_MARK, APLOG_ERR, sts, s, - "Digest: %s - all nonce-count checking, one-time nonces, and " - "MD5-sess algorithm disabled", msg); - - cleanup_tables(NULL); -} - -#if APR_HAS_SHARED_MEMORY - -static void initialize_tables(server_rec *s, apr_pool_t *ctx) -{ - unsigned long idx; - apr_status_t sts; - - /* set up client list */ - - sts = apr_shm_init(&client_shm, shmem_size, tmpnam(NULL), ctx); - if (sts != APR_SUCCESS) { - log_error_and_cleanup("failed to create shared memory segments", sts, s); - return; - } - - client_list = apr_shm_malloc(client_shm, sizeof(*client_list) + - sizeof(client_entry*)*num_buckets); - if (!client_list) { - log_error_and_cleanup("failed to allocate shared memory", -1, s); - return; - } - client_list->table = (client_entry**) (client_list + 1); - for (idx=0; idxtable[idx] = NULL; - client_list->tbl_len = num_buckets; - client_list->num_entries = 0; - - tmpnam(client_lock_name); - sts = apr_lock_create(&client_lock, APR_READWRITE, APR_LOCKALL, - client_lock_name, ctx); - if (sts != APR_SUCCESS) { - log_error_and_cleanup("failed to create lock", sts, s); - return; - } - - - /* setup opaque */ - - opaque_cntr = apr_shm_malloc(client_shm, sizeof(*opaque_cntr)); - if (opaque_cntr == NULL) { - log_error_and_cleanup("failed to allocate shared memory", -1, s); - return; - } - *opaque_cntr = 1UL; - - tmpnam(opaque_lock_name); - sts = apr_lock_create(&opaque_lock, APR_MUTEX, APR_LOCKALL, - opaque_lock_name, ctx); - if (sts != APR_SUCCESS) { - log_error_and_cleanup("failed to create lock", sts, s); - return; - } - - - /* setup one-time-nonce counter */ - - otn_counter = apr_shm_malloc(client_shm, sizeof(*otn_counter)); - if (otn_counter == NULL) { - log_error_and_cleanup("failed to allocate shared memory", -1, s); - return; - } - *otn_counter = 0; - /* no lock here */ - - - /* success */ - return; -} - -#endif /* APR_HAS_SHARED_MEMORY */ - - -static void initialize_module(apr_pool_t *p, apr_pool_t *plog, - apr_pool_t *ptemp, server_rec *s) -{ - /* 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); - -/* Disable shmem until pools/init gets sorted out - remove next line when fixed */ -#undef APR_HAS_SHARED_MEMORY -#define APR_HAS_SHARED_MEMORY 0 - -#if APR_HAS_SHARED_MEMORY - /* 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 apr_shm_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, p); - apr_pool_cleanup_register(p, NULL, cleanup_tables, apr_pool_cleanup_null); -#endif /* APR_HAS_SHARED_MEMORY */ -} - -static void initialize_child(apr_pool_t *p, server_rec *s) -{ - apr_status_t sts; - - if (!client_shm) - return; - - if ((sts = apr_lock_child_init(&client_lock, client_lock_name, p)) - != APR_SUCCESS - || (sts = apr_lock_child_init(&opaque_lock, opaque_lock_name, p)) - != APR_SUCCESS) { - log_error_and_cleanup("failed to create lock", sts, s); - return; - } -} - -/* - * configuration code - */ - -static void *create_digest_dir_config(apr_pool_t *p, char *dir) -{ - digest_config_rec *conf; - - if (dir == NULL) return NULL; - - conf = (digest_config_rec *) apr_pcalloc(p, sizeof(digest_config_rec)); - if (conf) { - conf->qop_list = apr_palloc(p, sizeof(char*)); - conf->qop_list[0] = NULL; - conf->nonce_lifetime = DFLT_NONCE_LIFE; - conf->dir_name = apr_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) - */ - apr_sha1_init(&conf->nonce_ctx); - apr_sha1_update_binary(&conf->nonce_ctx, secret, sizeof(secret)); - apr_sha1_update_binary(&conf->nonce_ctx, (const unsigned char *) realm, - strlen(realm)); - - 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; - char **tmp; - int cnt; - - if (!strcasecmp(op, "none")) { - if (conf->qop_list[0] == NULL) { - conf->qop_list = apr_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, 0, cmd->server, - "Digest: WARNING: qop `auth-int' currently only works " - "correctly for responses with no entity"); - else if (strcasecmp(op, "auth")) - return apr_pstrcat(cmd->pool, "Unrecognized qop: ", op, NULL); - - for (cnt=0; conf->qop_list[cnt] != NULL; cnt++) - ; - tmp = apr_palloc(cmd->pool, (cnt+2)*sizeof(char*)); - memcpy(tmp, conf->qop_list, cnt*sizeof(char*)); - tmp[cnt] = apr_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)) && !apr_isspace(*endptr)) - return apr_pstrcat(cmd->pool, "Invalid time in AuthDigestNonceLifetime: ", t, NULL); - - ((digest_config_rec *) config)->nonce_lifetime = lifetime * APR_USEC_PER_SEC; - 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) -{ - if (flag && !client_shm) - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, - cmd->server, "Digest: WARNING: nonce-count checking " - "is not supported on platforms without shared-memory " - "support - disabling check"); - - ((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")) { - if (!client_shm) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, - cmd->server, "Digest: WARNING: algorithm `MD5-sess' " - "is not supported on platforms without shared-memory " - "support - reverting to MD5"); - alg = "MD5"; - } - } - else if (strcasecmp(alg, "MD5")) - return apr_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 = apr_pstrcat(cmd->pool, c->uri_list, " ", uri, "\"", NULL); - } - else - c->uri_list = apr_pstrcat(cmd->pool, ", domain=\"", uri, "\"", NULL); - return NULL; -} - -static const char *set_shmem_size(cmd_parms *cmd, void *config, - const char *size_str) -{ - char *endptr; - long size, min; - - size = strtol(size_str, &endptr, 10); - while (apr_isspace(*endptr)) endptr++; - if (*endptr == '\0' || *endptr == 'b' || *endptr == 'B') - ; - else if (*endptr == 'k' || *endptr == 'K') - size *= 1024; - else if (*endptr == 'm' || *endptr == 'M') - size *= 1048576; - else - return apr_pstrcat(cmd->pool, "Invalid size in AuthDigestShmemSize: ", - size_str, NULL); - - min = sizeof(*client_list) + sizeof(client_entry*) + sizeof(client_entry); - if (size < min) - return apr_psprintf(cmd->pool, "size in AuthDigestShmemSize too small: " - "%ld < %ld", size, min); - - shmem_size = size; - num_buckets = (size - sizeof(*client_list)) / - (sizeof(client_entry*) + HASH_DEPTH * sizeof(client_entry)); - if (num_buckets == 0) - num_buckets = 1; - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, cmd->server, - "Digest: Set shmem-size: %ld, num-buckets: %ld", shmem_size, - num_buckets); - - return NULL; -} - -static const command_rec digest_cmds[] = -{ - AP_INIT_TAKE1("AuthName", set_realm, NULL, OR_AUTHCFG, - "The authentication realm (e.g. \"Members Only\")"), - AP_INIT_TAKE1("AuthDigestFile", set_digest_file, NULL, OR_AUTHCFG, - "The name of the file containing the usernames and password hashes"), - AP_INIT_TAKE1("AuthDigestGroupFile", set_group_file, NULL, OR_AUTHCFG, - "The name of the file containing the group names and members"), - AP_INIT_ITERATE("AuthDigestQop", set_qop, NULL, OR_AUTHCFG, - "A list of quality-of-protection options"), - AP_INIT_TAKE1("AuthDigestNonceLifetime", set_nonce_lifetime, NULL, OR_AUTHCFG, - "Maximum lifetime of the server nonce (seconds)"), - AP_INIT_TAKE1("AuthDigestNonceFormat", set_nonce_format, NULL, OR_AUTHCFG, - "The format to use when generating the server nonce"), - AP_INIT_FLAG("AuthDigestNcCheck", set_nc_check, NULL, OR_AUTHCFG, - "Whether or not to check the nonce-count sent by the client"), - AP_INIT_TAKE1("AuthDigestAlgorithm", set_algorithm, NULL, OR_AUTHCFG, - "The algorithm used for the hash calculation"), - AP_INIT_ITERATE("AuthDigestDomain", set_uri_list, NULL, OR_AUTHCFG, - "A list of URI's which belong to the same protection space as the current URI"), - AP_INIT_TAKE1("AuthDigestShmemSize", set_shmem_size, NULL, RSRC_CONF, - "The amount of shared memory to allocate for keeping track of clients"), - {NULL} -}; - - -/* - * 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_shm) return NULL; - - bucket = key % client_list->tbl_len; - entry = client_list->table[bucket]; - - apr_lock_acquire(client_lock /*, 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; - } - - apr_lock_release(client_lock); - - if (entry) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, r, - "get_client(): client %lu found", key); - else - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, 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 */ - apr_shm_free(client_shm, 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 if memory is low. - */ -static client_entry *add_client(unsigned long key, client_entry *info, - server_rec *s) -{ - int bucket; - client_entry *entry; - - - if (!key || !client_shm) return NULL; - - bucket = key % client_list->tbl_len; - entry = client_list->table[bucket]; - - apr_lock_acquire(client_lock /*, MM_LOCK_RW */); - - /* try to allocate a new entry */ - - entry = apr_shm_malloc(client_shm, sizeof(client_entry)); - if (!entry) { - long num_removed = gc(); - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, 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 = apr_shm_malloc(client_shm, sizeof(client_entry)); - if (!entry) return NULL; /* give up */ - } - - /* now add the entry */ - - memcpy(entry, info, 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++; - - apr_lock_release(client_lock); - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, s, - "allocated new client %lu", key); - - return entry; -} - - -/* - * 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; - size_t l; - int vk = 0, vv = 0; - char *key, *value; - - auth_line = apr_table_get(r->headers_in, - (PROXYREQ_PROXY == r->proxyreq) ? "Proxy-Authorization" - : "Authorization"); - 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 = apr_palloc(r->pool, l+1); - value = apr_palloc(r->pool, l+1); - - while (auth_line[0] != '\0') { - - /* find key */ - - while (apr_isspace(auth_line[0])) auth_line++; - vk = 0; - while (auth_line[0] != '=' && auth_line[0] != ',' - && auth_line[0] != '\0' && !apr_isspace(auth_line[0])) - key[vk++] = *auth_line++; - key[vk] = '\0'; - while (apr_isspace(auth_line[0])) auth_line++; - - /* find value */ - - if (auth_line[0] == '=') { - auth_line++; - while (apr_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' - && !apr_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 = apr_pstrdup(r->pool, value); - else if (!strcasecmp(key, "realm")) - resp->realm = apr_pstrdup(r->pool, value); - else if (!strcasecmp(key, "nonce")) - resp->nonce = apr_pstrdup(r->pool, value); - else if (!strcasecmp(key, "uri")) - resp->uri = apr_pstrdup(r->pool, value); - else if (!strcasecmp(key, "response")) - resp->digest = apr_pstrdup(r->pool, value); - else if (!strcasecmp(key, "algorithm")) - resp->algorithm = apr_pstrdup(r->pool, value); - else if (!strcasecmp(key, "cnonce")) - resp->cnonce = apr_pstrdup(r->pool, value); - else if (!strcasecmp(key, "opaque")) - resp->opaque = apr_pstrdup(r->pool, value); - else if (!strcasecmp(key, "qop")) - resp->message_qop = apr_pstrdup(r->pool, value); - else if (!strcasecmp(key, "nc")) - resp->nonce_count = apr_pstrdup(r->pool, value); - } - - if (!resp->username || !resp->realm || !resp->nonce || !resp->uri - || !resp->digest - || (resp->message_qop && (!resp->cnonce || !resp->nonce_count))) { - 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 parse_hdr_and_update_nc(request_rec *r) -{ - digest_header_rec *resp; - int res; - - if (!ap_is_initial_req(r)) - return DECLINED; - - resp = apr_pcalloc(r->pool, sizeof(digest_header_rec)); - resp->raw_request_uri = r->unparsed_uri; - resp->psd_request_uri = &r->parsed_uri; - resp->needed_auth = 0; - ap_set_module_config(r->request_config, &auth_digest_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, server host - * and port, 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[APR_SHA1_DIGESTSIZE]; - apr_sha1_ctx_t ctx; - int idx; - - memcpy(&ctx, &conf->nonce_ctx, sizeof(ctx)); - /* - apr_sha1_update_binary(&ctx, (const unsigned char *) server->server_hostname, - strlen(server->server_hostname)); - apr_sha1_update_binary(&ctx, (const unsigned char *) &server->port, - sizeof(server->port)); - */ - apr_sha1_update_binary(&ctx, (const unsigned char *) timestr, strlen(timestr)); - if (opaque) - apr_sha1_update_binary(&ctx, (const unsigned char *) opaque, - strlen(opaque)); - apr_sha1_final(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(apr_pool_t *p, apr_time_t now, const char *opaque, - const server_rec *server, - const digest_config_rec *conf) -{ - char *nonce = apr_palloc(p, NONCE_LEN+1); - int len; - time_rec t; - - if (conf->nonce_lifetime != 0) - t.time = now; - else if (otn_counter) - /* this counter is not synch'd, because it doesn't really matter - * if it counts exactly. - */ - t.time = (*otn_counter)++; - else - t.time = 42; - len = apr_base64_encode_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 - */ - -/* - * 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_entry = { 0, NULL, 0, "", "" }, *entry; - - if (!opaque_cntr) return NULL; - - apr_lock_acquire(opaque_lock /*, MM_LOCK_RW */); - op = (*opaque_cntr)++; - apr_lock_release(opaque_lock); - - if (!(entry = add_client(op, &new_entry, r->server))) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "Digest: failed to allocate client entry - ignoring " - "client"); - return NULL; - } - - return entry; -} - - -/* - * 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 uses 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 - * - * h_urp = ap_md5(r->pool, - * apr_pstrcat(r->pool, username, ":", ap_auth_name(r), ":", passwd)) - * ap_md5(r->pool, - * (unsigned char *) apr_pstrcat(r->pool, h_urp, ":", resp->nonce, ":", - * resp->cnonce, NULL)); - * - * or put differently, it must return - * - * MD5(MD5(username ":" realm ":" password) ":" nonce ":" cnonce) - * - * If something goes wrong, the failure must be logged and NULL returned. - * - * You must implement this yourself, which will probably consist of code - * contacting the password server with the necessary information (typically - * the username, realm, nonce, and cnonce) and receiving 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) -{ - return ap_md5(r->pool, - (unsigned char *) apr_pstrcat(r->pool, conf->ha1, ":", resp->nonce, - ":", resp->cnonce, NULL)); -} - - -/* Retrieve current session H(A1). If there is none and "generate" is - * true then a new session for MD5-sess is generated and stored in the - * client struct; if generate is false, or a new session could not be - * generated then NULL is returned (in case of failure to generate the - * failure reason will have been logged already). - */ -static const char *get_session_HA1(const request_rec *r, - digest_header_rec *resp, - const digest_config_rec *conf, - int generate) -{ - const char *ha1 = NULL; - - /* return the current sessions if there is one */ - if (resp->opaque && resp->client && resp->client->ha1[0]) - return resp->client->ha1; - else if (!generate) - return NULL; - - /* generate a new session */ - if (!resp->client) - resp->client = gen_client(r); - if (resp->client) { - ha1 = get_userpw_hash(r, resp, conf); - if (ha1) - memcpy(resp->client->ha1, ha1, sizeof(resp->client->ha1)); - } - - 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(apr_pool_t *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 = apr_pstrdup(p, uri); - tmp[(u-uri)+(d_len-(f-filename))] = '\0'; - return tmp; - } - - return ""; /* give up */ -} - - -static const char *ltox(apr_pool_t *p, unsigned long num) -{ - if (num != 0) - return apr_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 = apr_pstrcat(r->pool, ", qop=\"", conf->qop_list[0], NULL); - for (cnt=1; conf->qop_list[cnt] != NULL; cnt++) - qop = apr_pstrcat(r->pool, qop, ",", conf->qop_list[cnt], NULL); - qop = apr_pstrcat(r->pool, qop, "\"", NULL); - } - - /* 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 = apr_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 MD5-sess stuff. Note that we just clear out the session - * info here, since we can't generate a new session until the request - * from the client comes in with the cnonce. - */ - - if (!strcasecmp(conf->algorithm, "MD5-sess")) - clear_session(resp); - - /* 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 (r->proxyreq) - domain = NULL; /* don't send domain for proxy requests */ - else 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->psd_request_uri->path, r->filename, - conf->dir_name); - if (domain[0] == '/' && domain[1] == '\0') - domain = NULL; /* "/" is the default, so no need to send it */ - else - domain = apr_pstrcat(r->pool, ", domain=\"", domain, "\"", NULL); - } - - apr_table_mergen(r->err_headers_out, - (PROXYREQ_PROXY == r->proxyreq) ? "Proxy-Authenticate" : "WWW-Authenticate", - apr_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) -{ - ap_configfile_t *f; - char l[MAX_STRING_LEN]; - const char *rpw; - char *w, *x; - apr_status_t sts; - - if ((sts = ap_pcfg_openfile(&f, r->pool, auth_pwfile)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, sts, 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 apr_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) -{ - unsigned long nc; - const char *snc = resp->nonce_count; - char *endptr; - - if (!conf->check_nc || !client_shm) - return OK; - - nc = strtol(snc, &endptr, 16); - if (endptr < (snc+strlen(snc)) && !apr_isspace(*endptr)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, 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_ERR, 0, r, - "Digest: Warning, possible replay attack: 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) -{ - apr_time_t dt; - int len; - 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, 0, r, - "Digest: invalid nonce %s received - length is not %d", - resp->nonce, NONCE_LEN); - note_digest_auth_failure(r, conf, resp, 1); - return HTTP_UNAUTHORIZED; - } - - tmp = resp->nonce[NONCE_TIME_LEN]; - resp->nonce[NONCE_TIME_LEN] = '\0'; - len = apr_base64_decode_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, 0, r, - "Digest: invalid nonce %s received - hash is not %s", - resp->nonce, hash); - note_digest_auth_failure(r, conf, resp, 1); - return HTTP_UNAUTHORIZED; - } - - dt = r->request_time - nonce_time.time; - if (conf->nonce_lifetime > 0 && dt < 0) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Digest: invalid nonce %s received - user attempted " - "time travel", resp->nonce); - note_digest_auth_failure(r, conf, resp, 1); - return HTTP_UNAUTHORIZED; - } - - if (conf->nonce_lifetime > 0) { - if (dt > conf->nonce_lifetime) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0,r, - "Digest: user %s: nonce expired (%.2f seconds old - max lifetime %.2f) - sending new nonce", - r->user, ((double)dt)/APR_USEC_PER_SEC, - ((double)(conf->nonce_lifetime))/APR_USEC_PER_SEC); - note_digest_auth_failure(r, conf, resp, 1); - return HTTP_UNAUTHORIZED; - } - } - 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, 0, r, - "Digest: user %s: one-time-nonce mismatch - sending " - "new nonce", r->user); - note_digest_auth_failure(r, conf, resp, 1); - return HTTP_UNAUTHORIZED; - } - } - /* else (lifetime < 0) => never expires */ - - return OK; -} - -/* The actual MD5 code... whee */ - -/* RFC-2069 */ -static const char *old_digest(const request_rec *r, - const digest_header_rec *resp, const char *ha1) -{ - const char *ha2; - - ha2 = ap_md5(r->pool, (unsigned char *)apr_pstrcat(r->pool, r->method, ":", - resp->uri, NULL)); - return ap_md5(r->pool, - (unsigned char *)apr_pstrcat(r->pool, ha1, ":", resp->nonce, - ":", ha2, NULL)); -} - -/* RFC-2617 */ -static const char *new_digest(const request_rec *r, - digest_header_rec *resp, - const digest_config_rec *conf) -{ - const char *ha1, *ha2, *a2; - - if (resp->algorithm && !strcasecmp(resp->algorithm, "MD5-sess")) { - ha1 = get_session_HA1(r, resp, conf, 1); - if (!ha1) - return NULL; - } - else - ha1 = conf->ha1; - - if (resp->message_qop && !strcasecmp(resp->message_qop, "auth-int")) - a2 = apr_pstrcat(r->pool, r->method, ":", resp->uri, ":", - ap_md5(r->pool, (const unsigned char*) ""), NULL); /* TBD */ - else - a2 = apr_pstrcat(r->pool, r->method, ":", resp->uri, NULL); - ha2 = ap_md5(r->pool, (const unsigned char *)a2); - - return ap_md5(r->pool, - (unsigned char *)apr_pstrcat(r->pool, ha1, ":", resp->nonce, - ":", resp->nonce_count, ":", - resp->cnonce, ":", - resp->message_qop, ":", ha2, - NULL)); -} - - -static void copy_uri_components(uri_components *dst, uri_components *src, - request_rec *r) { - if (src->scheme && src->scheme[0] != '\0') - dst->scheme = src->scheme; - else - dst->scheme = (char *) "http"; - - if (src->hostname && src->hostname[0] != '\0') { - dst->hostname = apr_pstrdup(r->pool, src->hostname); - ap_unescape_url(dst->hostname); - } - else - dst->hostname = (char *) ap_get_server_name(r); - - if (src->port_str && src->port_str[0] != '\0') - dst->port = src->port; - else - dst->port = ap_get_server_port(r); - - if (src->path && src->path[0] != '\0') { - dst->path = apr_pstrdup(r->pool, src->path); - ap_unescape_url(dst->path); - } - else - dst->path = src->path; - - if (src->query && src->query[0] != '\0') { - dst->query = apr_pstrdup(r->pool, src->query); - ap_unescape_url(dst->query); - } - else - dst->query = src->query; -} - -/* These functions return 0 if client is OK, and proper error status - * if not... either HTTP_UNAUTHORIZED, if we made a check, and it failed, or - * HTTP_INTERNAL_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; - 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, 0, r, - "Digest: need AuthName: %s", r->uri); - return HTTP_INTERNAL_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, - &auth_digest_module); - resp->needed_auth = 1; - - - /* get our conf */ - - conf = (digest_config_rec *) ap_get_module_config(r->per_dir_config, - &auth_digest_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, 0, 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, 0, r, - "Digest: missing user, realm, nonce, uri, digest, " - "cnonce, or nonce_count in authorization header: %s", - r->uri); - /* else (resp->auth_hdr_sts == NO_HEADER) */ - note_digest_auth_failure(r, conf, resp, 0); - return HTTP_UNAUTHORIZED; - } - - r->user = (char *) resp->username; - r->ap_auth_type = (char *) "Digest"; - - /* check the auth attributes */ - - if (strcmp(resp->uri, resp->raw_request_uri)) { - /* Hmm, the simple match didn't work (probably a proxy modified the - * request-uri), so lets do a more sophisticated match - */ - uri_components r_uri, d_uri; - - copy_uri_components(&r_uri, resp->psd_request_uri, r); - if (ap_parse_uri_components(r->pool, resp->uri, &d_uri) != HTTP_OK) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Digest: invalid uri <%s> in Authorization header", - resp->uri); - return HTTP_BAD_REQUEST; - } - - if (d_uri.hostname) - ap_unescape_url(d_uri.hostname); - if (d_uri.path) - ap_unescape_url(d_uri.path); - if (d_uri.query) - ap_unescape_url(d_uri.query); - - if (r->method_number == M_CONNECT) { - if (strcmp(resp->uri, r_uri.hostinfo)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Digest: uri mismatch - <%s> does not match " - "request-uri <%s>", resp->uri, r_uri.hostinfo); - return HTTP_BAD_REQUEST; - } - } - else if ( - /* check hostname matches, if present */ - (d_uri.hostname && d_uri.hostname[0] != '\0' - && strcasecmp(d_uri.hostname, r_uri.hostname)) - /* check port matches, if present */ - || (d_uri.port_str && d_uri.port != r_uri.port) - /* check that server-port is default port if no port present */ - || (d_uri.hostname && d_uri.hostname[0] != '\0' - && !d_uri.port_str && r_uri.port != ap_default_port(r)) - /* check that path matches */ - || (d_uri.path != r_uri.path - /* either exact match */ - && (!d_uri.path || !r_uri.path - || strcmp(d_uri.path, r_uri.path)) - /* or '*' matches empty path in scheme://host */ - && !(d_uri.path && !r_uri.path && resp->psd_request_uri->hostname - && d_uri.path[0] == '*' && d_uri.path[1] == '\0')) - /* check that query matches */ - || (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, 0, r, - "Digest: uri mismatch - <%s> does not match " - "request-uri <%s>", resp->uri, resp->raw_request_uri); - return HTTP_BAD_REQUEST; - } - } - - if (resp->opaque && resp->opaque_num == 0) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Digest: received invalid opaque - got `%s'", - resp->opaque); - note_digest_auth_failure(r, conf, resp, 0); - return HTTP_UNAUTHORIZED; - } - - if (strcmp(resp->realm, conf->realm)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Digest: realm mismatch - got `%s' but expected `%s'", - resp->realm, conf->realm); - note_digest_auth_failure(r, conf, resp, 0); - return HTTP_UNAUTHORIZED; - } - - if (resp->algorithm != NULL - && strcasecmp(resp->algorithm, "MD5") - && strcasecmp(resp->algorithm, "MD5-sess")) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Digest: unknown algorithm `%s' received: %s", - resp->algorithm, r->uri); - note_digest_auth_failure(r, conf, resp, 0); - return HTTP_UNAUTHORIZED; - } - - if (!conf->pwfile) - return DECLINED; - - if (!(conf->ha1 = get_hash(r, r->user, conf->realm, conf->pwfile))) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Digest: user `%s' in realm `%s' not found: %s", - r->user, conf->realm, r->uri); - note_digest_auth_failure(r, conf, resp, 0); - return HTTP_UNAUTHORIZED; - } - - - 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, 0, r, - "Digest: user %s: password mismatch: %s", r->user, - r->uri); - note_digest_auth_failure(r, conf, resp, 0); - return HTTP_UNAUTHORIZED; - } - } - else { - const char *exp_digest; - 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, 0, r, - "Digest: invalid qop `%s' received: %s", - resp->message_qop, r->uri); - note_digest_auth_failure(r, conf, resp, 0); - return HTTP_UNAUTHORIZED; - } - - exp_digest = new_digest(r, resp, conf); - if (!exp_digest) { - /* we failed to allocate a client struct */ - return HTTP_INTERNAL_SERVER_ERROR; - } - if (strcmp(resp->digest, exp_digest)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Digest: user %s: password mismatch: %s", r->user, - r->uri); - note_digest_auth_failure(r, conf, resp, 0); - return HTTP_UNAUTHORIZED; - } - } - - if (check_nc(r, resp, conf) != OK) { - note_digest_auth_failure(r, conf, resp, 0); - return HTTP_UNAUTHORIZED; - } - - /* 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 apr_table_t *groups_for_user(request_rec *r, const char *user, - const char *grpfile) -{ - ap_configfile_t *f; - apr_table_t *grps = apr_table_make(r->pool, 15); - apr_pool_t *sp; - char l[MAX_STRING_LEN]; - const char *group_name, *ll, *w; - apr_status_t sts; - - if ((sts = ap_pcfg_openfile(&f, r->pool, grpfile)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, sts, r, - "Digest: Could not open group file: %s", grpfile); - return NULL; - } - - if (apr_pool_create(&sp, r->pool) != APR_SUCCESS) - return NULL; - - while (!(ap_cfg_getline(l, MAX_STRING_LEN, f))) { - if ((l[0] == '#') || (!l[0])) - continue; - ll = l; - apr_pool_clear(sp); - - group_name = ap_getword(sp, &ll, ':'); - - while (ll[0]) { - w = ap_getword_conf(sp, &ll); - if (!strcmp(w, user)) { - apr_table_setn(grps, apr_pstrdup(r->pool, group_name), "in"); - break; - } - } - } - - ap_cfg_closefile(f); - apr_pool_destroy(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, - &auth_digest_module); - const char *user = r->user; - int m = r->method_number; - int method_restricted = 0; - register int x; - const char *t, *w; - apr_table_t *grpstatus; - const apr_array_header_t *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 (apr_table_get(grpstatus, w)) - return OK; - } - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, 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, 0, 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, - &auth_digest_module), - 0); - return HTTP_UNAUTHORIZED; -} - - -/* - * Authorization-Info header code - */ - -#ifdef SEND_DIGEST -static const char *hdr(const apr_table_t *tbl, const char *name) -{ - const char *val = apr_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, - &auth_digest_module); - digest_header_rec *resp = - (digest_header_rec *) ap_get_module_config(r->request_config, - &auth_digest_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 date[APR_RFC822_DATE_LEN]; - apr_rfc822_date(date, r->request_time); - char *entity_info = - ap_md5(r->pool, - (unsigned char *) apr_pstrcat(r->pool, resp->raw_request_uri, - ":", - 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 && !apr_table_get(r->headers_out, "Expires") ? - date : - hdr(r->headers_out, "Expires"), - NULL)); - digest = - ap_md5(r->pool, - (unsigned char *)apr_pstrcat(r->pool, conf->ha1, ":", - resp->nonce, ":", - r->method, ":", - date, ":", - 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 ((r->request_time - resp->nonce_time) > (conf->nonce_lifetime-NEXTNONCE_DELTA)) { - nextnonce = apr_pstrcat(r->pool, ", nextnonce=\"", - gen_nonce(r->pool, r->request_time, - resp->opaque, r->server, conf), - "\"", NULL); - if (resp->client) - 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 = apr_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 = apr_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_HA1(r, resp, conf, 0); - if (!ha1) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Digest: internal error: couldn't find session " - "info for user %s", resp->username); - return !OK; - } - } - else - ha1 = conf->ha1; - - if (resp->message_qop && !strcasecmp(resp->message_qop, "auth-int")) - a2 = apr_pstrcat(r->pool, ":", resp->uri, ":", - ap_md5(r->pool, (const unsigned char *) ""), NULL); /* TBD */ - else - a2 = apr_pstrcat(r->pool, ":", resp->uri, NULL); - ha2 = ap_md5(r->pool, (const unsigned char *)a2); - - resp_dig = ap_md5(r->pool, - (unsigned char *)apr_pstrcat(r->pool, ha1, ":", - resp->nonce, ":", - resp->nonce_count, ":", - resp->cnonce, ":", - resp->message_qop ? - resp->message_qop : "", - ":", ha2, NULL)); - - /* assemble Authentication-Info header - */ - ai = apr_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]) - apr_table_mergen(r->headers_out, - (PROXYREQ_PROXY == r->proxyreq) ? "Proxy-Authentication-Info" - : "Authentication-Info", - ai); - return OK; -} - - -static void register_hooks(apr_pool_t *p) -{ - static const char * const cfgPost[]={ "http_core.c", NULL }; - static const char * const parsePre[]={ "mod_proxy.c", NULL }; - - ap_hook_post_config(initialize_module, NULL, cfgPost, APR_HOOK_MIDDLE); - ap_hook_child_init(initialize_child, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_post_read_request(parse_hdr_and_update_nc, parsePre, NULL, APR_HOOK_MIDDLE); - ap_hook_check_user_id(authenticate_digest_user, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_auth_checker(digest_check_auth, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_fixups(add_auth_info, NULL, NULL, APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA auth_digest_module = -{ - STANDARD20_MODULE_STUFF, - 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 */ - register_hooks /* register hooks */ -}; - diff --git a/modules/aaa/mod_auth_digest.dsp b/modules/aaa/mod_auth_digest.dsp deleted file mode 100644 index 84d6760577..0000000000 --- a/modules/aaa/mod_auth_digest.dsp +++ /dev/null @@ -1,95 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_auth_digest" - 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_auth_digest - 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_auth_digest.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_auth_digest.mak" CFG="mod_auth_digest - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_auth_digest - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_auth_digest - 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_auth_digest - 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_auth_digest" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" -# 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 /incremental:no /map /out:"Release/mod_auth_digest.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_auth_digest -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_auth_digest.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_auth_digest - -!ELSEIF "$(CFG)" == "mod_auth_digest - 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_auth_digest" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" -# 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 /out:"Debug/mod_auth_digest.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_auth_digest -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_auth_digest.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_auth_digest - -!ENDIF - -# Begin Target - -# Name "mod_auth_digest - Win32 Release" -# Name "mod_auth_digest - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_auth_digest.c -# End Source File -# End Target -# End Project diff --git a/modules/aaa/mod_auth_digest.mak b/modules/aaa/mod_auth_digest.mak deleted file mode 100644 index 871e162be7..0000000000 --- a/modules/aaa/mod_auth_digest.mak +++ /dev/null @@ -1,370 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on mod_auth_digest.dsp -!IF "$(CFG)" == "" -CFG=mod_auth_digest - Win32 Debug -!MESSAGE No configuration specified. Defaulting to mod_auth_digest - Win32\ - Debug. -!ENDIF - -!IF "$(CFG)" != "mod_auth_digest - Win32 Release" && "$(CFG)" !=\ - "mod_auth_digest - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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_auth_digest.mak" CFG="mod_auth_digest - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_auth_digest - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_auth_digest - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "mod_auth_digest - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_auth_digest.so" - -!ELSE - -ALL : "libhttpd - Win32 Release" "libaprutil - Win32 Release"\ - "libapr - Win32 Release" "$(OUTDIR)\mod_auth_digest.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 ReleaseCLEAN" "libaprutil - Win32 ReleaseCLEAN"\ - "libhttpd - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_auth_digest.idb" - -@erase "$(INTDIR)\mod_auth_digest.obj" - -@erase "$(OUTDIR)\mod_auth_digest.exp" - -@erase "$(OUTDIR)\mod_auth_digest.lib" - -@erase "$(OUTDIR)\mod_auth_digest.map" - -@erase "$(OUTDIR)\mod_auth_digest.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I\ - "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D\ - "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_auth_digest" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_auth_digest.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_auth_digest.pdb" /map:"$(INTDIR)\mod_auth_digest.map"\ - /machine:I386 /out:"$(OUTDIR)\mod_auth_digest.so"\ - /implib:"$(OUTDIR)\mod_auth_digest.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_auth_digest -LINK32_OBJS= \ - "$(INTDIR)\mod_auth_digest.obj" \ - "..\..\Release\libhttpd.lib" \ - "..\..\srclib\apr-util\Release\libaprutil.lib" \ - "..\..\srclib\apr\Release\libapr.lib" - -"$(OUTDIR)\mod_auth_digest.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "mod_auth_digest - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_auth_digest.so" - -!ELSE - -ALL : "libhttpd - Win32 Debug" "libaprutil - Win32 Debug"\ - "libapr - Win32 Debug" "$(OUTDIR)\mod_auth_digest.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 DebugCLEAN" "libaprutil - Win32 DebugCLEAN"\ - "libhttpd - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_auth_digest.idb" - -@erase "$(INTDIR)\mod_auth_digest.obj" - -@erase "$(OUTDIR)\mod_auth_digest.exp" - -@erase "$(OUTDIR)\mod_auth_digest.lib" - -@erase "$(OUTDIR)\mod_auth_digest.map" - -@erase "$(OUTDIR)\mod_auth_digest.pdb" - -@erase "$(OUTDIR)\mod_auth_digest.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_auth_digest" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_auth_digest.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_auth_digest.pdb" /map:"$(INTDIR)\mod_auth_digest.map"\ - /debug /machine:I386 /out:"$(OUTDIR)\mod_auth_digest.so"\ - /implib:"$(OUTDIR)\mod_auth_digest.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_auth_digest -LINK32_OBJS= \ - "$(INTDIR)\mod_auth_digest.obj" \ - "..\..\Debug\libhttpd.lib" \ - "..\..\srclib\apr-util\Debug\libaprutil.lib" \ - "..\..\srclib\apr\Debug\libapr.lib" - -"$(OUTDIR)\mod_auth_digest.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "mod_auth_digest - Win32 Release" || "$(CFG)" ==\ - "mod_auth_digest - Win32 Debug" - -!IF "$(CFG)" == "mod_auth_digest - Win32 Release" - -"libapr - Win32 Release" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Release" - cd "..\..\modules\aaa" - -"libapr - Win32 ReleaseCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\..\modules\aaa" - -!ELSEIF "$(CFG)" == "mod_auth_digest - Win32 Debug" - -"libapr - Win32 Debug" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Debug" - cd "..\..\modules\aaa" - -"libapr - Win32 DebugCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\..\modules\aaa" - -!ENDIF - -!IF "$(CFG)" == "mod_auth_digest - Win32 Release" - -"libaprutil - Win32 Release" : - cd "..\..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\libaprutil.mak" CFG="libaprutil - Win32 Release"\ - - cd "..\..\modules\aaa" - -"libaprutil - Win32 ReleaseCLEAN" : - cd "..\..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libaprutil.mak"\ - CFG="libaprutil - Win32 Release" RECURSE=1 - cd "..\..\modules\aaa" - -!ELSEIF "$(CFG)" == "mod_auth_digest - Win32 Debug" - -"libaprutil - Win32 Debug" : - cd "..\..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\libaprutil.mak" CFG="libaprutil - Win32 Debug" - cd "..\..\modules\aaa" - -"libaprutil - Win32 DebugCLEAN" : - cd "..\..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libaprutil.mak"\ - CFG="libaprutil - Win32 Debug" RECURSE=1 - cd "..\..\modules\aaa" - -!ENDIF - -!IF "$(CFG)" == "mod_auth_digest - Win32 Release" - -"libhttpd - Win32 Release" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Release" - cd ".\modules\aaa" - -"libhttpd - Win32 ReleaseCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Release"\ - RECURSE=1 - cd ".\modules\aaa" - -!ELSEIF "$(CFG)" == "mod_auth_digest - Win32 Debug" - -"libhttpd - Win32 Debug" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Debug" - cd ".\modules\aaa" - -"libhttpd - Win32 DebugCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Debug"\ - RECURSE=1 - cd ".\modules\aaa" - -!ENDIF - -SOURCE=.\mod_auth_digest.c -DEP_CPP_MOD_A=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.h"\ - "..\..\include\ap_release.h"\ - "..\..\include\http_config.h"\ - "..\..\include\http_core.h"\ - "..\..\include\http_log.h"\ - "..\..\include\http_protocol.h"\ - "..\..\include\http_request.h"\ - "..\..\include\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_md5.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\srclib\apr-util\include\apr_base64.h"\ - "..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\srclib\apr-util\include\apr_sha1.h"\ - "..\..\srclib\apr-util\include\apu.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_dso.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_lib.h"\ - "..\..\srclib\apr\include\apr_lock.h"\ - "..\..\srclib\apr\include\apr_md5.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_portable.h"\ - "..\..\srclib\apr\include\apr_shmem.h"\ - "..\..\srclib\apr\include\apr_strings.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\include\apr_user.h"\ - "..\..\srclib\apr\include\apr_want.h"\ - "..\..\srclib\apr\include\apr_xlate.h"\ - -NODEP_CPP_MOD_A=\ - "..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_auth_digest.obj" : $(SOURCE) $(DEP_CPP_MOD_A) "$(INTDIR)" - - - -!ENDIF - diff --git a/modules/arch/win32/mod_isapi.c b/modules/arch/win32/mod_isapi.c deleted file mode 100644 index 5753afbeaf..0000000000 --- a/modules/arch/win32/mod_isapi.c +++ /dev/null @@ -1,1299 +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. - */ - -/* - * 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 "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" - -/* We use the exact same header file as the original */ -#include - -#if !defined(HSE_REQ_MAP_URL_TO_PATH_EX) \ - || !defined(HSE_REQ_SEND_RESPONSE_HEADER_EX) -#pragma message("WARNING: This build of Apache is missing the recent changes") -#pragma message("in the Microsoft Win32 Platform SDK; some mod_isapi features") -#pragma message("will be disabled. To obtain the latest Platform SDK files,") -#pragma message("please refer to:") -#pragma message("http://msdn.microsoft.com/downloads/sdks/platform/platform.asp") -#endif - -/* TODO: Unknown errors that must be researched for correct codes */ - -#define TODO_ERROR 1 - -/* 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; - -/* 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 HttpExtensionProc's address and calling through it. We work around the problem by - forcing it to use frame pointers. - - The revisions below may eliminate this artifact. -*/ -#pragma optimize("y",off) - -/* Our isapi server config structure */ - -typedef struct { - HANDLE lock; - apr_array_header_t *loaded; - DWORD ReadAheadBuffer; - int LogNotSupported; - int AppendLogToErrors; - int AppendLogToQuery; -} isapi_server_conf; - -/* Our loaded isapi module description structure */ - -typedef struct { - const char *filename; - apr_dso_handle_t *handle; - HSE_VERSION_INFO *pVer; - PFN_GETEXTENSIONVERSION GetExtensionVersion; - PFN_HTTPEXTENSIONPROC HttpExtensionProc; - PFN_TERMINATEEXTENSION TerminateExtension; - int refcount; - DWORD timeout; - BOOL fakeasync; - DWORD reportversion; -} isapi_loaded; - -/* Our "Connection ID" structure */ - -typedef struct { - LPEXTENSION_CONTROL_BLOCK ecb; - isapi_server_conf *sconf; - isapi_loaded *isa; - request_rec *r; - PFN_HSE_IO_COMPLETION completion; - PVOID completion_arg; - HANDLE complete; -} isapi_cid; - -static BOOL isapi_unload(isapi_loaded* isa, int force); - -static apr_status_t cleanup_isapi_server_config(void *sconfv) -{ - isapi_server_conf *sconf = sconfv; - size_t n; - isapi_loaded **isa; - - n = sconf->loaded->nelts; - isa = (isapi_loaded **)sconf->loaded->elts; - while(n--) { - if ((*isa)->handle) - isapi_unload(*isa, TRUE); - ++isa; - } - CloseHandle(sconf->lock); - return APR_SUCCESS; -} - -static void *create_isapi_server_config(apr_pool_t *p, server_rec *s) -{ - isapi_server_conf *sconf = apr_palloc(p, sizeof(isapi_server_conf)); - sconf->loaded = apr_array_make(p, 20, sizeof(isapi_loaded*)); - sconf->lock = CreateMutex(NULL, FALSE, NULL); - - sconf->ReadAheadBuffer = 49152; - sconf->LogNotSupported = -1; - sconf->AppendLogToErrors = 0; - sconf->AppendLogToQuery = 0; - - apr_pool_cleanup_register(p, sconf, cleanup_isapi_server_config, - apr_pool_cleanup_null); - - return sconf; -} - -static int compare_loaded(const void *av, const void *bv) -{ - const isapi_loaded **a = av; - const isapi_loaded **b = bv; - - return strcmp((*a)->filename, (*b)->filename); -} - -static void isapi_post_config(apr_pool_t *p, apr_pool_t *plog, - apr_pool_t *ptemp, server_rec *s) -{ - isapi_server_conf *sconf = ap_get_module_config(s->module_config, - &isapi_module); - isapi_loaded **elts = (isapi_loaded **)sconf->loaded->elts; - int nelts = sconf->loaded->nelts; - - /* sort the elements of the main_server, by filename */ - qsort(elts, nelts, sizeof(isapi_loaded*), compare_loaded); - - /* and make the virtualhosts share the same thing */ - for (s = s->next; s; s = s->next) { - ap_set_module_config(s->module_config, &isapi_module, sconf); - } -} - -static apr_status_t isapi_load(apr_pool_t *p, isapi_server_conf *sconf, - request_rec *r, const char *fpath, - isapi_loaded** isa) -{ - isapi_loaded **found = (isapi_loaded **)sconf->loaded->elts; - apr_status_t rv; - int n; - - for (n = 0; n < sconf->loaded->nelts; ++n) { - if (strcasecmp(fpath, (*found)->filename) == 0) { - break; - } - ++found; - } - - if (n < sconf->loaded->nelts) - { - *isa = *found; - if ((*isa)->handle) - { - ++(*isa)->refcount; - return APR_SUCCESS; - } - /* Otherwise we fall through and have to reload the resource - * into this existing mod_isapi cache bucket. - */ - } - else - { - *isa = apr_pcalloc(p, sizeof(isapi_module)); - (*isa)->filename = fpath; - (*isa)->pVer = apr_pcalloc(p, sizeof(HSE_VERSION_INFO)); - - /* TODO: These need to become overrideable, so that we - * assure a given isapi can be fooled into behaving well. - */ - (*isa)->timeout = INFINITE; /* microsecs */ - (*isa)->fakeasync = TRUE; - (*isa)->reportversion = MAKELONG(0, 5); /* Revision 5.0 */ - } - - rv = apr_dso_load(&(*isa)->handle, fpath, p); - if (rv) - { - ap_log_rerror(APLOG_MARK, APLOG_ALERT, rv, r, - "ISAPI %s failed to load", fpath); - (*isa)->handle = NULL; - return rv; - } - - rv = apr_dso_sym((void**)&(*isa)->GetExtensionVersion, (*isa)->handle, - "GetExtensionVersion"); - if (rv) - { - ap_log_rerror(APLOG_MARK, APLOG_ALERT, rv, r, - "ISAPI %s is missing GetExtensionVersion()", - fpath); - apr_dso_unload((*isa)->handle); - (*isa)->handle = NULL; - return rv; - } - - rv = apr_dso_sym((void**)&(*isa)->HttpExtensionProc, (*isa)->handle, - "HttpExtensionProc"); - if (rv) - { - ap_log_rerror(APLOG_MARK, APLOG_ALERT, rv, r, - "ISAPI %s is missing HttpExtensionProc()", - fpath); - apr_dso_unload((*isa)->handle); - (*isa)->handle = NULL; - return rv; - } - - /* TerminateExtension() is an optional interface */ - rv = apr_dso_sym((void**)&(*isa)->TerminateExtension, (*isa)->handle, - "TerminateExtension"); - SetLastError(0); - - /* Run GetExtensionVersion() */ - if (!((*isa)->GetExtensionVersion)((*isa)->pVer)) { - apr_status_t rv = apr_get_os_error(); - ap_log_rerror(APLOG_MARK, APLOG_ALERT, rv, r, - "ISAPI %s call GetExtensionVersion() failed", - fpath); - apr_dso_unload((*isa)->handle); - (*isa)->handle = NULL; - return rv; - } - - ++(*isa)->refcount; - - return APR_SUCCESS; -} - -static int isapi_unload(isapi_loaded* isa, int force) -{ - /* All done with the DLL... get rid of it... - * - * If optionally cached, pass HSE_TERM_ADVISORY_UNLOAD, - * and if it returns TRUE, unload, otherwise, cache it. - */ - if ((--isa->refcount > 0) && !force) - return FALSE; - if (isa->TerminateExtension) { - if (force) - (*isa->TerminateExtension)(HSE_TERM_MUST_UNLOAD); - else if (!(*isa->TerminateExtension)(HSE_TERM_ADVISORY_UNLOAD)) - return FALSE; - } - apr_dso_unload(isa->handle); - isa->handle = NULL; - return TRUE; -} - -apr_status_t isapi_handler (request_rec *r) -{ - isapi_server_conf * sconf; - apr_table_t *e; - apr_status_t rv; - isapi_loaded *isa; - isapi_cid *cid; - DWORD read; - int res; - - if(strcmp(r->handler, "isapi-isa")) - return DECLINED; - - sconf = ap_get_module_config(r->server->module_config, &isapi_module); - e = r->subprocess_env; - - /* Use similar restrictions as CGIs - * - * If this fails, it's pointless to load the isapi dll. - */ - if (!(ap_allow_options(r) & OPT_EXECCGI)) - return HTTP_FORBIDDEN; - - if (r->finfo.filetype == APR_NOFILE) - return HTTP_NOT_FOUND; - - if (r->finfo.filetype != APR_REG) - return HTTP_FORBIDDEN; - - /* Load the isapi extention without caching (sconf == NULL) - * but note that we will recover an existing cached module. - */ - if (isapi_load(r->pool, sconf, r, r->filename, &isa) != APR_SUCCESS) - return HTTP_INTERNAL_SERVER_ERROR; - - /* Set up variables */ - ap_add_common_vars(r); - ap_add_cgi_vars(r); - apr_table_setn(r->subprocess_env, "UNMAPPED_REMOTE_USER", "REMOTE_USER"); - apr_table_setn(r->subprocess_env, "SERVER_PORT_SECURE", "0"); - apr_table_setn(r->subprocess_env, "URL", r->uri); - - /* Set up connection structure and ecb */ - cid = apr_pcalloc(r->pool, sizeof(isapi_cid)); - cid->sconf = ap_get_module_config(r->server->module_config, &isapi_module); - - cid->ecb = apr_pcalloc(r->pool, sizeof(struct _EXTENSION_CONTROL_BLOCK)); - cid->ecb->ConnID = (HCONN)cid; - cid->isa = isa; - cid->r = r; - cid->r->status = 0; - cid->complete = NULL; - cid->completion = NULL; - - cid->ecb->cbSize = sizeof(EXTENSION_CONTROL_BLOCK); - cid->ecb->dwVersion = isa->reportversion; - cid->ecb->dwHttpStatusCode = 0; - strcpy(cid->ecb->lpszLogData, ""); - // TODO: are copies really needed here? - cid->ecb->lpszMethod = apr_pstrdup(r->pool, (char*) r->method); - cid->ecb->lpszQueryString = apr_pstrdup(r->pool, - (char*) apr_table_get(e, "QUERY_STRING")); - cid->ecb->lpszPathInfo = apr_pstrdup(r->pool, - (char*) apr_table_get(e, "PATH_INFO")); - cid->ecb->lpszPathTranslated = apr_pstrdup(r->pool, - (char*) apr_table_get(e, "PATH_TRANSLATED")); - cid->ecb->lpszContentType = apr_pstrdup(r->pool, - (char*) apr_table_get(e, "CONTENT_TYPE")); - /* Set up the callbacks */ - cid->ecb->GetServerVariable = GetServerVariable; - cid->ecb->WriteClient = WriteClient; - cid->ecb->ReadClient = ReadClient; - cid->ecb->ServerSupportFunction = ServerSupportFunction; - - - /* Set up client input */ - rv = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR); - if (rv) { - isapi_unload(isa, FALSE); - return HTTP_INTERNAL_SERVER_ERROR; /* XXX: The wrong error */ - } - - if (ap_should_client_block(r)) { - /* Time to start reading the appropriate amount of data, - * and allow the administrator to tweak the number - * TODO: add the httpd.conf option for ReadAheadBuffer. - */ - if (r->remaining) { - cid->ecb->cbTotalBytes = r->remaining; - if (cid->ecb->cbTotalBytes > cid->sconf->ReadAheadBuffer) - cid->ecb->cbAvailable = cid->sconf->ReadAheadBuffer; - else - cid->ecb->cbAvailable = cid->ecb->cbTotalBytes; - } - else - { - cid->ecb->cbTotalBytes = 0xffffffff; - cid->ecb->cbAvailable = cid->sconf->ReadAheadBuffer; - } - - cid->ecb->lpbData = apr_pcalloc(r->pool, cid->ecb->cbAvailable + 1); - - read = 0; - while (read < cid->ecb->cbAvailable && - ((res = ap_get_client_block(r, cid->ecb->lpbData + read, - cid->ecb->cbAvailable - read)) > 0)) { - read += res; - } - - if (res < 0) { - isapi_unload(isa, FALSE); - return HTTP_INTERNAL_SERVER_ERROR; - } - - /* Although its not to spec, IIS seems to null-terminate - * its lpdData string. So we will too. - */ - if (res == 0) - cid->ecb->cbAvailable = cid->ecb->cbTotalBytes = read; - else - cid->ecb->cbAvailable = read; - cid->ecb->lpbData[read] = '\0'; - } - else { - cid->ecb->cbTotalBytes = 0; - cid->ecb->cbAvailable = 0; - cid->ecb->lpbData = NULL; - } - - /* All right... try and run the sucker */ - rv = (*isa->HttpExtensionProc)(cid->ecb); - - /* Check for a log message - and log it */ - if (cid->ecb->lpszLogData && *cid->ecb->lpszLogData) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, r, - "ISAPI %s: %s", r->filename, cid->ecb->lpszLogData); - - switch(rv) { - 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". - * Per Microsoft: "In IIS versions 4.0 and later, the return - * values HSE_STATUS_SUCCESS and HSE_STATUS_SUCCESS_AND_KEEP_CONN - * are functionally identical: Keep-Alive connections are - * maintained, if supported by the client." - * ... so we were pat all this time - */ - break; - - case HSE_STATUS_PENDING: - /* emulating async behavior... - * - * Create a cid->completed event and wait on it for some timeout - * so that the app thinks is it running async. - * - * All async ServerSupportFunction calls will be handled through - * the registered IO_COMPLETION hook. - */ - - if (!isa->fakeasync) { - if (cid->sconf->LogNotSupported) - { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r, - "ISAPI %s asynch I/O request refused", - r->filename); - cid->r->status = HTTP_INTERNAL_SERVER_ERROR; - } - } - else { - cid->complete = CreateEvent(NULL, FALSE, FALSE, NULL); - if (WaitForSingleObject(cid->complete, isa->timeout) - == WAIT_TIMEOUT) { - /* TODO: Now what... if this hung, then do we kill our own - * thread to force it's death? For now leave timeout = -1 - */ - } - } - break; - - case HSE_STATUS_ERROR: - /* end response if we have yet to do so. - */ - cid->r->status = HTTP_INTERNAL_SERVER_ERROR; - break; - - default: - /* TODO: log unrecognized retval for debugging - */ - cid->r->status = HTTP_INTERNAL_SERVER_ERROR; - break; - } - - /* Set the status (for logging) */ - if (cid->ecb->dwHttpStatusCode) { - cid->r->status = cid->ecb->dwHttpStatusCode; - } - - /* All done with the DLL... get rid of it... */ - isapi_unload(isa, FALSE); - - return OK; /* NOT r->status, even if it has changed. */ -} -#pragma optimize("",on) - -BOOL WINAPI GetServerVariable (HCONN hConn, LPSTR lpszVariableName, - LPVOID lpvBuffer, LPDWORD lpdwSizeofBuffer) -{ - request_rec *r = ((isapi_cid *)hConn)->r; - const char *result; - DWORD len; - - if (!strcmp(lpszVariableName, "ALL_HTTP")) - { - /* lf delimited, colon split, comma seperated and - * null terminated list of HTTP_ vars - */ - char **env = (char**) apr_table_elts(r->subprocess_env)->elts; - int nelts = 2 * apr_table_elts(r->subprocess_env)->nelts; - int i; - - for (len = 0, i = 0; i < nelts; i += 2) - if (!strncmp(env[i], "HTTP_", 5)) - len += strlen(env[i]) + strlen(env[i + 1]) + 2; - - if (*lpdwSizeofBuffer < len + 1) { - *lpdwSizeofBuffer = len + 1; - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return FALSE; - } - - for (i = 0; i < nelts; i += 2) - if (!strncmp(env[i], "HTTP_", 5)) { - strcpy(lpvBuffer, env[i]); - ((char*)lpvBuffer) += strlen(env[i]); - *(((char*)lpvBuffer)++) = ':'; - strcpy(lpvBuffer, env[i + 1]); - ((char*)lpvBuffer) += strlen(env[i + 1]); - *(((char*)lpvBuffer)++) = '\n'; - } - - *(((char*)lpvBuffer)++) = '\0'; - *lpdwSizeofBuffer = len; - return TRUE; - } - - if (!strcmp(lpszVariableName, "ALL_RAW")) - { - /* lf delimited, colon split, comma seperated and - * null terminated list of the raw request header - */ - char **raw = (char**) apr_table_elts(r->headers_in)->elts; - int nelts = 2 * apr_table_elts(r->headers_in)->nelts; - int i; - - for (len = 0, i = 0; i < nelts; i += 2) - len += strlen(raw[i]) + strlen(raw[i + 1]) + 2; - - if (*lpdwSizeofBuffer < len + 1) { - *lpdwSizeofBuffer = len + 1; - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return FALSE; - } - - for (i = 0; i < nelts; i += 2) { - strcpy(lpvBuffer, raw[i]); - ((char*)lpvBuffer) += strlen(raw[i]); - *(((char*)lpvBuffer)++) = ':'; - *(((char*)lpvBuffer)++) = ' '; - strcpy(lpvBuffer, raw[i + 1]); - ((char*)lpvBuffer) += strlen(raw[i + 1]); - *(((char*)lpvBuffer)++) = '\n'; - i += 2; - } - *(((char*)lpvBuffer)++) = '\0'; - *lpdwSizeofBuffer = len; - return TRUE; - } - - /* Not a special case */ - result = apr_table_get(r->subprocess_env, lpszVariableName); - - if (result) { - len = strlen(result); - if (*lpdwSizeofBuffer < len + 1) { - *lpdwSizeofBuffer = len + 1; - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return FALSE; - } - strcpy(lpvBuffer, result); - *lpdwSizeofBuffer = len; - return TRUE; - } - - /* Not Found */ - SetLastError(ERROR_INVALID_INDEX); - return FALSE; -} - -BOOL WINAPI WriteClient (HCONN ConnID, LPVOID Buffer, LPDWORD lpwdwBytes, - DWORD dwReserved) -{ - request_rec *r = ((isapi_cid *)ConnID)->r; - apr_bucket_brigade *bb; - apr_bucket *b; - - if (dwReserved == HSE_IO_SYNC) - ; /* XXX: Fake it */ - - bb = apr_brigade_create(r->pool); - b = apr_bucket_transient_create(Buffer, *lpwdwBytes); - APR_BRIGADE_INSERT_TAIL(bb, b); - b = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(bb, b); - ap_pass_brigade(r->output_filters, bb); - - return TRUE; -} - -BOOL WINAPI ReadClient (HCONN ConnID, LPVOID lpvBuffer, LPDWORD lpdwSize) -{ - request_rec *r = ((isapi_cid *)ConnID)->r; - DWORD read = 0; - int res; - - if (r->remaining < (long) *lpdwSize) - *lpdwSize = r->remaining; - - while (read < *lpdwSize && - ((res = ap_get_client_block(r, (char*)lpvBuffer + read, - *lpdwSize - read)) > 0)) { - if (res < 0) { - *lpdwSize = 0; - if (!apr_get_os_error()) - SetLastError(TODO_ERROR); /* XXX: Find the right error code */ - return FALSE; - } - - read += res; - } - - *lpdwSize = read; - return TRUE; -} - -static apr_off_t SendResponseHeaderEx(isapi_cid *cid, const char *stat, - const char *head, apr_size_t statlen, - apr_size_t headlen) -{ - int termarg; - char *termch; - - if (!stat || statlen == 0 || !*stat) { - stat = "Status: 200 OK"; - } - else { - char *newstat; - newstat = apr_palloc(cid->r->pool, statlen + 9); - strcpy(newstat, "Status: "); - apr_cpystrn(newstat + 8, stat, statlen + 1); - stat = newstat; - } - - if (!head || headlen == 0 || !*head) { - head = "\r\n"; - } - else - { - if (head[headlen]) { - /* Whoops... not NULL terminated */ - head = apr_pstrndup(cid->r->pool, head, headlen); - } - } - - /* Parse them out, or die trying */ - cid->r->status= ap_scan_script_header_err_strs(cid->r, NULL, &termch, - &termarg, stat, head, NULL); - cid->ecb->dwHttpStatusCode = cid->r->status; - if (cid->r->status == HTTP_INTERNAL_SERVER_ERROR) - return -1; - - /* Headers will actually go when they are good and ready */ - - /* If all went well, tell the caller we consumed the headers complete */ - if (!termch) - return(headlen); - - /* Any data left is sent directly by the caller, all we - * give back is the size of the headers we consumed - */ - if (termch && (termarg == 1) && headlen > (termch - head)) { - return termch - head; - } - return 0; -} - -/* XXX: Is there is still an O(n^2) attack possible here? Please detail. */ -BOOL WINAPI ServerSupportFunction(HCONN hConn, DWORD dwHSERequest, - LPVOID lpvBuffer, LPDWORD lpdwSize, - LPDWORD lpdwDataType) -{ - isapi_cid *cid = (isapi_cid *)hConn; - request_rec *r = cid->r; - request_rec *subreq; - - switch (dwHSERequest) { - case 1: /* HSE_REQ_SEND_URL_REDIRECT_RESP */ - /* Set the status to be returned when the HttpExtensionProc() - * is done. - * WARNING: Microsoft now advertises HSE_REQ_SEND_URL_REDIRECT_RESP - * and HSE_REQ_SEND_URL as equivalant per the Jan 2000 SDK. - * They most definately are not, even in their own samples. - */ - apr_table_set (r->headers_out, "Location", lpvBuffer); - cid->r->status = cid->ecb->dwHttpStatusCode - = HTTP_MOVED_TEMPORARILY; - return TRUE; - - case 2: /* HSE_REQ_SEND_URL */ - /* Soak up remaining 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 = apr_pstrdup(r->pool, "GET"); - r->method_number = M_GET; - - /* Don't let anyone think there's still data */ - apr_table_unset(r->headers_in, "Content-Length"); - - /* AV fault per PR3598 - redirected path is lost! */ - (char*)lpvBuffer = apr_pstrdup(r->pool, (char*)lpvBuffer); - ap_internal_redirect((char*)lpvBuffer, r); - return TRUE; - - case 3: /* HSE_REQ_SEND_RESPONSE_HEADER */ - { - /* Parse them out, or die trying */ - apr_size_t statlen = 0, headlen = 0; - int ate; - if (lpvBuffer) - statlen = strlen((char*) lpvBuffer); - if (lpdwDataType) - headlen = strlen((char*) lpdwDataType); - ate = SendResponseHeaderEx(cid, (char*) lpvBuffer, - (char*) lpdwDataType, - statlen, headlen); - if (ate < 0) { - SetLastError(TODO_ERROR); - return FALSE; - } - else if (ate < headlen) { - apr_bucket_brigade *bb; - apr_bucket *b; - bb = apr_brigade_create(cid->r->pool); - b = apr_bucket_transient_create((char*) lpdwDataType + ate, - headlen - ate); - APR_BRIGADE_INSERT_TAIL(bb, b); - b = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(bb, b); - ap_pass_brigade(cid->r->output_filters, bb); - } - return TRUE; - } - - case 4: /* HSE_REQ_DONE_WITH_SESSION */ - /* Signal to resume the thread completing this request - */ - if (cid->complete) - SetEvent(cid->complete); - return TRUE; - - case 1001: /* HSE_REQ_MAP_URL_TO_PATH */ - { - /* Map a URL to a filename */ - char *file = (char *)lpvBuffer; - DWORD len; - subreq = ap_sub_req_lookup_uri(apr_pstrndup(r->pool, file, *lpdwSize), - r, NULL); - - len = apr_cpystrn(file, subreq->filename, *lpdwSize) - file; - - - /* IIS puts a trailing slash on directories, Apache doesn't */ - if (subreq->finfo.filetype == APR_DIR) { - if (len < *lpdwSize - 1) { - file[len++] = '\\'; - file[len] = '\0'; - } - } - *lpdwSize = len; - return TRUE; - } - - case 1002: /* HSE_REQ_GET_SSPI_INFO */ - if (cid->sconf->LogNotSupported) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r, - "ISAPI ServerSupportFunction HSE_REQ_GET_SSPI_INFO " - "is not supported: %s", r->filename); - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - - case 1003: /* HSE_APPEND_LOG_PARAMETER */ - /* Log lpvBuffer, of lpdwSize bytes, in the URI Query (cs-uri-query) field - */ - apr_table_set(r->notes, "isapi-parameter", (char*) lpvBuffer); - if (cid->sconf->AppendLogToQuery) { - if (r->args) - r->args = apr_pstrcat(r->pool, r->args, (char*) lpvBuffer, NULL); - else - r->args = apr_pstrdup(r->pool, (char*) lpvBuffer); - } - if (cid->sconf->AppendLogToErrors) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, r, - "ISAPI %s: %s", cid->r->filename, - (char*) lpvBuffer); - return TRUE; - - case 1005: /* HSE_REQ_IO_COMPLETION */ - /* Emulates a completion port... Record callback address and - * user defined arg, we will call this after any async request - * (e.g. transmitfile) as if the request executed async. - * Per MS docs... HSE_REQ_IO_COMPLETION replaces any prior call - * to HSE_REQ_IO_COMPLETION, and lpvBuffer may be set to NULL. - */ - if (!cid->isa->fakeasync) { - if (cid->sconf->LogNotSupported) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r, - "ISAPI ServerSupportFunction HSE_REQ_IO_COMPLETION " - "is not supported: %s", r->filename); - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - cid->completion = (PFN_HSE_IO_COMPLETION) lpvBuffer; - cid->completion_arg = (PVOID) lpdwDataType; - return TRUE; - - case 1006: /* HSE_REQ_TRANSMIT_FILE */ - { - HSE_TF_INFO *tf = (HSE_TF_INFO*)lpvBuffer; - apr_status_t rv; - apr_bucket_brigade *bb; - apr_bucket *b; - apr_file_t *fd; - - if (!cid->isa->fakeasync && (tf->dwFlags & HSE_IO_ASYNC)) { - if (cid->sconf->LogNotSupported) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r, - "ISAPI ServerSupportFunction HSE_REQ_TRANSMIT_FILE " - "as HSE_IO_ASYNC is not supported: %s", r->filename); - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - if ((rv = apr_os_file_put(&fd, tf->hFile, r->pool)) != APR_SUCCESS) { - return FALSE; - } - - /* apr_dupfile_oshandle (&fd, tf->hFile, r->pool); */ - bb = apr_brigade_create(r->pool); - - if (tf->dwFlags & HSE_IO_SEND_HEADERS) - { - /* According to MS: if calling HSE_REQ_TRANSMIT_FILE with the - * HSE_IO_SEND_HEADERS flag, then you can't otherwise call any - * HSE_SEND_RESPONSE_HEADERS* fn, but if you don't use the flag, - * you must have done so. They document that the pHead headers - * option is valid only for HSE_IO_SEND_HEADERS - we are a bit - * more flexible and assume with the flag, pHead are the - * response headers, and without, pHead simply contains text - * (handled after this case). - */ - apr_off_t ate = SendResponseHeaderEx(cid, tf->pszStatusCode, - (char*)tf->pHead, - strlen(tf->pszStatusCode), - (apr_size_t)tf->HeadLength); - if (ate < 0) - { - apr_brigade_destroy(bb); - SetLastError(TODO_ERROR); - return FALSE; - } - if (ate < (apr_size_t)tf->HeadLength) - { - b = apr_bucket_transient_create((char*)tf->pHead + ate, - (apr_size_t)tf->HeadLength - ate); - APR_BRIGADE_INSERT_TAIL(bb, b); - } - } - else if (tf->pHead && tf->HeadLength) { - b = apr_bucket_transient_create((char*)tf->pHead, - (apr_size_t)tf->HeadLength); - APR_BRIGADE_INSERT_TAIL(bb, b); - } - - b = apr_bucket_file_create(fd, (apr_off_t)tf->Offset, - (apr_size_t)tf->BytesToWrite); - APR_BRIGADE_INSERT_TAIL(bb, b); - - if (tf->pTail && (apr_size_t)tf->TailLength) { - b = apr_bucket_transient_create((char*)tf->pTail, - (apr_size_t)tf->TailLength); - APR_BRIGADE_INSERT_TAIL(bb, b); - } - - b = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(bb, b); - ap_pass_brigade(r->output_filters, bb); - - /* we do nothing with (tf->dwFlags & HSE_DISCONNECT_AFTER_SEND) - */ - - if (tf->dwFlags & HSE_IO_ASYNC) { - /* XXX: Fake async response, - * use tf->pfnHseIO, or if NULL, then use cid->fnIOComplete - * pass pContect to the HseIO callback. - */ - } - return TRUE; - } - - case 1007: /* HSE_REQ_REFRESH_ISAPI_ACL */ - if (cid->sconf->LogNotSupported) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r, - "ISAPI ServerSupportFunction " - "HSE_REQ_REFRESH_ISAPI_ACL " - "is not supported: %s", r->filename); - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - - case 1008: /* HSE_REQ_IS_KEEP_CONN */ - *((LPBOOL) lpvBuffer) = (r->connection->keepalive == 1); - return TRUE; - - case 1010: /* XXX: Fake it : HSE_REQ_ASYNC_READ_CLIENT */ - if (cid->sconf->LogNotSupported) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r, - "ISAPI asynchronous I/O not supported: %s", - r->filename); - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - - case 1011: /* HSE_REQ_GET_IMPERSONATION_TOKEN Added in ISAPI 4.0 */ - if (cid->sconf->LogNotSupported) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r, - "ISAPI ServerSupportFunction " - "HSE_REQ_GET_IMPERSONATION_TOKEN " - "is not supported: %s", r->filename); - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - -#ifdef HSE_REQ_MAP_URL_TO_PATH_EX - case 1012: /* HSE_REQ_MAP_URL_TO_PATH_EX */ - { - /* Map a URL to a filename */ - LPHSE_URL_MAPEX_INFO info = (LPHSE_URL_MAPEX_INFO) lpdwDataType; - char* test_uri = apr_pstrndup(r->pool, (char *)lpvBuffer, *lpdwSize); - - subreq = ap_sub_req_lookup_uri(test_uri, r, NULL); - info->cchMatchingURL = strlen(test_uri); - info->cchMatchingPath = apr_cpystrn(info->lpszPath, subreq->filename, - MAX_PATH) - info->lpszPath; - - /* Mapping started with assuming both strings matched. - * Now roll on the path_info as a mismatch and handle - * terminating slashes for directory matches. - */ - if (subreq->path_info && *subreq->path_info) { - apr_cpystrn(info->lpszPath + info->cchMatchingPath, - subreq->path_info, MAX_PATH - info->cchMatchingPath); - info->cchMatchingURL -= strlen(subreq->path_info); - if (subreq->finfo.filetype == APR_DIR - && info->cchMatchingPath < MAX_PATH - 1) { - /* roll forward over path_info's first slash */ - ++info->cchMatchingPath; - ++info->cchMatchingURL; - } - } - else if (subreq->finfo.filetype == APR_DIR - && info->cchMatchingPath < MAX_PATH - 1) { - /* Add a trailing slash for directory */ - info->lpszPath[info->cchMatchingPath++] = '/'; - info->lpszPath[info->cchMatchingPath] = '\0'; - } - - /* If the matched isn't a file, roll match back to the prior slash */ - if (subreq->finfo.filetype == APR_NOFILE) { - while (info->cchMatchingPath && info->cchMatchingURL) { - if (info->lpszPath[info->cchMatchingPath - 1] == '/') - break; - --info->cchMatchingPath; - --info->cchMatchingURL; - } - } - - /* Paths returned with back slashes */ - for (test_uri = info->lpszPath; *test_uri; ++test_uri) - if (*test_uri == '/') - *test_uri = '\\'; - - /* is a combination of: - * HSE_URL_FLAGS_READ 0x001 Allow read - * HSE_URL_FLAGS_WRITE 0x002 Allow write - * HSE_URL_FLAGS_EXECUTE 0x004 Allow execute - * HSE_URL_FLAGS_SSL 0x008 Require SSL - * HSE_URL_FLAGS_DONT_CACHE 0x010 Don't cache (VRoot only) - * HSE_URL_FLAGS_NEGO_CERT 0x020 Allow client SSL cert - * HSE_URL_FLAGS_REQUIRE_CERT 0x040 Require client SSL cert - * HSE_URL_FLAGS_MAP_CERT 0x080 Map client SSL cert to account - * HSE_URL_FLAGS_SSL128 0x100 Require 128-bit SSL cert - * HSE_URL_FLAGS_SCRIPT 0x200 Allow script execution - * - * XxX: As everywhere, EXEC flags could use some work... - * and this could go further with more flags, as desired. - */ - info->dwFlags = (subreq->finfo.protection & APR_UREAD ? 0x001 : 0) - | (subreq->finfo.protection & APR_UWRITE ? 0x002 : 0) - | (subreq->finfo.protection & APR_UEXECUTE ? 0x204 : 0); - return TRUE; - } -#endif - - case 1014: /* HSE_REQ_ABORTIVE_CLOSE */ - if (cid->sconf->LogNotSupported) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r, - "ISAPI ServerSupportFunction HSE_REQ_ABORTIVE_CLOSE" - " is not supported: %s", r->filename); - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - - case 1015: /* HSE_REQ_GET_CERT_INFO_EX Added in ISAPI 4.0 */ - if (cid->sconf->LogNotSupported) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r, - "ISAPI ServerSupportFunction " - "HSE_REQ_GET_CERT_INFO_EX " - "is not supported: %s", r->filename); - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - -#ifdef HSE_REQ_SEND_RESPONSE_HEADER_EX - case 1016: /* HSE_REQ_SEND_RESPONSE_HEADER_EX Added in ISAPI 4.0 */ - { - LPHSE_SEND_HEADER_EX_INFO shi - = (LPHSE_SEND_HEADER_EX_INFO) lpvBuffer; - /* XXX: ignore shi->fKeepConn? We shouldn't need the advise */ - /* r->connection->keepalive = shi->fKeepConn; */ - apr_off_t ate = SendResponseHeaderEx(cid, shi->pszStatus, - shi->pszHeader, - shi->cchStatus, - shi->cchHeader); - if (ate < 0) { - SetLastError(TODO_ERROR); - return FALSE; - } - else if (ate < (apr_off_t)shi->cchHeader) { - apr_bucket_brigade *bb; - apr_bucket *b; - bb = apr_brigade_create(cid->r->pool); - b = apr_bucket_transient_create(shi->pszHeader + ate, - (apr_size_t)shi->cchHeader - ate); - APR_BRIGADE_INSERT_TAIL(bb, b); - b = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(bb, b); - ap_pass_brigade(cid->r->output_filters, bb); - } - return TRUE; - - } -#endif - - case 1017: /* HSE_REQ_CLOSE_CONNECTION Added after ISAPI 4.0 */ - if (cid->sconf->LogNotSupported) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r, - "ISAPI ServerSupportFunction " - "HSE_REQ_CLOSE_CONNECTION " - "is not supported: %s", r->filename); - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - - case 1018: /* HSE_REQ_IS_CONNECTED Added after ISAPI 4.0 */ - /* Returns True if client is connected c.f. MSKB Q188346 - * assuming the identical return mechanism as HSE_REQ_IS_KEEP_CONN - */ - *((LPBOOL) lpvBuffer) = (r->connection->aborted == 0); - return TRUE; - - case 1020: /* HSE_REQ_EXTENSION_TRIGGER Added after ISAPI 4.0 */ - /* Undocumented - defined by the Microsoft Jan '00 Platform SDK - */ - if (cid->sconf->LogNotSupported) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r, - "ISAPI ServerSupportFunction " - "HSE_REQ_EXTENSION_TRIGGER " - "is not supported: %s", r->filename); - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - - default: - if (cid->sconf->LogNotSupported) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r, - "ISAPI ServerSupportFunction (%d) not supported: " - "%s", dwHSERequest, r->filename); - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } -} - -/* - * Command handler for the ISAPIReadAheadBuffer directive, which is TAKE1 - */ -static const char *isapi_cmd_readaheadbuffer(cmd_parms *cmd, void *config, - char *arg) -{ - isapi_server_conf *sconf = ap_get_module_config(cmd->server->module_config, - &isapi_module); - char *scan; - long val; - - if (((val = strtol(arg, (char **) &scan, 10)) <= 0) || *scan) - return "ISAPIReadAheadBuffer must be a legitimate value."; - - sconf->ReadAheadBuffer = val; - return NULL; -} - -/* - * Command handler for the ISAPIReadAheadBuffer directive, which is TAKE1 - */ -static const char *isapi_cmd_lognotsupported(cmd_parms *cmd, void *config, - char *arg) -{ - isapi_server_conf *sconf = ap_get_module_config(cmd->server->module_config, - &isapi_module); - - if (strcasecmp(arg, "on") == 0) { - sconf->LogNotSupported = -1; - } - else if (strcasecmp(arg, "off") == 0) { - sconf->LogNotSupported = 0; - } - else { - return "ISAPILogNotSupported must be on or off"; - } - return NULL; -} - -static const char *isapi_cmd_appendlogtoerrors(cmd_parms *cmd, void *config, - char *arg) -{ - isapi_server_conf *sconf = ap_get_module_config(cmd->server->module_config, - &isapi_module); - - if (strcasecmp(arg, "on") == 0) { - sconf->AppendLogToErrors = -1; - } - else if (strcasecmp(arg, "off") == 0) { - sconf->AppendLogToErrors = 0; - } - else { - return "ISAPIAppendLogToErrors must be on or off"; - } - return NULL; -} - -static const char *isapi_cmd_appendlogtoquery(cmd_parms *cmd, void *config, - char *arg) -{ - isapi_server_conf *sconf = ap_get_module_config(cmd->server->module_config, - &isapi_module); - - if (strcasecmp(arg, "on") == 0) { - sconf->AppendLogToQuery = -1; - } - else if (strcasecmp(arg, "off") == 0) { - sconf->AppendLogToQuery = 0; - } - else { - return "ISAPIAppendLogToQuery must be on or off"; - } - return NULL; -} - -static const char *isapi_cmd_cachefile(cmd_parms *cmd, void *dummy, - const char *filename) - -{ - isapi_server_conf *sconf = ap_get_module_config(cmd->server->module_config, - &isapi_module); - isapi_loaded *isa, **newisa; - apr_finfo_t tmp; - apr_status_t rv; - char *fspec; - - fspec = ap_os_case_canonical_filename(cmd->pool, filename); - if (apr_stat(&tmp, fspec, - APR_FINFO_TYPE, cmd->temp_pool) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, cmd->server, - "ISAPI: unable to stat(%s), skipping", filename); - return NULL; - } - if (tmp.filetype != APR_REG) { - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, cmd->server, - "ISAPI: %s isn't a regular file, skipping", filename); - return NULL; - } - - /* Load the extention as cached (passing sconf) */ - rv = isapi_load(cmd->pool, sconf, NULL, fspec, &isa); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_WARNING, rv, cmd->server, - "ISAPI: unable to cache %s, skipping", filename); - return NULL; - } - - /* Add to cached list of loaded modules */ - newisa = apr_array_push(sconf->loaded); - *newisa = isa; - - return NULL; -} - -static void isapi_hooks(apr_pool_t *cont) -{ - ap_hook_post_config(isapi_post_config, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_handler(isapi_handler, NULL, NULL, APR_HOOK_MIDDLE); -} - -static const command_rec isapi_cmds[] = { -AP_INIT_TAKE1("ISAPIReadAheadBuffer", isapi_cmd_readaheadbuffer, NULL, RSRC_CONF, - "Maximum bytes to initially pass to the ISAPI handler"), -AP_INIT_TAKE1("ISAPILogNotSupported", isapi_cmd_lognotsupported, NULL, RSRC_CONF, - "Log requests not supported by the ISAPI server"), -AP_INIT_TAKE1("ISAPIAppendLogToErrors", isapi_cmd_appendlogtoerrors, NULL, RSRC_CONF, - "Send all Append Log requests to the error log"), -AP_INIT_TAKE1("ISAPIAppendLogToQuery", isapi_cmd_appendlogtoquery, NULL, RSRC_CONF, - "Append Log requests are concatinated to the query args"), -AP_INIT_ITERATE("ISAPICacheFile", isapi_cmd_cachefile, NULL, RSRC_CONF, - "Cache the specified ISAPI extension in-process"), -{ NULL } -}; - -module isapi_module = { - STANDARD20_MODULE_STUFF, - NULL, /* create per-dir config */ - NULL, /* merge per-dir config */ - create_isapi_server_config, /* server config */ - NULL, /* merge server config */ - isapi_cmds, /* command apr_table_t */ - isapi_hooks /* register hooks */ -}; diff --git a/modules/cache/.cvsignore b/modules/cache/.cvsignore deleted file mode 100644 index 65f0cc30cf..0000000000 --- a/modules/cache/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -Debug -Release diff --git a/modules/cache/.indent.pro b/modules/cache/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- 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 167b343d0d..0000000000 --- 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 c4ad083075..0000000000 --- a/modules/cache/config.m4 +++ /dev/null @@ -1,11 +0,0 @@ -dnl modules enabled in this directory by default - -dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]]) - -APACHE_MODPATH_INIT(cache) - -APACHE_MODULE(file_cache, File cache, , , no) - -APR_ADDTO(LTFLAGS,-export-dynamic) - -APACHE_MODPATH_FINISH diff --git a/modules/cache/mod_file_cache.c b/modules/cache/mod_file_cache.c deleted file mode 100644 index 345a8e108b..0000000000 --- a/modules/cache/mod_file_cache.c +++ /dev/null @@ -1,468 +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 - * . - */ - -/* - * 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 "apr.h" - -#if !(APR_HAS_SENDFILE || APR_HAS_MMAP) -#error mod_file_cache only works on systems with APR_HAS_SENDFILE or APR_HAS_MMAP -#endif - -#include "apr_mmap.h" -#include "apr_strings.h" -#include "apr_hash.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if APR_HAVE_SYS_TYPES_H -#include -#endif - -#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" - -module AP_MODULE_DECLARE_DATA file_cache_module; - -typedef struct { -#if APR_HAS_SENDFILE - apr_file_t *file; -#endif - const char *filename; - apr_finfo_t finfo; - int is_mmapped; -#if APR_HAS_MMAP - apr_mmap_t *mm; -#endif - char mtimestr[APR_RFC822_DATE_LEN]; - char sizestr[21]; /* big enough to hold any 64-bit file size + null */ -} a_file; - -typedef struct { - apr_hash_t *fileht; -} a_server_config; - - -static void *create_server_config(apr_pool_t *p, server_rec *s) -{ - a_server_config *sconf = apr_palloc(p, sizeof(*sconf)); - - sconf->fileht = apr_hash_make(p); - return sconf; -} - -static apr_status_t cleanup_file_cache(void *sconfv) -{ - a_server_config *sconf = sconfv; - a_file *file; - apr_hash_index_t *hi; - - /* Iterate over the file hash table and clean up each entry */ - for (hi = apr_hash_first(sconf->fileht); hi; hi=apr_hash_next(hi)) { - apr_hash_this(hi, NULL, NULL, (void **)&file); -#if APR_HAS_MMAP - if (file->is_mmapped) { - apr_mmap_delete(file->mm); - } -#endif -#if APR_HAS_SENDFILE - if (!file->is_mmapped) { - apr_file_close(file->file); - } -#endif - } - return APR_SUCCESS; -} - -static void cache_the_file(cmd_parms *cmd, const char *filename, int mmap) -{ - a_server_config *sconf; - a_file *new_file; - a_file tmp; - apr_file_t *fd = NULL; - apr_status_t rc; - const char *fspec; - - fspec = ap_os_case_canonical_filename(cmd->pool, filename); - if ((rc = apr_stat(&tmp.finfo, fspec, APR_FINFO_MIN, - cmd->temp_pool)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server, - "mod_file_cache: unable to stat(%s), skipping", fspec); - return; - } - if (tmp.finfo.filetype != APR_REG) { - ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, cmd->server, - "mod_file_cache: %s isn't a regular file, skipping", fspec); - return; - } - - rc = apr_file_open(&fd, fspec, APR_READ | APR_XTHREAD, APR_OS_DEFAULT, cmd->pool); - if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server, - "mod_file_cache: unable to open(%s, O_RDONLY), skipping", fspec); - return; - } - - /* WooHoo, we have a file to put in the cache */ - new_file = apr_pcalloc(cmd->pool, sizeof(a_file)); - new_file->finfo = tmp.finfo; - -#if APR_HAS_MMAP - if (mmap) { - /* MMAPFile directive. MMAP'ing the file */ - if ((rc = apr_mmap_create(&new_file->mm, fd, 0, new_file->finfo.size, - APR_MMAP_READ, cmd->pool)) != APR_SUCCESS) { - apr_file_close(fd); - ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server, - "mod_file_cache: unable to mmap %s, skipping", filename); - return; - } - apr_file_close(fd); - new_file->is_mmapped = TRUE; - } -#endif -#if APR_HAS_SENDFILE - if (!mmap) { - /* CacheFile directive. Caching the file handle */ - new_file->is_mmapped = FALSE; - new_file->file = fd; - } -#endif - - new_file->filename = fspec; - apr_rfc822_date(new_file->mtimestr, new_file->finfo.mtime); - apr_snprintf(new_file->sizestr, sizeof new_file->sizestr, "%" APR_OFF_T_FMT, new_file->finfo.size); - - sconf = ap_get_module_config(cmd->server->module_config, &file_cache_module); - apr_hash_set(sconf->fileht, new_file->filename, strlen(new_file->filename), new_file); - - if (apr_hash_count(sconf->fileht) == 1) { - /* first one, register the cleanup */ - apr_pool_cleanup_register(cmd->pool, sconf, cleanup_file_cache, apr_pool_cleanup_null); - } -} - -static const char *cachefilehandle(cmd_parms *cmd, void *dummy, const char *filename) -{ -#if APR_HAS_SENDFILE - cache_the_file(cmd, filename, 0); -#else - /* Sendfile not supported by this OS */ - ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, cmd->server, - "mod_file_cache: unable to cache file: %s. Sendfile is not supported on this OS", filename); -#endif - return NULL; -} -static const char *cachefilemmap(cmd_parms *cmd, void *dummy, const char *filename) -{ -#if APR_HAS_MMAP - cache_the_file(cmd, filename, 1); -#else - /* MMAP not supported by this OS */ - ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, cmd->server, - "mod_file_cache: unable to cache file: %s. MMAP is not supported by this OS", filename); -#endif - return NULL; -} - -static void file_cache_post_config(apr_pool_t *p, apr_pool_t *plog, - apr_pool_t *ptemp, server_rec *s) -{ - /* Hummm, anything to do here? */ -} - -/* 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. - */ -static int file_cache_xlat(request_rec *r) -{ - a_server_config *sconf; - a_file *match; - int res; - - sconf = ap_get_module_config(r->server->module_config, &file_cache_module); - - /* we only operate when at least one cachefile directive was used */ - if (!apr_hash_count(sconf->fileht)) { - return DECLINED; - } - - res = ap_core_translate(r); - if (res != OK || !r->filename) { - return res; - } - - /* search the cache */ - match = (a_file *) apr_hash_get(sconf->fileht, r->filename, APR_HASH_KEY_STRING); - if (match == NULL) - return DECLINED; - - /* pass search results to handler */ - ap_set_module_config(r->request_config, &file_cache_module, match); - - /* shortcircuit the get_path_info() stat() calls and stuff */ - r->finfo = match->finfo; - return OK; -} - -static int mmap_handler(request_rec *r, a_file *file) -{ -#if APR_HAS_MMAP - ap_send_mmap (file->mm, r, 0, file->finfo.size); -#endif - return OK; -} - -static int sendfile_handler(request_rec *r, a_file *file) -{ -#if APR_HAS_SENDFILE - apr_size_t nbytes; - apr_status_t rv = APR_EINIT; - - /* A cached file handle (more importantly, its file pointer) is - * shared by all threads in the process. The file pointer will - * be corrupted if multiple threads attempt to read from the - * cached file handle. The sendfile API does not rely on the position - * of the file pointer instead taking explicit file offset and - * length arguments. - * - * We should call ap_send_fd with a cached file handle IFF - * we are CERTAIN the file will be served with apr_sendfile(). - * The presense of an AP_FTYPE_FILTER in the filter chain nearly - * guarantees that apr_sendfile will NOT be used to send the file. - * Furthermore, AP_FTYPE_CONTENT filters will be at the beginning - * of the chain, so it should suffice to just check the first - * filter in the chain. If the first filter is not a content filter, - * assume apr_sendfile() will be used to send the content. - */ - if (r->output_filters && r->output_filters->frec) { - if (r->output_filters->frec->ftype == AP_FTYPE_CONTENT) - return DECLINED; - } - - - rv = ap_send_fd(file->file, r, 0, file->finfo.size, &nbytes); - if (rv != APR_SUCCESS) { - /* ap_send_fd will log the error */ - return HTTP_INTERNAL_SERVER_ERROR; - } -#endif - return OK; -} - -static int file_cache_handler(request_rec *r) -{ - a_file *match; - int errstatus; - int rc = OK; - - /* XXX: not sure if this is right yet - * see comment in http_core.c:default_handler - */ - if (ap_strcmp_match(r->handler, "*/*")) { - return DECLINED; - } - - /* we don't handle anything but GET */ - if (r->method_number != M_GET) return DECLINED; - - /* did xlat phase find the file? */ - match = ap_get_module_config(r->request_config, &file_cache_module); - - if (match == NULL) { - return DECLINED; - } - - /* 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() always converts the file mtime to a string - * which is slow. Accelerate the common case. - * ap_set_last_modified(r); - */ - { - apr_time_t mod_time; - char *datestr; - - mod_time = ap_rationalize_mtime(r, r->mtime); - if (mod_time == match->finfo.mtime) - datestr = match->mtimestr; - else { - datestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN); - apr_rfc822_date(datestr, mod_time); - } - apr_table_setn(r->headers_out, "Last-Modified", datestr); - } - - ap_set_etag(r); - if ((errstatus = ap_meets_conditions(r)) != OK) { - return errstatus; - } - - /* ap_set_content_length() always converts the same number and never - * returns an error. Accelerate it. - */ - r->clength = match->finfo.size; - apr_table_setn(r->headers_out, "Content-Length", match->sizestr); - - /* Call appropriate handler */ - if (!r->header_only) { - if (match->is_mmapped == TRUE) - rc = mmap_handler(r, match); - else - rc = sendfile_handler(r, match); - } - - return rc; -} - -static command_rec file_cache_cmds[] = -{ -AP_INIT_ITERATE("cachefile", cachefilehandle, NULL, RSRC_CONF, - "A space separated list of files to add to the file handle cache at config time"), -AP_INIT_ITERATE("mmapfile", cachefilemmap, NULL, RSRC_CONF, - "A space separated list of files to mmap at config time"), - {NULL} -}; - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_handler(file_cache_handler, NULL, NULL, APR_HOOK_LAST); - ap_hook_post_config(file_cache_post_config, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_translate_name(file_cache_xlat, NULL, NULL, APR_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, APR_HOOK_MIDDLE); - */ - -} - -module AP_MODULE_DECLARE_DATA 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 */ - file_cache_cmds, /* command 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 58786f2e40..0000000000 --- a/modules/cache/mod_file_cache.dsp +++ /dev/null @@ -1,95 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_file_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_file_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_file_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_file_cache.mak" CFG="mod_file_cache - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_file_cache - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_file_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_file_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 /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_file_cache" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" -# 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 /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_file_cache.so" /base:@..\..\os\win32\BaseAddr.ref,mod_file_cache -# ADD LINK32 /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_file_cache.so" /base:@..\..\os\win32\BaseAddr.ref,mod_file_cache - -!ELSEIF "$(CFG)" == "mod_file_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 /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_file_cache" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" -# 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 /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_file_cache.so" /base:@..\..\os\win32\BaseAddr.ref,mod_file_cache -# ADD LINK32 /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_file_cache.so" /base:@..\..\os\win32\BaseAddr.ref,mod_file_cache - -!ENDIF - -# Begin Target - -# Name "mod_file_cache - Win32 Release" -# Name "mod_file_cache - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_file_cache.c -# End Source File -# End Target -# End Project diff --git a/modules/cache/mod_file_cache.mak b/modules/cache/mod_file_cache.mak deleted file mode 100644 index 3a4c5da41d..0000000000 --- a/modules/cache/mod_file_cache.mak +++ /dev/null @@ -1,331 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on mod_file_cache.dsp -!IF "$(CFG)" == "" -CFG=mod_file_cache - Win32 Debug -!MESSAGE No configuration specified. Defaulting to mod_file_cache - Win32\ - Debug. -!ENDIF - -!IF "$(CFG)" != "mod_file_cache - Win32 Release" && "$(CFG)" !=\ - "mod_file_cache - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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_file_cache.mak" CFG="mod_file_cache - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_file_cache - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_file_cache - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "mod_file_cache - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_file_cache.so" - -!ELSE - -ALL : "libhttpd - Win32 Release" "libapr - Win32 Release"\ - "$(OUTDIR)\mod_file_cache.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 ReleaseCLEAN" "libhttpd - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_file_cache.idb" - -@erase "$(INTDIR)\mod_file_cache.obj" - -@erase "$(OUTDIR)\mod_file_cache.exp" - -@erase "$(OUTDIR)\mod_file_cache.lib" - -@erase "$(OUTDIR)\mod_file_cache.map" - -@erase "$(OUTDIR)\mod_file_cache.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I\ - "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D\ - "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_file_cache" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_file_cache.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=/nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_file_cache.pdb" /map:"$(INTDIR)\mod_file_cache.map"\ - /machine:I386 /out:"$(OUTDIR)\mod_file_cache.so"\ - /implib:"$(OUTDIR)\mod_file_cache.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_file_cache -LINK32_OBJS= \ - "$(INTDIR)\mod_file_cache.obj" \ - "..\..\Release\libhttpd.lib" \ - "..\..\srclib\apr\Release\libapr.lib" - -"$(OUTDIR)\mod_file_cache.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "mod_file_cache - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_file_cache.so" - -!ELSE - -ALL : "libhttpd - Win32 Debug" "libapr - Win32 Debug"\ - "$(OUTDIR)\mod_file_cache.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 DebugCLEAN" "libhttpd - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_file_cache.idb" - -@erase "$(INTDIR)\mod_file_cache.obj" - -@erase "$(OUTDIR)\mod_file_cache.exp" - -@erase "$(OUTDIR)\mod_file_cache.lib" - -@erase "$(OUTDIR)\mod_file_cache.map" - -@erase "$(OUTDIR)\mod_file_cache.pdb" - -@erase "$(OUTDIR)\mod_file_cache.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_file_cache" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_file_cache.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=/nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_file_cache.pdb" /map:"$(INTDIR)\mod_file_cache.map" /debug\ - /machine:I386 /out:"$(OUTDIR)\mod_file_cache.so"\ - /implib:"$(OUTDIR)\mod_file_cache.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_file_cache -LINK32_OBJS= \ - "$(INTDIR)\mod_file_cache.obj" \ - "..\..\Debug\libhttpd.lib" \ - "..\..\srclib\apr\Debug\libapr.lib" - -"$(OUTDIR)\mod_file_cache.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "mod_file_cache - Win32 Release" || "$(CFG)" ==\ - "mod_file_cache - Win32 Debug" - -!IF "$(CFG)" == "mod_file_cache - Win32 Release" - -"libapr - Win32 Release" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Release" - cd "..\..\modules\cache" - -"libapr - Win32 ReleaseCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\..\modules\cache" - -!ELSEIF "$(CFG)" == "mod_file_cache - Win32 Debug" - -"libapr - Win32 Debug" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Debug" - cd "..\..\modules\cache" - -"libapr - Win32 DebugCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\..\modules\cache" - -!ENDIF - -!IF "$(CFG)" == "mod_file_cache - Win32 Release" - -"libhttpd - Win32 Release" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Release" - cd ".\modules\cache" - -"libhttpd - Win32 ReleaseCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Release"\ - RECURSE=1 - cd ".\modules\cache" - -!ELSEIF "$(CFG)" == "mod_file_cache - Win32 Debug" - -"libhttpd - Win32 Debug" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Debug" - cd ".\modules\cache" - -"libhttpd - Win32 DebugCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Debug"\ - RECURSE=1 - cd ".\modules\cache" - -!ENDIF - -SOURCE=.\mod_file_cache.c -DEP_CPP_MOD_F=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.h"\ - "..\..\include\ap_release.h"\ - "..\..\include\http_config.h"\ - "..\..\include\http_core.h"\ - "..\..\include\http_log.h"\ - "..\..\include\http_protocol.h"\ - "..\..\include\http_request.h"\ - "..\..\include\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\srclib\apr-util\include\apu.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_dso.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_hash.h"\ - "..\..\srclib\apr\include\apr_lock.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_portable.h"\ - "..\..\srclib\apr\include\apr_strings.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\include\apr_user.h"\ - "..\..\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_F=\ - "..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_file_cache.obj" : $(SOURCE) $(DEP_CPP_MOD_F) "$(INTDIR)" - - - -!ENDIF - diff --git a/modules/config5.m4 b/modules/config5.m4 deleted file mode 100644 index caa40eaf70..0000000000 --- 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 65f0cc30cf..0000000000 --- a/modules/dav/fs/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -Debug -Release diff --git a/modules/dav/fs/Makefile.in b/modules/dav/fs/Makefile.in deleted file mode 100644 index 7c5c149d85..0000000000 --- a/modules/dav/fs/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/dav/fs/config6.m4 b/modules/dav/fs/config6.m4 deleted file mode 100644 index ca1153aed3..0000000000 --- a/modules/dav/fs/config6.m4 +++ /dev/null @@ -1,15 +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" - -if test "$enable_dav" = "no"; then - dav_fs_enable=no -else - dav_fs_enable=yes -fi - -APACHE_MODULE(dav_fs, DAV provider for the filesystem, $dav_fs_objects, , $dav_fs_enable) - -APACHE_MODPATH_FINISH diff --git a/modules/dav/fs/dbm.c b/modules/dav/fs/dbm.c deleted file mode 100644 index fd1b7714de..0000000000 --- a/modules/dav/fs/dbm.c +++ /dev/null @@ -1,259 +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 - * . - */ - -/* -** DAV extension module for Apache 2.0.* -** - Database support using DBM-style databases, -** part of the filesystem repository implementation -*/ - -/* -** This implementation uses a SDBM 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. -*/ - -#include "apr_strings.h" -#include "apr_file_io.h" - -#include "apr_dbm.h" - -#include "mod_dav.h" -#include "repos.h" - -struct dav_db { - apr_pool_t *pool; - apr_dbm_t *file; -}; - - -void dav_dbm_get_statefiles(apr_pool_t *p, const char *fname, - const char **state1, const char **state2) -{ - if (fname == NULL) - fname = DAV_FS_STATE_FILE_FOR_DIR; - - apr_dbm_get_usednames(p, fname, state1, state2); -} - -static dav_error * dav_fs_dbm_error(dav_db *db, apr_pool_t *p, - apr_status_t status) -{ - int save_errno = errno; - int errcode; - const char *errstr; - dav_error *err; - char errbuf[200]; - - if (status == APR_SUCCESS) - return NULL; - - p = db ? db->pool : p; - - /* There might not be a if we had problems creating it. */ - if (db == NULL) { - errcode = 1; - errstr = "Could not open property database."; - } - else { - (void) apr_dbm_geterror(db->file, &errcode, errbuf, sizeof(errbuf)); - errstr = apr_pstrdup(p, errbuf); - } - - 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(apr_pool_t * p, const char *dirname) -{ - const char *pathname = apr_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 */ - (void) apr_dir_make(pathname, APR_OS_DEFAULT, p); -} - -/* dav_dbm_open_direct: Opens a *dbm database specified by path. - * ro = boolean read-only flag. - */ -dav_error * dav_dbm_open_direct(apr_pool_t *p, const char *pathname, int ro, - dav_db **pdb) -{ - apr_status_t status; - apr_dbm_t *file; - - *pdb = NULL; - - if ((status = apr_dbm_open(&file, pathname, - ro ? APR_DBM_READONLY : APR_DBM_RWCREATE, - APR_OS_DEFAULT, p)) - != APR_SUCCESS - && !ro) { - /* ### do something with 'status' */ - - /* we can't continue if we couldn't open the file - and we need to write */ - return dav_fs_dbm_error(NULL, p, status); - } - - /* 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 = apr_pcalloc(p, sizeof(**pdb)); - (*pdb)->pool = p; - (*pdb)->file = file; - } - - return NULL; -} - -static dav_error * dav_dbm_open(apr_pool_t * 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 = apr_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) -{ - apr_dbm_close(db->file); -} - -static dav_error * dav_dbm_fetch(dav_db *db, dav_datum key, dav_datum *pvalue) -{ - apr_status_t status = apr_dbm_fetch(db->file, key, pvalue); - - return dav_fs_dbm_error(db, NULL, status); -} - -static dav_error * dav_dbm_store(dav_db *db, dav_datum key, dav_datum value) -{ - apr_status_t status = apr_dbm_store(db->file, key, value); - - return dav_fs_dbm_error(db, NULL, status); -} - -static dav_error * dav_dbm_delete(dav_db *db, dav_datum key) -{ - apr_status_t status = apr_dbm_delete(db->file, key); - - return dav_fs_dbm_error(db, NULL, status); -} - -static int dav_dbm_exists(dav_db *db, dav_datum key) -{ - return apr_dbm_exists(db->file, key); -} - -static dav_error * dav_dbm_firstkey(dav_db *db, dav_datum *pkey) -{ - apr_status_t status = apr_dbm_firstkey(db->file, pkey); - - return dav_fs_dbm_error(db, NULL, status); -} - -static dav_error * dav_dbm_nextkey(dav_db *db, dav_datum *pkey) -{ - apr_status_t status = apr_dbm_nextkey(db->file, pkey); - - return dav_fs_dbm_error(db, NULL, status); -} - -static void dav_dbm_freedatum(dav_db *db, dav_datum data) -{ - apr_dbm_freedatum(db->file, 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 cd7c43188d..0000000000 --- a/modules/dav/fs/lock.c +++ /dev/null @@ -1,1537 +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 - * . - */ - -/* -** DAV filesystem lock implementation -*/ - -#include "apr.h" -#include "apr_strings.h" -#include "apr_file_io.h" -#include "apr_uuid.h" - -#define APR_WANT_MEMFUNC -#include "apr_want.h" - -#include "httpd.h" -#include "http_log.h" - -#include "mod_dav.h" -#include "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, -** apr_uuid_t locktoken, -** char[] owner, -** char[] auth_user] -** -** INDIRECT LOCK: [char (DAV_LOCK_INDIRECT), -** apr_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(apr_pool_t *p, - const char *filename, - dav_buffer *pbuf); - -/* -** Use the opaquelock scheme for locktokens -*/ -struct dav_locktoken { - apr_uuid_t uuid; -}; -#define dav_compare_locktoken(plt1, plt2) \ - memcmp(&(plt1)->uuid, &(plt2)->uuid, sizeof((plt1)->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(apr_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(apr_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 */ - apr_pool_t *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 = apr_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; - apr_uuid_get(&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( - apr_pool_t *p, - const char *char_token, - dav_locktoken **locktoken_p) -{ - dav_locktoken *locktoken; - - if (ap_strstr_c(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 = apr_pcalloc(p, sizeof(*locktoken)); - if (apr_uuid_parse(&locktoken->uuid, char_token)) { - 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( - apr_pool_t *p, - const dav_locktoken *locktoken) -{ - char buf[APR_UUID_FORMATTED_LENGTH + 1]; - - apr_uuid_format(buf, &locktoken->uuid); - return apr_pstrcat(p, "opaquelocktoken:", buf, 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_locktoken(lt1, lt2); -} - -/* -** 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 = apr_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(apr_pool_t *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 = apr_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(apr_pool_t *p, const dav_resource *resource) -{ - const char *file = dav_fs_pathname(resource); -#ifndef WIN32 - dav_datum key; - apr_finfo_t finfo; - - /* ### use lstat() ?? */ - if (apr_stat(&finfo, file, APR_FINFO_NORM, p) == APR_SUCCESS) { - - /* ### can we use a buffer for this? */ - key.dsize = 1 + sizeof(finfo.inode) + sizeof(finfo.device); - key.dptr = apr_palloc(p, key.dsize); - *key.dptr = DAV_TYPE_INODE; - memcpy(key.dptr + 1, &finfo.inode, sizeof(finfo.inode)); - memcpy(key.dptr + 1 + sizeof(finfo.inode), &finfo.device, - sizeof(finfo.device)); - - 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 apr_palloc() ? */ - /* ### hmmm.... investigate the use of a buffer here */ - ptr = val.dptr = apr_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) -{ - apr_pool_t *p = lockdb->info->pool; - dav_error *err; - apr_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 = apr_pcalloc(p, sizeof(*dp)); - memcpy(dp, val.dptr + offset, sizeof(dp->f)); - offset += sizeof(dp->f); - dp->locktoken = apr_palloc(p, 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 = apr_pstrdup(p, val.dptr + offset); - offset += strlen(dp->owner) + 1; - } - - if (*(val.dptr + offset) == '\0') { - ++offset; - } - else { - dp->auth_user = apr_pstrdup(p, 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; - apr_finfo_t finfo; - - /* if we don't see the file, then it's a locknull */ - if (apr_lstat(&finfo, fname, APR_FINFO_NORM, p) != APR_SUCCESS) { - if ((err = dav_fs_remove_locknull_member(p, fname, &buf)) != NULL) { - /* ### push a higher-level description? */ - return err; - } - } - } - } - break; - - case DAV_LOCK_INDIRECT: - /* Create and fill a dav_lock_indirect structure */ - - ip = apr_pcalloc(p, sizeof(*ip)); - ip->locktoken = apr_palloc(p, 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 = apr_palloc(p, 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(p, - HTTP_INTERNAL_SERVER_ERROR, - DAV_ERR_LOCK_CORRUPT_DB, - apr_psprintf(p, - "The lock database was found to " - "be corrupt. offset %" - APR_SIZE_T_FMT ", 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_locktoken(indirect->locktoken, dir->locktoken)) { - *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(const dav_resource *resource) -{ - 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(apr_pool_t *p, const char *dirpath, - dav_buffer *pbuf) -{ - apr_finfo_t finfo; - apr_file_t *file = NULL; - dav_error *err = NULL; - apr_size_t amt; - - 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 (apr_file_open(&file, pbuf->buf, APR_READ | APR_BINARY, APR_OS_DEFAULT, - p) != APR_SUCCESS) { - return NULL; - } - - if (apr_file_info_get(&finfo, APR_FINFO_NORM, file) != APR_SUCCESS) { - err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - apr_psprintf(p, - "Opened but could not stat file %s", - pbuf->buf)); - goto loaderror; - } - - dav_set_bufsize(p, pbuf, finfo.size); - amt = finfo.size; - if (apr_file_read(file, pbuf->buf, &amt) != APR_SUCCESS - || amt != finfo.size) { - err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - apr_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: - apr_file_close(file); - 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(apr_pool_t *p, const char *dirpath, - dav_buffer *pbuf) -{ - const char *pathname; - apr_file_t *file = NULL; - dav_error *err = NULL; - apr_size_t amt; - - if (pbuf->buf == NULL) - return NULL; - - dav_fs_ensure_state_dir(p, dirpath); - pathname = apr_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 (apr_file_remove(pathname, p) != 0) { - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - apr_psprintf(p, - "Error removing %s", pathname)); - } - return NULL; - } - - if (apr_file_open(&file, pathname, - APR_WRITE | APR_CREATE | APR_TRUNCATE | APR_BINARY, - APR_OS_DEFAULT, p) != APR_SUCCESS) { - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - apr_psprintf(p, - "Error opening %s for writing", - pathname)); - } - - amt = pbuf->cur_len; - if (apr_file_write(file, pbuf->buf, &amt) != APR_SUCCESS - || amt != pbuf->cur_len) { - err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - apr_psprintf(p, - "Error writing %" APR_SIZE_T_FMT - " bytes to %s", - pbuf->cur_len, pathname)); - } - - apr_file_close(file); - return err; -} - -/* -** dav_fs_remove_locknull_member: Removes filename from the locknull list -** for directory path. -*/ -static dav_error * dav_fs_remove_locknull_member(apr_pool_t *p, - const char *filename, - dav_buffer *pbuf) -{ - dav_error *err; - apr_size_t len; - apr_size_t scanlen; - char *scan; - const char *scanend; - char *dirpath = apr_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 }; - apr_pool_t *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; - apr_pool_t *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) -{ - apr_pool_t *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_locktoken(locktoken, dp->locktoken)) { - *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_locktoken(locktoken, ip->locktoken)) { - *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) -{ - apr_pool_t *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 = apr_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 = apr_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 = apr_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_locktoken(locktoken, dp->locktoken) == 0) { - if (dprev) - dprev->next = dp->next; - else - dh = dh->next; - } - dprev = dp; - } - - for (ip = ih; ip != NULL; ip = ip->next) { - if (dav_compare_locktoken(locktoken, ip->locktoken) == 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_locktoken(dp->locktoken, ltl->locktoken) == 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 98493d7145..0000000000 --- a/modules/dav/fs/mod_dav_fs.c +++ /dev/null @@ -1,142 +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_dav.h" -#include "repos.h" - -/* per-server configuration */ -typedef struct { - const char *lockdb_path; - -} dav_fs_server_conf; - -extern module AP_MODULE_DECLARE_DATA 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(apr_pool_t *p, server_rec *s) -{ - return apr_pcalloc(p, sizeof(dav_fs_server_conf)); -} - -static void *dav_fs_merge_server_config(apr_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 = apr_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(apr_pool_t *p) -{ - dav_hook_gather_propsets(dav_fs_gather_propsets, NULL, NULL, - APR_HOOK_MIDDLE); - dav_hook_find_liveprop(dav_fs_find_liveprop, NULL, NULL, APR_HOOK_MIDDLE); - dav_hook_insert_all_liveprops(dav_fs_insert_all_liveprops, NULL, NULL, - APR_HOOK_MIDDLE); - - dav_fs_register(p); -} - -module AP_MODULE_DECLARE_DATA 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 */ - 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 d81178fd8b..0000000000 --- a/modules/dav/fs/mod_dav_fs.dsp +++ /dev/null @@ -1,119 +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 "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 "..\main" /I "..\..\..\srclib\aputil" /I "..\..\..\srclib\sdbm" /I "..\..\..\srclib\expat-lite" /I "..\..\..\srclib\apr\include" /I "../../../srclib/apr-util/include" /I "..\..\..\include" /I "..\..\..\os\win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_dav_fs" /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 /incremental:no /map /out:"Release/mod_dav_fs.so" /machine:I386 /base:@..\..\..\os\win32\BaseAddr.ref,mod_dav_fs -# ADD LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_dav_fs.so" /machine:I386 /base:@..\..\..\os\win32\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 "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 "..\main" /I "..\..\..\srclib\aputil" /I "..\..\..\srclib\sdbm" /I "..\..\..\srclib\expat-lite" /I "..\..\..\srclib\apr\include" /I "../../../srclib/apr-util/include" /I "..\..\..\include" /I "..\..\..\os\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_dav_fs" /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 /out:"Debug/mod_dav_fs.so" /machine:I386 /base:@..\..\..\os\win32\BaseAddr.ref,mod_dav_fs -# ADD LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_dav_fs.so" /machine:I386 /base:@..\..\..\os\win32\BaseAddr.ref,mod_dav_fs - -!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=.\dbm.c -# End Source File -# Begin Source File - -SOURCE=.\lock.c -# End Source File -# Begin Source File - -SOURCE=.\mod_dav_fs.c -# End Source File -# Begin Source File - -SOURCE=.\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=.\repos.h -# End Source File -# End Group -# End Target -# End Project diff --git a/modules/dav/fs/mod_dav_fs.mak b/modules/dav/fs/mod_dav_fs.mak deleted file mode 100644 index bd7b6238ae..0000000000 --- a/modules/dav/fs/mod_dav_fs.mak +++ /dev/null @@ -1,533 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on mod_dav_fs.dsp -!IF "$(CFG)" == "" -CFG=mod_dav_fs - Win32 Release -!MESSAGE No configuration specified. Defaulting to mod_dav_fs - Win32 Release. -!ENDIF - -!IF "$(CFG)" != "mod_dav_fs - Win32 Release" && "$(CFG)" !=\ - "mod_dav_fs - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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 -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "mod_dav_fs - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_dav_fs.so" - -!ELSE - -ALL : "mod_dav - Win32 Release" "libhttpd - Win32 Release"\ - "libaprutil - Win32 Release" "libapr - Win32 Release" "$(OUTDIR)\mod_dav_fs.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 ReleaseCLEAN" "libaprutil - Win32 ReleaseCLEAN"\ - "libhttpd - Win32 ReleaseCLEAN" "mod_dav - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\dbm.obj" - -@erase "$(INTDIR)\lock.obj" - -@erase "$(INTDIR)\mod_dav_fs.idb" - -@erase "$(INTDIR)\mod_dav_fs.obj" - -@erase "$(INTDIR)\repos.obj" - -@erase "$(OUTDIR)\mod_dav_fs.exp" - -@erase "$(OUTDIR)\mod_dav_fs.lib" - -@erase "$(OUTDIR)\mod_dav_fs.map" - -@erase "$(OUTDIR)\mod_dav_fs.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "..\main" /I "..\..\..\srclib\aputil" /I\ - "..\..\..\srclib\sdbm" /I "..\..\..\srclib\expat-lite" /I\ - "..\..\..\srclib\apr\include" /I "../../../srclib/apr-util/include" /I\ - "..\..\..\include" /I "..\..\..\os\win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS"\ - /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_dav_fs" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_dav_fs.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows\ - /dll /incremental:no /pdb:"$(OUTDIR)\mod_dav_fs.pdb"\ - /map:"$(INTDIR)\mod_dav_fs.map" /machine:I386 /out:"$(OUTDIR)\mod_dav_fs.so"\ - /implib:"$(OUTDIR)\mod_dav_fs.lib"\ - /base:@..\..\..\os\win32\BaseAddr.ref,mod_dav_fs -LINK32_OBJS= \ - "$(INTDIR)\dbm.obj" \ - "$(INTDIR)\lock.obj" \ - "$(INTDIR)\mod_dav_fs.obj" \ - "$(INTDIR)\repos.obj" \ - "..\..\..\Release\libhttpd.lib" \ - "..\..\..\srclib\apr-util\Release\libaprutil.lib" \ - "..\..\..\srclib\apr\Release\libapr.lib" \ - "..\main\Release\mod_dav.lib" - -"$(OUTDIR)\mod_dav_fs.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "mod_dav_fs - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_dav_fs.so" - -!ELSE - -ALL : "mod_dav - Win32 Debug" "libhttpd - Win32 Debug"\ - "libaprutil - Win32 Debug" "libapr - Win32 Debug" "$(OUTDIR)\mod_dav_fs.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 DebugCLEAN" "libaprutil - Win32 DebugCLEAN"\ - "libhttpd - Win32 DebugCLEAN" "mod_dav - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\dbm.obj" - -@erase "$(INTDIR)\lock.obj" - -@erase "$(INTDIR)\mod_dav_fs.idb" - -@erase "$(INTDIR)\mod_dav_fs.obj" - -@erase "$(INTDIR)\repos.obj" - -@erase "$(OUTDIR)\mod_dav_fs.exp" - -@erase "$(OUTDIR)\mod_dav_fs.lib" - -@erase "$(OUTDIR)\mod_dav_fs.map" - -@erase "$(OUTDIR)\mod_dav_fs.pdb" - -@erase "$(OUTDIR)\mod_dav_fs.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Zi /Od /I "..\main" /I "..\..\..\srclib\aputil"\ - /I "..\..\..\srclib\sdbm" /I "..\..\..\srclib\expat-lite" /I\ - "..\..\..\srclib\apr\include" /I "../../../srclib/apr-util/include" /I\ - "..\..\..\include" /I "..\..\..\os\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS"\ - /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_dav_fs" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_dav_fs.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows\ - /dll /incremental:no /pdb:"$(OUTDIR)\mod_dav_fs.pdb"\ - /map:"$(INTDIR)\mod_dav_fs.map" /debug /machine:I386\ - /out:"$(OUTDIR)\mod_dav_fs.so" /implib:"$(OUTDIR)\mod_dav_fs.lib"\ - /base:@..\..\..\os\win32\BaseAddr.ref,mod_dav_fs -LINK32_OBJS= \ - "$(INTDIR)\dbm.obj" \ - "$(INTDIR)\lock.obj" \ - "$(INTDIR)\mod_dav_fs.obj" \ - "$(INTDIR)\repos.obj" \ - "..\..\..\Debug\libhttpd.lib" \ - "..\..\..\srclib\apr-util\Debug\libaprutil.lib" \ - "..\..\..\srclib\apr\Debug\libapr.lib" \ - "..\main\Debug\mod_dav.lib" - -"$(OUTDIR)\mod_dav_fs.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "mod_dav_fs - Win32 Release" || "$(CFG)" ==\ - "mod_dav_fs - Win32 Debug" -SOURCE=.\dbm.c -DEP_CPP_DBM_C=\ - "..\..\..\include\ap_config.h"\ - "..\..\..\include\ap_mmn.h"\ - "..\..\..\include\ap_release.h"\ - "..\..\..\include\httpd.h"\ - "..\..\..\include\pcreposix.h"\ - "..\..\..\include\util_uri.h"\ - "..\..\..\include\util_xml.h"\ - "..\..\..\os\win32\os.h"\ - "..\..\..\srclib\apr-util\include\apr_dbm.h"\ - "..\..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\..\srclib\apr-util\include\apr_xml.h"\ - "..\..\..\srclib\apr-util\include\apu.h"\ - "..\..\..\srclib\apr-util\include\apu_compat.h"\ - "..\..\..\srclib\apr\include\apr.h"\ - "..\..\..\srclib\apr\include\apr_compat.h"\ - "..\..\..\srclib\apr\include\apr_errno.h"\ - "..\..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\..\srclib\apr\include\apr_general.h"\ - "..\..\..\srclib\apr\include\apr_hash.h"\ - "..\..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\..\srclib\apr\include\apr_pools.h"\ - "..\..\..\srclib\apr\include\apr_strings.h"\ - "..\..\..\srclib\apr\include\apr_tables.h"\ - "..\..\..\srclib\apr\include\apr_time.h"\ - "..\..\..\srclib\apr\include\apr_user.h"\ - "..\..\..\srclib\apr\include\apr_want.h"\ - "..\main\mod_dav.h"\ - ".\repos.h"\ - -NODEP_CPP_DBM_C=\ - "..\..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\dbm.obj" : $(SOURCE) $(DEP_CPP_DBM_C) "$(INTDIR)" - - -SOURCE=.\lock.c -DEP_CPP_LOCK_=\ - "..\..\..\include\ap_config.h"\ - "..\..\..\include\ap_mmn.h"\ - "..\..\..\include\ap_release.h"\ - "..\..\..\include\http_log.h"\ - "..\..\..\include\httpd.h"\ - "..\..\..\include\pcreposix.h"\ - "..\..\..\include\util_uri.h"\ - "..\..\..\include\util_xml.h"\ - "..\..\..\os\win32\os.h"\ - "..\..\..\srclib\apr-util\include\apr_dbm.h"\ - "..\..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\..\srclib\apr-util\include\apr_xml.h"\ - "..\..\..\srclib\apr-util\include\apu.h"\ - "..\..\..\srclib\apr-util\include\apu_compat.h"\ - "..\..\..\srclib\apr\include\apr.h"\ - "..\..\..\srclib\apr\include\apr_compat.h"\ - "..\..\..\srclib\apr\include\apr_errno.h"\ - "..\..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\..\srclib\apr\include\apr_general.h"\ - "..\..\..\srclib\apr\include\apr_hash.h"\ - "..\..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\..\srclib\apr\include\apr_pools.h"\ - "..\..\..\srclib\apr\include\apr_strings.h"\ - "..\..\..\srclib\apr\include\apr_tables.h"\ - "..\..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\..\srclib\apr\include\apr_time.h"\ - "..\..\..\srclib\apr\include\apr_user.h"\ - "..\..\..\srclib\apr\include\apr_uuid.h"\ - "..\..\..\srclib\apr\include\apr_want.h"\ - "..\main\mod_dav.h"\ - ".\repos.h"\ - -NODEP_CPP_LOCK_=\ - "..\..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\lock.obj" : $(SOURCE) $(DEP_CPP_LOCK_) "$(INTDIR)" - - -SOURCE=.\mod_dav_fs.c -DEP_CPP_MOD_D=\ - "..\..\..\include\ap_config.h"\ - "..\..\..\include\ap_mmn.h"\ - "..\..\..\include\ap_release.h"\ - "..\..\..\include\http_config.h"\ - "..\..\..\include\httpd.h"\ - "..\..\..\include\pcreposix.h"\ - "..\..\..\include\util_cfgtree.h"\ - "..\..\..\include\util_uri.h"\ - "..\..\..\include\util_xml.h"\ - "..\..\..\os\win32\os.h"\ - "..\..\..\srclib\apr-util\include\apr_dbm.h"\ - "..\..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\..\srclib\apr-util\include\apr_xml.h"\ - "..\..\..\srclib\apr-util\include\apu.h"\ - "..\..\..\srclib\apr-util\include\apu_compat.h"\ - "..\..\..\srclib\apr\include\apr.h"\ - "..\..\..\srclib\apr\include\apr_compat.h"\ - "..\..\..\srclib\apr\include\apr_errno.h"\ - "..\..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\..\srclib\apr\include\apr_general.h"\ - "..\..\..\srclib\apr\include\apr_hash.h"\ - "..\..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\..\srclib\apr\include\apr_pools.h"\ - "..\..\..\srclib\apr\include\apr_tables.h"\ - "..\..\..\srclib\apr\include\apr_time.h"\ - "..\..\..\srclib\apr\include\apr_user.h"\ - "..\..\..\srclib\apr\include\apr_want.h"\ - "..\main\mod_dav.h"\ - ".\repos.h"\ - -NODEP_CPP_MOD_D=\ - "..\..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_dav_fs.obj" : $(SOURCE) $(DEP_CPP_MOD_D) "$(INTDIR)" - - -SOURCE=.\repos.c -DEP_CPP_REPOS=\ - "..\..\..\include\ap_config.h"\ - "..\..\..\include\ap_mmn.h"\ - "..\..\..\include\ap_release.h"\ - "..\..\..\include\http_log.h"\ - "..\..\..\include\http_protocol.h"\ - "..\..\..\include\http_request.h"\ - "..\..\..\include\httpd.h"\ - "..\..\..\include\pcreposix.h"\ - "..\..\..\include\util_filter.h"\ - "..\..\..\include\util_uri.h"\ - "..\..\..\include\util_xml.h"\ - "..\..\..\os\win32\os.h"\ - "..\..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\..\srclib\apr-util\include\apr_dbm.h"\ - "..\..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\..\srclib\apr-util\include\apr_xml.h"\ - "..\..\..\srclib\apr-util\include\apu.h"\ - "..\..\..\srclib\apr-util\include\apu_compat.h"\ - "..\..\..\srclib\apr\include\apr.h"\ - "..\..\..\srclib\apr\include\apr_compat.h"\ - "..\..\..\srclib\apr\include\apr_dso.h"\ - "..\..\..\srclib\apr\include\apr_errno.h"\ - "..\..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\..\srclib\apr\include\apr_general.h"\ - "..\..\..\srclib\apr\include\apr_hash.h"\ - "..\..\..\srclib\apr\include\apr_lock.h"\ - "..\..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\..\srclib\apr\include\apr_pools.h"\ - "..\..\..\srclib\apr\include\apr_portable.h"\ - "..\..\..\srclib\apr\include\apr_strings.h"\ - "..\..\..\srclib\apr\include\apr_tables.h"\ - "..\..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\..\srclib\apr\include\apr_time.h"\ - "..\..\..\srclib\apr\include\apr_user.h"\ - "..\..\..\srclib\apr\include\apr_want.h"\ - "..\main\mod_dav.h"\ - ".\repos.h"\ - -NODEP_CPP_REPOS=\ - "..\..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\repos.obj" : $(SOURCE) $(DEP_CPP_REPOS) "$(INTDIR)" - - -!IF "$(CFG)" == "mod_dav_fs - Win32 Release" - -"libapr - Win32 Release" : - cd "..\../..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Release" - cd "..\..\modules\dav\fs" - -"libapr - Win32 ReleaseCLEAN" : - cd "..\../..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\..\modules\dav\fs" - -!ELSEIF "$(CFG)" == "mod_dav_fs - Win32 Debug" - -"libapr - Win32 Debug" : - cd "..\../..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Debug" - cd "..\..\modules\dav\fs" - -"libapr - Win32 DebugCLEAN" : - cd "..\../..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\..\modules\dav\fs" - -!ENDIF - -!IF "$(CFG)" == "mod_dav_fs - Win32 Release" - -"libaprutil - Win32 Release" : - cd "..\../..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\libaprutil.mak" CFG="libaprutil - Win32 Release"\ - - cd "..\..\modules\dav\fs" - -"libaprutil - Win32 ReleaseCLEAN" : - cd "..\../..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libaprutil.mak"\ - CFG="libaprutil - Win32 Release" RECURSE=1 - cd "..\..\modules\dav\fs" - -!ELSEIF "$(CFG)" == "mod_dav_fs - Win32 Debug" - -"libaprutil - Win32 Debug" : - cd "..\../..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\libaprutil.mak" CFG="libaprutil - Win32 Debug" - cd "..\..\modules\dav\fs" - -"libaprutil - Win32 DebugCLEAN" : - cd "..\../..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libaprutil.mak"\ - CFG="libaprutil - Win32 Debug" RECURSE=1 - cd "..\..\modules\dav\fs" - -!ENDIF - -!IF "$(CFG)" == "mod_dav_fs - Win32 Release" - -"libhttpd - Win32 Release" : - cd "..\../.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Release" - cd ".\modules\dav\fs" - -"libhttpd - Win32 ReleaseCLEAN" : - cd "..\../.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Release"\ - RECURSE=1 - cd ".\modules\dav\fs" - -!ELSEIF "$(CFG)" == "mod_dav_fs - Win32 Debug" - -"libhttpd - Win32 Debug" : - cd "..\../.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Debug" - cd ".\modules\dav\fs" - -"libhttpd - Win32 DebugCLEAN" : - cd "..\../.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Debug"\ - RECURSE=1 - cd ".\modules\dav\fs" - -!ENDIF - -!IF "$(CFG)" == "mod_dav_fs - Win32 Release" - -"mod_dav - Win32 Release" : - cd "..\../..\modules\dav\main" - $(MAKE) /$(MAKEFLAGS) /F .\mod_dav.mak CFG="mod_dav - Win32 Release" - cd "..\fs" - -"mod_dav - Win32 ReleaseCLEAN" : - cd "..\../..\modules\dav\main" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\mod_dav.mak CFG="mod_dav - Win32 Release"\ - RECURSE=1 - cd "..\fs" - -!ELSEIF "$(CFG)" == "mod_dav_fs - Win32 Debug" - -"mod_dav - Win32 Debug" : - cd "..\../..\modules\dav\main" - $(MAKE) /$(MAKEFLAGS) /F .\mod_dav.mak CFG="mod_dav - Win32 Debug" - cd "..\fs" - -"mod_dav - Win32 DebugCLEAN" : - cd "..\../..\modules\dav\main" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\mod_dav.mak CFG="mod_dav - Win32 Debug"\ - RECURSE=1 - cd "..\fs" - -!ENDIF - - -!ENDIF - diff --git a/modules/dav/fs/repos.c b/modules/dav/fs/repos.c deleted file mode 100644 index e8064d1cc7..0000000000 --- a/modules/dav/fs/repos.c +++ /dev/null @@ -1,2077 +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 - * . - */ - -/* -** DAV filesystem-based repository provider -*/ - -#include "apr.h" -#include "apr_file_io.h" -#include "apr_strings.h" - -#if APR_HAVE_STDIO_H -#include /* for sprintf() */ -#endif - -#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 "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 { - apr_pool_t *pool; /* memory storage pool associated with request */ - const char *pathname; /* full pathname to resource */ - apr_finfo_t finfo; /* filesystem info */ -}; - -/* private context for doing a filesystem walk */ -typedef struct { - /* the input walk parameters */ - const dav_walk_params *params; - - /* reused as we walk */ - dav_walk_resource wres; - - dav_resource res1; - dav_resource_private info1; - dav_buffer path1; - dav_buffer uri_buf; - - /* MOVE/COPY need a secondary path */ - dav_resource res2; - dav_resource_private info2; - dav_buffer path2; - - dav_buffer locknull_buf; - -} dav_fs_walker_context; - -typedef struct { - int is_move; /* is this a MOVE? */ - dav_buffer work_buf; /* handy buffer for copymove_file() */ - - /* CALLBACK: this is a secondary resource managed specially for us */ - const dav_resource *res_dst; - - /* copied from dav_walk_params (they are invariant across the walk) */ - const dav_resource *root; - apr_pool_t *pool; - -} dav_fs_copymove_walk_ctx; - -/* an internal WALKTYPE to walk hidden files (the .DAV directory) */ -#define DAV_WALKTYPE_HIDDEN 0x4000 - -/* an internal WALKTYPE to call collections (again) after their contents */ -#define DAV_WALKTYPE_POSTFIX 0x8000 - -#define DAV_CALLTYPE_POSTFIX 1000 /* a private call type */ - - -/* pull this in from the other source file */ -extern const dav_hooks_locks dav_hooks_locks_fs; - -/* forward-declare the hook structures */ -static const dav_hooks_repository dav_hooks_repository_fs; -static const dav_hooks_liveprop dav_hooks_liveprop_fs; - -/* -** 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 single property that we define (in the DAV_FS_URI_MYPROPS namespace) -*/ -#define DAV_PROPID_FS_executable 1 - -static const dav_liveprop_spec dav_fs_props[] = -{ - { - DAV_FS_URI_DAV, - "creationdate", - DAV_PROPID_creationdate, - 0 - }, - { - DAV_FS_URI_DAV, - "getcontentlength", - DAV_PROPID_getcontentlength, - 0 - }, - { - DAV_FS_URI_DAV, - "getetag", - DAV_PROPID_getetag, - 0 - }, - { - DAV_FS_URI_DAV, - "getlastmodified", - DAV_PROPID_getlastmodified, - 0 - }, - - { - DAV_FS_URI_MYPROPS, - "executable", - DAV_PROPID_FS_executable, - 0 /* handled special in dav_fs_is_writable */ - }, - - { 0 } /* sentinel */ -}; - -static const dav_liveprop_group dav_fs_liveprop_group = -{ - dav_fs_props, - dav_fs_namespace_uris, - &dav_hooks_liveprop_fs -}; - - -/* define the dav_stream structure for our use */ -struct dav_stream { - apr_pool_t *p; - apr_file_t *f; - const char *pathname; /* we may need to remove it at close time */ -}; - -/* forward declaration for internal treewalkers */ -static dav_error * dav_fs_walk(const dav_walk_params *params, int depth, - dav_response **response); -static dav_error * dav_fs_internal_walk(const dav_walk_params *params, - int depth, int is_move, - const dav_resource *root_dst, - dav_response **response); - -/* -------------------------------------------------------------------- -** -** PRIVATE REPOSITORY FUNCTIONS -*/ -apr_pool_t *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); - apr_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, apr_time_t sec, char *buf) -{ - apr_exploded_time_t tms; - - /* ### what to do if fails? */ - (void) apr_explode_gmt(&tms, 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", - apr_day_snames[tms.tm_wday], - tms.tm_mday, apr_month_snames[tms.tm_mon], - tms.tm_year + 1900, - tms.tm_hour, tms.tm_min, tms.tm_sec); -} - -static dav_error * dav_fs_copymove_file( - int is_move, - apr_pool_t * p, - const char *src, - const char *dst, - dav_buffer *pbuf) -{ - dav_buffer work_buf = { 0 }; - apr_file_t *inf = NULL; - apr_file_t *outf = NULL; - - if (pbuf == NULL) - pbuf = &work_buf; - - dav_set_bufsize(p, pbuf, DAV_FS_COPY_BLOCKSIZE); - - if ((apr_file_open(&inf, src, APR_READ | APR_BINARY, APR_OS_DEFAULT, p)) - != APR_SUCCESS) { - /* ### 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 ((apr_file_open(&outf, dst, APR_WRITE | APR_CREATE | APR_TRUNCATE | APR_BINARY, - APR_OS_DEFAULT, p)) != APR_SUCCESS) { - apr_file_close(inf); - - /* ### use something besides 500? */ - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not open file for writing"); - } - - while (1) { - apr_size_t len = DAV_FS_COPY_BLOCKSIZE; - apr_status_t status; - - status = apr_file_read(inf, pbuf->buf, &len); - if (status != APR_SUCCESS && status != APR_EOF) { - apr_file_close(inf); - apr_file_close(outf); - - if (apr_file_remove(dst, p) != APR_SUCCESS) { - /* ### 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"); - } - - /* write any bytes that were read (applies to APR_EOF, too) */ - if (apr_file_write_full(outf, pbuf->buf, len, NULL) != APR_SUCCESS) { - int save_errno = errno; - - apr_file_close(inf); - apr_file_close(outf); - - if (apr_file_remove(dst, p) != APR_SUCCESS) { - /* ### 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"); - } - - if (status == APR_EOF) - break; - } - - apr_file_close(inf); - apr_file_close(outf); - - if (is_move && apr_file_remove(src, p) != APR_SUCCESS) { - dav_error *err; - int save_errno = errno; /* save the errno that got us here */ - - if (apr_file_remove(dst, p) != APR_SUCCESS) { - /* ### 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, - apr_pool_t * p, - const char *src_dir, const char *src_file, - const char *dst_dir, const char *dst_file, - dav_buffer *pbuf) -{ - apr_finfo_t src_finfo; /* finfo for source file */ - apr_finfo_t dst_state_finfo; /* finfo for STATE directory */ - apr_status_t rv; - const char *src; - const char *dst; - - /* build the propset pathname for the source file */ - src = apr_pstrcat(p, src_dir, "/" DAV_FS_STATE_DIR "/", src_file, NULL); - - /* the source file doesn't exist */ - if (apr_stat(&src_finfo, src, APR_FINFO_NORM, p) != APR_SUCCESS) { - return NULL; - } - - /* build the pathname for the destination state dir */ - dst = apr_pstrcat(p, dst_dir, "/" DAV_FS_STATE_DIR, NULL); - - /* ### do we need to deal with the umask? */ - - /* ensure that it exists */ - rv = apr_dir_make(dst, APR_OS_DEFAULT, p); - if (rv != APR_SUCCESS) { - if (!APR_STATUS_IS_EEXIST(rv)) { - /* ### 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 (apr_stat(&dst_state_finfo, dst, APR_FINFO_NORM, p) != APR_SUCCESS) { - /* 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 (dst_state_finfo.filetype != APR_DIR) { - /* ### 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 = apr_pstrcat(p, dst, "/", dst_file, NULL); - - /* copy/move the file now */ - if (is_move && src_finfo.device == dst_state_finfo.device) { - /* simple rename is possible since it is on the same device */ - if (apr_file_rename(src, dst, p) != APR_SUCCESS) { - /* ### 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, apr_pool_t *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(apr_pool_t *p, const dav_resource *resource) -{ - const char *dirpath; - const char *fname; - const char *state1; - const char *state2; - const char *pathname; - apr_status_t status; - - /* 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 = apr_pstrcat(p, - dirpath, - "/" DAV_FS_STATE_DIR "/", - state1, - NULL); - - /* note: we may get ENOENT if the state dir is not present */ - if ((status = apr_file_remove(pathname, p)) != APR_SUCCESS - && !APR_STATUS_IS_ENOENT(status)) { - 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 = apr_pstrcat(p, - dirpath, - "/" DAV_FS_STATE_DIR "/", - state2, - NULL); - - if ((status = apr_file_remove(pathname, p)) != APR_SUCCESS - && !APR_STATUS_IS_ENOENT(status)) { - /* ### 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_error * dav_fs_get_resource( - request_rec *r, - const char *root_dir, - const char *label, - int use_checked_in, - dav_resource **result_resource) -{ - dav_resource_private *ctx; - dav_resource *resource; - char *s; - char *filename; - apr_size_t len; - - /* ### optimize this into a single allocation! */ - - /* Create private resource context descriptor */ - ctx = apr_pcalloc(r->pool, sizeof(*ctx)); - ctx->finfo = r->finfo; - - /* ### this should go away */ - ctx->pool = r->pool; - - /* Preserve case on OSes which fold canonical filenames */ -#if 0 - /* ### not available in Apache 2.0 yet */ - 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 = apr_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 = apr_pcalloc(r->pool, sizeof(*resource)); - resource->type = DAV_RESOURCE_TYPE_REGULAR; - resource->info = ctx; - resource->hooks = &dav_hooks_repository_fs; - resource->pool = r->pool; - - /* make sure the URI does not have a trailing "/" */ - len = strlen(r->uri); - if (len > 1 && r->uri[len - 1] == '/') { - s = apr_pstrdup(r->pool, r->uri); - s[len - 1] = '\0'; - resource->uri = s; - } - else { - resource->uri = r->uri; - } - - if (r->finfo.filetype != 0) { - resource->exists = 1; - resource->collection = r->finfo.filetype == APR_DIR; - - /* 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 dav_new_error(r->pool, HTTP_BAD_REQUEST, 0, - "The URL contains extraneous path " - "components. The resource could not " - "be identified."); - } - - /* retain proper integrity across the structures */ - if (!resource->exists) { - ctx->finfo.filetype = 0; - } - } - } - - *result_resource = resource; - return NULL; -} - -static dav_error * dav_fs_get_parent_resource(const dav_resource *resource, - dav_resource **result_parent) -{ - 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 - ) { - *result_parent = NULL; - return NULL; - } - - /* ### optimize this into a single allocation! */ - - /* Create private resource context descriptor */ - parent_ctx = apr_pcalloc(ctx->pool, sizeof(*parent_ctx)); - - /* ### this should go away */ - 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 = apr_pcalloc(ctx->pool, sizeof(*parent_resource)); - parent_resource->info = parent_ctx; - parent_resource->collection = 1; - parent_resource->hooks = &dav_hooks_repository_fs; - parent_resource->pool = resource->pool; - - 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 (apr_stat(&parent_ctx->finfo, parent_ctx->pathname, - APR_FINFO_NORM, ctx->pool) == APR_SUCCESS) { - parent_resource->exists = 1; - } - - *result_parent = parent_resource; - return NULL; -} - -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.filetype != 0) - return ctx1->finfo.inode == ctx2->finfo.inode; - 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; - apr_size_t len1 = strlen(ctx1->pathname); - apr_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) -{ - apr_pool_t *p = resource->info->pool; - dav_stream *ds = apr_pcalloc(p, sizeof(*ds)); - apr_int32_t flags; - - switch (mode) { - case DAV_MODE_READ: - case DAV_MODE_READ_SEEKABLE: - default: - flags = APR_READ | APR_BINARY; - break; - - case DAV_MODE_WRITE_TRUNC: - flags = APR_WRITE | APR_CREATE | APR_TRUNCATE | APR_BINARY; - break; - case DAV_MODE_WRITE_SEEKABLE: - flags = APR_WRITE | APR_CREATE | APR_BINARY; - break; - } - - ds->p = p; - ds->pathname = resource->info->pathname; - if (apr_file_open(&ds->f, ds->pathname, flags, APR_OS_DEFAULT, - ds->p) != APR_SUCCESS) { - /* ### use something besides 500? */ - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "An error occurred while opening a resource."); - } - - /* (APR registers cleanups for the fd with the pool) */ - - *stream = ds; - return NULL; -} - -static dav_error * dav_fs_close_stream(dav_stream *stream, int commit) -{ - apr_file_close(stream->f); - - if (!commit) { - if (apr_file_remove(stream->pathname, stream->p) != APR_SUCCESS) { - /* ### 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, apr_size_t *bufsize) -{ - if (apr_file_read(stream->f, buf, bufsize) != APR_SUCCESS) { - /* ### use something besides 500? */ - return dav_new_error(stream->p, HTTP_INTERNAL_SERVER_ERROR, 0, - "An error occurred while reading from a " - "resource."); - } - return NULL; -} - -static dav_error * dav_fs_write_stream(dav_stream *stream, - const void *buf, apr_size_t bufsize) -{ - apr_status_t status; - - status = apr_file_write_full(stream->f, buf, bufsize, NULL); - if (APR_STATUS_IS_ENOSPC(status)) { - return dav_new_error(stream->p, HTTP_INSUFFICIENT_STORAGE, 0, - "There is not enough storage to write to " - "this resource."); - } - else if (status != APR_SUCCESS) { - /* ### 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, apr_off_t abs_pos) -{ - if (apr_file_seek(stream->f, APR_SET, &abs_pos) != APR_SUCCESS) { - /* ### should check whether apr_file_seek set abs_pos was set to the - * correct position? */ - /* ### 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.mtime); - - /* ### note that these use r->filename rather than */ - ap_set_last_modified(r); - ap_set_etag(r); - - /* we accept byte-ranges */ - apr_table_setn(r->headers_out, "Accept-Ranges", "bytes"); - - /* set up the Content-Length header */ - ap_set_content_length(r, resource->info->finfo.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(dav_resource *resource) -{ - dav_resource_private *ctx = resource->info; - apr_status_t status; - - status = apr_dir_make(ctx->pathname, APR_OS_DEFAULT, ctx->pool); - if (status == ENOSPC) { - return dav_new_error(ctx->pool, HTTP_INSUFFICIENT_STORAGE, 0, - "There is not enough storage to create " - "this collection."); - } - else if (status != APR_SUCCESS) { - /* ### refine this error message? */ - return dav_new_error(ctx->pool, 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_walk_resource *wres, - int calltype) -{ - dav_fs_copymove_walk_ctx *ctx = wres->walk_ctx; - dav_resource_private *srcinfo = wres->resource->info; - dav_resource_private *dstinfo = ctx->res_dst->info; - dav_error *err = NULL; - - if (wres->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) apr_dir_remove(srcinfo->pathname, ctx->pool); - } - else { - /* copy/move of a collection. Create the new, target collection */ - if (apr_dir_make(dstinfo->pathname, APR_OS_DEFAULT, - ctx->pool) != APR_SUCCESS) { - /* ### 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(wres->resource, ctx->root))) { - /* ### use errno to generate DAV:responsedescription? */ - dav_add_response(wres, 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_walk_params params = { 0 }; - dav_response *multi_status; - - params.walk_type = DAV_WALKTYPE_NORMAL | DAV_WALKTYPE_HIDDEN; - params.func = dav_fs_copymove_walker; - params.pool = src->info->pool; - params.root = src; - - /* params.walk_ctx is managed by dav_fs_internal_walk() */ - - /* postfix is needed for MOVE to delete source dirs */ - if (is_move) - params.walk_type |= DAV_WALKTYPE_POSTFIX; - - /* note that we return the error OR the multistatus. never both */ - - if ((err = dav_fs_internal_walk(¶ms, depth, is_move, dst, - &multi_status)) != NULL) { - /* on a "real" error, then just punt. nothing else to do. */ - return err; - } - - if ((*response = multi_status) != 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.filetype != 0) { - if (dstinfo->finfo.device == srcinfo->finfo.device) { - /* target exists and is on the same device. */ - can_rename = 1; - } - } - else { - const char *dirpath; - apr_finfo_t finfo; - - /* destination does not exist, but the parent directory should, - * so try it - */ - dirpath = ap_make_dirstr_parent(dstinfo->pool, dstinfo->pathname); - if (apr_stat(&finfo, dirpath, APR_FINFO_NORM, dstinfo->pool) == 0 - && finfo.device == srcinfo->finfo.device) { - can_rename = 1; - } - } - - /* if we can't simply rename, 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; - - /* ### APR has no rename? */ - if (apr_file_rename(srcinfo->pathname, dstinfo->pathname, - srcinfo->pool) != APR_SUCCESS) { - /* ### 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 (apr_file_rename(dstinfo->pathname, srcinfo->pathname, - srcinfo->pool) != APR_SUCCESS) { - /* 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_walk_resource *wres, int calltype) -{ - dav_resource_private *info = wres->resource->info; - - /* do not attempt to remove a null resource, - * or a collection with children - */ - if (wres->resource->exists && - (!wres->resource->collection || calltype == DAV_CALLTYPE_POSTFIX)) { - /* try to remove the resource */ - apr_status_t result; - - result = wres->resource->collection - ? apr_dir_remove(info->pathname, wres->pool) - : apr_file_remove(info->pathname, wres->pool); - - /* - ** 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 != APR_SUCCESS) { - /* ### assume there is a permissions problem */ - - /* ### use errno to generate DAV:responsedescription? */ - dav_add_response(wres, 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_walk_params params = { 0 }; - dav_error *err = NULL; - dav_response *multi_status; - - params.walk_type = (DAV_WALKTYPE_NORMAL - | DAV_WALKTYPE_HIDDEN - | DAV_WALKTYPE_POSTFIX); - params.func = dav_fs_delete_walker; - params.pool = info->pool; - params.root = resource; - - if ((err = dav_fs_walk(¶ms, DAV_INFINITY, - &multi_status)) != NULL) { - /* on a "real" error, then just punt. nothing else to do. */ - return err; - } - - if ((*response = multi_status) != 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 (apr_file_remove(info->pathname, info->pool) != APR_SUCCESS) { - /* ### 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. */ -static dav_error * dav_fs_walker(dav_fs_walker_context *fsctx, int depth) -{ - const dav_walk_params *params = fsctx->params; - apr_pool_t *pool = params->pool; - dav_error *err = NULL; - int isdir = fsctx->res1.collection; - apr_finfo_t dirent; - apr_dir_t *dirp; - - /* ensure the context is prepared properly, then call the func */ - err = (*params->func)(&fsctx->wres, - 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(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(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 ((apr_dir_open(&dirp, fsctx->path1.buf, pool)) != APR_SUCCESS) { - /* ### need a better error */ - return dav_new_error(pool, HTTP_NOT_FOUND, 0, NULL); - } - while ((apr_dir_read(&dirent, APR_FINFO_DIRENT, dirp)) == APR_SUCCESS) { - apr_size_t len; - - len = strlen(dirent.name); - - /* avoid recursing into our current, parent, or state directories */ - if (dirent.name[0] == '.' - && (len == 1 || (dirent.name[1] == '.' && len == 2))) { - continue; - } - - if (params->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(dirent.name, DAV_FS_STATE_DIR)) { - continue; - } - } - /* skip the state dir unless a HIDDEN is performed */ - if (!(params->walk_type & DAV_WALKTYPE_HIDDEN) - && !strcmp(dirent.name, DAV_FS_STATE_DIR)) { - continue; - } - - /* append this file onto the path buffer (copy null term) */ - dav_buffer_place_mem(pool, &fsctx->path1, dirent.name, len + 1, 0); - - - /* ### Optimize me, dirent can give us what we need! */ - if (apr_lstat(&fsctx->info1.finfo, fsctx->path1.buf, - APR_FINFO_NORM, pool) != APR_SUCCESS) { - /* woah! where'd it go? */ - /* ### should have a better error here */ - err = dav_new_error(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(pool, &fsctx->uri_buf, dirent.name, len + 1, 1); - - /* if there is a secondary path, then do that, too */ - if (fsctx->path2.buf != NULL) { - dav_buffer_place_mem(pool, &fsctx->path2, dirent.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 = fsctx->uri_buf.buf; - - /* ### for now, only process regular files (e.g. skip symlinks) */ - if (fsctx->info1.finfo.filetype == APR_REG) { - /* call the function for the specified dir + file */ - if ((err = (*params->func)(&fsctx->wres, - DAV_CALLTYPE_MEMBER)) != NULL) { - /* ### maybe add a higher-level description? */ - break; - } - } - else if (fsctx->info1.finfo.filetype == APR_DIR) { - apr_size_t save_path_len = fsctx->path1.cur_len; - apr_size_t save_uri_len = fsctx->uri_buf.cur_len; - apr_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 */ - fsctx->uri_buf.cur_len += len + 1; - fsctx->uri_buf.buf[fsctx->uri_buf.cur_len - 1] = '/'; - fsctx->uri_buf.buf[fsctx->uri_buf.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; - fsctx->uri_buf.cur_len = save_uri_len; - - fsctx->res1.collection = 0; - fsctx->res2.collection = 0; - - /* assert: res1.exists == 1 */ - } - } - - /* ### check the return value of this? */ - apr_dir_close(dirp); - - if (err != NULL) - return err; - - if (params->walk_type & DAV_WALKTYPE_LOCKNULL) { - apr_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) { - apr_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(pool, &fsctx->path1, - fsctx->locknull_buf.buf + offset, len + 1, 0); - dav_buffer_place_mem(pool, &fsctx->uri_buf, - fsctx->locknull_buf.buf + offset, len + 1, 0); - if (fsctx->path2.buf != NULL) { - dav_buffer_place_mem(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 = fsctx->uri_buf.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(params->lockdb, &fsctx->res1, - &locks)) != NULL) { - /* ### maybe add a higher-level description? */ - return err; - } - - /* call the function for the specified dir + file */ - if (locks != NULL && - (err = (*params->func)(&fsctx->wres, - DAV_CALLTYPE_LOCKNULL)) != NULL) { - /* ### maybe add a higher-level description? */ - return err; - } - - offset += len + 1; - } - - /* reset the exists flag */ - fsctx->res1.exists = 1; - } - - if (params->walk_type & DAV_WALKTYPE_POSTFIX) { - /* replace the dirs' trailing slashes with null terms */ - fsctx->path1.buf[--fsctx->path1.cur_len] = '\0'; - fsctx->uri_buf.buf[--fsctx->uri_buf.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 (*params->func)(&fsctx->wres, DAV_CALLTYPE_POSTFIX); - } - - return NULL; -} - -static dav_error * dav_fs_internal_walk(const dav_walk_params *params, - int depth, int is_move, - const dav_resource *root_dst, - dav_response **response) -{ - dav_fs_walker_context fsctx = { 0 }; - dav_error *err; - dav_fs_copymove_walk_ctx cm_ctx = { 0 }; - -#if DAV_DEBUG - if ((params->walk_type & DAV_WALKTYPE_LOCKNULL) != 0 - && params->lockdb == NULL) { - return dav_new_error(params->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - "DESIGN ERROR: walker called to walk locknull " - "resources, but a lockdb was not provided."); - } -#endif - - fsctx.params = params; - fsctx.wres.walk_ctx = params->walk_ctx; - fsctx.wres.pool = params->pool; - - /* ### zero out versioned, working, baselined? */ - - fsctx.res1 = *params->root; - fsctx.res1.pool = params->pool; - - fsctx.res1.info = &fsctx.info1; - fsctx.info1 = *params->root->info; - - /* the pathname is stored in the path1 buffer */ - dav_buffer_init(params->pool, &fsctx.path1, fsctx.info1.pathname); - fsctx.info1.pathname = fsctx.path1.buf; - - if (root_dst != NULL) { - /* internal call from the COPY/MOVE code. set it up. */ - - fsctx.wres.walk_ctx = &cm_ctx; - cm_ctx.is_move = is_move; - cm_ctx.res_dst = &fsctx.res2; - cm_ctx.root = params->root; - cm_ctx.pool = params->pool; - - fsctx.res2 = *root_dst; - fsctx.res2.exists = 0; - fsctx.res2.collection = 0; - fsctx.res2.uri = NULL; /* we don't track this */ - fsctx.res2.pool = params->pool; - - fsctx.res2.info = &fsctx.info2; - fsctx.info2 = *root_dst->info; - - /* res2 does not exist -- clear its finfo structure */ - memset(&fsctx.info2.finfo, 0, sizeof(fsctx.info2.finfo)); - - /* the pathname is stored in the path2 buffer */ - dav_buffer_init(params->pool, &fsctx.path2, fsctx.info2.pathname); - fsctx.info2.pathname = fsctx.path2.buf; - } - - /* prep the URI buffer */ - dav_buffer_init(params->pool, &fsctx.uri_buf, params->root->uri); - - /* if we have a directory, then ensure the URI has a trailing "/" */ - if (fsctx.res1.collection - && fsctx.uri_buf.buf[fsctx.uri_buf.cur_len - 1] != '/') { - - /* this will fall into the pad area */ - fsctx.uri_buf.buf[fsctx.uri_buf.cur_len++] = '/'; - fsctx.uri_buf.buf[fsctx.uri_buf.cur_len] = '\0'; - } - - /* the current resource's URI is stored in the uri_buf buffer */ - fsctx.res1.uri = fsctx.uri_buf.buf; - - /* point the callback's resource at our structure */ - fsctx.wres.resource = &fsctx.res1; - - /* always return the error, and any/all multistatus responses */ - err = dav_fs_walker(&fsctx, depth); - *response = fsctx.wres.response; - return err; -} - -static dav_error * dav_fs_walk(const dav_walk_params *params, int depth, - dav_response **response) -{ - /* always return the error, and any/all multistatus responses */ - return dav_fs_internal_walk(params, depth, 0, NULL, response); -} - -/* 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 apr_pstrdup(ctx->pool, ""); - - if (ctx->finfo.filetype != 0) { - return apr_psprintf(ctx->pool, "\"%lx-%lx-%lx\"", - (unsigned long) ctx->finfo.inode, - (unsigned long) ctx->finfo.size, - (unsigned long) ctx->finfo.mtime); - } - - return apr_psprintf(ctx->pool, "\"%lx\"", (unsigned long) ctx->finfo.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 dav_prop_insert dav_fs_insert_prop(const dav_resource *resource, - int propid, dav_prop_insert what, - ap_text_header *phdr) -{ - const char *value; - const char *s; - apr_pool_t *p = resource->info->pool; - const dav_liveprop_spec *info; - int global_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]; - - /* - ** None of FS provider properties are defined if the resource does not - ** exist. Just bail for this case. - ** - ** 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_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.ctime, - buf); - value = buf; - break; - - case DAV_PROPID_getcontentlength: - /* our property, but not defined on collection resources */ - if (resource->collection) - return DAV_PROP_INSERT_NOTDEF; - - (void) sprintf(buf, "%" APR_OFF_T_FMT, resource->info->finfo.size); - value = buf; - break; - - case DAV_PROPID_getetag: - value = dav_fs_getetag(resource); - break; - - case DAV_PROPID_getlastmodified: - dav_format_time(DAV_STYLE_RFC822, - resource->info->finfo.mtime, - buf); - value = buf; - break; - - case DAV_PROPID_FS_executable: - /* our property, but not defined on collection resources */ - if (resource->collection) - return DAV_PROP_INSERT_NOTDEF; - - /* our property, but not defined on this platform */ - if (!(resource->info->finfo.valid & APR_FINFO_UPROT)) - return DAV_PROP_INSERT_NOTDEF; - - /* the files are "ours" so we only need to check owner exec privs */ - if (resource->info->finfo.protection & APR_UEXECUTE) - value = "T"; - else - value = "F"; - break; - - default: - /* ### what the heck was this 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_fs_liveprop_group, &info); - - /* assert: info != NULL && info->name != NULL */ - - /* DBG3("FS: inserting lp%d:%s (local %d)", ns, scan->name, scan->ns); */ - - if (what == DAV_PROP_INSERT_VALUE) { - s = apr_psprintf(p, "%s" DEBUG_CR, - global_ns, info->name, value, global_ns, info->name); - } - else if (what == DAV_PROP_INSERT_NAME) { - s = apr_psprintf(p, "" DEBUG_CR, global_ns, info->name); - } - else { - /* assert: what == DAV_PROP_INSERT_SUPPORTED */ - s = apr_psprintf(p, - "" DEBUG_CR, - info->name, dav_fs_namespace_uris[info->ns]); - } - ap_text_append(p, phdr, s); - - /* we inserted what was asked for */ - return what; -} - -static int dav_fs_is_writable(const dav_resource *resource, int propid) -{ - const dav_liveprop_spec *info; - -#ifndef WIN32 - /* this property is not usable (writable) on the Win32 platform */ - if (propid == DAV_PROPID_FS_executable && !resource->collection) - return 1; -#endif - - (void) dav_get_liveprop_info(propid, &dav_fs_liveprop_group, &info); - return info->is_writable; -} - -static dav_error *dav_fs_patch_validate(const dav_resource *resource, - const ap_xml_elem *elem, - int operation, - void **context, - int *defer_to_dead) -{ - const ap_text *cdata; - const ap_text *f_cdata; - char value; - dav_elem_private *priv = elem->private; - - if (priv->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; - - /* ### hmm. this isn't actually looking at all the possible text items */ - f_cdata = elem->first_child == NULL - ? NULL - : elem->first_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(const dav_resource *resource, - const ap_xml_elem *elem, - int operation, - void *context, - dav_liveprop_rollback **rollback_ctx) -{ - int value = context != NULL; - apr_fileperms_t perms = resource->info->finfo.protection; - int old_value = (perms & APR_UEXECUTE) != 0; - - /* assert: prop == executable. operation == SET. */ - - /* don't do anything if there is no change. no rollback info either. */ - /* DBG2("new value=%d (old=%d)", value, old_value); */ - if (value == old_value) - return NULL; - - perms &= ~APR_UEXECUTE; - if (value) - perms |= APR_UEXECUTE; - - if (apr_file_perms_set(resource->info->pathname, perms) != APR_SUCCESS) { - 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.protection = perms; - *rollback_ctx = (dav_liveprop_rollback *)old_value; - - return NULL; -} - -static void dav_fs_patch_commit(const dav_resource *resource, - int operation, - void *context, - dav_liveprop_rollback *rollback_ctx) -{ - /* nothing to do */ -} - -static dav_error *dav_fs_patch_rollback(const dav_resource *resource, - int operation, - void *context, - dav_liveprop_rollback *rollback_ctx) -{ - apr_fileperms_t perms = resource->info->finfo.protection & ~APR_UEXECUTE; - int value = rollback_ctx != NULL; - - /* assert: prop == executable. operation == SET. */ - - /* restore the executable bit */ - if (value) - perms |= APR_UEXECUTE; - - if (apr_file_perms_set(resource->info->pathname, perms) != APR_SUCCESS) { - 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.protection = perms; - - return NULL; -} - - -static const dav_hooks_liveprop dav_hooks_liveprop_fs = -{ - dav_fs_insert_prop, - dav_fs_is_writable, - dav_fs_namespace_uris, - dav_fs_patch_validate, - dav_fs_patch_exec, - dav_fs_patch_commit, - dav_fs_patch_rollback -}; - -static const dav_provider dav_fs_provider = -{ - &dav_hooks_repository_fs, - &dav_hooks_db_dbm, - &dav_hooks_locks_fs, - NULL, /* vsn */ - NULL /* binding */ -}; - -void dav_fs_gather_propsets(apr_array_header_t *uris) -{ -#ifndef WIN32 - *(const char **)apr_array_push(uris) = - ""; -#endif -} - -int dav_fs_find_liveprop(const dav_resource *resource, - const char *ns_uri, const char *name, - const dav_hooks_liveprop **hooks) -{ - /* don't try to find any liveprops if this isn't "our" resource */ - if (resource->hooks != &dav_hooks_repository_fs) - return 0; - return dav_do_find_liveprop(ns_uri, name, &dav_fs_liveprop_group, hooks); -} - -void dav_fs_insert_all_liveprops(request_rec *r, const dav_resource *resource, - dav_prop_insert what, ap_text_header *phdr) -{ - /* don't insert any liveprops if this isn't "our" resource */ - if (resource->hooks != &dav_hooks_repository_fs) - return; - - 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_creationdate, - what, phdr); - (void) dav_fs_insert_prop(resource, DAV_PROPID_getcontentlength, - what, phdr); - (void) dav_fs_insert_prop(resource, DAV_PROPID_getlastmodified, - what, phdr); - (void) dav_fs_insert_prop(resource, DAV_PROPID_getetag, - what, 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, - what, phdr); -#endif - - /* ### we know the others aren't defined as liveprops */ -} - -void dav_fs_register(apr_pool_t *p) -{ - /* register the namespace URIs */ - dav_register_liveprop_group(p, &dav_fs_liveprop_group); - - /* register the repository provider */ - dav_register_provider(p, "filesystem", &dav_fs_provider); -} diff --git a/modules/dav/fs/repos.h b/modules/dav/fs/repos.h deleted file mode 100644 index 8e69773286..0000000000 --- a/modules/dav/fs/repos.h +++ /dev/null @@ -1,110 +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 - * . - */ - -/* -** Declarations for the filesystem repository implementation -*/ - -#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" - - -/* ensure that our state subdirectory is present */ -void dav_fs_ensure_state_dir(apr_pool_t *p, const char *dirname); - -/* return the storage pool associated with a resource */ -apr_pool_t *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(apr_pool_t *p, const char *pathname, int ro, - dav_db **pdb); -void dav_dbm_get_statefiles(apr_pool_t *p, const char *fname, - const char **state1, const char **state2); - -/* where is the lock database located? */ -const char *dav_get_lockdb_path(const request_rec *r); - -const dav_hooks_locks *dav_fs_get_lock_hooks(request_rec *r); -const dav_hooks_propdb *dav_fs_get_propdb_hooks(request_rec *r); - -void dav_fs_gather_propsets(apr_array_header_t *uris); -int dav_fs_find_liveprop(const dav_resource *resource, - const char *ns_uri, const char *name, - const dav_hooks_liveprop **hooks); -void dav_fs_insert_all_liveprops(request_rec *r, const dav_resource *resource, - dav_prop_insert what, ap_text_header *phdr); - -void dav_fs_register(apr_pool_t *p); - -#endif /* _DAV_FS_REPOS_H_ */ diff --git a/modules/dav/main/.cvsignore b/modules/dav/main/.cvsignore deleted file mode 100644 index 65f0cc30cf..0000000000 --- a/modules/dav/main/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -Debug -Release diff --git a/modules/dav/main/Makefile.in b/modules/dav/main/Makefile.in deleted file mode 100644 index 7c5c149d85..0000000000 --- a/modules/dav/main/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/dav/main/config5.m4 b/modules/dav/main/config5.m4 deleted file mode 100644 index f576f5f579..0000000000 --- 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 - - APR_ADDTO(INCLUDES, [-I\$(top_srcdir)/$modpath_current]) -fi - - -APACHE_MODPATH_FINISH diff --git a/modules/dav/main/liveprop.c b/modules/dav/main/liveprop.c deleted file mode 100644 index 98358afb74..0000000000 --- a/modules/dav/main/liveprop.c +++ /dev/null @@ -1,177 +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 "apr_pools.h" -#include "apr_hash.h" -#include "apr_errno.h" -#include "apr_strings.h" -#include "util_xml.h" /* for ap_text_header */ -#include "mod_dav.h" - - -static apr_hash_t *dav_liveprop_uris = NULL; -static int dav_liveprop_count = 0; - - -static apr_status_t dav_cleanup_liveprops(void *ctx) -{ - dav_liveprop_uris = NULL; - dav_liveprop_count = 0; - return APR_SUCCESS; -} - -static void dav_register_liveprop_namespace(apr_pool_t *p, const char *uri) -{ - int value; - - if (dav_liveprop_uris == NULL) { - dav_liveprop_uris = apr_hash_make(p); - apr_pool_cleanup_register(p, NULL, dav_cleanup_liveprops, apr_pool_cleanup_null); - } - - value = (int)apr_hash_get(dav_liveprop_uris, uri, APR_HASH_KEY_STRING); - if (value != 0) { - /* already registered */ - return; - } - - /* start at 1, and count up */ - apr_hash_set(dav_liveprop_uris, uri, APR_HASH_KEY_STRING, - (void *)++dav_liveprop_count); -} - -DAV_DECLARE(int) dav_get_liveprop_ns_index(const char *uri) -{ - return (int)apr_hash_get(dav_liveprop_uris, uri, APR_HASH_KEY_STRING); -} - -int dav_get_liveprop_ns_count(void) -{ - return dav_liveprop_count; -} - -void dav_add_all_liveprop_xmlns(apr_pool_t *p, ap_text_header *phdr) -{ - apr_hash_index_t *idx = apr_hash_first(dav_liveprop_uris); - - for ( ; idx != NULL; idx = apr_hash_next(idx) ) { - const void *key; - void *val; - const char *s; - - apr_hash_this(idx, &key, NULL, &val); - - s = apr_psprintf(p, " xmlns:lp%d=\"%s\"", (int)val, (const char *)key); - ap_text_append(p, phdr, s); - } -} - -DAV_DECLARE(int) dav_do_find_liveprop(const char *ns_uri, const char *name, - const dav_liveprop_group *group, - const dav_hooks_liveprop **hooks) -{ - const char * const *uris = group->namespace_uris; - const dav_liveprop_spec *scan; - int ns; - - /* first: locate the namespace in the namespace table */ - for (ns = 0; uris[ns] != NULL; ++ns) - if (strcmp(ns_uri, uris[ns]) == 0) - break; - if (uris[ns] == NULL) { - /* not our property (the namespace matched none of ours) */ - return 0; - } - - /* second: look for the property in the liveprop specs */ - for (scan = group->specs; scan->name != NULL; ++scan) - if (ns == scan->ns && strcmp(name, scan->name) == 0) { - *hooks = group->hooks; - return scan->propid; - } - - /* not our property (same namespace, but no matching prop name) */ - return 0; -} - -DAV_DECLARE(int) dav_get_liveprop_info(int propid, - const dav_liveprop_group *group, - const dav_liveprop_spec **info) -{ - const dav_liveprop_spec *scan; - - for (scan = group->specs; scan->name != NULL; ++scan) { - if (scan->propid == propid) { - *info = scan; - - /* map the provider-local NS into a global NS index */ - return dav_get_liveprop_ns_index(group->namespace_uris[scan->ns]); - } - } - - /* assert: should not reach this point */ - *info = NULL; - return 0; -} - -DAV_DECLARE(void) dav_register_liveprop_group(apr_pool_t *p, - const dav_liveprop_group *group) -{ - /* register the namespace URIs */ - const char * const * uris = group->namespace_uris; - - for ( ; *uris != NULL; ++uris) { - dav_register_liveprop_namespace(p, *uris); - } -} diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c deleted file mode 100644 index 8e29f05c7f..0000000000 --- a/modules/dav/main/mod_dav.c +++ /dev/null @@ -1,4731 +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 - * . - */ - -/* -** DAV extension module for Apache 2.0.* -** -** This module is repository-independent. It depends on hooks provided by a -** repository implementation. -** -** 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 "apr_strings.h" -#include "apr_lib.h" /* for apr_is* */ - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#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" - - -/* ### what is the best way to set this? */ -#define DAV_DEFAULT_PROVIDER "filesystem" - -enum { - DAV_ENABLED_UNSET = 0, - DAV_ENABLED_OFF, - DAV_ENABLED_ON -}; - -/* per-dir configuration */ -typedef struct { - const char *provider_name; - const dav_provider *provider; - const char *dir; - int locktimeout; - int allow_depthinfinity; - - apr_table_t *d_params; /* per-directory DAV config parameters */ - -} dav_dir_conf; - -/* per-server configuration */ -typedef struct { - int unused; - -} dav_server_conf; - -#define DAV_INHERIT_VALUE(parent, child, field) \ - ((child)->field ? (child)->field : (parent)->field) - - -/* forward-declare for use in configuration lookup */ -extern module DAV_DECLARE_DATA dav_module; - -static void dav_init_handler(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, - server_rec *s) -{ - /* DBG0("dav_init_handler"); */ - - ap_add_version_component(p, "DAV/2"); -} - -static void *dav_create_server_config(apr_pool_t *p, server_rec *s) -{ - dav_server_conf *newconf; - - newconf = (dav_server_conf *) apr_pcalloc(p, sizeof(*newconf)); - - /* ### this isn't used at the moment... */ - - return newconf; -} - -static void *dav_merge_server_config(apr_pool_t *p, void *base, void *overrides) -{ -#if 0 - dav_server_conf *child = overrides; -#endif - dav_server_conf *newconf; - - newconf = (dav_server_conf *) apr_pcalloc(p, sizeof(*newconf)); - - /* ### nothing to merge right now... */ - - return newconf; -} - -static void *dav_create_dir_config(apr_pool_t *p, char *dir) -{ - /* NOTE: dir==NULL creates the default per-dir config */ - - dav_dir_conf *conf; - - conf = (dav_dir_conf *) apr_pcalloc(p, sizeof(*conf)); - - /* clean up the directory to remove any trailing slash */ - if (dir != NULL) { - char *d; - apr_size_t l; - - d = apr_pstrdup(p, dir); - l = strlen(d); - if (l > 1 && d[l - 1] == '/') - d[l - 1] = '\0'; - conf->dir = d; - } - - conf->d_params = apr_table_make(p, 1); - - return conf; -} - -static void *dav_merge_dir_config(apr_pool_t *p, void *base, void *overrides) -{ - dav_dir_conf *parent = base; - dav_dir_conf *child = overrides; - dav_dir_conf *newconf = (dav_dir_conf *) apr_pcalloc(p, sizeof(*newconf)); - - /* DBG3("dav_merge_dir_config: new=%08lx base=%08lx overrides=%08lx", - (long)newconf, (long)base, (long)overrides); */ - - newconf->provider_name = DAV_INHERIT_VALUE(parent, child, provider_name); - newconf->provider = DAV_INHERIT_VALUE(parent, child, provider); - if (parent->provider_name != NULL) { - if (child->provider_name == NULL) { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, NULL, - "\"DAV Off\" cannot be used to turn off a subtree " - "of a DAV-enabled location."); - } - else if (strcasecmp(child->provider_name, - parent->provider_name) != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, NULL, - "A subtree cannot specify a different DAV provider " - "than its parent."); - } - } - - 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); - - newconf->d_params = apr_table_copy(p, parent->d_params); - apr_table_overlap(newconf->d_params, child->d_params, - APR_OVERLAP_TABLES_SET); - - return newconf; -} - -apr_table_t *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; -} - -static const dav_provider * dav_get_provider(request_rec *r) -{ - dav_dir_conf *conf; - - conf = ap_get_module_config(r->per_dir_config, &dav_module); - /* assert: conf->provider_name != NULL - (otherwise, DAV is disabled, and we wouldn't be here) */ - - /* assert: conf->provider != NULL - (checked when conf->provider_name is set) */ - return conf->provider; -} - -const dav_hooks_locks *dav_get_lock_hooks(request_rec *r) -{ - return dav_get_provider(r)->locks; -} - -const dav_hooks_propdb *dav_get_propdb_hooks(request_rec *r) -{ - return dav_get_provider(r)->propdb; -} - -const dav_hooks_vsn *dav_get_vsn_hooks(request_rec *r) -{ - return dav_get_provider(r)->vsn; -} - -const dav_hooks_binding *dav_get_binding_hooks(request_rec *r) -{ - return dav_get_provider(r)->binding; -} - -/* - * Command handler for the DAV directive, which is TAKE1. - */ -static const char *dav_cmd_dav(cmd_parms *cmd, void *config, const char *arg1) -{ - dav_dir_conf *conf = (dav_dir_conf *) config; - - if (strcasecmp(arg1, "on") == 0) { - conf->provider_name = DAV_DEFAULT_PROVIDER; - } - else if (strcasecmp(arg1, "off") == 0) { - conf->provider_name = NULL; - conf->provider = NULL; - } - else { - conf->provider_name = apr_pstrdup(cmd->pool, arg1); - } - - if (conf->provider_name != NULL) { - /* lookup and cache the actual provider now */ - conf->provider = dav_lookup_provider(conf->provider_name); - - if (conf->provider == NULL) { - /* by the time they use it, the provider should be loaded and - registered with us. */ - return apr_psprintf(cmd->pool, - "Unknown DAV provider: %s", - conf->provider_name); - } - } - - 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 DAVMinTimeout directive, which is TAKE1 - */ -static const char *dav_cmd_davmintimeout(cmd_parms *cmd, void *config, - const 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, - const char *arg1, const char *arg2) -{ - dav_dir_conf *conf = (dav_dir_conf *) config; - - apr_table_set(conf->d_params, arg1, arg2); - - 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. -** -** ### this function is not logging any errors! (e.g. the body) -*/ -static int dav_error_response(request_rec *r, int status, const char *body) -{ - r->status = status; - r->status_line = ap_get_status_line(status); /* ### needed? */ - 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_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); - - /* 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(apr_pool_t *p, const char *uri) -{ - const char *e_uri = ap_escape_uri(p, uri); - - /* check the easy case... */ - if (ap_strchr_c(e_uri, '&') == NULL) - return e_uri; - - /* there was a '&', so more work is needed... sigh. */ - - /* - ** Note: this is a teeny bit of overkill since we know there are no - ** '<' or '>' characters, but who cares. - */ - return ap_xml_quote_string(p, e_uri, 0); -} - -static void dav_send_multistatus(request_rec *r, int status, - dav_response *first, - apr_array_header_t *namespaces) -{ - /* Set the correct status and Content-Type */ - r->status = status; - r->content_type = DAV_XML_CONTENT_TYPE; - - /* Send the headers and actual multistatus response now... */ - ap_rputs(DAV_XML_HEADER DEBUG_CR - "nelts; i--; ) { - ap_rprintf(r, " xmlns:ns%d=\"%s\"", i, - AP_XML_GET_URI_ITEM(namespaces, i)); - } - } - - /* ap_rputc('>', r); */ - ap_rputs(">" DEBUG_CR, r); - - for (; first != NULL; first = first->next) { - ap_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) { - /* use the Status-Line text from Apache. Note, this will - * default to 500 Internal Server Error if first->status - * is not a known (or valid) status code. */ - ap_rprintf(r, - "HTTP/1.1 %s" DEBUG_CR, - ap_get_status_line(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); -} - -/* -** 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, errno, r, "%s [%d, #%d]", - errscan->desc, errscan->status, errscan->error_id); - } - else { - ap_log_rerror(APLOG_MARK, level | APLOG_NOERRNO, 0, 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 -** - vsn_hooks->update -*/ -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 */ - apr_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, const char *locn, const char *what, - int replaced) -{ - const char *body; - - if (locn == NULL) { - locn = r->uri; - } - - /* 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. */ - - /* Convert locn to an absolute URI, and return in Location header */ - apr_table_setn(r->headers_out, "Location", ap_construct_url(r->pool, locn, r)); - - /* ### 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 = apr_psprintf(r->pool, "%s %s has been created.", - what, ap_escape_html(r->pool, locn)); - 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 = apr_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, 0, r, - "An invalid Depth header was specified."); - return -1; -} - -static int dav_get_overwrite(request_rec *r) -{ - const char *overwrite = apr_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, 0, r, - "An invalid Overwrite header was specified."); - return -1; -} - -/* resolve a request URI to a resource descriptor. - * - * If label_allowed != 0, then allow the request target to be altered by - * a Label: header. - * - * If use_checked_in is true, then the repository provider should return - * the resource identified by the DAV:checked-in property of the resource - * identified by the Request-URI. - */ -static dav_error * dav_get_resource(request_rec *r, int label_allowed, - int use_checked_in, dav_resource **res_p) -{ - dav_dir_conf *conf; - const char *label = NULL; - dav_error *err; - - /* if the request target can be overridden, get any target selector */ - if (label_allowed) { - label = apr_table_get(r->headers_in, "label"); - } - - conf = ap_get_module_config(r->per_dir_config, &dav_module); - /* assert: conf->provider != NULL */ - - /* resolve the resource */ - err = (*conf->provider->repos->get_resource)(r, conf->dir, - label, use_checked_in, - res_p); - if (err != NULL) { - err = dav_push_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not fetch resource information.", err); - return err; - } - - /* Note: this shouldn't happen, but just be sure... */ - if (*res_p == NULL) { - /* ### maybe use HTTP_INTERNAL_SERVER_ERROR */ - return dav_new_error(r->pool, HTTP_NOT_FOUND, 0, - apr_psprintf(r->pool, - "The provider did not define a " - "resource for %s.", - ap_escape_html(r->pool, r->uri))); - } - - /* ### hmm. this doesn't feel like the right place or thing to do */ - /* if there were any input headers requiring a Vary header in the response, - * add it now */ - dav_add_vary_header(r, r, *res_p); - - return NULL; -} - -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, - apr_off_t *range_start, apr_off_t *range_end) -{ - const char *range_c; - char *range; - char *dash; - char *slash; - - range_c = apr_table_get(r->headers_in, "content-range"); - if (range_c == NULL) - return 0; - - range = apr_pstrdup(r->pool, range_c); - if (strncasecmp(range, "bytes ", 6) != 0 - || (dash = ap_strchr(range, '-')) == NULL - || (slash = ap_strchr(range, '/')) == NULL) { - /* malformed header. ignore it (per S14.16 of RFC2616) */ - return 0; - } - - *dash = *slash = '\0'; - - /* ### atol may not be large enough for the apr_off_t */ - *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; - dav_error *err; - - /* 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. - */ - err = dav_get_resource(r, 1 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - 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_VERSION && - resource->type != DAV_RESOURCE_TYPE_WORKING) - { - 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, NULL); - 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; - apr_off_t range_start; - apr_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; - apr_table_setn(r->headers_out, - "Content-Range", - apr_psprintf(r->pool, - "bytes %" APR_OFF_T_FMT - "-%" APR_OFF_T_FMT "/*", - range_start, range_end)); - ap_set_content_length(r, range_end - range_start + 1); - } - - if (r->header_only) { - 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, - apr_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); - } - - buffer = apr_palloc(r->pool, DAV_READ_BLOCKSIZE); - while (1) { - apr_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 = (apr_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; - } - } - - 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; - - /* Ask repository module to resolve the resource */ - err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - - /* 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_auto_version_info av_info; - const dav_hooks_locks *locks_hooks = DAV_GET_HOOKS_LOCKS(r); - const char *body; - dav_error *err; - dav_error *err2; - int result; - dav_stream_mode mode; - dav_stream *stream; - dav_response *multi_response; - int has_range; - apr_off_t range_start; - apr_off_t range_end; - - if ((result = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)) != OK) { - return result; - } - - /* Ask repository module to resolve the resource */ - err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - - /* If not a file or collection resource, PUT not allowed */ - if (resource->type != DAV_RESOURCE_TYPE_REGULAR - && resource->type != DAV_RESOURCE_TYPE_WORKING) { - body = apr_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_auto_checkout(r, resource, - 0 /* not parent_only */, - &av_info)) != 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, - apr_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 = apr_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_auto_checkin(r, resource, err != NULL /* undo if error */, - 0 /*unlock*/, &av_info); - - /* 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 automatically checking in " - "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_state == DAV_RESOURCE_EXISTS); -} - -/* ### move this to dav_util? */ -DAV_DECLARE(void) dav_add_response(dav_walk_resource *wres, - int status, dav_get_props_result *propstats) -{ - dav_response *resp; - - /* just drop some data into an dav_response */ - resp = apr_pcalloc(wres->pool, sizeof(*resp)); - resp->href = apr_pstrdup(wres->pool, wres->resource->uri); - resp->status = status; - if (propstats) { - resp->propresult = *propstats; - } - - resp->next = wres->response; - wres->response = resp; -} - -/* handle the DELETE method */ -static int dav_method_delete(request_rec *r) -{ - dav_resource *resource; - dav_auto_version_info av_info; - dav_error *err; - dav_error *err2; - dav_response *multi_response; - int result; - int depth; - - /* 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 */ - err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - 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, 0, 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, 0, r, - "Depth of \"1\" is not allowed for DELETE."); - return HTTP_BAD_REQUEST; - } - - /* - ** 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, - apr_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_auto_checkout(r, resource, 1 /* parent_only */, - &av_info)) != 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_auto_checkin(r, NULL, err != NULL /* undo if error */, - 0 /*unlock*/, &av_info); - - /* check for errors now */ - if (err != NULL) { - err = dav_push_error(r->pool, err->status, 0, - apr_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 automatically checking in " - "the 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; -} - -/* generate DAV:supported-method-set OPTIONS response */ -static dav_error *dav_gen_supported_methods(request_rec *r, - const ap_xml_elem *elem, - const apr_table_t *methods, - ap_text_header *body) -{ - apr_array_header_t *arr; - apr_table_entry_t *elts; - ap_xml_elem *child; - ap_xml_attr *attr; - char *s; - int i; - - ap_text_append(r->pool, body, "" DEBUG_CR); - - if (elem->first_child == NULL) { - /* show all supported methods */ - arr = apr_table_elts(methods); - elts = (apr_table_entry_t *) arr->elts; - - for (i = 0; i < arr->nelts; ++i) { - if (elts[i].key == NULL) - continue; - s = apr_psprintf(r->pool, - "" DEBUG_CR, - elts[i].key); - ap_text_append(r->pool, body, s); - } - } - else { - /* check for support of specific methods */ - for (child = elem->first_child; child != NULL; child = child->next) { - if (child->ns == AP_XML_NS_DAV_ID - && strcmp(child->name, "supported-method") == 0) { - const char *name = NULL; - - /* go through attributes to find method name */ - for (attr = child->attr; attr != NULL; attr = attr->next) { - if (attr->ns == AP_XML_NS_DAV_ID - && strcmp(attr->name, "name") == 0) - name = attr->value; - } - - if (name == NULL) { - return dav_new_error(r->pool, HTTP_BAD_REQUEST, 0, - "A DAV:supported-method element " - "does not have a \"name\" attribute"); - } - - /* see if method is supported */ - if (apr_table_get(methods, name) != NULL) { - s = apr_psprintf(r->pool, - "" DEBUG_CR, - name); - ap_text_append(r->pool, body, s); - } - } - } - } - - ap_text_append(r->pool, body, "" DEBUG_CR); - return NULL; -} - -/* generate DAV:supported-live-property-set OPTIONS response */ -static dav_error *dav_gen_supported_live_props(request_rec *r, - const dav_resource *resource, - const ap_xml_elem *elem, - ap_text_header *body) -{ - dav_lockdb *lockdb; - dav_propdb *propdb; - ap_xml_elem *child; - ap_xml_attr *attr; - dav_error *err; - - /* open lock database, to report on supported lock properties */ - /* ### should open read-only */ - if ((err = dav_open_lockdb(r, 0, &lockdb)) != NULL) { - return dav_push_error(r->pool, err->status, 0, - "The lock database could not be opened, " - "preventing the reporting of supported lock " - "properties.", - err); - } - - /* open the property database (readonly) for the resource */ - if ((err = dav_open_propdb(r, lockdb, resource, 1, NULL, - &propdb)) != NULL) { - if (lockdb != NULL) - (*lockdb->hooks->close_lockdb)(lockdb); - - return dav_push_error(r->pool, err->status, 0, - "The property database could not be opened, " - "preventing report of supported properties.", - err); - } - - ap_text_append(r->pool, body, "" DEBUG_CR); - - if (elem->first_child == NULL) { - /* show all supported live properties */ - dav_get_props_result props = dav_get_allprops(propdb, DAV_PROP_INSERT_SUPPORTED); - body->last->next = props.propstats; - while (body->last->next != NULL) - body->last = body->last->next; - } - else { - /* check for support of specific live property */ - for (child = elem->first_child; child != NULL; child = child->next) { - if (child->ns == AP_XML_NS_DAV_ID - && strcmp(child->name, "supported-live-property") == 0) { - const char *name = NULL; - const char *nmspace = NULL; - - /* go through attributes to find name and namespace */ - for (attr = child->attr; attr != NULL; attr = attr->next) { - if (attr->ns == AP_XML_NS_DAV_ID) { - if (strcmp(attr->name, "name") == 0) - name = attr->value; - else if (strcmp(attr->name, "namespace") == 0) - nmspace = attr->value; - } - } - - if (name == NULL) { - err = dav_new_error(r->pool, HTTP_BAD_REQUEST, 0, - "A DAV:supported-live-property " - "element does not have a \"name\" " - "attribute"); - break; - } - - /* default namespace to DAV: */ - if (nmspace == NULL) - nmspace = "DAV:"; - - /* check for support of property */ - dav_get_liveprop_supported(propdb, nmspace, name, body); - } - } - } - - ap_text_append(r->pool, body, "" DEBUG_CR); - - dav_close_propdb(propdb); - - if (lockdb != NULL) - (*lockdb->hooks->close_lockdb)(lockdb); - - return err; -} - -/* generate DAV:supported-report-set OPTIONS response */ -static dav_error *dav_gen_supported_reports(request_rec *r, - const dav_resource *resource, - const ap_xml_elem *elem, - const dav_hooks_vsn *vsn_hooks, - ap_text_header *body) -{ - ap_xml_elem *child; - ap_xml_attr *attr; - dav_error *err; - char *s; - - ap_text_append(r->pool, body, "" DEBUG_CR); - - if (vsn_hooks != NULL) { - const dav_report_elem *reports; - const dav_report_elem *rp; - - if ((err = (*vsn_hooks->avail_reports)(resource, &reports)) != NULL) { - return dav_push_error(r->pool, err->status, 0, - "DAV:supported-report-set could not be " - "determined due to a problem fetching the " - "available reports for this resource.", - err); - } - - if (reports != NULL) { - if (elem->first_child == NULL) { - /* show all supported reports */ - for (rp = reports; rp->nmspace != NULL; ++rp) { - /* Note: we presume reports->namespace is properly XML/URL quoted */ - s = apr_psprintf(r->pool, - "" DEBUG_CR, - rp->name, rp->nmspace); - ap_text_append(r->pool, body, s); - } - } - else { - /* check for support of specific report */ - for (child = elem->first_child; child != NULL; child = child->next) { - if (child->ns == AP_XML_NS_DAV_ID - && strcmp(child->name, "supported-report") == 0) { - const char *name = NULL; - const char *nmspace = NULL; - - /* go through attributes to find name and namespace */ - for (attr = child->attr; attr != NULL; attr = attr->next) { - if (attr->ns == AP_XML_NS_DAV_ID) { - if (strcmp(attr->name, "name") == 0) - name = attr->value; - else if (strcmp(attr->name, "namespace") == 0) - nmspace = attr->value; - } - } - - if (name == NULL) { - return dav_new_error(r->pool, HTTP_BAD_REQUEST, 0, - "A DAV:supported-report element " - "does not have a \"name\" attribute"); - } - - /* default namespace to DAV: */ - if (nmspace == NULL) - nmspace = "DAV:"; - - for (rp = reports; rp->nmspace != NULL; ++rp) { - if (strcmp(name, rp->name) == 0 - && strcmp(nmspace, rp->nmspace) == 0) { - /* Note: we presume reports->nmspace is properly XML/URL quoted */ - s = apr_psprintf(r->pool, - "" DEBUG_CR, - rp->name, rp->nmspace); - ap_text_append(r->pool, body, s); - break; - } - } - } - } - } - } - } - - ap_text_append(r->pool, body, "" DEBUG_CR); - return NULL; -} - -/* 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); - const dav_hooks_binding *binding_hooks = DAV_GET_HOOKS_BINDING(r); - dav_resource *resource; - const char *dav_level; - char *allow; - char *s; - apr_array_header_t *arr; - apr_table_entry_t *elts; - apr_table_t *methods = apr_table_make(r->pool, 12); - ap_text_header vsn_options = { 0 }; - ap_text_header body = { 0 }; - ap_text *t; - int text_size; - int result; - int i; - apr_array_header_t *uri_ary; - ap_xml_doc *doc; - const ap_xml_elem *elem; - dav_error *err; - - /* resolve the resource */ - err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - - /* parse any request body */ - if ((result = ap_xml_parse_input(r, &doc)) != OK) { - return result; - } - /* note: doc == NULL if no request body */ - - if (doc && !dav_validate_root(doc, "options")) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The \"options\" element was not found."); - return HTTP_BAD_REQUEST; - } - - /* determine which providers are available */ - dav_level = "1"; - - if (locks_hooks != NULL) { - dav_level = "1,2"; - } - - if (binding_hooks != NULL) - dav_level = apr_pstrcat(r->pool, dav_level, ",bindings", NULL); - - /* ### - ** MSFT Web Folders chokes if length of DAV header value > 63 characters! - ** To workaround that, we use separate DAV headers for versioning and - ** live prop provider namespace URIs. - ** ### - */ - apr_table_setn(r->headers_out, "DAV", dav_level); - - /* - ** If there is a versioning provider, generate DAV headers - ** for versioning options. - */ - if (vsn_hooks != NULL) { - (*vsn_hooks->get_vsn_options)(r->pool, &vsn_options); - - for (t = vsn_options.first; t != NULL; t = t->next) - apr_table_addn(r->headers_out, "DAV", t->text); - } - - /* - ** Gather property set URIs from all the liveprop providers, - ** and generate a separate DAV header for each URI, to avoid - ** problems with long header lengths. - */ - uri_ary = apr_array_make(r->pool, 5, sizeof(const char *)); - dav_run_gather_propsets(uri_ary); - for (i = 0; i < uri_ary->nelts; ++i) { - if (((char **)uri_ary->elts)[i] != NULL) - apr_table_addn(r->headers_out, "DAV", ((char **)uri_ary->elts)[i]); - } - - /* this tells MSFT products to skip looking for FrontPage extensions */ - apr_table_setn(r->headers_out, "MS-Author-Via", "DAV"); - - /* - ** Determine which methods are allowed on the resource. - ** Three cases: resource is null (3), is lock-null (7.4), or exists. - ** - ** All cases support OPTIONS, and if there is a lock provider, LOCK. - ** (Lock-) null resources also support MKCOL and PUT. - ** Lock-null supports PROPFIND and UNLOCK. - ** Existing resources support lots of stuff. - */ - - apr_table_addn(methods, "OPTIONS", ""); - - /* ### take into account resource type */ - switch (dav_get_resource_state(r, resource)) - { - case DAV_RESOURCE_EXISTS: - /* resource exists */ - apr_table_addn(methods, "GET", ""); - apr_table_addn(methods, "HEAD", ""); - apr_table_addn(methods, "POST", ""); - apr_table_addn(methods, "DELETE", ""); - apr_table_addn(methods, "TRACE", ""); - apr_table_addn(methods, "PROPFIND", ""); - apr_table_addn(methods, "PROPPATCH", ""); - apr_table_addn(methods, "COPY", ""); - apr_table_addn(methods, "MOVE", ""); - - if (!resource->collection) - apr_table_addn(methods, "PUT", ""); - - if (locks_hooks != NULL) { - apr_table_addn(methods, "LOCK", ""); - apr_table_addn(methods, "UNLOCK", ""); - } - - break; - - case DAV_RESOURCE_LOCK_NULL: - /* resource is lock-null. */ - apr_table_addn(methods, "MKCOL", ""); - apr_table_addn(methods, "PROPFIND", ""); - apr_table_addn(methods, "PUT", ""); - - if (locks_hooks != NULL) { - apr_table_addn(methods, "LOCK", ""); - apr_table_addn(methods, "UNLOCK", ""); - } - - break; - - case DAV_RESOURCE_NULL: - /* resource is null. */ - apr_table_addn(methods, "MKCOL", ""); - apr_table_addn(methods, "PUT", ""); - - if (locks_hooks != NULL) - apr_table_addn(methods, "LOCK", ""); - - break; - - default: - /* ### internal error! */ - break; - } - - /* If there is a versioning provider, add versioning methods */ - if (vsn_hooks != NULL) { - if (!resource->exists) { - if ((*vsn_hooks->versionable)(resource)) - apr_table_addn(methods, "VERSION-CONTROL", ""); - - if (vsn_hooks->can_be_workspace != NULL - && (*vsn_hooks->can_be_workspace)(resource)) - apr_table_addn(methods, "MKWORKSPACE", ""); - - if (vsn_hooks->can_be_activity != NULL - && (*vsn_hooks->can_be_activity)(resource)) - apr_table_addn(methods, "MKACTIVITY", ""); - } - else if (!resource->versioned) { - if ((*vsn_hooks->versionable)(resource)) - apr_table_addn(methods, "VERSION-CONTROL", ""); - } - else if (resource->working) { - apr_table_addn(methods, "CHECKIN", ""); - - /* ### we might not support this DeltaV option */ - apr_table_addn(methods, "UNCHECKOUT", ""); - } - else if (vsn_hooks->add_label != NULL) { - apr_table_addn(methods, "CHECKOUT", ""); - apr_table_addn(methods, "LABEL", ""); - } - else { - apr_table_addn(methods, "CHECKOUT", ""); - } - } - - /* If there is a bindings provider, see if resource is bindable */ - if (binding_hooks != NULL - && (*binding_hooks->is_bindable)(resource)) { - apr_table_addn(methods, "BIND", ""); - } - - /* Generate the Allow header */ - arr = apr_table_elts(methods); - elts = (apr_table_entry_t *) arr->elts; - text_size = 0; - - /* first, compute total length */ - for (i = 0; i < arr->nelts; ++i) { - if (elts[i].key == NULL) - continue; - - /* add 1 for comma or null */ - text_size += strlen(elts[i].key) + 1; - } - - s = allow = apr_palloc(r->pool, text_size); - - for (i = 0; i < arr->nelts; ++i) { - if (elts[i].key == NULL) - continue; - - if (s != allow) - *s++ = ','; - - strcpy(s, elts[i].key); - s += strlen(s); - } - - apr_table_setn(r->headers_out, "Allow", allow); - - /* if there was no request body, then there is no response body */ - if (doc == NULL) { - ap_set_content_length(r, 0); - - /* ### this sends a Content-Type. the default OPTIONS does not. */ - - /* ### 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. */ - return DONE; - } - - /* handle each options request */ - for (elem = doc->root->first_child; elem != NULL; elem = elem->next) { - /* check for something we recognize first */ - int core_option = 0; - dav_error *err = NULL; - - if (elem->ns == AP_XML_NS_DAV_ID) { - if (strcmp(elem->name, "supported-method-set") == 0) { - err = dav_gen_supported_methods(r, elem, methods, &body); - core_option = 1; - } - else if (strcmp(elem->name, "supported-live-property-set") == 0) { - err = dav_gen_supported_live_props(r, resource, elem, &body); - core_option = 1; - } - else if (strcmp(elem->name, "supported-report-set") == 0) { - err = dav_gen_supported_reports(r, resource, elem, vsn_hooks, &body); - core_option = 1; - } - } - - if (err != NULL) - return dav_handle_err(r, err, NULL); - - /* if unrecognized option, pass to versioning provider */ - if (!core_option) { - if ((err = (*vsn_hooks->get_option)(resource, elem, &body)) - != NULL) { - return dav_handle_err(r, err, NULL); - } - } - } - - /* send the options response */ - r->status = HTTP_OK; - r->content_type = DAV_XML_CONTENT_TYPE; - - /* send the headers and response body */ - ap_rputs(DAV_XML_HEADER DEBUG_CR - "" DEBUG_CR, r); - - for (t = body.first; t != NULL; t = t->next) - ap_rputs(t->text, r); - - ap_rputs("" DEBUG_CR, r); - - /* we've sent everything necessary to the client. */ - return DONE; -} - -static void dav_cache_badprops(dav_walker_ctx *ctx) -{ - const ap_xml_elem *elem; - ap_text_header hdr = { 0 }; - - /* just return if we built the thing already */ - if (ctx->propstat_404 != NULL) { - return; - } - - ap_text_append(ctx->w.pool, &hdr, - "" DEBUG_CR - "" DEBUG_CR); - - elem = dav_find_child(ctx->doc->root, "prop"); - for (elem = elem->first_child; elem; elem = elem->next) { - ap_text_append(ctx->w.pool, &hdr, - ap_xml_empty_elem(ctx->w.pool, elem)); - } - - ap_text_append(ctx->w.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_walk_resource *wres, int calltype) -{ - dav_walker_ctx *ctx = wres->walk_ctx; - 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->w.lockdb, wres->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(wres, 0, &badprops); - } - else { - /* no props on this collection/resource */ - dav_add_response(wres, 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 { - dav_prop_insert what = ctx->propfind_type == DAV_PROPFIND_IS_ALLPROP - ? DAV_PROP_INSERT_VALUE - : DAV_PROP_INSERT_NAME; - propstats = dav_get_allprops(propdb, what); - } - dav_close_propdb(propdb); - - dav_add_response(wres, 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; - ap_xml_doc *doc; - const ap_xml_elem *child; - dav_walker_ctx ctx = { { 0 } }; - dav_response *multi_status; - - /* Ask repository module to resolve the resource */ - err = dav_get_resource(r, 1 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - - 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 && resource->collection) { - 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, - apr_psprintf(r->pool, - "PROPFIND requests with a " - "Depth of \"infinity\" are " - "not allowed for %s.", - ap_escape_html(r->pool, - r->uri))); - } - } - - if ((result = ap_xml_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, 0, 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, 0, r, - "The \"propfind\" element does not contain one of " - "the required child elements (the specific command)."); - return HTTP_BAD_REQUEST; - } - - ctx.w.walk_type = DAV_WALKTYPE_NORMAL | DAV_WALKTYPE_AUTH; - ctx.w.func = dav_propfind_walker; - ctx.w.walk_ctx = &ctx; - ctx.w.pool = r->pool; - ctx.w.root = resource; - - ctx.doc = doc; - ctx.r = r; - - /* ### should open read-only */ - if ((err = dav_open_lockdb(r, 0, &ctx.w.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.w.lockdb != NULL) { - /* if we have a lock database, then we can walk locknull resources */ - ctx.w.walk_type |= DAV_WALKTYPE_LOCKNULL; - } - - err = (*resource->hooks->walk)(&ctx.w, depth, &multi_status); - - if (ctx.w.lockdb != NULL) { - (*ctx.w.lockdb->hooks->close_lockdb)(ctx.w.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, multi_status, - doc->namespaces); - } - else { - dav_send_multistatus(r, HTTP_MULTI_STATUS, multi_status, NULL); - } - - /* the response has been sent. */ - return DONE; -} - -static ap_text * dav_failed_proppatch(apr_pool_t *p, - apr_array_header_t *prop_ctx) -{ - ap_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 ) { - ap_text_append(p, &hdr, - "" DEBUG_CR - ""); - ap_text_append(p, &hdr, ap_xml_empty_elem(p, ctx->prop)); - ap_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 = apr_psprintf(p, - "" - "HTTP/1.1 %d (status)" - "" DEBUG_CR, - ctx->err->status); - ap_text_append(p, &hdr, s); - - /* ### we should use compute_desc if necessary... */ - if (ctx->err->desc != NULL) { - ap_text_append(p, &hdr, "" DEBUG_CR); - ap_text_append(p, &hdr, ctx->err->desc); - ap_text_append(p, &hdr, "" DEBUG_CR); - } - - ap_text_append(p, &hdr, "" DEBUG_CR); - } - - return hdr.first; -} - -static ap_text * dav_success_proppatch(apr_pool_t *p, apr_array_header_t *prop_ctx) -{ - ap_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. - */ - - ap_text_append(p, &hdr, - "" DEBUG_CR - "" DEBUG_CR); - - for ( ; i-- > 0; ++ctx ) { - ap_text_append(p, &hdr, ap_xml_empty_elem(p, ctx->prop)); - } - - ap_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), - apr_array_header_t *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; - ap_xml_doc *doc; - ap_xml_elem *child; - dav_propdb *propdb; - int failure = 0; - dav_response resp = { 0 }; - ap_text *propstat_text; - apr_array_header_t *ctx_list; - dav_prop_ctx *ctx; - dav_auto_version_info av_info; - - /* Ask repository module to resolve the resource */ - err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - if (!resource->exists) { - /* Apache will supply a default error for this. */ - return HTTP_NOT_FOUND; - } - - if ((result = ap_xml_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, 0, 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); - } - - /* make sure the resource can be modified (if versioning repository) */ - if ((err = dav_auto_checkout(r, resource, - 0 /* not parent_only */, - &av_info)) != 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) { - /* undo any auto-checkout */ - dav_auto_checkin(r, resource, 1 /*undo*/, 0 /*unlock*/, &av_info); - - err = dav_push_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - apr_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 = apr_array_make(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; - ap_xml_elem *prop_group; - ap_xml_elem *one_prop; - - /* Ignore children that are not set/remove */ - if (child->ns != AP_XML_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); - - /* undo any auto-checkout */ - dav_auto_checkin(r, resource, 1 /*undo*/, 0 /*unlock*/, &av_info); - - /* This supplies additional information for the default message. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, 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 *)apr_array_push(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); - - /* complete any auto-versioning */ - dav_auto_checkin(r, resource, failure, 0 /*unlock*/, &av_info); - - /* 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 = apr_table_get(r->headers_in, "Transfer-Encoding"); - const char *lenp = apr_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, 0, r, - "Unknown Transfer-Encoding %s", tenc); - return HTTP_NOT_IMPLEMENTED; - } - - r->read_chunked = 1; - } - else if (lenp) { - const char *pos = lenp; - - while (apr_isdigit(*pos) || apr_isspace(*pos)) { - ++pos; - } - if (*pos != '\0') { - /* This supplies additional information for the default message. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, 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_auto_version_info av_info; - const dav_hooks_locks *locks_hooks = DAV_GET_HOOKS_LOCKS(r); - dav_error *err; - dav_error *err2; - int result; - dav_dir_conf *conf; - 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 */ - err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - - 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_auto_checkout(r, resource, 1 /* parent_only */, - &av_info)) != 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)(resource); - - /* restore modifiability of parent back to what it was */ - err2 = dav_auto_checkin(r, NULL, err != NULL /* undo if error */, - 0 /*unlock*/, &av_info); - - /* 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 automatically checking in " - "the 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, "Collection", 0); -} - -/* handle the COPY and MOVE methods */ -static int dav_method_copymove(request_rec *r, int is_move) -{ - dav_resource *resource; - dav_resource *resnew; - dav_auto_version_info src_av_info = { 0 }; - dav_auto_version_info dst_av_info = { 0 }; - 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 replace_dest; - int resnew_state; - - /* Ask repository module to resolve the resource */ - err = dav_get_resource(r, !is_move /* label_allowed */, - 0 /* use_checked_in */, &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - 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 */ - /* ### allow COPY/MOVE of DeltaV resource types */ - if (resource->type != DAV_RESOURCE_TYPE_REGULAR) { - body = apr_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 = apr_table_get(r->headers_in, "Destination"); - if (dest == NULL) { - /* Look in headers provided by Netscape's Roaming Profiles */ - const char *nscp_host = apr_table_get(r->headers_in, "Host"); - const char *nscp_path = apr_table_get(r->headers_in, "New-uri"); - - if (nscp_host != NULL && nscp_path != NULL) - dest = apr_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, 0, r, - "The request is missing a Destination header."); - return HTTP_BAD_REQUEST; - } - - lookup = dav_lookup_uri(dest, r, 1 /* must_be_absolute */); - 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, 0, 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 */ - err = dav_get_resource(lookup.rnew, 0 /* label_allowed */, - 0 /* use_checked_in */, &resnew); - if (err != NULL) - return dav_handle_err(r, err, NULL); - - /* 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, 0, 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, 0, 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, - apr_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, - apr_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); - } - - /* if this is a move, then the source parent collection will be modified */ - if (is_move) { - if ((err = dav_auto_checkout(r, resource, 1 /* parent_only */, - &src_av_info)) != NULL) { - if (lockdb != NULL) - (*lockdb->hooks->close_lockdb)(lockdb); - - /* ### add a higher-level description? */ - return dav_handle_err(r, err, NULL); - } - } - - /* - * Remember the initial state of the destination, so the lock system - * can be notified as to how it changed. - */ - resnew_state = dav_get_resource_state(lookup.rnew, resnew); - - /* If destination does not exist, initialize resource object - * to be same type as the source. - */ - if (!resnew->exists) { - resnew->type = resource->type; - resnew->collection = resource->collection; - } - - /* In a MOVE operation, the destination is replaced by the source. - * In a COPY operation, if the destination exists, is under version - * control, and is the same resource type as the source, - * then it should not be replaced, but modified to be a copy of - * the source. - */ - if (!resnew->exists) - replace_dest = 0; - else if (is_move || !resource->versioned) - replace_dest = 1; - else if (resource->type != resnew->type) - replace_dest = 1; - else if ((resource->collection == 0) != (resnew->collection == 0)) - replace_dest = 1; - else - replace_dest = 0; - - /* If the destination must be created or replaced, - * make sure the parent collection is writable - */ - if (!resnew->exists || replace_dest) { - if ((err = dav_auto_checkout(r, resnew, 1 /*parent_only*/, - &dst_av_info)) != NULL) { - /* could not make destination writable: - * if move, restore state of source parent - */ - if (is_move) { - (void) dav_auto_checkin(r, NULL, 1 /* undo */, - 0 /*unlock*/, &src_av_info); - } - - 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 resource object, so status updates to one are reflected - * in the other, when doing auto-versioning. Otherwise, - * we may try to checkin the parent twice. - */ - if (src_av_info.parent_resource != NULL - && dst_av_info.parent_resource != NULL - && (*src_av_info.parent_resource->hooks->is_same_resource) - (src_av_info.parent_resource, dst_av_info.parent_resource)) { - - dst_av_info.parent_resource = src_av_info.parent_resource; - } - - /* If destination is being replaced, remove it first - * (we know Ovewrite must be TRUE). Then try to copy/move the resource. - */ - if (replace_dest) - 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); - } - - /* perform any auto-versioning cleanup */ - err2 = dav_auto_checkin(r, NULL, err != NULL /* undo if error */, - 0 /*unlock*/, &dst_av_info); - - if (is_move) { - err3 = dav_auto_checkin(r, NULL, err != NULL /* undo if error */, - 0 /*unlock*/, &src_av_info); - } - 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, - apr_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 auto-versioning */ - 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 automatically checking in 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 automatically checking in the " - "destination or its parent collection.", - err3); - dav_log_err(r, err, APLOG_WARNING); - } - - /* propagate any indirect locks at the target */ - if (lockdb != NULL) { - - /* notify lock system that we have created/replaced a resource */ - err = dav_notify_created(r, lockdb, resnew, resnew_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->uri, "Destination", - resnew_state == DAV_RESOURCE_EXISTS); -} - -/* 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; - ap_xml_doc *doc; - 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 = ap_xml_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, 0, r, - "Depth must be 0 or \"infinity\" for LOCK."); - return HTTP_BAD_REQUEST; - } - - /* Ask repository module to resolve the resource */ - err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - - /* - ** 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 = apr_pstrdup(r->pool, r->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, - apr_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, - apr_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 = apr_pstrcat(r->pool, "<", - (*locks_hooks->format_locktoken)(r->pool, lock->locktoken), - ">", NULL); - - apr_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_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); - - /* 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 = apr_table_get(r->headers_in, "Lock-Token")) == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "Unlock failed (%s): No Lock-Token specified in header", r->filename); - return HTTP_BAD_REQUEST; - } - - locktoken_txt = apr_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, - apr_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 */ - err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - - 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; -} - -static int dav_method_vsn_control(request_rec *r) -{ - dav_resource *resource; - int resource_state; - dav_auto_version_info av_info; - const dav_hooks_locks *locks_hooks = DAV_GET_HOOKS_LOCKS(r); - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); - dav_error *err; - ap_xml_doc *doc; - const char *target = NULL; - int result; - - /* if no versioning provider, decline the request */ - if (vsn_hooks == NULL) - return DECLINED; - - /* ask repository module to resolve the resource */ - err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - - /* remember the pre-creation resource state */ - resource_state = dav_get_resource_state(r, resource); - - /* parse the request body (may be a version-control element) */ - if ((result = ap_xml_parse_input(r, &doc)) != OK) { - return result; - } - /* note: doc == NULL if no request body */ - - if (doc != NULL) { - const ap_xml_elem *child; - apr_size_t tsize; - - if (!dav_validate_root(doc, "version-control")) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The request body does not contain " - "a \"version-control\" element."); - return HTTP_BAD_REQUEST; - } - - /* get the version URI */ - if ((child = dav_find_child(doc->root, "version")) == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The \"version-control\" element does not contain " - "a \"version\" element."); - return HTTP_BAD_REQUEST; - } - - if ((child = dav_find_child(child, "href")) == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The \"version\" element does not contain " - "an \"href\" element."); - return HTTP_BAD_REQUEST; - } - - /* get version URI */ - ap_xml_to_text(r->pool, child, AP_XML_X2T_INNER, NULL, NULL, - &target, &tsize); - if (tsize == 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "An \"href\" element does not contain a URI."); - return HTTP_BAD_REQUEST; - } - } - - /* Check request preconditions */ - - /* ### need a general mechanism for reporting precondition violations - * ### (should be returning XML document for 403/409 responses) - */ - - /* if not versioning existing resource, must specify version to select */ - if (!resource->exists && target == NULL) { - err = dav_new_error(r->pool, HTTP_CONFLICT, 0, - ""); - return dav_handle_err(r, err, NULL); - } - else if (resource->exists) { - /* cannot add resource to existing version history */ - if (target != NULL) { - err = dav_new_error(r->pool, HTTP_CONFLICT, 0, - ""); - return dav_handle_err(r, err, NULL); - } - - /* resource must be unversioned and versionable, or version selector */ - if (resource->type != DAV_RESOURCE_TYPE_REGULAR - || (!resource->versioned && !(vsn_hooks->versionable)(resource))) { - err = dav_new_error(r->pool, HTTP_CONFLICT, 0, - ""); - return dav_handle_err(r, err, NULL); - } - - /* the DeltaV spec says if resource is a version selector, - * then VERSION-CONTROL is a no-op - */ - if (resource->versioned) { - /* set the Cache-Control header, per the spec */ - apr_table_setn(r->headers_out, "Cache-Control", "no-cache"); - - /* no body */ - ap_set_content_length(r, 0); - - return DONE; - } - } - - /* 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, - resource_state == DAV_RESOURCE_NULL ? - DAV_VALIDATE_PARENT : - DAV_VALIDATE_RESOURCE, NULL)) != NULL) { - return dav_handle_err(r, err, NULL); - } - - /* if in versioned collection, make sure parent is checked out */ - if ((err = dav_auto_checkout(r, resource, 1 /* parent_only */, - &av_info)) != NULL) { - return dav_handle_err(r, err, NULL); - } - - /* attempt to version-control the resource */ - if ((err = (*vsn_hooks->vsn_control)(resource, target)) != NULL) { - dav_auto_checkin(r, resource, 1 /*undo*/, 0 /*unlock*/, &av_info); - err = dav_push_error(r->pool, HTTP_CONFLICT, 0, - apr_psprintf(r->pool, - "Could not VERSION-CONTROL resource %s.", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, NULL); - } - - /* revert writability of parent directory */ - err = dav_auto_checkin(r, resource, 0 /*undo*/, 0 /*unlock*/, &av_info); - if (err != NULL) { - /* just log a warning */ - err = dav_push_error(r->pool, err->status, 0, - "The VERSION-CONTROL was successful, but there " - "was a problem automatically checking in " - "the parent collection.", - err); - dav_log_err(r, err, APLOG_WARNING); - } - - /* if the resource is lockable, let lock system know of new resource */ - if (locks_hooks != NULL - && (*locks_hooks->get_supportedlock)(resource) != NULL) { - dav_lockdb *lockdb; - - if ((err = (*locks_hooks->open_lockdb)(r, 0, 0, &lockdb)) != NULL) { - /* The resource creation was successful, but the locking failed. */ - err = dav_push_error(r->pool, err->status, 0, - "The VERSION-CONTROL 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 VERSION-CONTROL was successful, but there " - "was a problem updating its lock " - "information.", - err); - return dav_handle_err(r, err, NULL); - } - } - - /* set the Cache-Control header, per the spec */ - apr_table_setn(r->headers_out, "Cache-Control", "no-cache"); - - /* return an appropriate response (HTTP_CREATED) */ - return dav_created(r, resource->uri, "Version selector", 0 /*replaced*/); -} - -/* handle the CHECKOUT method */ -static int dav_method_checkout(request_rec *r) -{ - dav_resource *resource; - dav_resource *working_resource; - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); - dav_error *err; - int result; - ap_xml_doc *doc; - int apply_to_vsn = 0; - int is_unreserved = 0; - int is_fork_ok = 0; - int create_activity = 0; - apr_array_header_t *activities = NULL; - - /* If no versioning provider, decline the request */ - if (vsn_hooks == NULL) - return DECLINED; - - if ((result = ap_xml_parse_input(r, &doc)) != OK) - return result; - - if (doc != NULL) { - const ap_xml_elem *aset; - - if (!dav_validate_root(doc, "checkout")) { - /* This supplies additional information for the default msg. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The request body, if present, must be a " - "DAV:checkout element."); - return HTTP_BAD_REQUEST; - } - - if (dav_find_child(doc->root, "apply-to-version") != NULL) { - if (apr_table_get(r->headers_in, "label") != NULL) { - /* ### we want generic 403/409 XML reporting here */ - /* ### DAV:must-not-have-label-and-apply-to-version */ - return dav_error_response(r, HTTP_CONFLICT, - "DAV:apply-to-version cannot be " - "used in conjunction with a " - "Label header."); - } - apply_to_vsn = 1; - } - - is_unreserved = dav_find_child(doc->root, "unreserved") != NULL; - is_fork_ok = dav_find_child(doc->root, "fork-ok") != NULL; - - if ((aset = dav_find_child(doc->root, "activity-set")) != NULL) { - if (dav_find_child(aset, "new") != NULL) { - create_activity = 1; - } - else { - const ap_xml_elem *child = aset->first_child; - - activities = apr_array_make(r->pool, 1, sizeof(const char *)); - - for (; child != NULL; child = child->next) { - if (child->ns == AP_XML_NS_DAV_ID - && strcmp(child->name, "href") == 0) { - const char *href; - - href = dav_xml_get_cdata(child, r->pool, - 1 /* strip_white */); - *(const char **)apr_array_push(activities) = href; - } - } - - if (activities->nelts == 0) { - /* no href's is a DTD violation: - - */ - - /* This supplies additional info for the default msg. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "Within the DAV:activity-set element, the " - "DAV:new element must be used, or at least " - "one DAV:href must be specified."); - return HTTP_BAD_REQUEST; - } - } - } - } - - /* Ask repository module to resolve the resource */ - err = dav_get_resource(r, 1 /*label_allowed*/, apply_to_vsn, &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - 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 - && resource->type != DAV_RESOURCE_TYPE_VERSION) { - 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, 0 /*auto_checkout*/, - is_unreserved, is_fork_ok, - create_activity, activities, - &working_resource)) != NULL) { - err = dav_push_error(r->pool, HTTP_CONFLICT, 0, - apr_psprintf(r->pool, - "Could not CHECKOUT resource %s.", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, NULL); - } - - /* set the Cache-Control header, per the spec */ - apr_table_setn(r->headers_out, "Cache-Control", "no-cache"); - - /* if no working resource created, return OK, - * else return CREATED with working resource URL in Location header - */ - if (working_resource == NULL) { - /* no body */ - ap_set_content_length(r, 0); - return DONE; - } - - return dav_created(r, working_resource->uri, "Checked-out resource", 0); -} - -/* 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 */ - err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - 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, - apr_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); - - return DONE; -} - -/* handle the CHECKIN method */ -static int dav_method_checkin(request_rec *r) -{ - dav_resource *resource; - dav_resource *new_version; - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); - dav_error *err; - int result; - ap_xml_doc *doc; - int keep_checked_out = 0; - - /* If no versioning provider, decline the request */ - if (vsn_hooks == NULL) - return DECLINED; - - if ((result = ap_xml_parse_input(r, &doc)) != OK) - return result; - - if (doc != NULL) { - if (!dav_validate_root(doc, "checkin")) { - /* This supplies additional information for the default msg. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The request body, if present, must be a " - "DAV:checkin element."); - return HTTP_BAD_REQUEST; - } - - keep_checked_out = dav_find_child(doc->root, "keep-checked-out") != NULL; - } - - /* Ask repository module to resolve the resource */ - err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - 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."); - } - - /* ### do lock checks, once behavior is defined */ - - /* Do the checkin */ - if ((err = (*vsn_hooks->checkin)(resource, keep_checked_out, &new_version)) - != NULL) { - err = dav_push_error(r->pool, HTTP_CONFLICT, 0, - apr_psprintf(r->pool, - "Could not CHECKIN resource %s.", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, NULL); - } - - return dav_created(r, new_version->uri, "Version", 0); -} - -static int dav_method_update(request_rec *r) -{ - dav_resource *resource; - dav_resource *version = NULL; - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); - ap_xml_doc *doc; - ap_xml_elem *child; - int is_label = 0; - int depth; - int result; - apr_size_t tsize; - const char *target; - dav_response *multi_response; - dav_error *err; - dav_lookup_result lookup; - - /* If no versioning provider, or UPDATE not supported, - * decline the request */ - if (vsn_hooks == NULL || vsn_hooks->update == NULL) - return DECLINED; - - if ((depth = dav_get_depth(r, 0)) < 0) { - /* dav_get_depth() supplies additional information for the - * default message. */ - return HTTP_BAD_REQUEST; - } - - /* parse the request body */ - if ((result = ap_xml_parse_input(r, &doc)) != OK) { - return result; - } - - if (doc == NULL || !dav_validate_root(doc, "update")) { - /* This supplies additional information for the default message. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The request body does not contain " - "an \"update\" element."); - return HTTP_BAD_REQUEST; - } - - /* check for label-name or version element, but not both */ - if ((child = dav_find_child(doc->root, "label-name")) != NULL) - is_label = 1; - else if ((child = dav_find_child(doc->root, "version")) != NULL) { - /* get the href element */ - if ((child = dav_find_child(child, "href")) == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The version element does not contain " - "an \"href\" element."); - return HTTP_BAD_REQUEST; - } - } - else { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The \"update\" element does not contain " - "a \"label-name\" or \"version\" element."); - return HTTP_BAD_REQUEST; - } - - /* a depth greater than zero is only allowed for a label */ - if (!is_label && depth != 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "Depth must be zero for UPDATE with a version"); - return HTTP_BAD_REQUEST; - } - - /* get the target value (a label or a version URI) */ - ap_xml_to_text(r->pool, child, AP_XML_X2T_INNER, NULL, NULL, - &target, &tsize); - if (tsize == 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "A \"label-name\" or \"href\" element does not contain " - "any content."); - return HTTP_BAD_REQUEST; - } - - /* Ask repository module to resolve the resource */ - err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - - if (!resource->exists) { - /* Apache will supply a default error for this. */ - return HTTP_NOT_FOUND; - } - - /* ### need a general mechanism for reporting precondition violations - * ### (should be returning XML document for 403/409 responses) - */ - if (resource->type != DAV_RESOURCE_TYPE_REGULAR - || !resource->versioned || resource->working) { - return dav_error_response(r, HTTP_CONFLICT, - ""); - } - - /* if target is a version, resolve the version resource */ - /* ### dav_lookup_uri only allows absolute URIs; is that OK? */ - if (!is_label) { - lookup = dav_lookup_uri(target, r, 0 /* must_be_absolute */); - 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, 0, 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, - "Version URI had an error."); - } - - /* resolve version resource */ - err = dav_get_resource(lookup.rnew, 0 /* label_allowed */, - 0 /* use_checked_in */, &version); - if (err != NULL) - return dav_handle_err(r, err, NULL); - - /* NULL out target, since we're using a version resource */ - target = NULL; - } - - /* do the UPDATE operation */ - err = (*vsn_hooks->update)(resource, version, target, depth, &multi_response); - - if (err != NULL) { - err = dav_push_error(r->pool, err->status, 0, - ap_psprintf(r->pool, - "Could not UPDATE %s.", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, multi_response); - } - - /* set the Cache-Control header, per the spec */ - apr_table_setn(r->headers_out, "Cache-Control", "no-cache"); - - /* no body */ - ap_set_content_length(r, 0); - - return DONE; -} - -/* context maintained during LABEL treewalk */ -typedef struct dav_label_walker_ctx -{ - /* input: */ - dav_walk_params w; - - /* label being manipulated */ - const char *label; - - /* label operation */ - int label_op; -#define DAV_LABEL_ADD 1 -#define DAV_LABEL_SET 2 -#define DAV_LABEL_REMOVE 3 - - /* version provider hooks */ - const dav_hooks_vsn *vsn_hooks; - -} dav_label_walker_ctx; - -static dav_error * dav_label_walker(dav_walk_resource *wres, int calltype) -{ - dav_label_walker_ctx *ctx = wres->walk_ctx; - dav_error *err = NULL; - - /* Check the state of the resource: must be a version or - * non-checkedout version selector - */ - /* ### need a general mechanism for reporting precondition violations - * ### (should be returning XML document for 403/409 responses) - */ - if (wres->resource->type != DAV_RESOURCE_TYPE_VERSION && - (wres->resource->type != DAV_RESOURCE_TYPE_REGULAR - || !wres->resource->versioned)) { - err = dav_new_error(ctx->w.pool, HTTP_CONFLICT, 0, - ""); - } - else if (wres->resource->working) { - err = dav_new_error(ctx->w.pool, HTTP_CONFLICT, 0, - ""); - } - else { - /* do the label operation */ - if (ctx->label_op == DAV_LABEL_REMOVE) - err = (*ctx->vsn_hooks->remove_label)(wres->resource, ctx->label); - else - err = (*ctx->vsn_hooks->add_label)(wres->resource, ctx->label, - ctx->label_op == DAV_LABEL_SET); - } - - if (err != NULL) { - /* ### need utility routine to add response with description? */ - dav_add_response(wres, err->status, NULL); - wres->response->desc = err->desc; - } - - return NULL; -} - -static int dav_method_label(request_rec *r) -{ - dav_resource *resource; - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); - ap_xml_doc *doc; - ap_xml_elem *child; - int depth; - int result; - apr_size_t tsize; - dav_error *err; - dav_label_walker_ctx ctx = { { 0 } }; - dav_response *multi_status; - - /* If no versioning provider, or the provider doesn't support - * labels, decline the request */ - if (vsn_hooks == NULL || vsn_hooks->add_label == NULL) - return DECLINED; - - /* Ask repository module to resolve the resource */ - err = dav_get_resource(r, 1 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - if (!resource->exists) { - /* Apache will supply a default error for this. */ - return HTTP_NOT_FOUND; - } - - if ((depth = dav_get_depth(r, 0)) < 0) { - /* dav_get_depth() supplies additional information for the - * default message. */ - return HTTP_BAD_REQUEST; - } - - /* parse the request body */ - if ((result = ap_xml_parse_input(r, &doc)) != OK) { - return result; - } - - if (doc == NULL || !dav_validate_root(doc, "label")) { - /* This supplies additional information for the default message. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The request body does not contain " - "a \"label\" element."); - return HTTP_BAD_REQUEST; - } - - /* check for add, set, or remove element */ - if ((child = dav_find_child(doc->root, "add")) != NULL) { - ctx.label_op = DAV_LABEL_ADD; - } - else if ((child = dav_find_child(doc->root, "set")) != NULL) { - ctx.label_op = DAV_LABEL_SET; - } - else if ((child = dav_find_child(doc->root, "remove")) != NULL) { - ctx.label_op = DAV_LABEL_REMOVE; - } - else { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The \"label\" element does not contain " - "an \"add\", \"set\", or \"remove\" element."); - return HTTP_BAD_REQUEST; - } - - /* get the label string */ - if ((child = dav_find_child(child, "label-name")) == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The label command element does not contain " - "a \"label-name\" element."); - return HTTP_BAD_REQUEST; - } - - ap_xml_to_text(r->pool, child, AP_XML_X2T_INNER, NULL, NULL, - &ctx.label, &tsize); - if (tsize == 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "A \"label-name\" element does not contain " - "a label name."); - return HTTP_BAD_REQUEST; - } - - /* do the label operation walk */ - ctx.w.walk_type = DAV_WALKTYPE_NORMAL; - ctx.w.func = dav_label_walker; - ctx.w.walk_ctx = &ctx; - ctx.w.pool = r->pool; - ctx.w.root = resource; - ctx.vsn_hooks = vsn_hooks; - - err = (*resource->hooks->walk)(&ctx.w, depth, &multi_status); - - if (err != NULL) { - /* some sort of error occurred which terminated the walk */ - err = dav_push_error(r->pool, err->status, 0, - "The LABEL operation was terminated prematurely.", - err); - return dav_handle_err(r, err, multi_status); - } - - if (multi_status != NULL) { - /* One or more resources had errors. If depth was zero, convert - * response to simple error, else make sure there is an - * overall error to pass to dav_handle_err() - */ - if (depth == 0) { - err = dav_new_error(r->pool, multi_status->status, 0, multi_status->desc); - multi_status = NULL; - } - else { - err = dav_new_error(r->pool, HTTP_MULTI_STATUS, 0, - "Errors occurred during the LABEL operation."); - } - - return dav_handle_err(r, err, multi_status); - } - - /* set the Cache-Control header, per the spec */ - apr_table_setn(r->headers_out, "Cache-Control", "no-cache"); - - /* no body */ - ap_set_content_length(r, 0); - - return DONE; -} - -static int dav_method_report(request_rec *r) -{ - dav_resource *resource; - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); - int result; - int label_allowed; - ap_xml_doc *doc; - ap_text_header hdr = { 0 }; - ap_text *t; - dav_error *err; - - /* If no versioning provider, decline the request */ - if (vsn_hooks == NULL) - return DECLINED; - - if ((result = ap_xml_parse_input(r, &doc)) != OK) - return result; - if (doc == NULL) { - /* This supplies additional information for the default msg. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The request body must specify a report."); - return HTTP_BAD_REQUEST; - } - - /* Ask repository module to resolve the resource. - * First determine whether a Target-Selector header is allowed - * for this report. - */ - label_allowed = (*vsn_hooks->report_label_header_allowed)(doc); - err = dav_get_resource(r, label_allowed, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - if (!resource->exists) { - /* Apache will supply a default error for this. */ - return HTTP_NOT_FOUND; - } - - /* run report hook */ - /* ### writing large reports to memory could be bad... - * ### but if provider generated output directly, it would - * ### have to handle error responses as well. - */ - if ((err = (*vsn_hooks->get_report)(r, resource, doc, &hdr)) != NULL) - return dav_handle_err(r, err, NULL); - - /* send the report response */ - r->status = HTTP_OK; - r->content_type = DAV_XML_CONTENT_TYPE; - - /* send the headers and response body */ - ap_rputs(DAV_XML_HEADER DEBUG_CR, r); - - for (t = hdr.first; t != NULL; t = t->next) - ap_rputs(t->text, r); - - return DONE; -} - -static int dav_method_make_workspace(request_rec *r) -{ - dav_resource *resource; - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); - dav_error *err; - ap_xml_doc *doc; - int result; - - /* if no versioning provider, or the provider does not support workspaces, - * decline the request - */ - if (vsn_hooks == NULL || vsn_hooks->make_workspace == NULL) - return DECLINED; - - /* ask repository module to resolve the resource */ - err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - - /* parse the request body (must be a mkworkspace element) */ - if ((result = ap_xml_parse_input(r, &doc)) != OK) { - return result; - } - - if (doc == NULL - || !dav_validate_root(doc, "mkworkspace")) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The request body does not contain " - "a \"mkworkspace\" element."); - return HTTP_BAD_REQUEST; - } - - /* Check request preconditions */ - - /* ### need a general mechanism for reporting precondition violations - * ### (should be returning XML document for 403/409 responses) - */ - - /* resource must not already exist */ - if (resource->exists) { - err = dav_new_error(r->pool, HTTP_CONFLICT, 0, - ""); - return dav_handle_err(r, err, NULL); - } - - /* ### what about locking? */ - - /* attempt to create the workspace */ - if ((err = (*vsn_hooks->make_workspace)(resource, doc)) != NULL) { - err = dav_push_error(r->pool, err->status, 0, - apr_psprintf(r->pool, - "Could not create workspace %s.", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, NULL); - } - - /* set the Cache-Control header, per the spec */ - apr_table_setn(r->headers_out, "Cache-Control", "no-cache"); - - /* return an appropriate response (HTTP_CREATED) */ - return dav_created(r, resource->uri, "Workspace", 0 /*replaced*/); -} - -static int dav_method_make_activity(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, or the provider does not support activities, - * decline the request - */ - if (vsn_hooks == NULL || vsn_hooks->make_activity == NULL) - return DECLINED; - - /* ask repository module to resolve the resource */ - err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - - /* MKACTIVITY does not have a defined request body. */ - if ((result = ap_discard_request_body(r)) != OK) { - return result; - } - - /* Check request preconditions */ - - /* ### need a general mechanism for reporting precondition violations - * ### (should be returning XML document for 403/409 responses) - */ - - /* resource must not already exist */ - if (resource->exists) { - err = dav_new_error(r->pool, HTTP_CONFLICT, 0, - ""); - return dav_handle_err(r, err, NULL); - } - - /* ### what about locking? */ - - /* attempt to create the activity */ - if ((err = (*vsn_hooks->make_activity)(resource)) != NULL) { - err = dav_push_error(r->pool, err->status, 0, - apr_psprintf(r->pool, - "Could not create activity %s.", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, NULL); - } - - /* set the Cache-Control header, per the spec */ - apr_table_setn(r->headers_out, "Cache-Control", "no-cache"); - - /* return an appropriate response (HTTP_CREATED) */ - return dav_created(r, resource->uri, "Activity", 0 /*replaced*/); -} - -static int dav_method_baseline_control(request_rec *r) -{ - /* ### */ - return HTTP_METHOD_NOT_ALLOWED; -} - -static int dav_method_merge(request_rec *r) -{ - dav_resource *resource; - dav_resource *source_resource; - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); - dav_error *err; - int result; - ap_xml_doc *doc; - ap_xml_elem *source_elem; - ap_xml_elem *href_elem; - ap_xml_elem *prop_elem; - const char *source; - int no_auto_merge; - int no_checkout; - dav_lookup_result lookup; - - /* If no versioning provider, decline the request */ - if (vsn_hooks == NULL) - return DECLINED; - - if ((result = ap_xml_parse_input(r, &doc)) != OK) - return result; - - if (doc == NULL || !dav_validate_root(doc, "merge")) { - /* This supplies additional information for the default msg. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The request body must be present and must be a " - "DAV:merge element."); - return HTTP_BAD_REQUEST; - } - - if ((source_elem = dav_find_child(doc->root, "source")) == NULL) { - /* This supplies additional information for the default msg. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The DAV:merge element must contain a DAV:source " - "element."); - return HTTP_BAD_REQUEST; - } - if ((href_elem = dav_find_child(source_elem, "href")) == NULL) { - /* This supplies additional information for the default msg. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The DAV:source element must contain a DAV:href " - "element."); - return HTTP_BAD_REQUEST; - } - source = dav_xml_get_cdata(href_elem, r->pool, 1 /* strip_white */); - - /* get a subrequest for the source, so that we can get a dav_resource - for that source. */ - lookup = dav_lookup_uri(source, r, 0 /* must_be_absolute */); - 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, 0, 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, - "Merge source URI had an error."); - } - err = dav_get_resource(lookup.rnew, 0 /* label_allowed */, - 0 /* use_checked_in */, &source_resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - - no_auto_merge = dav_find_child(doc->root, "no-auto-merge") != NULL; - no_checkout = dav_find_child(doc->root, "no-checkout") != NULL; - - prop_elem = dav_find_child(doc->root, "prop"); - - /* ### check RFC. I believe the DAV:merge element may contain any - ### element also allowed within DAV:checkout. need to extract them - ### here, and pass them along. - ### if so, then refactor the CHECKOUT method handling so we can reuse - ### the code. maybe create a structure to hold CHECKOUT parameters - ### which can be passed to the checkout() and merge() hooks. */ - - /* Ask repository module to resolve the resource */ - err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - if (!resource->exists) { - /* Apache will supply a default error for this. */ - return HTTP_NOT_FOUND; - } - - /* ### check the source and target resources flags/types */ - - /* ### do lock checks, once behavior is defined */ - - /* set the Cache-Control header, per the spec */ - /* ### correct? */ - apr_table_setn(r->headers_out, "Cache-Control", "no-cache"); - - /* Initialize these values for a standard MERGE response. If the MERGE - is going to do something different (i.e. an error), then it must - return a dav_error, and we'll reset these values properly. */ - r->status = HTTP_OK; - r->status_line = ap_get_status_line(HTTP_OK); /* ### needed? */ - r->content_type = "text/xml"; - - /* ### should we do any preliminary response generation? probably not, - ### because we may have an error, thus demanding something else in - ### the response body. */ - - /* Do the merge, including any response generation. */ - if ((err = (*vsn_hooks->merge)(resource, source_resource, - no_auto_merge, no_checkout, - prop_elem, - r->output_filters)) != NULL) { - /* ### is err->status the right error here? */ - err = dav_push_error(r->pool, err->status, 0, - apr_psprintf(r->pool, - "Could not MERGE resource \"%s\" " - "into \"%s\".", - ap_escape_html(r->pool, source), - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, NULL); - } - - /* the response was fully generated by the merge() hook. */ - /* ### urk. does this prevent logging? need to check... */ - return DONE; -} - -static int dav_method_bind(request_rec *r) -{ - dav_resource *resource; - dav_resource *binding; - dav_auto_version_info av_info; - const dav_hooks_binding *binding_hooks = DAV_GET_HOOKS_BINDING(r); - const char *dest; - dav_error *err; - dav_error *err2; - dav_response *multi_response = NULL; - dav_lookup_result lookup; - int overwrite; - - /* If no bindings provider, decline the request */ - if (binding_hooks == NULL) - return DECLINED; - - /* Ask repository module to resolve the resource */ - err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */, - &resource); - if (err != NULL) - return dav_handle_err(r, err, NULL); - if (!resource->exists) { - /* Apache will supply a default error for this. */ - return HTTP_NOT_FOUND; - } - - /* get the destination URI */ - dest = apr_table_get(r->headers_in, "Destination"); - if (dest == NULL) { - /* This supplies additional information for the default message. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "The request is missing a Destination header."); - return HTTP_BAD_REQUEST; - } - - lookup = dav_lookup_uri(dest, r, 0 /* must_be_absolute */); - 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, 0, r, - lookup.err.desc); - return HTTP_BAD_REQUEST; - } - else if (lookup.err.status == HTTP_BAD_GATEWAY) { - /* ### Bindings protocol draft 02 says to return 507 - * ### (Cross Server Binding Forbidden); Apache already defines 507 - * ### as HTTP_INSUFFICIENT_STORAGE. So, for now, we'll return - * ### HTTP_FORBIDDEN - */ - return dav_error_response(r, HTTP_FORBIDDEN, - "Cross server bindings are not allowed by this server."); - } - - /* ### 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 binding resource */ - err = dav_get_resource(lookup.rnew, 0 /* label_allowed */, - 0 /* use_checked_in */, &binding); - if (err != NULL) - return dav_handle_err(r, err, NULL); - - /* are the two resources handled by the same repository? */ - if (resource->hooks != binding->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. " - "BIND 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 (binding->exists && !overwrite) { - 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, binding)) { - return dav_error_response(r, HTTP_FORBIDDEN, - "Source and Destination URIs are the same."); - } - - /* - ** 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, binding, DAV_INFINITY, NULL, - &multi_response, - DAV_VALIDATE_PARENT - | DAV_VALIDATE_USE_424, NULL)) != NULL) { - err = dav_push_error(r->pool, err->status, 0, - apr_psprintf(r->pool, - "Could not BIND %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); - } - - /* guard against creating circular bindings */ - if (resource->collection - && (*resource->hooks->is_parent_resource)(resource, binding)) { - return dav_error_response(r, HTTP_FORBIDDEN, - "Source collection contains the Destination."); - } - if (resource->collection - && (*resource->hooks->is_parent_resource)(binding, 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 BIND, as that would - * delete the Source. - */ - - return dav_error_response(r, HTTP_FORBIDDEN, - "Destination collection contains the Source and " - "Overwrite has been specified."); - } - - /* prepare the destination collection for modification */ - if ((err = dav_auto_checkout(r, binding, 1 /* parent_only */, - &av_info)) != NULL) { - /* could not make destination writable */ - return dav_handle_err(r, err, NULL); - } - - /* If target exists, remove it first (we know Ovewrite must be TRUE). - * Then try to bind to the resource. - */ - if (binding->exists) - err = (*resource->hooks->remove_resource)(binding, &multi_response); - - if (err == NULL) { - err = (*binding_hooks->bind_resource)(resource, binding); - } - - /* restore parent collection states */ - err2 = dav_auto_checkin(r, NULL, - err != NULL /* undo if error */, - 0 /*unlock*/, &av_info); - - /* check for error from remove/bind operations */ - if (err != NULL) { - err = dav_push_error(r->pool, err->status, 0, - apr_psprintf(r->pool, - "Could not BIND %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 BIND was successful, but there was a " - "problem automatically checking in the " - "source parent collection.", - err2); - dav_log_err(r, err, APLOG_WARNING); - } - - /* return an appropriate response (HTTP_CREATED) */ - /* ### spec doesn't say what happens when destination was replaced */ - return dav_created(r, lookup.rnew->uri, "Binding", 0); -} - - -/* - * Response handler for DAV resources - */ -static int dav_handler(request_rec *r) -{ - dav_dir_conf *conf; - - if (strcmp(r->handler, "dav-handler")) { - return DECLINED; - } - - /* 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, "VERSION-CONTROL")) { - return dav_method_vsn_control(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 (!strcmp(r->method, "UPDATE")) { - return dav_method_update(r); - } - - if (!strcmp(r->method, "LABEL")) { - return dav_method_label(r); - } - - if (!strcmp(r->method, "REPORT")) { - return dav_method_report(r); - } - - if (!strcmp(r->method, "MKWORKSPACE")) { - return dav_method_make_workspace(r); - } - - if (!strcmp(r->method, "MKACTIVITY")) { - return dav_method_make_activity(r); - } - - if (!strcmp(r->method, "BASELINE-CONTROL")) { - return dav_method_baseline_control(r); - } - - if (!strcmp(r->method, "MERGE")) { - return dav_method_merge(r); - } - - if (!strcmp(r->method, "BIND")) { - return dav_method_bind(r); - } - - /* ### 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->provider == NULL) { - 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->provider->repos->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; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_handler(dav_handler, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_post_config(dav_init_handler, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_type_checker(dav_type_checker, NULL, NULL, APR_HOOK_FIRST); - - dav_hook_find_liveprop(dav_core_find_liveprop, NULL, NULL, APR_HOOK_LAST); - dav_hook_insert_all_liveprops(dav_core_insert_all_liveprops, - NULL, NULL, APR_HOOK_MIDDLE); - - dav_core_register_uris(p); -} - -/*--------------------------------------------------------------------------- -** -** Configuration info for the module -*/ - -static const command_rec dav_cmds[] = -{ - /* per directory/location */ - AP_INIT_TAKE1("DAV", dav_cmd_dav, NULL, ACCESS_CONF, - "specify the DAV provider for a directory or location"), - - /* per directory/location, or per server */ - AP_INIT_TAKE1("DAVMinTimeout", dav_cmd_davmintimeout, NULL, - ACCESS_CONF|RSRC_CONF, - "specify minimum allowed timeout"), - - /* per directory/location, or per server */ - AP_INIT_FLAG("DAVDepthInfinity", dav_cmd_davdepthinfinity, NULL, - ACCESS_CONF|RSRC_CONF, - "allow Depth infinity PROPFIND requests"), - - /* per directory/location, or per server */ - AP_INIT_TAKE2("DAVParam", dav_cmd_davparam, NULL, - ACCESS_CONF|RSRC_CONF, - "DAVParam "), - - { NULL } -}; - -module DAV_DECLARE_DATA dav_module = -{ - STANDARD20_MODULE_STUFF, - 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 */ - register_hooks, /* register hooks */ -}; - -APR_HOOK_STRUCT( - APR_HOOK_LINK(gather_propsets) - APR_HOOK_LINK(find_liveprop) - APR_HOOK_LINK(insert_all_liveprops) - ) -APR_IMPLEMENT_EXTERNAL_HOOK_VOID(dav, DAV, gather_propsets, - (apr_array_header_t *uris), - (uris)) -APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(dav, DAV, int, find_liveprop, - (const dav_resource *resource, - const char *ns_uri, const char *name, - const dav_hooks_liveprop **hooks), - (resource, ns_uri, name, hooks), 0); -APR_IMPLEMENT_EXTERNAL_HOOK_VOID(dav, DAV, insert_all_liveprops, - (request_rec *r, const dav_resource *resource, - dav_prop_insert what, ap_text_header *phdr), - (r, resource, what, phdr)); diff --git a/modules/dav/main/mod_dav.dsp b/modules/dav/main/mod_dav.dsp deleted file mode 100644 index ba781d9d56..0000000000 --- a/modules/dav/main/mod_dav.dsp +++ /dev/null @@ -1,131 +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 "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 "..\..\..\srclib\aputil" /I "..\..\..\srclib\sdbm" /I "..\..\..\srclib\expat-lite" /I "..\..\..\srclib\apr\include" /I "../../../srclib/apr-util/include" /I "..\..\..\include" /I "..\..\..\os\win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "DAV_DECLARE_EXPORT" /Fd"Release\mod_dav" /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 /incremental:no /map /out:"Release/mod_dav.so" /machine:I386 /base:@..\..\..\os\win32\BaseAddr.ref,mod_dav -# ADD LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_dav.so" /machine:I386 /base:@..\..\..\os\win32\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 "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 "..\..\..\srclib\aputil" /I "..\..\..\srclib\sdbm" /I "..\..\..\srclib\expat-lite" /I "..\..\..\srclib\apr\include" /I "../../../srclib/apr-util/include" /I "..\..\..\include" /I "..\..\..\os\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "DAV_DECLARE_EXPORT" /Fd"Debug\mod_dav" /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 /out:"Debug/mod_dav.so" /machine:I386 /base:@..\..\..\os\win32\BaseAddr.ref,mod_dav -# ADD LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /debug /out:"Debug/mod_dav.so" /machine:I386 /base:@..\..\..\os\win32\BaseAddr.ref,mod_dav - -!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=.\liveprop.c -# End Source File -# Begin Source File - -SOURCE=.\mod_dav.c -# End Source File -# Begin Source File - -SOURCE=.\props.c -# End Source File -# Begin Source File - -SOURCE=.\providers.c -# End Source File -# Begin Source File - -SOURCE=.\std_liveprop.c -# End Source File -# Begin Source File - -SOURCE=.\util.c -# End Source File -# Begin Source File - -SOURCE=.\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=.\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 162f7bff66..0000000000 --- a/modules/dav/main/mod_dav.h +++ /dev/null @@ -1,2231 +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 - * . - */ - -/* -** DAV extension module for Apache 2.0.* -*/ - -#ifndef _MOD_DAV_H_ -#define _MOD_DAV_H_ - -#include "apr_hooks.h" -#include "apr_hash.h" -#include "apr_dbm.h" -#include "apr_tables.h" - -#include "httpd.h" -#include "util_filter.h" -#include "util_xml.h" - -#include /* for INT_MAX */ -#include /* for time_t */ - -#ifdef __cplusplus -extern "C" { -#endif - - -#define DAV_VERSION AP_SERVER_BASEREVISION - -#define DAV_XML_HEADER "" -#define DAV_XML_CONTENT_TYPE "text/xml; charset=\"utf-8\"" - -#define DAV_READ_BLOCKSIZE 2048 /* used for reading input blocks */ - -#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, 0, NULL, (f)) -#define DBG1(f,a1) ap_log_error(APLOG_MARK, \ - APLOG_ERR|APLOG_NOERRNO, 0, NULL, f, a1) -#define DBG2(f,a1,a2) ap_log_error(APLOG_MARK, \ - APLOG_ERR|APLOG_NOERRNO, 0, NULL, f, a1, a2) -#define DBG3(f,a1,a2,a3) ap_log_error(APLOG_MARK, \ - APLOG_ERR|APLOG_NOERRNO, 0, NULL, f, a1, a2, a3) -#else -#undef DAV_DEBUG -#define DEBUG_CR "" -#endif - -#define DAV_INFINITY INT_MAX /* for the Depth: header */ - -/* Create a set of DAV_DECLARE(type), DAV_DECLARE_NONSTD(type) and - * DAV_DECLARE_DATA with appropriate export and import tags for the platform - */ -#if !defined(WIN32) -#define DAV_DECLARE(type) type -#define DAV_DECLARE_NONSTD(type) type -#define DAV_DECLARE_DATA -#elif defined(DAV_DECLARE_STATIC) -#define DAV_DECLARE(type) type __stdcall -#define DAV_DECLARE_NONSTD(type) type -#define DAV_DECLARE_DATA -#elif defined(DAV_DECLARE_EXPORT) -#define DAV_DECLARE(type) __declspec(dllexport) type __stdcall -#define DAV_DECLARE_NONSTD(type) __declspec(dllexport) type -#define DAV_DECLARE_DATA __declspec(dllexport) -#else -#define DAV_DECLARE(type) __declspec(dllimport) type __stdcall -#define DAV_DECLARE_NONSTD(type) __declspec(dllimport) type -#define DAV_DECLARE_DATA __declspec(dllimport) -#endif - -/* -------------------------------------------------------------------- -** -** 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, apr_pool_t *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_DECLARE(dav_error*) dav_new_error(apr_pool_t *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_DECLARE(dav_error*) dav_push_error(apr_pool_t *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 /* writable 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_propdb dav_hooks_propdb; -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; -typedef struct dav_hooks_binding dav_hooks_binding; - -/* ### deprecated name */ -typedef dav_hooks_propdb dav_hooks_db; - - -/* -------------------------------------------------------------------- -** -** 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. -** -** This enumeration identifies the type of URL used to identify the -** resource. Since the same resource may have more than one type of -** URL which can identify it, dav_resource_type cannot be used -** alone to determine the type of the resource; attributes of the -** dav_resource object must also be consulted. -*/ -typedef enum { - DAV_RESOURCE_TYPE_UNKNOWN, - - DAV_RESOURCE_TYPE_REGULAR, /* file or collection; could be - * unversioned, or version selector, - * or baseline selector */ - - DAV_RESOURCE_TYPE_VERSION, /* version or baseline URL */ - - DAV_RESOURCE_TYPE_HISTORY, /* version or baseline history URL */ - - DAV_RESOURCE_TYPE_WORKING, /* working resource URL */ - - DAV_RESOURCE_TYPE_WORKSPACE, /* workspace URL */ - - DAV_RESOURCE_TYPE_ACTIVITY, /* activity URL */ - - DAV_RESOURCE_TYPE_PRIVATE /* repository-private type */ - -} 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. -** -** A quick explanation of how the flags can apply to different resources: -** -** unversioned file or collection: -** type = DAV_RESOURCE_TYPE_REGULAR -** exists = ? (1 if exists) -** collection = ? (1 if collection) -** versioned = 0 -** baselined = 0 -** working = 0 -** -** version-controlled resource or configuration: -** type = DAV_RESOURCE_TYPE_REGULAR -** exists = 1 -** collection = ? (1 if collection) -** versioned = 1 -** baselined = ? (1 if configuration) -** working = ? (1 if checked out) -** -** version/baseline history: -** type = DAV_RESOURCE_TYPE_HISTORY -** exists = 1 -** collection = 0 -** versioned = 0 -** baselined = 0 -** working = 0 -** -** version/baseline: -** type = DAV_RESOURCE_TYPE_VERSION -** exists = 1 -** collection = ? (1 if collection) -** versioned = 1 -** baselined = ? (1 if baseline) -** working = 0 -** -** working resource: -** type = DAV_RESOURCE_TYPE_WORKING -** exists = 1 -** collection = ? (1 if collection) -** versioned = 1 -** baselined = 0 -** working = 1 -** -** workspace: -** type = DAV_RESOURCE_TYPE_WORKSPACE -** exists = ? (1 if exists) -** collection = 1 -** versioned = ? (1 if version-controlled) -** baselined = ? (1 if baseline-controlled) -** working = ? (1 if checked out) -** -** activity: -** type = DAV_RESOURCE_TYPE_ACTIVITY -** exists = ? (1 if exists) -** collection = 0 -** versioned = 0 -** baselined = 0 -** working = 0 -*/ -typedef struct dav_resource { - dav_resource_type type; - - int exists; /* 0 => null resource */ - - int collection; /* 0 => file; can be 1 for - * REGULAR, VERSION, and WORKING resources, - * and is always 1 for WORKSPACE */ - - int versioned; /* 0 => unversioned; can be 1 for - * REGULAR and WORKSPACE resources, - * and is always 1 for VERSION and WORKING */ - - int baselined; /* 0 => not baselined; can be 1 for - * REGULAR, VERSION, and WORKSPACE resources; - * versioned == 1 when baselined == 1 */ - - int working; /* 0 => not checked out; can be 1 for - * REGULAR and WORKSPACE resources, - * and is always 1 for WORKING */ - - const char *uri; /* the URI for this resource */ - - dav_resource_private *info; /* the provider's private info */ - - const dav_hooks_repository *hooks; /* hooks used for this resource */ - - /* When allocating items related specifically to this resource, the - following pool should be used. Its lifetime will be at least as - long as the dav_resource structure. */ - apr_pool_t *pool; - -} 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 -{ - apr_size_t alloc_len; /* how much has been allocated */ - apr_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 */ -DAV_DECLARE(void) dav_set_bufsize(apr_pool_t *p, dav_buffer *pbuf, - apr_size_t size); - -/* initialize a buffer and copy the specified (null-term'd) string into it */ -DAV_DECLARE(void) dav_buffer_init(apr_pool_t *p, dav_buffer *pbuf, - const char *str); - -/* check that the buffer can accomodate more bytes */ -DAV_DECLARE(void) dav_check_bufsize(apr_pool_t *p, dav_buffer *pbuf, - apr_size_t extra_needed); - -/* append a string to the end of the buffer, adjust length */ -DAV_DECLARE(void) dav_buffer_append(apr_pool_t *p, dav_buffer *pbuf, - const char *str); - -/* place a string on the end of the buffer, do NOT adjust length */ -DAV_DECLARE(void) dav_buffer_place(apr_pool_t *p, dav_buffer *pbuf, - const char *str); - -/* place some memory on the end of a buffer; do NOT adjust length */ -DAV_DECLARE(void) dav_buffer_place_mem(apr_pool_t *p, dav_buffer *pbuf, - const void *mem, apr_size_t amt, - apr_size_t pad); - - -/* -------------------------------------------------------------------- -** -** HANDY UTILITIES -*/ - -/* contains results from one of the getprop functions */ -typedef struct -{ - ap_text * propstats; /* element text */ - ap_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; - - -dav_lookup_result dav_lookup_uri(const char *uri, request_rec *r, - int must_be_absolute); - -/* defines type of property info a provider is to return */ -typedef enum { - 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_NOTSUPP, /* property is recognized by this provider, - but it is not supported, and cannot be - treated 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_SUPPORTED /* a supported live property was added to - the text block as a - element */ -} dav_prop_insert; - -/* ### this stuff is private to dav/fs/repos.c; move it... */ -/* 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); - -int dav_validate_root(const ap_xml_doc *doc, const char *tagname); -ap_xml_elem *dav_find_child(const ap_xml_elem *elem, const char *tagname); - -/* gather up all the CDATA into a single string */ -const char *dav_xml_get_cdata(const ap_xml_elem *elem, apr_pool_t *pool, - int strip_white); - - -/* -------------------------------------------------------------------- -** -** DAV PLUGINS -*/ - -/* ### docco ... */ - -/* -** dav_provider -** -** This structure wraps up all of the hooks that a mod_dav provider can -** supply. The provider MUST supply and . The rest are -** optional and should contain NULL if that feature is not supplied. -** -** Note that a provider cannot pick and choose portions. There are too many -** dependencies between a dav_resource (defined by ) and the other -** functionality. -** -** Live properties are not part of the dav_provider structure because they -** are handled through the APR_HOOK interface (to allow for multiple liveprop -** providers). The core always provides some properties, and then a given -** provider will add more properties. -*/ -typedef struct { - const dav_hooks_repository *repos; - const dav_hooks_propdb *propdb; - const dav_hooks_locks *locks; - const dav_hooks_vsn *vsn; - const dav_hooks_binding *binding; - -} dav_provider; - -/* -** gather_propsets: gather all live property propset-URIs -** -** The hook implementor should push one or more URIs into the specified -** array. These URIs are 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 each 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) -*/ -APR_DECLARE_EXTERNAL_HOOK(dav, DAV, void, gather_propsets, - (apr_array_header_t *uris)) - -/* -** find_liveprop: find a live property, returning a non-zero, unique, -** opaque identifier. -** -** If the hook implementor determines the specified URI/name refers to -** one of its properties, then it should fill in HOOKS and return a -** non-zero value. The returned value is the "property ID" and will -** be passed to the various liveprop hook functions. -** -** Return 0 if the property is not defined by the hook implementor. -*/ -APR_DECLARE_EXTERNAL_HOOK(dav, DAV, int, find_liveprop, - (const dav_resource *resource, - const char *ns_uri, const char *name, - const dav_hooks_liveprop **hooks)) - -/* -** insert_all_liveprops: insert all (known) live property names/values. -** -** The hook implementor should append XML text to PHDR, containing liveprop -** names. If INSVALUE is true, then the property values should also be -** inserted into the output XML stream. -** -** The liveprop provider should insert *all* known and *defined* live -** properties on the specified resource. If a particular liveprop is -** not defined for this resource, then it should not be inserted. -*/ -APR_DECLARE_EXTERNAL_HOOK(dav, DAV, void, insert_all_liveprops, - (request_rec *r, const dav_resource *resource, - dav_prop_insert what, ap_text_header *phdr)) - -const dav_hooks_locks *dav_get_lock_hooks(request_rec *r); -const dav_hooks_propdb *dav_get_propdb_hooks(request_rec *r); -const dav_hooks_vsn *dav_get_vsn_hooks(request_rec *r); -const dav_hooks_binding *dav_get_binding_hooks(request_rec *r); - -DAV_DECLARE(void) dav_register_provider(apr_pool_t *p, const char *name, - const dav_provider *hooks); -const dav_provider * dav_lookup_provider(const char *name); - - -/* ### deprecated */ -#define DAV_GET_HOOKS_PROPDB(r) dav_get_propdb_hooks(r) -#define DAV_GET_HOOKS_LOCKS(r) dav_get_lock_hooks(r) -#define DAV_GET_HOOKS_VSN(r) dav_get_vsn_hooks(r) -#define DAV_GET_HOOKS_BINDING(r) dav_get_binding_hooks(r) - - -/* -------------------------------------------------------------------- -** -** 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; - apr_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); - - -/* -------------------------------------------------------------------- -** -** LIVE PROPERTY HANDLING -*/ - -/* opaque type for PROPPATCH rollback information */ -typedef struct dav_liveprop_rollback dav_liveprop_rollback; - -struct dav_hooks_liveprop -{ - /* - ** Insert property information into a text block. The property to - ** insert is identified by the propid value. The information to insert - ** is identified by the "what" argument, as follows: - ** DAV_PROP_INSERT_NAME - ** property name, as an empty XML element - ** DAV_PROP_INSERT_VALUE - ** property name/value, as an XML element - ** DAV_PROP_INSERT_SUPPORTED - ** if the property is defined on the resource, then - ** a DAV:supported-live-property element, as defined - ** by the DeltaV extensions to RFC2518. - ** - ** Providers should return DAV_PROP_INSERT_NOTDEF if the property is - ** known and not defined for this resource, so should be handled as a - ** dead property. If a provider recognizes, but does not support, a - ** property, and does not want it handled as a dead property, it should - ** return DAV_PROP_INSERT_NOTSUPP. - ** - ** 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, dav_prop_insert what, - ap_text_header *phdr); - - /* - ** Determine whether a given property is writable. - ** - ** ### we may want a different semantic. i.e. maybe it should be - ** ### "can we write into this property?" - ** - ** Returns 1 if the live property can be written, 0 if read-only. - */ - int (*is_writable)(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 ap_xml_elem *elem, - int operation, - void **context, - int *defer_to_dead); - - /* ### doc... */ - dav_error * (*patch_exec)(const dav_resource *resource, - const ap_xml_elem *elem, - int operation, - void *context, - dav_liveprop_rollback **rollback_ctx); - - /* ### doc... */ - void (*patch_commit)(const dav_resource *resource, - int operation, - void *context, - dav_liveprop_rollback *rollback_ctx); - - /* ### doc... */ - dav_error * (*patch_rollback)(const dav_resource *resource, - int operation, - void *context, - dav_liveprop_rollback *rollback_ctx); -}; - -/* -** dav_liveprop_spec: specify a live property -** -** This structure is used as a standard way to determine if a particular -** property is a live property. Its use is not part of the mandated liveprop -** interface, but can be used by liveprop providers in conjuction with the -** utility routines below. -** -** spec->name == NULL is the defined end-sentinel for a list of specs. -*/ -typedef struct { - int ns; /* provider-local namespace index */ - const char *name; /* name of the property */ - - int propid; /* provider-local property ID */ - - int is_writable; /* is the property writable? */ - -} dav_liveprop_spec; - -/* -** dav_liveprop_group: specify a group of liveprops -** -** This structure specifies a group of live properties, their namespaces, -** and how to handle them. -*/ -typedef struct { - const dav_liveprop_spec *specs; - const char * const *namespace_uris; - const dav_hooks_liveprop *hooks; - -} dav_liveprop_group; - -/* ### docco */ -DAV_DECLARE(int) dav_do_find_liveprop(const char *ns_uri, const char *name, - const dav_liveprop_group *group, - const dav_hooks_liveprop **hooks); - -/* ### docco */ -DAV_DECLARE(int) dav_get_liveprop_info(int propid, - const dav_liveprop_group *group, - const dav_liveprop_spec **info); - -/* ### docco */ -DAV_DECLARE(void) dav_register_liveprop_group(apr_pool_t *pool, - const dav_liveprop_group *group); - -/* ### docco */ -DAV_DECLARE(int) dav_get_liveprop_ns_index(const char *uri); - -/* ### docco */ -int dav_get_liveprop_ns_count(void); - -/* ### docco */ -void dav_add_all_liveprop_xmlns(apr_pool_t *p, ap_text_header *phdr); - -/* -** The following three functions are part of mod_dav's internal handling -** for the core WebDAV properties. They are not part of mod_dav's API. -*/ -int dav_core_find_liveprop(const dav_resource *resource, - const char *ns_uri, const char *name, - const dav_hooks_liveprop **hooks); -void dav_core_insert_all_liveprops(request_rec *r, - const dav_resource *resource, - dav_prop_insert what, ap_text_header *phdr); -void dav_core_register_uris(apr_pool_t *p); - - -/* -** Standard WebDAV Property Identifiers -** -** A live property provider does not need to use these; they are simply -** provided for convenience. -** -** Property identifiers need to be unique within a given provider, but not -** *across* providers (note: this uniqueness constraint was different in -** older versions of mod_dav). -** -** The identifiers start at 20000 to make it easier for providers to avoid -** conflicts with the standard properties. The properties are arranged -** alphabetically, and may be reordered from time to time (as properties -** are introduced). -** -** NOTE: there is no problem with reordering (e.g. binary compat) since the -** identifiers are only used within a given provider, which would pick up -** the entire set of changes upon a recompile. -*/ -enum { - DAV_PROPID_BEGIN = 20000, - - /* Standard WebDAV properties (RFC 2518) */ - DAV_PROPID_creationdate, - DAV_PROPID_displayname, - DAV_PROPID_getcontentlanguage, - DAV_PROPID_getcontentlength, - DAV_PROPID_getcontenttype, - DAV_PROPID_getetag, - DAV_PROPID_getlastmodified, - DAV_PROPID_lockdiscovery, - DAV_PROPID_resourcetype, - DAV_PROPID_source, - DAV_PROPID_supportedlock, - - /* DeltaV properties (from the I-D (#14)) */ - DAV_PROPID_activity_checkout_set, - DAV_PROPID_activity_set, - DAV_PROPID_activity_version_set, - DAV_PROPID_auto_merge_set, - DAV_PROPID_auto_version, - DAV_PROPID_baseline_collection, - DAV_PROPID_baseline_controlled_collection, - DAV_PROPID_baseline_controlled_collection_set, - DAV_PROPID_checked_in, - DAV_PROPID_checked_out, - DAV_PROPID_checkin_fork, - DAV_PROPID_checkout_fork, - DAV_PROPID_checkout_set, - DAV_PROPID_comment, - DAV_PROPID_creator_displayname, - DAV_PROPID_current_activity_set, - DAV_PROPID_current_workspace_set, - DAV_PROPID_default_variant, - DAV_PROPID_eclipsed_set, - DAV_PROPID_label_name_set, - DAV_PROPID_merge_set, - DAV_PROPID_precursor_set, - DAV_PROPID_predecessor_set, - DAV_PROPID_root_version, - DAV_PROPID_subactivity_set, - DAV_PROPID_subbaseline_set, - DAV_PROPID_successor_set, - DAV_PROPID_supported_method_set, - DAV_PROPID_supported_live_property_set, - DAV_PROPID_supported_report_set, - DAV_PROPID_unreserved, - DAV_PROPID_variant_set, - DAV_PROPID_version_controlled_binding_set, - DAV_PROPID_version_controlled_configuration, - DAV_PROPID_version_history, - DAV_PROPID_version_name, - DAV_PROPID_workspace, - DAV_PROPID_workspace_checkout_set, - - DAV_PROPID_END -}; - -/* -** 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 apr_datum_t dav_datum; - -/* hook functions to enable pluggable databases */ -struct dav_hooks_propdb -{ - dav_error * (*open)(apr_pool_t *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, provider-specific information for a lock database. -*/ -typedef struct dav_lockdb_private dav_lockdb_private; - -/* -** Opaque, provider-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 */ -dav_error * dav_lock_parse_lockinfo(request_rec *r, - const dav_resource *resrouce, - dav_lockdb *lockdb, - const ap_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_DECLARE(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 a resource */ - const char * (*get_supportedlock)( - const dav_resource *resource - ); - - /* Parse a lock token URI, returning a lock token object allocated - * in the given pool. - */ - dav_error * (*parse_locktoken)( - apr_pool_t *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)( - apr_pool_t *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, - const dav_resource *resource, - int ro, - apr_array_header_t *ns_xlate, - dav_propdb **propdb); - -void dav_close_propdb(dav_propdb *db); - -dav_get_props_result dav_get_props( - dav_propdb *db, - ap_xml_doc *doc); - -dav_get_props_result dav_get_allprops( - dav_propdb *db, - dav_prop_insert what); - -void dav_get_liveprop_supported( - dav_propdb *propdb, - const char *ns_uri, - const char *propname, - ap_text_header *body); - -/* -** 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? */ - - ap_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 -*/ - -enum { - DAV_CALLTYPE_MEMBER = 1, /* called for a member resource */ - DAV_CALLTYPE_COLLECTION, /* called for a collection */ - DAV_CALLTYPE_LOCKNULL /* called for a locknull resource */ -}; - -typedef struct -{ - /* the client-provided context */ - void *walk_ctx; - - /* pool to use for allocations in the callback */ - apr_pool_t *pool; - - /* the current resource */ - const dav_resource *resource; - - /* OUTPUT: add responses to this */ - dav_response *response; - -} dav_walk_resource; - -typedef struct -{ - int walk_type; -#define DAV_WALKTYPE_AUTH 0x0001 /* limit to authorized files */ -#define DAV_WALKTYPE_NORMAL 0x0002 /* walk normal files */ -#define DAV_WALKTYPE_LOCKNULL 0x0004 /* walk locknull resources */ - - /* callback function and a client context for the walk */ - dav_error * (*func)(dav_walk_resource *wres, int calltype); - void *walk_ctx; - - /* what pool to use for allocations needed by walk logic */ - apr_pool_t *pool; - - /* beginning root of the walk */ - const dav_resource *root; - - /* lock database to enable walking LOCKNULL resources */ - dav_lockdb *lockdb; - -} dav_walk_params; - -/* directory tree walking context */ -typedef struct dav_walker_ctx -{ - /* input: */ - dav_walk_params w; - - - /* ### client data... phasing out this big glom */ - - request_rec *r; /* original request */ - - /* for PROPFIND operations */ - ap_xml_doc *doc; - int propfind_type; -#define DAV_PROPFIND_IS_ALLPROP 1 -#define DAV_PROPFIND_IS_PROPNAME 2 -#define DAV_PROPFIND_IS_PROP 3 - - ap_text *propstat_404; /* (cached) propstat giving a 404 error */ - - 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_buffer work_buf; /* for dav_validate_request() */ - -} dav_walker_ctx; - -DAV_DECLARE(void) dav_add_response(dav_walk_resource *wres, - 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 - * should always be returned even if the resource does not exist. This - * repository has been identified as handling the resource given by - * the URI, so an answer must be given. If there is a problem with the - * URI or accessing the resource or whatever, then an error should be - * returned. - * - * root_dir: - * the root of the directory for which this repository is configured. - * - * label: - * if a Label: header is present (and allowed), this is the label - * to use to identify a version resource from the resource's - * corresponding version history. Otherwise, it will be NULL. - * - * use_checked_in: - * use the DAV:checked-in property of the resource identified by the - * Request-URI to identify and return a version resource - * - * The provider may associate the request storage pool with the resource - * (in the resource->pool field), to use in other operations on that - * resource. - */ - dav_error * (*get_resource)( - request_rec *r, - const char *root_dir, - const char *label, - int use_checked_in, - dav_resource **resource - ); - - /* 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. - * - * An error should be returned only if there is a fatal error in - * fetching information about the parent resource. - */ - dav_error * (*get_parent_resource)( - const dav_resource *resource, - dav_resource **parent_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, apr_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, apr_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, apr_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)( - dav_resource *resource - ); - - /* Copy one resource to another. The destination may exist, if it is - * versioned. - * Handles both files and collections. Properties are copied as well. - * If the destination exists and is versioned, the provider must update - * the destination to have identical content to the source, - * recursively for collections. - * 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 params->root. - * Control of the walk and the callback are specified by 'params'. - * - * An error may be returned. *response will contain multistatus - * responses (if any) suitable for the body of the error. It is also - * possible to return NULL, yet still have multistatus responses. - * In this case, typically the caller should return a 207 (Multistatus) - * and the responses (in the body) as the HTTP response. - */ - dav_error * (*walk)(const dav_walk_params *params, int depth, - dav_response **response); - - /* Get the entity tag for a resource */ - const char * (*getetag)(const dav_resource *resource); -}; - - -/* -------------------------------------------------------------------- -** -** VERSIONING FUNCTIONS -*/ - - -/* dav_add_vary_header - * - * If there were any headers in the request which require a Vary header - * in the response, add it. - */ -void dav_add_vary_header(request_rec *in_req, - request_rec *out_req, - const dav_resource *resource); - -/* -** Flags specifying auto-versioning behavior, returned by -** the auto_versionable hook. The value returned depends -** on both the state of the resource and the value of the -** DAV:auto-versioning property for the resource. -** -** If the resource does not exist (null or lock-null), -** DAV_AUTO_VERSION_ALWAYS causes creation of a new version-controlled resource -** -** If the resource is checked in, -** DAV_AUTO_VERSION_ALWAYS causes it to be checked out always, -** DAV_AUTO_VERSION_LOCKED causes it to be checked out only when locked -** -** If the resource is checked out, -** DAV_AUTO_VERSION_ALWAYS causes it to be checked in always, -** DAV_AUTO_VERSION_LOCKED causes it to be checked in when unlocked -** (note: a provider should allow auto-checkin only for resources which -** were automatically checked out) -** -** In all cases, DAV_AUTO_VERSION_NEVER results in no auto-versioning behavior. -*/ -typedef enum { - DAV_AUTO_VERSION_NEVER, - DAV_AUTO_VERSION_ALWAYS, - DAV_AUTO_VERSION_LOCKED -} dav_auto_version; - -/* -** This structure is used to record what auto-versioning operations -** were done to make a resource writable, so that they can be undone -** at the end of a request. -*/ -typedef struct { - int resource_versioned; /* 1 => resource was auto-version-controlled */ - int resource_checkedout; /* 1 => resource was auto-checked-out */ - int parent_checkedout; /* 1 => parent was auto-checked-out */ - dav_resource *parent_resource; /* parent resource, if it was needed */ -} dav_auto_version_info; - -/* 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. - * - * If auto-versioning is not enabled for a versioned resource, then an error is - * returned, since the resource cannot be modified. - * - * The dav_auto_version_info structure is filled in with enough information - * to restore both parent and child resources to the state they were in - * before the auto-versioning operations occurred. - */ -dav_error *dav_auto_checkout( - request_rec *r, - dav_resource *resource, - int parent_only, - dav_auto_version_info *av_info); - -/* 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). - * - * Set the unlock flag to indicate that the resource is about - * to be unlocked; it will be checked in if the resource - * auto-versioning property indicates it should be. In this case, - * av_info is ignored, so it can be NULL. - * - * The resource argument may be NULL if only the parent resource - * was checked out (i.e. the parent_only was != 0 in the - * dav_auto_checkout call). - */ -dav_error *dav_auto_checkin( - request_rec *r, - dav_resource *resource, - int undo, - int unlock, - dav_auto_version_info *av_info); - -/* -** This structure is used to describe available reports -** -** "nmspace" should be valid XML and URL-quoted. mod_dav will place -** double-quotes around it and use it in an xmlns declaration. -*/ -typedef struct { - const char *nmspace; /* namespace of the XML report element */ - const char *name; /* element name for the XML report */ -} dav_report_elem; - - -/* Versioning provider hooks */ -struct dav_hooks_vsn -{ - /* - ** MANDATORY HOOKS - ** The following hooks are mandatory for all versioning providers; - ** they define the functionality needed to implement "core" versioning. - */ - - /* Return supported versioning options. - * Each dav_text item in the list will be returned as a separate - * DAV header. Providers are advised to limit the length of an - * individual text item to 63 characters, to conform to the limit - * used by MS Web Folders. - */ - void (*get_vsn_options)(apr_pool_t *p, ap_text_header *phdr); - - /* Get the value of a specific option for an OPTIONS request. - * The option being requested is given by the parsed XML - * element object "elem". The value of the option should be - * appended to the "option" text object. - */ - dav_error * (*get_option)(const dav_resource *resource, - const ap_xml_elem *elem, - ap_text_header *option); - - /* 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). If the resource - * is a checked-out resource, the provider must only enable - * auto-checkin if the resource was automatically checked out. - * - * The value returned depends on both the state of the resource - * and the value of its DAV:auto-version property. See the description - * of the dav_auto_version enumeration above for the details. - */ - dav_auto_version (*auto_versionable)(const dav_resource *resource); - - /* Put a resource under version control. If the resource already - * exists unversioned, then it becomes the initial version of the - * new version history, and it is replaced by a version selector - * which targets the new version. - * - * If the resource does not exist, then a new version-controlled - * resource is created which either targets an existing version (if the - * "target" argument is not NULL), or the initial, empty version - * in a new history resource (if the "target" argument is NULL). - * - * If successful, the resource object state is updated appropriately - * (that is, changed to refer to the new version-controlled resource). - */ - dav_error * (*vsn_control)(dav_resource *resource, - const char *target); - - /* Checkout a resource. If successful, the resource - * object state is updated appropriately. - * - * The auto_checkout flag will be set if this checkout is being - * done automatically, as part of some method which modifies - * the resource. The provider must remember that the resource - * was automatically checked out, so it can determine whether it - * can be automatically checked in. (Auto-checkin should only be - * enabled for resources which were automatically checked out.) - * - * If the working resource has a different URL from the - * target resource, a dav_resource descriptor is returned - * for the new working resource. Otherwise, the original - * resource descriptor will refer to the working resource. - * The working_resource argument can be NULL if the caller - * is not interested in the working resource. - * - * If the client has specified DAV:unreserved or DAV:fork-ok in the - * checkout request, then the corresponding flags are set. If - * DAV:activity-set has been specified, then create_activity is set - * if DAV:new was specified; otherwise, the DAV:href elements' CDATA - * (the actual href text) is passed in the "activities" array (each - * element of the array is a const char *). activities will be NULL - * no DAV:activity-set was provided or when create_activity is set. - */ - dav_error * (*checkout)(dav_resource *resource, - int auto_checkout, - int is_unreserved, int is_fork_ok, - int create_activity, - apr_array_header_t *activities, - dav_resource **working_resource); - - /* Uncheckout a checked-out resource. If successful, the resource - * object state is updated appropriately. - */ - dav_error * (*uncheckout)(dav_resource *resource); - - /* Checkin a checked-out resource. If successful, the resource - * object state is updated appropriately, and the - * version_resource descriptor will refer to the new version. - * The version_resource argument can be NULL if the caller - * is not interested in the new version resource. - * - * If the client has specified DAV:keep-checked-out in the checkin - * request, then the keep_checked_out flag is set. The provider - * should create a new version, but keep the resource in the - * checked-out state. - */ - dav_error * (*checkin)(dav_resource *resource, - int keep_checked_out, - dav_resource **version_resource); - - /* - ** Return the set of reports available at this resource. - ** - ** An array of report elements should be returned, with an end-marker - ** element containing namespace==NULL. The value of the - ** DAV:supported-report-set property will be constructed and - ** returned. - */ - dav_error * (*avail_reports)(const dav_resource *resource, - const dav_report_elem **reports); - - /* - ** Determine whether a Label header can be used - ** with a particular report. The dav_xml_doc structure - ** contains the parsed report request body. - ** Returns 0 if the Label header is not allowed. - */ - int (*report_label_header_allowed)(const ap_xml_doc *doc); - - /* - ** Generate a report on a resource. Since a provider is free - ** to define its own reports, and the value of request headers - ** may affect the interpretation of a report, the request record - ** must be passed to this routine. - ** - ** The dav_xml_doc structure contains the parsed report request - ** body. The report response is generated into the ap_text_header - ** structure. - ** - ** ### shouldn't generate large responses to memory ### - */ - dav_error * (*get_report)(request_rec *r, - const dav_resource *resource, - const ap_xml_doc *doc, - ap_text_header *report); - - /* - ** OPTIONAL HOOKS - ** The following hooks are optional; if not defined, then the - ** corresponding protocol methods will be unsupported. - */ - - /* - ** Set the state of a checked-in version-controlled resource. - ** - ** If the request specified a version, the version resource - ** represents that version. If the request specified a label, - ** then "version" is NULL, and "label" is the label. - ** - ** The depth argument is ignored for a file, and can be 0, 1, or - ** DAV_INFINITY for a collection. The depth argument only applies - ** with a label, not a version. - ** - ** If an error occurs in a child resource, then the return value is - ** non-NULL, and *response is set to a multistatus response. - ** - ** This hook is optional; if not defined, then the UPDATE method - ** will not be supported. - */ - dav_error * (*update)(const dav_resource *resource, - const dav_resource *version, - const char *label, - int depth, - dav_response **response); - - /* - ** Add a label to a version. The resource is either a specific - ** version, or a version selector, in which case the label should - ** be added to the current target of the version selector. The - ** version selector cannot be checked out. - ** - ** If replace != 0, any existing label by the same name is - ** effectively deleted first. Otherwise, it is an error to - ** attempt to add a label which already exists on some version - ** of the same history resource. - ** - ** This hook is optional; if not defined, then the LABEL method - ** will not be supported. If it is defined, then the remove_label - ** hook must be defined also. - */ - dav_error * (*add_label)(const dav_resource *resource, - const char *label, - int replace); - - /* - ** Remove a label from a version. The resource is either a specific - ** version, or a version selector, in which case the label should - ** be added to the current target of the version selector. The - ** version selector cannot be checked out. - ** - ** It is an error if no such label exists on the specified version. - ** - ** This hook is optional, but if defined, the add_label hook - ** must be defined also. - */ - dav_error * (*remove_label)(const dav_resource *resource, - const char *label); - - /* - ** Determine whether a null resource can be created as a workspace. - ** The provider may restrict workspaces to certain locations. - ** Returns 0 if the resource cannot be a workspace. - ** - ** This hook is optional; if the provider does not support workspaces, - ** it should be set to NULL. - */ - int (*can_be_workspace)(const dav_resource *resource); - - /* - ** Create a workspace resource. The resource must not already - ** exist. Any element is passed to the provider - ** in the "doc" structure; it may be empty. - ** - ** If workspace creation is succesful, the state of the resource - ** object is updated appropriately. - ** - ** This hook is optional; if the provider does not support workspaces, - ** it should be set to NULL. - */ - dav_error * (*make_workspace)(dav_resource *resource, - ap_xml_doc *doc); - - /* - ** Determine whether a null resource can be created as an activity. - ** The provider may restrict activities to certain locations. - ** Returns 0 if the resource cannot be an activity. - ** - ** This hook is optional; if the provider does not support activities, - ** it should be set to NULL. - */ - int (*can_be_activity)(const dav_resource *resource); - - /* - ** Create an activity resource. The resource must not already - ** exist. - ** - ** If activity creation is succesful, the state of the resource - ** object is updated appropriately. - ** - ** This hook is optional; if the provider does not support activities, - ** it should be set to NULL. - */ - dav_error * (*make_activity)(dav_resource *resource); - - /* - ** Merge a resource (tree) into target resource (tree). - ** - ** ### more doc... - ** - ** This hook is optional; if the provider does not support merging, - ** then this should be set to NULL. - */ - dav_error * (*merge)(dav_resource *target, dav_resource *source, - int no_auto_merge, int no_checkout, - ap_xml_elem *prop_elem, - ap_filter_t *output); -}; - - -/* -------------------------------------------------------------------- -** -** BINDING FUNCTIONS -*/ - -/* binding provider hooks */ -struct dav_hooks_binding { - - /* Determine whether a resource can be the target of a binding. - * Returns 0 if the resource cannot be a binding target. - */ - int (*is_bindable)(const dav_resource *resource); - - /* Create a binding to a resource. - * The resource argument is the target of the binding; - * the binding argument must be a resource which does not already - * exist. - */ - dav_error * (*bind_resource)(const dav_resource *resource, - dav_resource *binding); - -}; - - -/* -------------------------------------------------------------------- -** -** MISCELLANEOUS STUFF -*/ - -/* allow providers access to the per-directory parameters */ -apr_table_t *dav_get_dir_params(const request_rec *r); - -/* fetch the "LimitXMLRequestBody" in force for this resource */ -apr_size_t dav_get_limit_xml_body(const request_rec *r); - -typedef struct { - int propid; /* live property ID */ - const dav_hooks_liveprop *provider; /* the provider defining this prop */ -} dav_elem_private; - -#ifdef __cplusplus -} -#endif - -#endif /* _MOD_DAV_H_ */ diff --git a/modules/dav/main/mod_dav.mak b/modules/dav/main/mod_dav.mak deleted file mode 100644 index 531297978c..0000000000 --- a/modules/dav/main/mod_dav.mak +++ /dev/null @@ -1,659 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on mod_dav.dsp -!IF "$(CFG)" == "" -CFG=mod_dav - Win32 Release -!MESSAGE No configuration specified. Defaulting to mod_dav - Win32 Release. -!ENDIF - -!IF "$(CFG)" != "mod_dav - Win32 Release" && "$(CFG)" !=\ - "mod_dav - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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 -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "mod_dav - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_dav.so" - -!ELSE - -ALL : "libhttpd - Win32 Release" "libaprutil - Win32 Release"\ - "libapr - Win32 Release" "$(OUTDIR)\mod_dav.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 ReleaseCLEAN" "libaprutil - Win32 ReleaseCLEAN"\ - "libhttpd - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\liveprop.obj" - -@erase "$(INTDIR)\mod_dav.idb" - -@erase "$(INTDIR)\mod_dav.obj" - -@erase "$(INTDIR)\props.obj" - -@erase "$(INTDIR)\providers.obj" - -@erase "$(INTDIR)\std_liveprop.obj" - -@erase "$(INTDIR)\util.obj" - -@erase "$(INTDIR)\util_lock.obj" - -@erase "$(OUTDIR)\mod_dav.exp" - -@erase "$(OUTDIR)\mod_dav.lib" - -@erase "$(OUTDIR)\mod_dav.map" - -@erase "$(OUTDIR)\mod_dav.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "..\..\..\srclib\aputil" /I\ - "..\..\..\srclib\sdbm" /I "..\..\..\srclib\expat-lite" /I\ - "..\..\..\srclib\apr\include" /I "../../../srclib/apr-util/include" /I\ - "..\..\..\include" /I "..\..\..\os\win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS"\ - /D "DAV_DECLARE_EXPORT" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_dav" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_dav.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows\ - /dll /incremental:no /pdb:"$(OUTDIR)\mod_dav.pdb" /map:"$(INTDIR)\mod_dav.map"\ - /machine:I386 /out:"$(OUTDIR)\mod_dav.so" /implib:"$(OUTDIR)\mod_dav.lib"\ - /base:@..\..\..\os\win32\BaseAddr.ref,mod_dav -LINK32_OBJS= \ - "$(INTDIR)\liveprop.obj" \ - "$(INTDIR)\mod_dav.obj" \ - "$(INTDIR)\props.obj" \ - "$(INTDIR)\providers.obj" \ - "$(INTDIR)\std_liveprop.obj" \ - "$(INTDIR)\util.obj" \ - "$(INTDIR)\util_lock.obj" \ - "..\..\..\Release\libhttpd.lib" \ - "..\..\..\srclib\apr-util\Release\libaprutil.lib" \ - "..\..\..\srclib\apr\Release\libapr.lib" - -"$(OUTDIR)\mod_dav.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "mod_dav - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_dav.so" - -!ELSE - -ALL : "libhttpd - Win32 Debug" "libaprutil - Win32 Debug"\ - "libapr - Win32 Debug" "$(OUTDIR)\mod_dav.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 DebugCLEAN" "libaprutil - Win32 DebugCLEAN"\ - "libhttpd - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\liveprop.obj" - -@erase "$(INTDIR)\mod_dav.idb" - -@erase "$(INTDIR)\mod_dav.obj" - -@erase "$(INTDIR)\props.obj" - -@erase "$(INTDIR)\providers.obj" - -@erase "$(INTDIR)\std_liveprop.obj" - -@erase "$(INTDIR)\util.obj" - -@erase "$(INTDIR)\util_lock.obj" - -@erase "$(OUTDIR)\mod_dav.exp" - -@erase "$(OUTDIR)\mod_dav.ilk" - -@erase "$(OUTDIR)\mod_dav.lib" - -@erase "$(OUTDIR)\mod_dav.map" - -@erase "$(OUTDIR)\mod_dav.pdb" - -@erase "$(OUTDIR)\mod_dav.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Zi /Od /I "..\..\..\srclib\aputil" /I\ - "..\..\..\srclib\sdbm" /I "..\..\..\srclib\expat-lite" /I\ - "..\..\..\srclib\apr\include" /I "../../../srclib/apr-util/include" /I\ - "..\..\..\include" /I "..\..\..\os\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS"\ - /D "DAV_DECLARE_EXPORT" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_dav" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_dav.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows\ - /dll /incremental:yes /pdb:"$(OUTDIR)\mod_dav.pdb" /map:"$(INTDIR)\mod_dav.map"\ - /debug /machine:I386 /out:"$(OUTDIR)\mod_dav.so"\ - /implib:"$(OUTDIR)\mod_dav.lib" /base:@..\..\..\os\win32\BaseAddr.ref,mod_dav -LINK32_OBJS= \ - "$(INTDIR)\liveprop.obj" \ - "$(INTDIR)\mod_dav.obj" \ - "$(INTDIR)\props.obj" \ - "$(INTDIR)\providers.obj" \ - "$(INTDIR)\std_liveprop.obj" \ - "$(INTDIR)\util.obj" \ - "$(INTDIR)\util_lock.obj" \ - "..\..\..\Debug\libhttpd.lib" \ - "..\..\..\srclib\apr-util\Debug\libaprutil.lib" \ - "..\..\..\srclib\apr\Debug\libapr.lib" - -"$(OUTDIR)\mod_dav.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "mod_dav - Win32 Release" || "$(CFG)" ==\ - "mod_dav - Win32 Debug" -SOURCE=.\liveprop.c -DEP_CPP_LIVEP=\ - "..\..\..\include\ap_config.h"\ - "..\..\..\include\ap_mmn.h"\ - "..\..\..\include\ap_release.h"\ - "..\..\..\include\httpd.h"\ - "..\..\..\include\pcreposix.h"\ - "..\..\..\include\util_uri.h"\ - "..\..\..\include\util_xml.h"\ - "..\..\..\os\win32\os.h"\ - "..\..\..\srclib\apr-util\include\apr_dbm.h"\ - "..\..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\..\srclib\apr-util\include\apr_xml.h"\ - "..\..\..\srclib\apr-util\include\apu.h"\ - "..\..\..\srclib\apr-util\include\apu_compat.h"\ - "..\..\..\srclib\apr\include\apr.h"\ - "..\..\..\srclib\apr\include\apr_compat.h"\ - "..\..\..\srclib\apr\include\apr_errno.h"\ - "..\..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\..\srclib\apr\include\apr_general.h"\ - "..\..\..\srclib\apr\include\apr_hash.h"\ - "..\..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\..\srclib\apr\include\apr_pools.h"\ - "..\..\..\srclib\apr\include\apr_strings.h"\ - "..\..\..\srclib\apr\include\apr_tables.h"\ - "..\..\..\srclib\apr\include\apr_time.h"\ - "..\..\..\srclib\apr\include\apr_user.h"\ - "..\..\..\srclib\apr\include\apr_want.h"\ - ".\mod_dav.h"\ - -NODEP_CPP_LIVEP=\ - "..\..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\liveprop.obj" : $(SOURCE) $(DEP_CPP_LIVEP) "$(INTDIR)" - - -SOURCE=.\mod_dav.c -DEP_CPP_MOD_D=\ - "..\..\..\include\ap_config.h"\ - "..\..\..\include\ap_mmn.h"\ - "..\..\..\include\ap_release.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\httpd.h"\ - "..\..\..\include\pcreposix.h"\ - "..\..\..\include\util_cfgtree.h"\ - "..\..\..\include\util_filter.h"\ - "..\..\..\include\util_script.h"\ - "..\..\..\include\util_uri.h"\ - "..\..\..\include\util_xml.h"\ - "..\..\..\os\win32\os.h"\ - "..\..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\..\srclib\apr-util\include\apr_dbm.h"\ - "..\..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\..\srclib\apr-util\include\apr_xml.h"\ - "..\..\..\srclib\apr-util\include\apu.h"\ - "..\..\..\srclib\apr-util\include\apu_compat.h"\ - "..\..\..\srclib\apr\include\apr.h"\ - "..\..\..\srclib\apr\include\apr_compat.h"\ - "..\..\..\srclib\apr\include\apr_dso.h"\ - "..\..\..\srclib\apr\include\apr_errno.h"\ - "..\..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\..\srclib\apr\include\apr_general.h"\ - "..\..\..\srclib\apr\include\apr_hash.h"\ - "..\..\..\srclib\apr\include\apr_lib.h"\ - "..\..\..\srclib\apr\include\apr_lock.h"\ - "..\..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\..\srclib\apr\include\apr_pools.h"\ - "..\..\..\srclib\apr\include\apr_portable.h"\ - "..\..\..\srclib\apr\include\apr_strings.h"\ - "..\..\..\srclib\apr\include\apr_tables.h"\ - "..\..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\..\srclib\apr\include\apr_time.h"\ - "..\..\..\srclib\apr\include\apr_user.h"\ - "..\..\..\srclib\apr\include\apr_want.h"\ - ".\mod_dav.h"\ - -NODEP_CPP_MOD_D=\ - "..\..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_dav.obj" : $(SOURCE) $(DEP_CPP_MOD_D) "$(INTDIR)" - - -SOURCE=.\props.c -DEP_CPP_PROPS=\ - "..\..\..\include\ap_config.h"\ - "..\..\..\include\ap_mmn.h"\ - "..\..\..\include\ap_release.h"\ - "..\..\..\include\http_log.h"\ - "..\..\..\include\http_request.h"\ - "..\..\..\include\httpd.h"\ - "..\..\..\include\pcreposix.h"\ - "..\..\..\include\util_filter.h"\ - "..\..\..\include\util_uri.h"\ - "..\..\..\include\util_xml.h"\ - "..\..\..\os\win32\os.h"\ - "..\..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\..\srclib\apr-util\include\apr_dbm.h"\ - "..\..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\..\srclib\apr-util\include\apr_xml.h"\ - "..\..\..\srclib\apr-util\include\apu.h"\ - "..\..\..\srclib\apr-util\include\apu_compat.h"\ - "..\..\..\srclib\apr\include\apr.h"\ - "..\..\..\srclib\apr\include\apr_compat.h"\ - "..\..\..\srclib\apr\include\apr_errno.h"\ - "..\..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\..\srclib\apr\include\apr_general.h"\ - "..\..\..\srclib\apr\include\apr_hash.h"\ - "..\..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\..\srclib\apr\include\apr_pools.h"\ - "..\..\..\srclib\apr\include\apr_strings.h"\ - "..\..\..\srclib\apr\include\apr_tables.h"\ - "..\..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\..\srclib\apr\include\apr_time.h"\ - "..\..\..\srclib\apr\include\apr_user.h"\ - "..\..\..\srclib\apr\include\apr_want.h"\ - ".\mod_dav.h"\ - -NODEP_CPP_PROPS=\ - "..\..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\props.obj" : $(SOURCE) $(DEP_CPP_PROPS) "$(INTDIR)" - - -SOURCE=.\providers.c -DEP_CPP_PROVI=\ - "..\..\..\include\ap_config.h"\ - "..\..\..\include\ap_mmn.h"\ - "..\..\..\include\ap_release.h"\ - "..\..\..\include\httpd.h"\ - "..\..\..\include\pcreposix.h"\ - "..\..\..\include\util_uri.h"\ - "..\..\..\include\util_xml.h"\ - "..\..\..\os\win32\os.h"\ - "..\..\..\srclib\apr-util\include\apr_dbm.h"\ - "..\..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\..\srclib\apr-util\include\apr_xml.h"\ - "..\..\..\srclib\apr-util\include\apu.h"\ - "..\..\..\srclib\apr-util\include\apu_compat.h"\ - "..\..\..\srclib\apr\include\apr.h"\ - "..\..\..\srclib\apr\include\apr_compat.h"\ - "..\..\..\srclib\apr\include\apr_errno.h"\ - "..\..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\..\srclib\apr\include\apr_general.h"\ - "..\..\..\srclib\apr\include\apr_hash.h"\ - "..\..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\..\srclib\apr\include\apr_pools.h"\ - "..\..\..\srclib\apr\include\apr_tables.h"\ - "..\..\..\srclib\apr\include\apr_time.h"\ - "..\..\..\srclib\apr\include\apr_user.h"\ - "..\..\..\srclib\apr\include\apr_want.h"\ - ".\mod_dav.h"\ - -NODEP_CPP_PROVI=\ - "..\..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\providers.obj" : $(SOURCE) $(DEP_CPP_PROVI) "$(INTDIR)" - - -SOURCE=.\std_liveprop.c -DEP_CPP_STD_L=\ - "..\..\..\include\ap_config.h"\ - "..\..\..\include\ap_mmn.h"\ - "..\..\..\include\ap_release.h"\ - "..\..\..\include\httpd.h"\ - "..\..\..\include\pcreposix.h"\ - "..\..\..\include\util_uri.h"\ - "..\..\..\include\util_xml.h"\ - "..\..\..\os\win32\os.h"\ - "..\..\..\srclib\apr-util\include\apr_dbm.h"\ - "..\..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\..\srclib\apr-util\include\apr_xml.h"\ - "..\..\..\srclib\apr-util\include\apu.h"\ - "..\..\..\srclib\apr-util\include\apu_compat.h"\ - "..\..\..\srclib\apr\include\apr.h"\ - "..\..\..\srclib\apr\include\apr_compat.h"\ - "..\..\..\srclib\apr\include\apr_errno.h"\ - "..\..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\..\srclib\apr\include\apr_general.h"\ - "..\..\..\srclib\apr\include\apr_hash.h"\ - "..\..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\..\srclib\apr\include\apr_pools.h"\ - "..\..\..\srclib\apr\include\apr_strings.h"\ - "..\..\..\srclib\apr\include\apr_tables.h"\ - "..\..\..\srclib\apr\include\apr_time.h"\ - "..\..\..\srclib\apr\include\apr_user.h"\ - "..\..\..\srclib\apr\include\apr_want.h"\ - ".\mod_dav.h"\ - -NODEP_CPP_STD_L=\ - "..\..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\std_liveprop.obj" : $(SOURCE) $(DEP_CPP_STD_L) "$(INTDIR)" - - -SOURCE=.\util.c -DEP_CPP_UTIL_=\ - "..\..\..\include\ap_config.h"\ - "..\..\..\include\ap_mmn.h"\ - "..\..\..\include\ap_release.h"\ - "..\..\..\include\http_config.h"\ - "..\..\..\include\http_log.h"\ - "..\..\..\include\http_protocol.h"\ - "..\..\..\include\http_request.h"\ - "..\..\..\include\http_vhost.h"\ - "..\..\..\include\httpd.h"\ - "..\..\..\include\pcreposix.h"\ - "..\..\..\include\util_cfgtree.h"\ - "..\..\..\include\util_filter.h"\ - "..\..\..\include\util_uri.h"\ - "..\..\..\include\util_xml.h"\ - "..\..\..\os\win32\os.h"\ - "..\..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\..\srclib\apr-util\include\apr_dbm.h"\ - "..\..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\..\srclib\apr-util\include\apr_xml.h"\ - "..\..\..\srclib\apr-util\include\apu.h"\ - "..\..\..\srclib\apr-util\include\apu_compat.h"\ - "..\..\..\srclib\apr\include\apr.h"\ - "..\..\..\srclib\apr\include\apr_compat.h"\ - "..\..\..\srclib\apr\include\apr_dso.h"\ - "..\..\..\srclib\apr\include\apr_errno.h"\ - "..\..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\..\srclib\apr\include\apr_general.h"\ - "..\..\..\srclib\apr\include\apr_hash.h"\ - "..\..\..\srclib\apr\include\apr_lib.h"\ - "..\..\..\srclib\apr\include\apr_lock.h"\ - "..\..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\..\srclib\apr\include\apr_pools.h"\ - "..\..\..\srclib\apr\include\apr_portable.h"\ - "..\..\..\srclib\apr\include\apr_strings.h"\ - "..\..\..\srclib\apr\include\apr_tables.h"\ - "..\..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\..\srclib\apr\include\apr_time.h"\ - "..\..\..\srclib\apr\include\apr_user.h"\ - "..\..\..\srclib\apr\include\apr_want.h"\ - ".\mod_dav.h"\ - -NODEP_CPP_UTIL_=\ - "..\..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\util.obj" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)" - - -SOURCE=.\util_lock.c -DEP_CPP_UTIL_L=\ - "..\..\..\include\ap_config.h"\ - "..\..\..\include\ap_mmn.h"\ - "..\..\..\include\ap_release.h"\ - "..\..\..\include\http_config.h"\ - "..\..\..\include\http_core.h"\ - "..\..\..\include\http_log.h"\ - "..\..\..\include\http_protocol.h"\ - "..\..\..\include\httpd.h"\ - "..\..\..\include\pcreposix.h"\ - "..\..\..\include\util_cfgtree.h"\ - "..\..\..\include\util_filter.h"\ - "..\..\..\include\util_uri.h"\ - "..\..\..\include\util_xml.h"\ - "..\..\..\os\win32\os.h"\ - "..\..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\..\srclib\apr-util\include\apr_dbm.h"\ - "..\..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\..\srclib\apr-util\include\apr_xml.h"\ - "..\..\..\srclib\apr-util\include\apu.h"\ - "..\..\..\srclib\apr-util\include\apu_compat.h"\ - "..\..\..\srclib\apr\include\apr.h"\ - "..\..\..\srclib\apr\include\apr_compat.h"\ - "..\..\..\srclib\apr\include\apr_dso.h"\ - "..\..\..\srclib\apr\include\apr_errno.h"\ - "..\..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\..\srclib\apr\include\apr_general.h"\ - "..\..\..\srclib\apr\include\apr_hash.h"\ - "..\..\..\srclib\apr\include\apr_lock.h"\ - "..\..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\..\srclib\apr\include\apr_pools.h"\ - "..\..\..\srclib\apr\include\apr_portable.h"\ - "..\..\..\srclib\apr\include\apr_strings.h"\ - "..\..\..\srclib\apr\include\apr_tables.h"\ - "..\..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\..\srclib\apr\include\apr_time.h"\ - "..\..\..\srclib\apr\include\apr_user.h"\ - "..\..\..\srclib\apr\include\apr_want.h"\ - ".\mod_dav.h"\ - -NODEP_CPP_UTIL_L=\ - "..\..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\util_lock.obj" : $(SOURCE) $(DEP_CPP_UTIL_L) "$(INTDIR)" - - -!IF "$(CFG)" == "mod_dav - Win32 Release" - -"libapr - Win32 Release" : - cd "..\../..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Release" - cd "..\..\modules\dav\main" - -"libapr - Win32 ReleaseCLEAN" : - cd "..\../..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\..\modules\dav\main" - -!ELSEIF "$(CFG)" == "mod_dav - Win32 Debug" - -"libapr - Win32 Debug" : - cd "..\../..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Debug" - cd "..\..\modules\dav\main" - -"libapr - Win32 DebugCLEAN" : - cd "..\../..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\..\modules\dav\main" - -!ENDIF - -!IF "$(CFG)" == "mod_dav - Win32 Release" - -"libaprutil - Win32 Release" : - cd "..\../..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\libaprutil.mak" CFG="libaprutil - Win32 Release"\ - - cd "..\..\modules\dav\main" - -"libaprutil - Win32 ReleaseCLEAN" : - cd "..\../..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libaprutil.mak"\ - CFG="libaprutil - Win32 Release" RECURSE=1 - cd "..\..\modules\dav\main" - -!ELSEIF "$(CFG)" == "mod_dav - Win32 Debug" - -"libaprutil - Win32 Debug" : - cd "..\../..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\libaprutil.mak" CFG="libaprutil - Win32 Debug" - cd "..\..\modules\dav\main" - -"libaprutil - Win32 DebugCLEAN" : - cd "..\../..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libaprutil.mak"\ - CFG="libaprutil - Win32 Debug" RECURSE=1 - cd "..\..\modules\dav\main" - -!ENDIF - -!IF "$(CFG)" == "mod_dav - Win32 Release" - -"libhttpd - Win32 Release" : - cd "..\../.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Release" - cd ".\modules\dav\main" - -"libhttpd - Win32 ReleaseCLEAN" : - cd "..\../.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Release"\ - RECURSE=1 - cd ".\modules\dav\main" - -!ELSEIF "$(CFG)" == "mod_dav - Win32 Debug" - -"libhttpd - Win32 Debug" : - cd "..\../.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Debug" - cd ".\modules\dav\main" - -"libhttpd - Win32 DebugCLEAN" : - cd "..\../.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Debug"\ - RECURSE=1 - cd ".\modules\dav\main" - -!ENDIF - - -!ENDIF - diff --git a/modules/dav/main/props.c b/modules/dav/main/props.c deleted file mode 100644 index 2929a9a297..0000000000 --- a/modules/dav/main/props.c +++ /dev/null @@ -1,1590 +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 - * . - */ - -/* -** DAV extension module for Apache 2.0.* -** - Property database handling (repository-independent) -** -** 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 "apr.h" -#include "apr_strings.h" - -#define APR_WANT_STDIO -#define APR_WANT_BYTEFUNC -#include "apr_want.h" - -#include "mod_dav.h" - -#include "http_log.h" -#include "http_request.h" - -/* -** There is some rough support for writable 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_WRITABLE_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 AP_XML_NS_ERROR_NOT_FOUND (AP_XML_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 */ - - apr_pool_t *p; /* the pool we should use */ - request_rec *r; /* the request record */ - - const 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 */ - - apr_array_header_t *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; - -}; - -/* NOTE: dav_core_props[] and the following enum must stay in sync. */ -/* ### move these into a "core" liveprop provider? */ -static const char * const dav_core_props[] = -{ - "getcontenttype", - "getcontentlanguage", - "lockdiscovery", - "supportedlock", - - NULL /* sentinel */ -}; -enum { - DAV_PROPID_CORE_getcontenttype = DAV_PROPID_CORE, - DAV_PROPID_CORE_getcontentlanguage, - DAV_PROPID_CORE_lockdiscovery, - DAV_PROPID_CORE_supportedlock, - - 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 int dav_find_liveprop_provider(dav_propdb *propdb, - const char *ns_uri, - const char *propname, - const dav_hooks_liveprop **provider) -{ - int propid; - - *provider = NULL; - - if (ns_uri == NULL) { - /* policy: liveprop providers cannot define no-namespace properties */ - return DAV_PROPID_CORE_UNKNOWN; - } - - /* check liveprop providers first, so they can define core properties */ - propid = dav_run_find_liveprop(propdb->resource, ns_uri, propname, - provider); - if (propid != 0) { - return propid; - } - - /* check for core property */ - if (strcmp(ns_uri, "DAV:") == 0) { - const char * const *p = dav_core_props; - - for (propid = DAV_PROPID_CORE; *p != NULL; ++p, ++propid) - if (strcmp(propname, *p) == 0) { - return propid; - } - } - - /* no provider for this property */ - return DAV_PROPID_CORE_UNKNOWN; -} - -static void dav_find_liveprop(dav_propdb *propdb, ap_xml_elem *elem) -{ - const char *ns_uri; - dav_elem_private *priv = elem->private; - const dav_hooks_liveprop *hooks; - - - if (elem->ns == AP_XML_NS_NONE) - ns_uri = NULL; - else if (elem->ns == AP_XML_NS_DAV_ID) - ns_uri = "DAV:"; - else - ns_uri = AP_XML_GET_URI_ITEM(propdb->ns_xlate, elem->ns); - - priv->propid = dav_find_liveprop_provider(propdb, ns_uri, elem->name, - &hooks); - - /* ### this test seems redundant... */ - if (priv->propid != DAV_PROPID_CORE_UNKNOWN) { - priv->provider = hooks; - } -} - -/* is the live property read/write? */ -static int dav_rw_liveprop(dav_propdb *propdb, dav_elem_private *priv) -{ - int propid = priv->propid; - - /* - ** Check the liveprop provider (if this is a provider-defined prop) - */ - if (priv->provider != NULL) { - return (*priv->provider->is_writable)(propdb->resource, propid); - } - - /* these are defined as read-only */ - if (propid == DAV_PROPID_CORE_lockdiscovery -#if DAV_DISABLE_WRITABLE_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; - } - - /* - ** We don't recognize 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, - NULL); -} - -static dav_error * dav_insert_coreprop(dav_propdb *propdb, - int propid, const char *name, - dav_prop_insert what, - ap_text_header *phdr, - dav_prop_insert *inserted) -{ - const char *value = NULL; - dav_error *err; - - *inserted = DAV_PROP_INSERT_NOTDEF; - - /* fast-path the common case */ - if (propid == DAV_PROPID_CORE_UNKNOWN) - return NULL; - - switch (propid) { - - case DAV_PROPID_CORE_lockdiscovery: - if (propdb->lockdb != NULL) { - 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 = apr_pstrdup(propdb->p, propdb->wb_lock.buf); - } - } - break; - - case DAV_PROPID_CORE_supportedlock: - if (propdb->lockdb != NULL) { - value = (*propdb->lockdb->hooks->get_supportedlock)(propdb->resource); - } - 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 = apr_table_get(propdb->subreq->headers_out, - "Content-Language")) != NULL) { - value = lang; - } - break; - } - - default: - /* fall through to interpret as a dead property */ - break; - } - - /* if something was supplied, then insert it */ - if (value != NULL) { - const char *s; - - if (what == DAV_PROP_INSERT_SUPPORTED) { - /* use D: prefix to refer to the DAV: namespace URI, - * and let the namespace attribute default to "DAV:" - */ - s = apr_psprintf(propdb->p, - "" DEBUG_CR, - name); - } - else if (what == DAV_PROP_INSERT_VALUE && *value != '\0') { - /* use D: prefix to refer to the DAV: namespace URI */ - s = apr_psprintf(propdb->p, "%s" DEBUG_CR, - name, value, name); - } - else { - /* use D: prefix to refer to the DAV: namespace URI */ - s = apr_psprintf(propdb->p, "" DEBUG_CR, name); - } - ap_text_append(propdb->p, phdr, s); - - *inserted = what; - } - - return NULL; -} - -static dav_error * dav_insert_liveprop(dav_propdb *propdb, - const ap_xml_elem *elem, - dav_prop_insert what, - ap_text_header *phdr, - dav_prop_insert *inserted) -{ - dav_elem_private *priv = elem->private; - - *inserted = DAV_PROP_INSERT_NOTDEF; - - if (priv->provider == NULL) { - /* this is a "core" property that we define */ - return dav_insert_coreprop(propdb, priv->propid, elem->name, - what, phdr, inserted); - } - - /* ask the provider (that defined this prop) to insert the prop */ - *inserted = (*priv->provider->insert_prop)(propdb->resource, priv->propid, - what, phdr); - - return NULL; -} - -static void dav_append_prop(dav_propdb *propdb, - const char *name, const char *value, - ap_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 = apr_psprintf(propdb->p, "<%s/>" DEBUG_CR, name+1); - } - else { - s = apr_psprintf(propdb->p, "" DEBUG_CR, name); - } - } - else if (*lang != '\0') { - if (*name == ':') { - /* "no namespace" case */ - s = apr_psprintf(propdb->p, "<%s xml:lang=\"%s\">%s" DEBUG_CR, - name+1, lang, value, name+1); - } - else { - s = apr_psprintf(propdb->p, "%s" DEBUG_CR, - name, lang, value, name); - } - } - else if (*name == ':') { - /* "no namespace" case */ - s = apr_psprintf(propdb->p, "<%s>%s" DEBUG_CR, name+1, value, name+1); - } - else { - s = apr_psprintf(propdb->p, "%s" DEBUG_CR, name, value, name); - } - ap_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 -** ### AP_XML_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 = apr_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 != AP_XML_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 = AP_XML_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(apr_pool_t *p, const char *pre_prefix, int ns, - const char *ns_uri, ap_text_header *phdr) -{ - const char *s; - - s = apr_psprintf(p, " xmlns:%s%d=\"%s\"", pre_prefix, ns, ns_uri); - ap_text_append(p, phdr, s); -} - -/* return all known namespaces (in this propdb) */ -static void dav_get_propdb_xmlns(dav_propdb *propdb, ap_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, - apr_array_header_t *ns_table, - const char *pre_prefix, - ap_text_header *phdr) -{ - if (marks[ns]) - return; - marks[ns] = 1; - - dav_insert_xmlns(propdb->p, - pre_prefix, ns, AP_XML_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 ap_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 == AP_XML_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 (AP_XML_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; -} - -static 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, - const dav_resource *resource, - int ro, - apr_array_header_t * ns_xlate, - dav_propdb **p_propdb) -{ - dav_propdb *propdb = apr_pcalloc(r->pool, sizeof(*propdb)); - - *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->lockdb = lockdb; - - /* always defer actual open, to avoid expense of accessing db - * when only live properties are involved - */ - propdb->deferred = 1; - - /* ### 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, dav_prop_insert what) -{ - const dav_hooks_db *db_hooks = propdb->db_hooks; - ap_text_header hdr = { 0 }; - ap_text_header hdr_ns = { 0 }; - dav_get_props_result result = { 0 }; - int found_contenttype = 0; - int found_contentlang = 0; - dav_prop_insert unused_inserted; - - /* if not just getting supported live properties, - * scan all properties in the dead prop database - */ - if (what != DAV_PROP_INSERT_SUPPORTED) { - if (propdb->deferred) { - /* ### what to do with db open error? */ - (void) dav_really_open_db(propdb, 1 /*ro*/); - } - - /* generate all the namespaces that are in the propdb */ - dav_get_propdb_xmlns(propdb, &hdr_ns); - - /* initialize the result with some start tags... */ - ap_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; - - /* - ** 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] == 'g') { - if (strcmp(colon + 1, "getcontenttype") == 0) { - found_contenttype = 1; - } - else if (strcmp(colon + 1, "getcontentlanguage") == 0) { - found_contentlang = 1; - } - } - } - - if (what == DAV_PROP_INSERT_VALUE) { - 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 */ - dav_add_all_liveprop_xmlns(propdb->p, &hdr_ns); - } - - /* ask the liveprop providers to insert their properties */ - dav_run_insert_all_liveprops(propdb->r, propdb->resource, what, &hdr); - - /* insert the standard properties */ - /* ### should be handling the return errors here */ - (void)dav_insert_coreprop(propdb, - DAV_PROPID_CORE_supportedlock, "supportedlock", - what, &hdr, &unused_inserted); - (void)dav_insert_coreprop(propdb, - DAV_PROPID_CORE_lockdiscovery, "lockdiscovery", - what, &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", - what, &hdr, &unused_inserted); - } - if (!found_contentlang) { - /* ### should be handling the return error here */ - (void)dav_insert_coreprop(propdb, - DAV_PROPID_CORE_getcontentlanguage, - "getcontentlanguage", - what, &hdr, &unused_inserted); - } - - /* if not just reporting on supported live props, - * terminate the result */ - if (what != DAV_PROP_INSERT_SUPPORTED) { - ap_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, ap_xml_doc *doc) -{ - const dav_hooks_db *db_hooks = propdb->db_hooks; - ap_xml_elem *elem = dav_find_child(doc->root, "prop"); - ap_text_header hdr_good = { 0 }; - ap_text_header hdr_bad = { 0 }; - ap_text_header hdr_ns = { 0 }; - int have_good = 0; - int propdb_xmlns_done = 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 */ - ap_text_append(propdb->p, &hdr_good, - "" DEBUG_CR - "" DEBUG_CR); - - /* ### 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 = apr_pcalloc(propdb->p, propdb->ns_xlate->nelts); - - /* same for the liveprops */ - marks_liveprop = apr_pcalloc(propdb->p, dav_get_liveprop_ns_count() + 1); - - for (elem = elem->first_child; elem; elem = elem->next) { - dav_datum key = { 0 }; - dav_datum value = { 0 }; - dav_elem_private *priv; - dav_error *err; - dav_prop_insert inserted; - int is_liveprop = 0; - - /* - ** First try live property providers; if they don't handle - ** the property, then try looking it up in the propdb. - */ - - if (elem->private == NULL) { - elem->private = apr_pcalloc(propdb->p, sizeof(*priv)); - } - priv = elem->private; - - /* cache the propid; dav_get_props() could be called many times */ - if (priv->propid == 0) - dav_find_liveprop(propdb, elem); - - if (priv->propid != DAV_PROPID_CORE_UNKNOWN) { - is_liveprop = 1; - - /* insert the property. returns 1 if an insertion was done. */ - if ((err = dav_insert_liveprop(propdb, elem, DAV_PROP_INSERT_VALUE, - &hdr_good, &inserted)) != NULL) { - /* ### need to propagate the error to the caller... */ - /* ### skip it for now, as if nothing was inserted */ - } - if (inserted == DAV_PROP_INSERT_VALUE) { - have_good = 1; - - /* - ** Add the liveprop's namespace URIs. Note that provider==NULL - ** for core properties. - */ - if (priv->provider != NULL) { - const char * const * scan_ns_uri; - - for (scan_ns_uri = priv->provider->namespace_uris; - *scan_ns_uri != NULL; - ++scan_ns_uri) { - int ns; - - ns = dav_get_liveprop_ns_index(*scan_ns_uri); - if (marks_liveprop[ns]) - continue; - marks_liveprop[ns] = 1; - - dav_insert_xmlns(propdb->p, "lp", ns, *scan_ns_uri, - &hdr_ns); - } - } - - continue; - } - else if (inserted == DAV_PROP_INSERT_NOTDEF) { - /* allow property to be handled as a dead property */ - is_liveprop = 0; - } - } - - /* - ** If not handled as a live property, look in the dead property - ** database. - */ - if (!is_liveprop) { - /* make sure propdb is really open */ - if (propdb->deferred) { - /* ### what to do with db open error? */ - (void) dav_really_open_db(propdb, 1 /*ro*/); - } - - /* if not done yet, - * generate all the namespaces that are in the propdb - */ - if (!propdb_xmlns_done) { - dav_get_propdb_xmlns(propdb, &hdr_ns); - propdb_xmlns_done = 1; - } - - /* - ** 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 (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) { - ap_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 == AP_XML_NS_NONE) { - /* - * elem has a prefix already (xml...:name) or the elem - * simply has no namespace. - */ - s = apr_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 = apr_psprintf(propdb->p, "" DEBUG_CR, - elem->ns, elem->name); - } - ap_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); - } - } - - ap_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) { - ap_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_get_liveprop_supported(dav_propdb *propdb, - const char *ns_uri, - const char *propname, - ap_text_header *body) -{ - int propid; - const dav_hooks_liveprop *hooks; - - propid = dav_find_liveprop_provider(propdb, ns_uri, propname, &hooks); - - if (propid != DAV_PROPID_CORE_UNKNOWN) { - if (hooks == NULL) { - /* this is a "core" property that we define */ - dav_prop_insert unused_inserted; - dav_insert_coreprop(propdb, propid, propname, - DAV_PROP_INSERT_SUPPORTED, body, &unused_inserted); - } - else { - (*hooks->insert_prop)(propdb->resource, propid, - DAV_PROP_INSERT_SUPPORTED, body); - } - } -} - -void dav_prop_validate(dav_prop_ctx *ctx) -{ - dav_propdb *propdb = ctx->propdb; - ap_xml_elem *prop = ctx->prop; - dav_elem_private *priv; - - priv = ctx->prop->private = apr_pcalloc(propdb->p, sizeof(*priv)); - - /* - ** 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 (priv->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 = priv->provider != NULL; - } - - if (!dav_rw_liveprop(propdb, priv)) { - 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 = (*priv->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 writable). - */ - 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; - dav_elem_private *priv = ctx->prop->private; - - rollback = apr_pcalloc(propdb->p, sizeof(*rollback)); - ctx->rollback = rollback; - - if (ctx->is_liveprop) { - err = (*priv->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 */ - ap_xml_quote_elem(propdb->p, ctx->prop); - - /* generate a text blob for the xml:lang plus the contents */ - ap_xml_to_text(propdb->p, ctx->prop, AP_XML_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) -{ - dav_elem_private *priv = ctx->prop->private; - - /* - ** 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) { - (*priv->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; - dav_elem_private *priv = ctx->prop->private; - - /* 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 = (*priv->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 b0a18cf5f4..0000000000 --- a/modules/dav/main/providers.c +++ /dev/null @@ -1,84 +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 "apr_pools.h" -#include "apr_hash.h" -#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; -} - -DAV_DECLARE(void) dav_register_provider(apr_pool_t *p, const char *name, - const dav_provider *provider) -{ - if (dav_repos_providers == NULL) { - dav_repos_providers = apr_hash_make(p); - apr_pool_cleanup_register(p, NULL, dav_cleanup_providers, apr_pool_cleanup_null); - } - - /* just set it. no biggy if it was there before. */ - apr_hash_set(dav_repos_providers, name, APR_HASH_KEY_STRING, provider); -} - -const dav_provider * dav_lookup_provider(const char *name) -{ - return apr_hash_get(dav_repos_providers, name, APR_HASH_KEY_STRING); -} diff --git a/modules/dav/main/std_liveprop.c b/modules/dav/main/std_liveprop.c deleted file mode 100644 index e10a5b1b82..0000000000 --- a/modules/dav/main/std_liveprop.c +++ /dev/null @@ -1,229 +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 "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 } /* 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, dav_prop_insert what, - ap_text_header *phdr) -{ - const char *value; - const char *s; - 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_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 (what == DAV_PROP_INSERT_SUPPORTED) { - s = apr_psprintf(p, - "" DEBUG_CR, - info->name, dav_core_namespace_uris[info->ns]); - } - else if (what == DAV_PROP_INSERT_VALUE && *value != '\0') { - s = apr_psprintf(p, "%s" DEBUG_CR, - global_ns, info->name, value, global_ns, info->name); - } - else { - s = apr_psprintf(p, "" DEBUG_CR, global_ns, info->name); - } - ap_text_append(p, phdr, s); - - /* we inserted what was asked for */ - return what; -} - -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 writable 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(const dav_resource *resource, - 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, - dav_prop_insert what, ap_text_header *phdr) -{ - (void) dav_core_insert_prop(resource, DAV_PROPID_resourcetype, - what, 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 5a8d4728e0..0000000000 --- a/modules/dav/main/util.c +++ /dev/null @@ -1,1958 +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 - * . - */ - -/* -** DAV extension module for Apache 2.0.* -** - various utilities, repository-independent -*/ - -#include "apr_strings.h" -#include "apr_lib.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#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_DECLARE(dav_error*) dav_new_error(apr_pool_t *p, int status, - int error_id, const char *desc) -{ - int save_errno = errno; - dav_error *err = apr_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_DECLARE(dav_error*) dav_push_error(apr_pool_t *p, int status, - int error_id, const char *desc, - dav_error *prev) -{ - dav_error *err = apr_pcalloc(p, sizeof(*err)); - - err->status = status; - err->error_id = error_id; - err->desc = desc; - err->prev = prev; - - return err; -} - -DAV_DECLARE(void) dav_check_bufsize(apr_pool_t * p, dav_buffer *pbuf, - apr_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 = apr_palloc(p, pbuf->alloc_len); - memcpy(newbuf, pbuf->buf, pbuf->cur_len); - pbuf->buf = newbuf; - } -} - -DAV_DECLARE(void) dav_set_bufsize(apr_pool_t * p, dav_buffer *pbuf, - apr_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 = apr_palloc(p, pbuf->alloc_len); - } - pbuf->cur_len = size; -} - - -/* initialize a buffer and copy the specified (null-term'd) string into it */ -DAV_DECLARE(void) dav_buffer_init(apr_pool_t *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 */ -DAV_DECLARE(void) dav_buffer_append(apr_pool_t *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 */ -DAV_DECLARE(void) dav_buffer_place(apr_pool_t *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 */ -DAV_DECLARE(void) dav_buffer_place_mem(apr_pool_t *p, dav_buffer *pbuf, - const void *mem, apr_size_t amt, - apr_size_t pad) -{ - dav_check_bufsize(p, pbuf, amt + pad); - memcpy(pbuf->buf + pbuf->cur_len, mem, amt); -} - -/* -** 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, - int must_be_absolute) -{ - dav_lookup_result result = { 0 }; - const char *scheme; - apr_port_t 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 && must_be_absolute) { - result.err.status = HTTP_BAD_REQUEST; - result.err.desc = "Destination URI must be an absolute URI."; - return result; - } - - /* the URI must not have a query (args) or a fragment */ - 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; - } - - /* If the scheme or port was provided, then make sure that it matches - the scheme/port of this request. If the request must be absolute, - then require the (explicit/implicit) scheme/port be matching. - - ### hmm. if a port wasn't provided (does the parse return port==0?), - ### but we're on a non-standard port, then we won't detect that the - ### URI's port implies the wrong one. - */ - if (comp.scheme != NULL || comp.port != 0 || must_be_absolute) - { - /* ### 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. - */ - apr_sockaddr_port_get(&port, r->connection->local_addr); - if (strcasecmp(comp.scheme, scheme) != 0 || - comp.port != port) { - result.err.status = HTTP_BAD_GATEWAY; - result.err.desc = apr_psprintf(r->pool, - "Destination URI refers to " - "different scheme or port " - "(%s://hostname:%d)" APR_EOL_STR - "(want: %s://hostname:%d)", - comp.scheme ? comp.scheme : scheme, - comp.port ? comp.port : port, - scheme, port); - 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 (comp.hostname != NULL - && strrchr(comp.hostname, '.') == NULL - && (domain = strchr(r->server->server_hostname, '.')) != NULL) { - comp.hostname = apr_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). - */ - result.rnew = ap_sub_req_method_uri(r->method, new_file, r, NULL); - - return result; -} - -/* --------------------------------------------------------------- -** -** XML UTILITY FUNCTIONS -*/ - -/* validate that the root element uses a given DAV: tagname (TRUE==valid) */ -int dav_validate_root(const ap_xml_doc *doc, const char *tagname) -{ - return doc->root && - doc->root->ns == AP_XML_NS_DAV_ID && - strcmp(doc->root->name, tagname) == 0; -} - -/* find and return the (unique) child with a given DAV: tagname */ -ap_xml_elem *dav_find_child(const ap_xml_elem *elem, const char *tagname) -{ - ap_xml_elem *child = elem->first_child; - - for (; child; child = child->next) - if (child->ns == AP_XML_NS_DAV_ID && !strcmp(child->name, tagname)) - return child; - return NULL; -} - -/* gather up all the CDATA into a single string */ -const char *dav_xml_get_cdata(const ap_xml_elem *elem, apr_pool_t *pool, - int strip_white) -{ - apr_size_t len = 0; - ap_text *scan; - const ap_xml_elem *child; - char *cdata; - char *s; - apr_size_t tlen; - const char *found_text = NULL; /* initialize to avoid gcc warning */ - int found_count = 0; - - for (scan = elem->first_cdata.first; scan != NULL; scan = scan->next) { - found_text = scan->text; - ++found_count; - len += strlen(found_text); - } - - for (child = elem->first_child; child != NULL; child = child->next) { - for (scan = child->following_cdata.first; - scan != NULL; - scan = scan->next) { - found_text = scan->text; - ++found_count; - len += strlen(found_text); - } - } - - /* some fast-path cases: - * 1) zero-length cdata - * 2) a single piece of cdata with no whitespace to strip - */ - if (len == 0) - return ""; - if (found_count == 1) { - if (!strip_white - || (!apr_isspace(*found_text) - && !apr_isspace(found_text[len - 1]))) - return found_text; - } - - cdata = s = apr_palloc(pool, len + 1); - - for (scan = elem->first_cdata.first; scan != NULL; scan = scan->next) { - tlen = strlen(scan->text); - memcpy(s, scan->text, tlen); - s += tlen; - } - - for (child = elem->first_child; child != NULL; child = child->next) { - for (scan = child->following_cdata.first; - scan != NULL; - scan = scan->next) { - tlen = strlen(scan->text); - memcpy(s, scan->text, tlen); - s += tlen; - } - } - - *s = '\0'; - - if (strip_white) { - /* trim leading whitespace */ - while (apr_isspace(*cdata)) /* assume: return false for '\0' */ - ++cdata; - - /* trim trailing whitespace */ - while (len-- > 0 && apr_isspace(cdata[len])) - continue; - cdata[len + 1] = '\0'; - } - - return cdata; -} - -/* --------------------------------------------------------------- -** -** 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 = apr_table_get(r->headers_in, "Timeout"); - const char *timeout = apr_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(apr_pool_t *p, dav_if_header *next_ih, - const char *uri, size_t uri_len) -{ - dav_if_header *ih; - - if ((ih = apr_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(apr_pool_t *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 = apr_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 = 0; - 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 = apr_pstrdup(r->pool, apr_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, - apr_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, - apr_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(apr_pool_t *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; - apr_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->user || - strcmp(lock->auth_user, r->user))) { - const char *errmsg; - - errmsg = apr_pstrcat(p, "User \"", - r->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. - ** - ** 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... 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, - apr_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_walk_resource *wres, int calltype) -{ - dav_walker_ctx *ctx = wres->walk_ctx; - dav_error *err; - - if ((err = dav_validate_resource_state(ctx->w.pool, wres->resource, - ctx->w.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) - || (*wres->resource->hooks->is_same_resource)(wres->resource, - ctx->w.root)) { - /* ### maybe push a higher-level description? */ - return err; - } - - /* associate the error with the current URI */ - dav_add_response(wres, 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 = apr_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 = apr_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; - } - } - - /* (1) Validate the specified resource, at the specified depth */ - if (resource->exists && depth > 0) { - dav_walker_ctx ctx = { { 0 } }; - dav_response *multi_status; - - ctx.w.walk_type = DAV_WALKTYPE_NORMAL; - ctx.w.func = dav_validate_walker; - ctx.w.walk_ctx = &ctx; - ctx.w.pool = r->pool; - ctx.w.root = resource; - - ctx.if_header = if_header; - ctx.r = r; - ctx.flags = flags; - - if (lockdb != NULL) { - ctx.w.lockdb = lockdb; - ctx.w.walk_type |= DAV_WALKTYPE_LOCKNULL; - } - - err = (*repos_hooks->walk)(&ctx.w, DAV_INFINITY, &multi_status); - if (err == NULL) { - *response = multi_status;; - } - /* 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; - - err = (*repos_hooks->get_parent_resource)(resource, &parent_resource); - - if (err == NULL && parent_resource == NULL) { - err = dav_new_error(r->pool, HTTP_FORBIDDEN, 0, - "Cannot access parent of repository root."); - } - else if (err == NULL) { - 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 = apr_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 = apr_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) { - ap_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 = apr_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 = apr_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 = apr_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; -} - -#if 0 /* not needed right now... */ - -static const char *strip_white(const char *s, apr_pool_t *pool) -{ - apr_size_t idx; - - /* trim leading whitespace */ - while (apr_isspace(*s)) /* assume: return false for '\0' */ - ++s; - - /* trim trailing whitespace */ - idx = strlen(s) - 1; - if (apr_isspace(s[idx])) { - char *s2 = apr_pstrdup(pool, s); - - while (apr_isspace(s2[idx]) && idx > 0) - --idx; - s2[idx + 1] = '\0'; - return s2; - } - - return s; -} -#endif - -#define DAV_LABEL_HDR "Label" - -/* dav_add_vary_header - * - * If there were any headers in the request which require a Vary header - * in the response, add it. - */ -void dav_add_vary_header(request_rec *in_req, - request_rec *out_req, - const dav_resource *resource) -{ - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(in_req); - - /* ### this is probably all wrong... I think there is a function in - ### the Apache API to add things to the Vary header. need to check */ - - /* Only versioning headers require a Vary response header, - * so only do this check if there is a versioning provider */ - if (vsn_hooks != NULL) { - const char *target = apr_table_get(in_req->headers_in, DAV_LABEL_HDR); - const char *vary = apr_table_get(out_req->headers_out, "Vary"); - - /* If Target-Selector specified, add it to the Vary header */ - if (target != NULL) { - if (vary == NULL) - vary = DAV_LABEL_HDR; - else - vary = apr_pstrcat(out_req->pool, vary, "," DAV_LABEL_HDR, - NULL); - - apr_table_setn(out_req->headers_out, "Vary", vary); - } - } -} - -/* dav_can_auto_checkout - * - * Determine whether auto-checkout is enabled for a resource. - * r - the request_rec - * resource - the resource - * auto_version - the value of the auto_versionable hook for the resource - * lockdb - pointer to lock database (opened if necessary) - * auto_checkout - set to 1 if auto-checkout enabled - */ -static dav_error * dav_can_auto_checkout( - request_rec *r, - dav_resource *resource, - dav_auto_version auto_version, - dav_lockdb **lockdb, - int *auto_checkout) -{ - dav_error *err; - dav_lock *lock_list; - - *auto_checkout = 0; - - if (auto_version == DAV_AUTO_VERSION_ALWAYS) { - *auto_checkout = 1; - } - else if (auto_version == DAV_AUTO_VERSION_LOCKED) { - if (*lockdb == NULL) { - const dav_hooks_locks *locks_hooks = DAV_GET_HOOKS_LOCKS(r); - - if (locks_hooks == NULL) { - return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - "Auto-checkout is only enabled for locked resources, " - "but there is no lock provider."); - } - - if ((err = (*locks_hooks->open_lockdb)(r, 0, 0, lockdb)) != NULL) { - return dav_push_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - "Cannot open lock database to determine " - "auto-versioning behavior.", - err); - } - } - - if ((err = dav_lock_query(*lockdb, resource, &lock_list)) != NULL) { - return dav_push_error(r->pool, - HTTP_INTERNAL_SERVER_ERROR, 0, - "The locks could not be queried for " - "determining auto-versioning behavior.", - err); - } - - if (lock_list != NULL) - *auto_checkout = 1; - } - - return NULL; -} - -/* see mod_dav.h for docco */ -dav_error *dav_auto_checkout( - request_rec *r, - dav_resource *resource, - int parent_only, - dav_auto_version_info *av_info) -{ - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); - dav_lockdb *lockdb = NULL; - dav_error *err = NULL; - - /* Initialize results */ - memset(av_info, 0, sizeof(*av_info)); - - /* if no versioning provider, just return */ - if (vsn_hooks == NULL) - return NULL; - - /* check parent resource if requested or if resource must be created */ - if (!resource->exists || parent_only) { - dav_resource *parent; - - if ((err = (*resource->hooks->get_parent_resource)(resource, - &parent)) != NULL) - goto done; - - if (parent == NULL || !parent->exists) { - err = dav_new_error(r->pool, HTTP_CONFLICT, 0, - apr_psprintf(r->pool, - "Missing one or more intermediate " - "collections. Cannot create resource %s.", - ap_escape_html(r->pool, resource->uri))); - goto done; - } - - av_info->parent_resource = parent; - - /* if parent versioned and not checked out, see if it can be */ - if (parent->versioned && !parent->working) { - int checkout_parent; - - if ((err = dav_can_auto_checkout(r, parent, - (*vsn_hooks->auto_versionable)(parent), - &lockdb, &checkout_parent)) - != NULL) { - goto done; - } - - if (!checkout_parent) { - err = dav_new_error(r->pool, HTTP_CONFLICT, 0, - ""); - goto done; - } - - /* Try to checkout the parent collection. - * Note that auto-versioning can only be applied to a version selector, - * so no separate working resource will be created. - */ - if ((err = (*vsn_hooks->checkout)(parent, 1 /*auto_checkout*/, - 0, 0, 0, NULL, NULL)) - != NULL) - { - err = dav_push_error(r->pool, HTTP_CONFLICT, 0, - apr_psprintf(r->pool, - "Unable to auto-checkout parent collection. " - "Cannot create resource %s.", - ap_escape_html(r->pool, resource->uri)), - err); - goto done; - } - - /* remember that parent was checked out */ - av_info->parent_checkedout = 1; - } - } - - /* if only checking parent, we're done */ - if (parent_only) - goto done; - - /* if creating a new resource, see if it should be version-controlled */ - if (!resource->exists - && (*vsn_hooks->auto_versionable)(resource) == DAV_AUTO_VERSION_ALWAYS) { - - if ((err = (*vsn_hooks->vsn_control)(resource, NULL)) != NULL) { - err = dav_push_error(r->pool, HTTP_CONFLICT, 0, - apr_psprintf(r->pool, - "Unable to create versioned resource %s.", - ap_escape_html(r->pool, resource->uri)), - err); - goto done; - } - - /* remember that resource was created */ - av_info->resource_versioned = 1; - } - - /* if resource is versioned, make sure it is checked out */ - if (resource->versioned && !resource->working) { - int checkout_resource; - - if ((err = dav_can_auto_checkout(r, resource, - (*vsn_hooks->auto_versionable)(resource), - &lockdb, &checkout_resource)) != NULL) { - goto done; - } - - if (!checkout_resource) { - err = dav_new_error(r->pool, HTTP_CONFLICT, 0, - ""); - goto done; - } - - /* Auto-versioning can only be applied to version selectors, so - * no separate working resource will be created. */ - if ((err = (*vsn_hooks->checkout)(resource, 1 /*auto_checkout*/, - 0, 0, 0, NULL, NULL)) - != NULL) - { - err = dav_push_error(r->pool, HTTP_CONFLICT, 0, - apr_psprintf(r->pool, - "Unable to checkout resource %s.", - ap_escape_html(r->pool, resource->uri)), - err); - goto done; - } - - /* remember that resource was checked out */ - av_info->resource_checkedout = 1; - } - -done: - - /* make sure lock database is closed */ - if (lockdb != NULL) - (*lockdb->hooks->close_lockdb)(lockdb); - - /* if an error occurred, undo any auto-versioning operations already done */ - if (err != NULL) { - dav_auto_checkin(r, resource, 1 /*undo*/, 0 /*unlock*/, av_info); - return err; - } - - return NULL; -} - -/* see mod_dav.h for docco */ -dav_error *dav_auto_checkin( - request_rec *r, - dav_resource *resource, - int undo, - int unlock, - dav_auto_version_info *av_info) -{ - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); - dav_error *err = NULL; - dav_auto_version auto_version; - - /* If no versioning provider, this is a no-op */ - if (vsn_hooks == NULL) - return NULL; - - /* If undoing auto-checkouts, then do uncheckouts */ - if (undo) { - if (resource != NULL) { - if (av_info->resource_checkedout) { - if ((err = (*vsn_hooks->uncheckout)(resource)) != NULL) { - return dav_push_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - apr_psprintf(r->pool, - "Unable to undo auto-checkout " - "of resource %s.", - ap_escape_html(r->pool, resource->uri)), - err); - } - } - - if (av_info->resource_versioned) { - dav_response *response; - - /* ### should we do anything with the response? */ - if ((err = (*resource->hooks->remove_resource)(resource, - &response)) != NULL) { - return dav_push_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - apr_psprintf(r->pool, - "Unable to undo auto-version-control " - "of resource %s.", - ap_escape_html(r->pool, resource->uri)), - err); - } - } - } - - if (av_info->parent_resource != NULL && av_info->parent_checkedout) { - if ((err = (*vsn_hooks->uncheckout)(av_info->parent_resource)) != NULL) { - return dav_push_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - apr_psprintf(r->pool, - "Unable to undo auto-checkout " - "of parent collection %s.", - ap_escape_html(r->pool, av_info->parent_resource->uri)), - err); - } - } - - return NULL; - } - - /* If the resource was checked out, and auto-checkin is enabled, - * then check it in. - */ - if (resource != NULL && resource->working - && (unlock || av_info->resource_checkedout)) { - - auto_version = (*vsn_hooks->auto_versionable)(resource); - - if (auto_version == DAV_AUTO_VERSION_ALWAYS || - (unlock && (auto_version == DAV_AUTO_VERSION_LOCKED))) { - - if ((err = (*vsn_hooks->checkin)(resource, - 0 /*keep_checked_out*/, NULL)) - != NULL) { - return dav_push_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - apr_psprintf(r->pool, - "Unable to auto-checkin resource %s.", - ap_escape_html(r->pool, resource->uri)), - err); - } - } - } - - /* If parent resource was checked out, and auto-checkin is enabled, - * then check it in. - */ - if (av_info->parent_resource != NULL && av_info->parent_resource->working - && (unlock || av_info->parent_checkedout)) { - - auto_version = (*vsn_hooks->auto_versionable)(av_info->parent_resource); - - if (auto_version == DAV_AUTO_VERSION_ALWAYS || - (unlock && (auto_version == DAV_AUTO_VERSION_LOCKED))) { - - if ((err = (*vsn_hooks->checkin)(av_info->parent_resource, - 0 /*keep_checked_out*/, NULL)) - != NULL) { - return dav_push_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - apr_psprintf(r->pool, - "Unable to auto-checkin parent collection %s.", - ap_escape_html(r->pool, av_info->parent_resource->uri)), - err); - } - } - } - - return NULL; -} diff --git a/modules/dav/main/util_lock.c b/modules/dav/main/util_lock.c deleted file mode 100644 index ff59b58e4a..0000000000 --- a/modules/dav/main/util_lock.c +++ /dev/null @@ -1,826 +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 - * . - */ - -/* -** DAV repository-independent lock functions -*/ - -#include "apr.h" -#include "apr_strings.h" - -#if APR_HAVE_STDIO_H -#include /* for sprintf() */ -#endif - -#include "mod_dav.h" -#include "http_log.h" -#include "http_config.h" -#include "http_protocol.h" -#include "http_core.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 }; - apr_pool_t *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", (long unsigned int)(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 ap_xml_doc *doc, - dav_lock **lock_request) -{ - apr_pool_t *p = r->pool; - dav_error *err; - ap_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 = (*lockdb->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 */ - ap_xml_quote_elem(p, child); - - /* - ** Store a full element with namespace definitions - ** and an xml:lang definition, if applicable. - */ - ap_xml_to_text(p, child, AP_XML_X2T_FULL_NS_LANG, doc->namespaces, - NULL, &text, NULL); - lock->owner = text; - - continue; - } - - return dav_new_error(p, HTTP_PRECONDITION_FAILED, 0, - apr_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_walk_resource *wres, int calltype) -{ - dav_walker_ctx *ctx = wres->walk_ctx; - dav_error *err; - - /* We don't want to set indirects on the target */ - if ((*wres->resource->hooks->is_same_resource)(wres->resource, - ctx->w.root)) - return NULL; - - if ((err = (*ctx->w.lockdb->hooks->append_locks)(ctx->w.lockdb, - wres->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(wres, 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) -{ - 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 = (*lockdb->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 } }; - dav_response *multi_status; - - ctx.w.walk_type = DAV_WALKTYPE_NORMAL | DAV_WALKTYPE_AUTH; - ctx.w.func = dav_lock_walker; - ctx.w.walk_ctx = &ctx; - ctx.w.pool = r->pool; - ctx.w.root = resource; - ctx.w.lockdb = lockdb; - - ctx.r = r; - ctx.lock = lock; - - err = (*resource->hooks->walk)(&ctx.w, DAV_INFINITY, &multi_status); - if (err != NULL) { - /* implies a 5xx status code occurred. screw the multistatus */ - return err; - } - - if (multi_status != NULL) { - /* manufacture a 207 error for the multistatus response */ - *response = multi_status; - 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_DECLARE(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_walk_resource *wres, int calltype) -{ - dav_walker_ctx *ctx = wres->walk_ctx; - dav_error *err; - - /* Before removing the lock, do any auto-checkin required */ - if (wres->resource->working) { - /* ### get rid of this typecast */ - if ((err = dav_auto_checkin(ctx->r, (dav_resource *) wres->resource, - 0 /*undo*/, 1 /*unlock*/, NULL)) - != NULL) { - return err; - } - } - - if ((err = (*ctx->w.lockdb->hooks->remove_lock)(ctx->w.lockdb, - wres->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(apr_pool_t *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; - dav_resource *parent; - - /* - ** 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 */ - if ((err = (*resource->hooks->get_parent_resource)(resource, - &parent)) != NULL) { - /* ### add a higher-level desc? */ - return err; - } - resource = parent; - } - - 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_walker_ctx ctx = { { 0 } }; - dav_response *multi_status; - dav_error *err; - - /* If no locks provider, then there is nothing to unlock. */ - if (hooks == NULL) { - return OK; - } - - /* 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. - */ - ctx.w.walk_type = DAV_WALKTYPE_NORMAL | DAV_WALKTYPE_LOCKNULL; - ctx.w.func = dav_unlock_walker; - ctx.w.walk_ctx = &ctx; - ctx.w.pool = r->pool; - ctx.w.root = lock_resource; - ctx.w.lockdb = lockdb; - - ctx.r = r; - ctx.locktoken = locktoken; - - err = (*repos_hooks->walk)(&ctx.w, DAV_INFINITY, &multi_status); - - /* ### fix this! */ - /* ### do something with multi_status */ - result = err == NULL ? OK : err->status; - - (*hooks->close_lockdb)(lockdb); - - return result; -} - -/* dav_inherit_walker: Walker callback function to inherit locks */ -static dav_error * dav_inherit_walker(dav_walk_resource *wres, int calltype) -{ - dav_walker_ctx *ctx = wres->walk_ctx; - - if (ctx->skip_root - && (*wres->resource->hooks->is_same_resource)(wres->resource, - ctx->w.root)) { - return NULL; - } - - /* ### maybe add a higher-level desc */ - return (*ctx->w.lockdb->hooks->append_locks)(ctx->w.lockdb, - wres->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; - dav_response *multi_status; - - if (use_parent) { - dav_resource *parent; - if ((err = (*repos_hooks->get_parent_resource)(resource, - &parent)) != NULL) { - /* ### add a higher-level desc? */ - return err; - } - if (parent == 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."); - } - which_resource = parent; - } - 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.w.walk_type = DAV_WALKTYPE_NORMAL | DAV_WALKTYPE_LOCKNULL; - ctx.w.func = dav_inherit_walker; - ctx.w.walk_ctx = &ctx; - ctx.w.pool = r->pool; - ctx.w.root = resource; - ctx.w.lockdb = lockdb; - - ctx.r = r; - ctx.lock = locks; - ctx.skip_root = !use_parent; - - /* ### do something with multi_status */ - return (*repos_hooks->walk)(&ctx.w, DAV_INFINITY, &multi_status); -} - -/* --------------------------------------------------------------- -** -** 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, 0, 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 65f0cc30cf..0000000000 --- a/modules/echo/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -Debug -Release diff --git a/modules/echo/.indent.pro b/modules/echo/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- 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 167b343d0d..0000000000 --- a/modules/echo/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ - -include $(top_srcdir)/build/special.mk - diff --git a/modules/echo/config.m4 b/modules/echo/config.m4 deleted file mode 100644 index 504a89c44a..0000000000 --- a/modules/echo/config.m4 +++ /dev/null @@ -1,11 +0,0 @@ -dnl modules enabled in this directory by default - -dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]]) - -APACHE_MODPATH_INIT(echo) - -APACHE_MODULE(echo, ECHO server, , , no) - -APR_ADDTO(LTFLAGS,-export-dynamic) - -APACHE_MODPATH_FINISH diff --git a/modules/echo/mod_echo.c b/modules/echo/mod_echo.c deleted file mode 100644 index f182123213..0000000000 --- a/modules/echo/mod_echo.c +++ /dev/null @@ -1,136 +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 "ap_config.h" -#include "ap_mmn.h" -#include "httpd.h" -#include "http_config.h" -#include "http_connection.h" - -AP_DECLARE_DATA module echo_module; - -typedef struct { - int bEnabled; -} EchoConfig; - -static void *create_echo_server_config(apr_pool_t *p, server_rec *s) -{ - EchoConfig *pConfig = apr_pcalloc(p, sizeof *pConfig); - - pConfig->bEnabled = 0; - - return pConfig; -} - -static const char *echo_on(cmd_parms *cmd, void *dummy, int arg) -{ - EchoConfig *pConfig = ap_get_module_config(cmd->server->module_config, - &echo_module); - pConfig->bEnabled = arg; - - 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 ( ; ; ) { - apr_ssize_t r, w; - r = sizeof(buf); - apr_recv(c->client_socket, buf, &r); - if (r <= 0) { - break; - } - w = r; - apr_send(c->client_socket, buf, &w); - if (w != r) { - break; - } - } - return OK; -} - -static const command_rec echo_cmds[] = -{ - AP_INIT_FLAG("ProtocolEcho", echo_on, NULL, RSRC_CONF, - "Run an echo server on this host"), - { NULL } -}; - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_process_connection(process_echo_connection, NULL, NULL, - APR_HOOK_MIDDLE); -} - -AP_DECLARE_DATA module echo_module = { - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/experimental/.cvsignore b/modules/experimental/.cvsignore deleted file mode 100644 index 15cf55fd3f..0000000000 --- a/modules/experimental/.cvsignore +++ /dev/null @@ -1,11 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -Debug -Release -*.plg diff --git a/modules/experimental/.indent.pro b/modules/experimental/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- 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 7c5c149d85..0000000000 --- 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 1d80fa5855..0000000000 --- a/modules/experimental/README +++ /dev/null @@ -1,41 +0,0 @@ -README for Apache 2.0 Example Module -[April, 1997, updated May 2000] - -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 run `./configure ---enable-example` in the src directory before running `make`. - -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. Build the server as above, with appropriate changes. - -To activate the example module, include a block similar to the -following in your httpd.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/config.m4 b/modules/experimental/config.m4 deleted file mode 100644 index 975e9d8329..0000000000 --- a/modules/experimental/config.m4 +++ /dev/null @@ -1,14 +0,0 @@ - -APACHE_MODPATH_INIT(experimental) - -APACHE_MODULE(charset_lite, character set translation, , , no) -APACHE_MODULE(cache, dynamic file caching, , , no) -APACHE_MODULE(disk_cache, disk caching module, , , no) -APACHE_MODULE(ext_filter, external filter module, , , no) -APACHE_MODULE(case_filter, example uppercase conversion filter, , , no) -APACHE_MODULE(generic_hook_export, example hook exporter, , , no) -APACHE_MODULE(generic_hook_import, example 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/experimental/mod_cache.c b/modules/experimental/mod_cache.c deleted file mode 100644 index 49871abe58..0000000000 --- a/modules/experimental/mod_cache.c +++ /dev/null @@ -1,124 +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 "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 "apr_hooks.h" - -module AP_DECLARE_DATA cache_module; - -APR_HOOK_STRUCT( - APR_HOOK_LINK(serve_cache) - APR_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, apr_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, apr_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(apr_pool_t *p) -{ - ap_hook_handler(cache_handler, NULL, NULL, APR_HOOK_MIDDLE); - ap_register_output_filter("CACHE", cache_filter, AP_FTYPE_HTTP_HEADER); -} - -module AP_DECLARE_DATA 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_register_hook /* register hooks */ -}; diff --git a/modules/experimental/mod_cache.h b/modules/experimental/mod_cache.h deleted file mode 100644 index 7f2cf9b0c1..0000000000 --- a/modules/experimental/mod_cache.h +++ /dev/null @@ -1,65 +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_buckets.h" -#include "apr_hooks.h" -#include "httpd.h" - -AP_DECLARE_HOOK(int,serve_cache,(request_rec *r)); -AP_DECLARE_HOOK(int,store_cache,(request_rec *r, apr_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 bb59985ae4..0000000000 --- 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 "apr_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, - apr_bucket_brigade *pbbIn) - { - apr_bucket *pbktIn; - apr_bucket_brigade *pbbOut; - - // XXX: is this the most appropriate pool? - pbbOut=apr_brigade_create(f->r->pool); - APR_BRIGADE_FOREACH(pbktIn,pbbIn) - { - const char *data; - apr_size_t len; - char *buf; - apr_size_t n; - apr_bucket *pbktOut; - - if(APR_BUCKET_IS_EOS(pbktIn)) - { - // XXX: why can't I reuse pbktIn??? - apr_bucket *pbktEOS=apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(pbbOut,pbktEOS); - break; - } - - // read - apr_bucket_read(pbktIn,&data,&len,APR_BLOCK_READ); - - // 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=apr_bucket_pool_create(buf,len,f->r->pool); - APR_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,APR_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_charset_lite.c b/modules/experimental/mod_charset_lite.c deleted file mode 100644 index 79830eed08..0000000000 --- a/modules/experimental/mod_charset_lite.c +++ /dev/null @@ -1,1142 +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. - */ - -/* - * 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 "httpd.h" -#include "http_config.h" -#define CORE_PRIVATE -#include "http_core.h" -#include "http_log.h" -#include "http_main.h" -#include "http_protocol.h" -#include "http_request.h" -#include "util_charset.h" -#include "apr_buckets.h" -#include "util_filter.h" -#include "apr_strings.h" -#include "apr_lib.h" -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#ifndef APACHE_XLATE -#error mod_charset_lite cannot work without APACHE_XLATE enabled -#endif - -#define OUTPUT_XLATE_BUF_SIZE (16*1024) /* size of translation buffer used on output */ -#define INPUT_XLATE_BUF_SIZE (8*1024) /* size of translation buffer used on input */ - -/* XXX this works around an issue with the heap bucket: apr_bucket_heap_create will - * copy only the first 4096 bytes - */ -#undef INPUT_XLATE_BUF_SIZE /* XXX */ -#define INPUT_XLATE_BUF_SIZE (4096) /* XXX must match DEFAULT_BUCKET_SIZE */ - -#define XLATE_MIN_BUFF_LEFT 128 /* flush once there is no more than this much - * space is left in the translation buffer - */ - -#define FATTEST_CHAR 8 /* we don't handle chars wider than this that straddle - * two buckets - */ - -/* extended error status codes; this is used in addition to an apr_status_t to - * track errors in the translation filter - */ -typedef enum { - EES_INIT = 0, /* no error info yet; value must be 0 for easy init */ - EES_LIMIT, /* built-in restriction encountered */ - EES_INCOMPLETE_CHAR, /* incomplete multi-byte char at end of content */ - EES_BUCKET_READ, - EES_DOWNSTREAM, /* something bad happened in a filter below xlate */ - EES_BAD_INPUT /* input data invalid */ -} ees_t; - -/* registered name of the output translation filter */ -#define XLATEOUT_FILTER_NAME "XLATEOUT" -/* registered name of input translation filter */ -#define XLATEIN_FILTER_NAME "XLATEIN" - -typedef struct charset_dir_t { - /** debug level; -1 means uninitialized, 0 means no debug */ - int debug; - const char *charset_source; /* source encoding */ - const char *charset_default; /* how to ship on wire */ - /** module does ap_add_*_filter()? */ - enum {IA_INIT, IA_IMPADD, IA_NOIMPADD} implicit_add; -} charset_dir_t; - -/* charset_filter_ctx_t is created for each filter instance; because the same - * filter code is used for translating in both directions, we need this context - * data to tell the filter which translation handle to use; it also can hold a - * character which was split between buckets - */ -typedef struct charset_filter_ctx_t { - apr_xlate_t *xlate; - charset_dir_t *dc; - ees_t ees; /* extended error status */ - apr_size_t saved; - char buf[FATTEST_CHAR]; /* we want to be able to build a complete char here */ - int ran; /* has filter instance run before? */ - int noop; /* should we pass brigades through unchanged? */ - char *tmp; /* buffer for input filtering */ - apr_bucket_brigade *bb; /* input buckets we couldn't finish translating */ -} charset_filter_ctx_t; - -/* charset_req_t is available via r->request_config if any translation is - * being performed - */ -typedef struct charset_req_t { - charset_dir_t *dc; - charset_filter_ctx_t *output_ctx, *input_ctx; -} charset_req_t; - -/* debug level definitions */ -#define DBGLVL_GORY 9 /* gory details */ -#define DBGLVL_FLOW 4 /* enough messages to see what happens on - * each request */ -#define DBGLVL_PMC 2 /* messages about possible misconfiguration */ - -module charset_lite_module; - -static void *create_charset_dir_conf(apr_pool_t *p,char *dummy) -{ - charset_dir_t *dc = (charset_dir_t *)apr_pcalloc(p,sizeof(charset_dir_t)); - - dc->debug = -1; - return dc; -} - -static void *merge_charset_dir_conf(apr_pool_t *p, void *basev, void *overridesv) -{ - charset_dir_t *a = (charset_dir_t *)apr_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 != -1 ? 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; - a->implicit_add = - over->implicit_add != IA_INIT ? over->implicit_add : base->implicit_add; - return a; -} - -/* CharsetSourceEnc charset - */ -static const char *add_charset_source(cmd_parms *cmd, void *in_dc, - const char *name) -{ - charset_dir_t *dc = in_dc; - - dc->charset_source = name; - return NULL; -} - -/* CharsetDefault charset - */ -static const char *add_charset_default(cmd_parms *cmd, void *in_dc, - const char *name) -{ - charset_dir_t *dc = in_dc; - - dc->charset_default = name; - return NULL; -} - -/* CharsetOptions optionflag... - */ -static const char *add_charset_options(cmd_parms *cmd, void *in_dc, - const char *flag) -{ - charset_dir_t *dc = in_dc; - - if (!strcasecmp(flag, "ImplicitAdd")) { - dc->implicit_add = IA_IMPADD; - } - else if (!strcasecmp(flag, "NoImplicitAdd")) { - dc->implicit_add = IA_NOIMPADD; - } - else if (!strncasecmp(flag, "DebugLevel=", 11)) { - dc->debug = atoi(flag + 11); - } - else { - return apr_pstrcat(cmd->temp_pool, - "Invalid CharsetOptions option: ", - flag, - NULL); - } - - return NULL; -} - -/* find_code_page() is a fixup hook that decides if translation should be - * enabled; if so, it sets up request data for use by the filter registration - * hook so that it knows what to do - */ -static int find_code_page(request_rec *r) -{ - charset_dir_t *dc = ap_get_module_config(r->per_dir_config, - &charset_lite_module); - charset_req_t *reqinfo; - charset_filter_ctx_t *input_ctx, *output_ctx; - apr_status_t rv; - const char *mime_type; - - if (dc->debug >= DBGLVL_FLOW) { - ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "uri: %s file: %s method: %d " - "imt: %s flags: %s%s%s %s->%s", - r->uri, r->filename, r->method_number, - r->content_type ? r->content_type : "(unknown)", - r->main ? "S" : "", /* S if subrequest */ - r->prev ? "R" : "", /* R if redirect */ - r->proxyreq ? "P" : "", /* P if proxy */ - dc->charset_source, dc->charset_default); - } - - /* If we don't have a full directory configuration, bail out. - */ - if (!dc->charset_source || !dc->charset_default) { - if (dc->debug >= DBGLVL_PMC) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "incomplete configuration: src %s, dst %s", - dc->charset_source ? dc->charset_source : "unspecified", - dc->charset_default ? dc->charset_default : "unspecified"); - } - return DECLINED; - } - - /* 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; - - mime_type = r->content_type ? r->content_type : ap_default_type(r); - - /* If mime type isn't text or message, bail out. - */ - -/* XXX When we handle translation of the request body, watch out here as - * 1.3 allowed additional mime types: multipart and - * application/x-www-form-urlencoded - */ - - if (strncasecmp(mime_type, "text/", 5) && -#if APR_CHARSET_EBCDIC - /* On an EBCDIC machine, be willing to translate mod_autoindex- - * generated output. Otherwise, it doesn't look too cool. - * - * XXX This isn't a perfect fix because this doesn't trigger us - * to convert from the charset of the source code to ASCII. The - * general solution seems to be to allow a generator to set an - * indicator in the r specifying that the body is coded in the - * implementation character set (i.e., the charset of the source - * code). This would get several different types of documents - * translated properly: mod_autoindex output, mod_status output, - * mod_info output, hard-coded error documents, etc. - */ - strcmp(mime_type, DIR_MAGIC_TYPE) && -#endif - strncasecmp(mime_type, "message/", 8)) { - if (dc->debug >= DBGLVL_GORY) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "mime type is %s; no translation selected", - mime_type); - } - return DECLINED; - } - - if (dc->debug >= DBGLVL_GORY) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "charset_source: %s charset_default: %s", - dc && dc->charset_source ? dc->charset_source : "(none)", - dc && dc->charset_default ? dc->charset_default : "(none)"); - } - - /* Get storage for the request data and the output filter context. - * We rarely need the input filter context, so allocate that separately. - */ - reqinfo = (charset_req_t *)apr_pcalloc(r->pool, - sizeof(charset_req_t) + - sizeof(charset_filter_ctx_t)); - output_ctx = (charset_filter_ctx_t *)(reqinfo + 1); - - reqinfo->dc = dc; - output_ctx->dc = dc; - ap_set_module_config(r->request_config, &charset_lite_module, reqinfo); - - reqinfo->output_ctx = output_ctx; - rv = apr_xlate_open(&output_ctx->xlate, - dc->charset_default, dc->charset_source, r->pool); - if (rv != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "can't open translation %s->%s", - dc->charset_source, dc->charset_default); - return HTTP_INTERNAL_SERVER_ERROR; - } - - switch (r->method_number) { - case M_PUT: - case M_POST: - /* Set up input translation. Note: A request body can be included - * with the OPTIONS method, but for now we don't set up translation - * of it. - */ - input_ctx = apr_pcalloc(r->pool, sizeof(charset_filter_ctx_t)); - input_ctx->bb = apr_brigade_create(r->pool); - input_ctx->tmp = apr_palloc(r->pool, INPUT_XLATE_BUF_SIZE); - input_ctx->dc = dc; - reqinfo->input_ctx = input_ctx; - rv = apr_xlate_open(&input_ctx->xlate, dc->charset_source, - dc->charset_default, r->pool); - if (rv != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "can't open translation %s->%s", - dc->charset_default, dc->charset_source); - return HTTP_INTERNAL_SERVER_ERROR; - } - } - - return DECLINED; -} - -static int configured_on_input(request_rec *r, const char *filter_name) -{ - int i; - core_dir_config *conf = - (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - char **items = (char **)conf->input_filters->elts; - - for (i = 0; i < conf->input_filters->nelts; i++) { - if (!strcmp(items[i], filter_name)) - return 1; - } - return 0; -} - -static int configured_on_output(request_rec *r, const char *filter_name) -{ - 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++) { - if (!strcmp(items[i], filter_name)) - return 1; - } - return 0; -} - -/* xlate_insert_filter() is a filter hook which decides whether or not - * to insert a translation filter for the current request. - */ -static void xlate_insert_filter(request_rec *r) -{ - /* Hey... don't be so quick to use reqinfo->dc here; reqinfo may be NULL */ - charset_req_t *reqinfo = ap_get_module_config(r->request_config, - &charset_lite_module); - charset_dir_t *dc = ap_get_module_config(r->per_dir_config, - &charset_lite_module); - - if (reqinfo) { - if (reqinfo->output_ctx && !configured_on_output(r, XLATEOUT_FILTER_NAME)) { - ap_add_output_filter(XLATEOUT_FILTER_NAME, reqinfo->output_ctx, r, - r->connection); - } - else if (dc->debug >= DBGLVL_FLOW) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "xlate output filter not added implicitly because %s", - !reqinfo->output_ctx ? - "no output configuration available" : - "SetOutputFilter was used to add the filter"); - } - - if (reqinfo->input_ctx && !configured_on_input(r, XLATEIN_FILTER_NAME)) { - ap_add_input_filter(XLATEIN_FILTER_NAME, reqinfo->input_ctx, r, - r->connection); - } - else if (dc->debug >= DBGLVL_FLOW) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "xlate input filter not added implicitly because %s", - !reqinfo->input_ctx ? - "no input configuration available" : - "SetInputFilter was used to add the filter"); - } - } -} - -/* stuff that sucks that I know of: - * - * bucket handling: - * why create an eos bucket when we see it come down the stream? just send the one - * passed as input... news flash: this will be fixed when xlate_out_filter() starts - * using the more generic xlate_brigade() - * - * translation mechanics: - * we don't handle characters that straddle more than two buckets; an error - * will be generated - */ - -/* send_downstream() is passed the translated data; it puts it in a single- - * bucket brigade and passes the brigade to the next filter - */ -static apr_status_t send_downstream(ap_filter_t *f, const char *tmp, apr_size_t len) -{ - apr_bucket_brigade *bb; - apr_bucket *b; - charset_filter_ctx_t *ctx = f->ctx; - apr_status_t rv; - - bb = apr_brigade_create(f->r->pool); - b = apr_bucket_transient_create(tmp, len); - APR_BRIGADE_INSERT_TAIL(bb, b); - rv = ap_pass_brigade(f->next, bb); - if (rv != APR_SUCCESS) { - ctx->ees = EES_DOWNSTREAM; - } - return rv; -} - -static apr_status_t send_eos(ap_filter_t *f) -{ - apr_bucket_brigade *bb; - apr_bucket *b; - charset_filter_ctx_t *ctx = f->ctx; - apr_status_t rv; - - bb = apr_brigade_create(f->r->pool); - b = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(bb, b); - rv = ap_pass_brigade(f->next, bb); - if (rv != APR_SUCCESS) { - ctx->ees = EES_DOWNSTREAM; - } - return rv; -} - -static apr_status_t set_aside_partial_char(charset_filter_ctx_t *ctx, - const char *partial, - apr_size_t partial_len) -{ - apr_status_t rv; - - if (sizeof(ctx->buf) > partial_len) { - ctx->saved = partial_len; - memcpy(ctx->buf, partial, partial_len); - rv = APR_SUCCESS; - } - else { - rv = APR_INCOMPLETE; - ctx->ees = EES_LIMIT; /* we don't handle chars this wide which straddle - * buckets - */ - } - return rv; -} - -static apr_status_t finish_partial_char(charset_filter_ctx_t *ctx, - /* input buffer: */ - const char **cur_str, - apr_size_t *cur_len, - /* output buffer: */ - char **out_str, - apr_size_t *out_len) -{ - apr_status_t rv; - apr_size_t tmp_input_len; - - /* Keep adding bytes from the input string to the saved string until we - * 1) finish the input char - * 2) get an error - * or 3) run out of bytes to add - */ - - do { - ctx->buf[ctx->saved] = **cur_str; - ++ctx->saved; - ++*cur_str; - --*cur_len; - tmp_input_len = ctx->saved; - rv = apr_xlate_conv_buffer(ctx->xlate, - ctx->buf, - &tmp_input_len, - *out_str, - out_len); - } while (rv == APR_INCOMPLETE && *cur_len); - - if (rv == APR_SUCCESS) { - ctx->saved = 0; - } - else { - ctx->ees = EES_LIMIT; /* code isn't smart enough to handle chars - * straddling more than two buckets - */ - } - - return rv; -} - -static void log_xlate_error(ap_filter_t *f, apr_status_t rv) -{ - charset_filter_ctx_t *ctx = f->ctx; - const char *msg; - char msgbuf[100]; - int cur; - int flags = APLOG_ERR; - - switch(ctx->ees) { - case EES_LIMIT: - flags |= APLOG_NOERRNO; - msg = "xlate filter - a built-in restriction was encountered"; - break; - case EES_BAD_INPUT: - flags |= APLOG_NOERRNO; - msg = "xlate filter - an input character was invalid"; - break; - case EES_BUCKET_READ: - msg = "xlate filter - bucket read routine failed"; - break; - case EES_INCOMPLETE_CHAR: - flags |= APLOG_NOERRNO; - strcpy(msgbuf, "xlate filter - incomplete char at end of input - "); - cur = 0; - while (cur < ctx->saved) { - apr_snprintf(msgbuf + strlen(msgbuf), sizeof(msgbuf) - strlen(msgbuf), - "%02X", (unsigned)ctx->buf[cur]); - ++cur; - } - msg = msgbuf; - break; - case EES_DOWNSTREAM: - msg = "xlate filter - an error occurred in a lower filter"; - break; - default: - msg = "xlate filter - returning error"; - } - ap_log_rerror(APLOG_MARK, flags, rv, f->r, - "%s", msg); -} - -/* chk_filter_chain() is called once per filter instance; it tries to - * determine if the current filter instance should be disabled because - * its translation is incompatible with the translation of an existing - * instance of the translate filter - * - * Example bad scenario: - * - * configured filter chain for the request: - * INCLUDES XLATEOUT(8859-1->UTS-16) - * configured filter chain for the subrequest: - * XLATEOUT(8859-1->UTS-16) - * - * When the subrequest is processed, the filter chain will be - * XLATEOUT(8859-1->UTS-16) XLATEOUT(8859-1->UTS-16) - * This makes no sense, so the instance of XLATEOUT added for the - * subrequest will be noop-ed. - * - * Example good scenario: - * - * configured filter chain for the request: - * INCLUDES XLATEOUT(8859-1->UTS-16) - * configured filter chain for the subrequest: - * XLATEOUT(IBM-1047->8859-1) - * - * When the subrequest is processed, the filter chain will be - * XLATEOUT(IBM-1047->8859-1) XLATEOUT(8859-1->UTS-16) - * This makes sense, so the instance of XLATEOUT added for the - * subrequest will be left alone and it will translate from - * IBM-1047->8859-1. - */ -static void chk_filter_chain(ap_filter_t *f) -{ - ap_filter_t *curf; - charset_filter_ctx_t *curctx, *last_xlate_ctx = NULL, - *ctx = f->ctx; - int debug = ctx->dc->debug; - int output = !strcmp(f->frec->name, XLATEOUT_FILTER_NAME); - - if (ctx->noop) { - return; - } - - /* walk the filter chain; see if it makes sense for our filter to - * do any translation - */ - curf = output ? f->r->output_filters : f->r->input_filters; - while (curf) { - if (!strcmp(curf->frec->name, f->frec->name) && - curf->ctx) { - curctx = (charset_filter_ctx_t *)curf->ctx; - if (!last_xlate_ctx) { - last_xlate_ctx = curctx; - } - else { - if (strcmp(last_xlate_ctx->dc->charset_default, - curctx->dc->charset_source)) { - /* incompatible translation - * if our filter instance is incompatible with an instance - * already in place, noop our instance - * Notes: - * . We are only willing to noop our own instance. - * . It is possible to noop another instance which has not - * yet run, but this is not currently implemented. - * Hopefully it will not be needed. - * . It is not possible to noop an instance which has - * already run. - */ - if (last_xlate_ctx == f->ctx) { - last_xlate_ctx->noop = 1; - if (debug >= DBGLVL_PMC) { - const char *symbol = output ? "->" : "<-"; - - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, - 0, f->r, - "%s %s - disabling " - "translation %s%s%s; existing " - "translation %s%s%s", - f->r->uri ? "uri" : "file", - f->r->uri ? f->r->uri : f->r->filename, - last_xlate_ctx->dc->charset_source, - symbol, - last_xlate_ctx->dc->charset_default, - curctx->dc->charset_source, - symbol, - curctx->dc->charset_default); - } - } - else { - const char *symbol = output ? "->" : "<-"; - - ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, - 0, f->r, - "chk_filter_chain() - can't disable " - "translation %s%s%s; existing " - "translation %s%s%s", - last_xlate_ctx->dc->charset_source, - symbol, - last_xlate_ctx->dc->charset_default, - curctx->dc->charset_source, - symbol, - curctx->dc->charset_default); - } - break; - } - } - } - curf = curf->next; - } -} - -/* xlate_brigade() is used to filter request and response bodies - * - * we'll stop when one of the following occurs: - * . we run out of buckets - * . we run out of space in the output buffer - * . we hit an error - * - * inputs: - * bb: brigade to process - * buffer: storage to hold the translated characters - * buffer_size: size of buffer - * (and a few more uninteresting parms) - * - * outputs: - * return value: APR_SUCCESS or some error code - * bb: we've removed any buckets representing the - * translated characters; the eos bucket, if - * present, will be left in the brigade - * buffer: filled in with translated characters - * buffer_size: updated with the bytes remaining - * hit_eos: did we hit an EOS bucket? - */ -static apr_status_t xlate_brigade(charset_filter_ctx_t *ctx, - apr_bucket_brigade *bb, - char *buffer, - apr_size_t *buffer_avail, - int *hit_eos) -{ - apr_bucket *b, *consumed_bucket; - const char *bucket; - apr_size_t bytes_in_bucket; /* total bytes read from current bucket */ - apr_size_t bucket_avail; /* bytes left in current bucket */ - apr_status_t rv = APR_SUCCESS; - - *hit_eos = 0; - bucket_avail = 0; - consumed_bucket = NULL; - while (1) { - if (!bucket_avail) { /* no bytes left to process in the current bucket... */ - if (consumed_bucket) { - apr_bucket_delete(consumed_bucket); - consumed_bucket = NULL; - } - b = APR_BRIGADE_FIRST(bb); - if (b == APR_BRIGADE_SENTINEL(bb) || - APR_BUCKET_IS_EOS(b)) { - break; - } - rv = apr_bucket_read(b, &bucket, &bytes_in_bucket, APR_BLOCK_READ); - if (rv != APR_SUCCESS) { - ctx->ees = EES_BUCKET_READ; - break; - } - bucket_avail = bytes_in_bucket; - consumed_bucket = b; /* for axing when we're done reading it */ - } - if (bucket_avail) { - /* We've got data, so translate it. */ - if (ctx->saved) { - /* Rats... we need to finish a partial character from the previous - * bucket. - * - * Strangely, finish_partial_char() increments the input buffer - * pointer but does not increment the output buffer pointer. - */ - apr_size_t old_buffer_avail = *buffer_avail; - rv = finish_partial_char(ctx, - &bucket, &bucket_avail, - &buffer, buffer_avail); - buffer += old_buffer_avail - *buffer_avail; - } - else { - apr_size_t old_buffer_avail = *buffer_avail; - apr_size_t old_bucket_avail = bucket_avail; - rv = apr_xlate_conv_buffer(ctx->xlate, - bucket, &bucket_avail, - buffer, - buffer_avail); - buffer += old_buffer_avail - *buffer_avail; - bucket += old_bucket_avail - bucket_avail; - - if (rv == APR_INCOMPLETE) { /* partial character at end of input */ - /* We need to save the final byte(s) for next time; we can't - * convert it until we look at the next bucket. - */ - rv = set_aside_partial_char(ctx, bucket, bucket_avail); - bucket_avail = 0; - } - } - if (rv != APR_SUCCESS) { - /* bad input byte or partial char too big to store */ - break; - } - if (*buffer_avail < XLATE_MIN_BUFF_LEFT) { - /* if any data remains in the current bucket, split there */ - if (bucket_avail) { - apr_bucket_split(b, bytes_in_bucket - bucket_avail); - } - apr_bucket_delete(b); - break; - } - } - } - - if (!APR_BRIGADE_EMPTY(bb)) { - b = APR_BRIGADE_FIRST(bb); - if (APR_BUCKET_IS_EOS(b)) { - /* Leave the eos bucket in the brigade for reporting to - * subsequent filters. - */ - *hit_eos = 1; - if (ctx->saved) { - /* Oops... we have a partial char from the previous bucket - * that won't be completed because there's no more data. - */ - rv = APR_INCOMPLETE; - ctx->ees = EES_INCOMPLETE_CHAR; - } - } - } - - return rv; -} - -/* xlate_out_filter() handles (almost) arbitrary conversions from one charset - * to another... - * translation is determined in the fixup hook (find_code_page), which is - * where the filter's context data is set up... the context data gives us - * the translation handle - */ -static apr_status_t xlate_out_filter(ap_filter_t *f, apr_bucket_brigade *bb) -{ - charset_req_t *reqinfo = ap_get_module_config(f->r->request_config, - &charset_lite_module); - charset_dir_t *dc = ap_get_module_config(f->r->per_dir_config, - &charset_lite_module); - charset_filter_ctx_t *ctx = f->ctx; - apr_bucket *dptr, *consumed_bucket; - const char *cur_str; - apr_size_t cur_len, cur_avail; - char tmp[OUTPUT_XLATE_BUF_SIZE]; - apr_size_t space_avail; - int done; - apr_status_t rv = APR_SUCCESS; - - if (!ctx) { - /* this is SetOutputFilter path; grab the preallocated context, - * if any; note that if we decided not to do anything in an earlier - * handler, we won't even have a reqinfo - */ - if (reqinfo) { - ctx = f->ctx = reqinfo->output_ctx; - reqinfo->output_ctx = NULL; /* prevent SNAFU if user coded us twice - * in the filter chain; we can't have two - * instances using the same context - */ - } - if (!ctx) { /* no idea how to translate; don't do anything */ - ctx = f->ctx = apr_pcalloc(f->r->pool, sizeof(charset_filter_ctx_t)); - ctx->dc = dc; - ctx->noop = 1; - } - } - - if (dc->debug >= DBGLVL_GORY) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, f->r, - "xlate_out_filter() - " - "charset_source: %s charset_default: %s", - dc && dc->charset_source ? dc->charset_source : "(none)", - dc && dc->charset_default ? dc->charset_default : "(none)"); - } - - if (!ctx->ran) { /* filter never ran before */ - chk_filter_chain(f); - ctx->ran = 1; - } - - if (ctx->noop) { - return ap_pass_brigade(f->next, bb); - } - - dptr = APR_BRIGADE_FIRST(bb); - done = 0; - cur_len = 0; - space_avail = sizeof(tmp); - consumed_bucket = NULL; - while (!done) { - if (!cur_len) { /* no bytes left to process in the current bucket... */ - if (consumed_bucket) { - apr_bucket_delete(consumed_bucket); - consumed_bucket = NULL; - } - if (dptr == APR_BRIGADE_SENTINEL(bb)) { - done = 1; - break; - } - if (APR_BUCKET_IS_EOS(dptr)) { - done = 1; - cur_len = -1; /* XXX yuck, but that tells us to send - * eos down; when we minimize our bb construction - * we'll fix this crap */ - if (ctx->saved) { - /* Oops... we have a partial char from the previous bucket - * that won't be completed because there's no more data. - */ - rv = APR_INCOMPLETE; - ctx->ees = EES_INCOMPLETE_CHAR; - } - break; - } - rv = apr_bucket_read(dptr, &cur_str, &cur_len, APR_BLOCK_READ); - if (rv != APR_SUCCESS) { - done = 1; - ctx->ees = EES_BUCKET_READ; - break; - } - consumed_bucket = dptr; /* for axing when we're done reading it */ - dptr = APR_BUCKET_NEXT(dptr); /* get ready for when we access the - * next bucket */ - } - /* Try to fill up our tmp buffer with translated data. */ - cur_avail = cur_len; - - if (cur_len) { /* maybe we just hit the end of a pipe (len = 0) ? */ - if (ctx->saved) { - /* Rats... we need to finish a partial character from the previous - * bucket. - */ - char *tmp_tmp; - - tmp_tmp = tmp + sizeof(tmp) - space_avail; - rv = finish_partial_char(ctx, - &cur_str, &cur_len, - &tmp_tmp, &space_avail); - } - else { - rv = apr_xlate_conv_buffer(ctx->xlate, - cur_str, &cur_avail, - tmp + sizeof(tmp) - space_avail, &space_avail); - - /* Update input ptr and len after consuming some bytes */ - cur_str += cur_len - cur_avail; - cur_len = cur_avail; - - if (rv == APR_INCOMPLETE) { /* partial character at end of input */ - /* We need to save the final byte(s) for next time; we can't - * convert it until we look at the next bucket. - */ - rv = set_aside_partial_char(ctx, cur_str, cur_len); - cur_len = 0; - } - } - } - - if (rv != APR_SUCCESS) { - /* bad input byte or partial char too big to store */ - done = 1; - } - - if (space_avail < XLATE_MIN_BUFF_LEFT) { - /* It is time to flush, as there is not enough space left in the - * current output buffer to bother with converting more data. - */ - rv = send_downstream(f, tmp, sizeof(tmp) - space_avail); - if (rv != APR_SUCCESS) { - done = 1; - } - - /* tmp is now empty */ - space_avail = sizeof(tmp); - } - } - - if (rv == APR_SUCCESS) { - if (space_avail < sizeof(tmp)) { /* gotta write out what we converted */ - rv = send_downstream(f, tmp, sizeof(tmp) - space_avail); - } - } - if (rv == APR_SUCCESS) { - if (cur_len == -1) { - rv = send_eos(f); - } - } - else { - log_xlate_error(f, rv); - } - - return rv; -} - -static void transfer_brigade(apr_bucket_brigade *in, apr_bucket_brigade *out) -{ - apr_bucket *b; - - while (!APR_BRIGADE_EMPTY(in)) { - b = APR_BRIGADE_FIRST(in); - APR_BUCKET_REMOVE(b); - APR_BRIGADE_INSERT_TAIL(out, b); - } -} - -static int xlate_in_filter(ap_filter_t *f, apr_bucket_brigade *bb, - ap_input_mode_t mode, apr_size_t *readbytes) -{ - apr_status_t rv; - charset_req_t *reqinfo = ap_get_module_config(f->r->request_config, - &charset_lite_module); - charset_dir_t *dc = ap_get_module_config(f->r->per_dir_config, - &charset_lite_module); - charset_filter_ctx_t *ctx = f->ctx; - apr_size_t buffer_size; - int hit_eos; - - if (!ctx) { - /* this is SetInputFilter path; grab the preallocated context, - * if any; note that if we decided not to do anything in an earlier - * handler, we won't even have a reqinfo - */ - if (reqinfo) { - ctx = f->ctx = reqinfo->input_ctx; - reqinfo->input_ctx = NULL; /* prevent SNAFU if user coded us twice - * in the filter chain; we can't have two - * instances using the same context - */ - } - if (!ctx) { /* no idea how to translate; don't do anything */ - ctx = f->ctx = apr_pcalloc(f->r->pool, sizeof(charset_filter_ctx_t)); - ctx->dc = dc; - ctx->noop = 1; - } - } - - if (dc->debug >= DBGLVL_GORY) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, f->r, - "xlate_in_filter() - " - "charset_source: %s charset_default: %s", - dc && dc->charset_source ? dc->charset_source : "(none)", - dc && dc->charset_default ? dc->charset_default : "(none)"); - } - - if (!ctx->ran) { /* filter never ran before */ - chk_filter_chain(f); - ctx->ran = 1; - } - - if (ctx->noop) { - return ap_get_brigade(f->next, bb, mode, readbytes); - } - - if (APR_BRIGADE_EMPTY(ctx->bb)) { - if ((rv = ap_get_brigade(f->next, bb, mode, readbytes)) != APR_SUCCESS) { - return rv; - } - } - else { - transfer_brigade(ctx->bb, bb); /* first use the leftovers */ - } - - buffer_size = INPUT_XLATE_BUF_SIZE; - rv = xlate_brigade(ctx, bb, ctx->tmp, &buffer_size, &hit_eos); - if (rv == APR_SUCCESS) { - if (!hit_eos) { - /* move anything leftover into our context for next time; - * we don't currently "set aside" since the data came from - * down below, but I suspect that for long-term we need to - * do that - */ - transfer_brigade(bb, ctx->bb); - } - if (buffer_size < INPUT_XLATE_BUF_SIZE) { /* do we have output? */ - apr_bucket *e; - - e = apr_bucket_heap_create(ctx->tmp, - INPUT_XLATE_BUF_SIZE - buffer_size, 1, - NULL); - /* make sure we insert at the head, because there may be - * an eos bucket already there, and the eos bucket should - * come after the data - */ - APR_BRIGADE_INSERT_HEAD(bb, e); - } - else { - /* XXX need to get some more data... what if the last brigade - * we got had only the first byte of a multibyte char? we need - * to grab more data from the network instead of returning an - * empty brigade - */ - } - } - else { - log_xlate_error(f, rv); - } - - return rv; -} - -static const command_rec cmds[] = -{ - AP_INIT_TAKE1("CharsetSourceEnc", - add_charset_source, - NULL, - OR_FILEINFO, - "source (html,cgi,ssi) file charset"), - AP_INIT_TAKE1("CharsetDefault", - add_charset_default, - NULL, - OR_FILEINFO, - "name of default charset"), - AP_INIT_ITERATE("CharsetOptions", - add_charset_options, - NULL, - OR_FILEINFO, - "valid options: ImplicitAdd, NoImplicitAdd, DebugLevel=n"), - {NULL} -}; - -static void charset_register_hooks(apr_pool_t *p) -{ - ap_hook_fixups(find_code_page, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_insert_filter(xlate_insert_filter, NULL, NULL, APR_HOOK_MIDDLE); - ap_register_output_filter(XLATEOUT_FILTER_NAME, xlate_out_filter, - AP_FTYPE_CONTENT); - ap_register_input_filter(XLATEIN_FILTER_NAME, xlate_in_filter, - AP_FTYPE_CONTENT); -} - -module charset_lite_module = -{ - STANDARD20_MODULE_STUFF, - create_charset_dir_conf, - merge_charset_dir_conf, - NULL, - NULL, - cmds, - charset_register_hooks -}; - diff --git a/modules/experimental/mod_disk_cache.c b/modules/experimental/mod_disk_cache.c deleted file mode 100644 index cbd28bf04a..0000000000 --- a/modules/experimental/mod_disk_cache.c +++ /dev/null @@ -1,170 +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 "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) -{ - apr_bucket *e; - apr_bucket_brigade *bb = apr_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_file_open(&fd, filename, APR_READ, - APR_UREAD, r->connection->pool)) != APR_SUCCESS) { - return DECLINED; - } - - /* skip the cached headers. */ - do { - apr_file_gets(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 = apr_bucket_file_create(fd, offset, r->finfo.size); - - APR_BRIGADE_INSERT_HEAD(bb, e); - e = apr_bucket_eos_create(); - APR_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, apr_bucket_brigade *bb, void **cf) -{ - cache_struct *ctx = *cf; - apr_bucket *e; - - if (ctx == NULL) { - *cf = ctx = apr_pcalloc(r->pool, sizeof(*ctx)); - } - if (ctx->filename == NULL) { - apr_status_t rv; - apr_dir_make(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_file_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; - } - } - APR_BRIGADE_FOREACH(e, bb) { - const char *str; - apr_ssize_t length; - - apr_bucket_read(e, &str, &length, APR_BLOCK_READ); - apr_file_write(ctx->fd, str, &length); - } - if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) { - apr_file_close(ctx->fd); - } - return OK; -} - -static void disk_cache_register_hook(apr_pool_t *p) -{ - ap_hook_store_cache(disk_cache, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_serve_cache(disk_serve, NULL, NULL, APR_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 */ - disk_cache_register_hook /* register hooks */ -}; diff --git a/modules/experimental/mod_example.c b/modules/experimental/mod_example.c deleted file mode 100644 index 5d8de38777..0000000000 --- a/modules/experimental/mod_example.c +++ /dev/null @@ -1,1198 +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. - */ - -/* - * 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 "http_request.h" -#include "util_script.h" - -#include "apr_strings.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 apr_table_t *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 apr_pool_t *example_pool = NULL; -static apr_pool_t *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(void) -{ - /* - * If we haven't already allocated our module-private pool, do so now. - */ - if (example_pool == NULL) { - apr_pool_create(&example_pool, NULL); - }; - /* - * Likewise for the apr_table_t of routine/environment pairs we visit outside of - * request context. - */ - if (static_calls_made == NULL) { - static_calls_made = apr_table_make(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 apr_pool_t 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 apr_table_t 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; - apr_pool_t *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 = apr_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. - */ - apr_pool_create(&p, example_pool); - if (trace != NULL) { - trace = apr_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) { - apr_pool_destroy(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 apr_table_t is allocated in the - * module's private pool, which doesn't get destroyed. - */ - if (r == NULL) { - char *key; - - key = apr_pstrcat(p, note, ":", where, NULL); - if (apr_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. - */ - apr_table_set(static_calls_made, key, "been here"); - } - } - addon = apr_pstrcat(p, "
      • \n", "
        \n", "
        ", - note, "\n", "
        \n", "
        [", - where, "]\n", "
        \n", "
        \n", - "
      • \n", NULL); - sofar = (trace_copy == NULL) ? "" : trace_copy; - trace_copy = apr_pstrcat(p, sofar, addon, NULL); - if (r != NULL) { - apr_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, 0, 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"; - /* - * If we're only supposed to send header information (HEAD request), we're - * already there. - */ - if (r->header_only) { - 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", apr_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. - */ - /* - * 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(apr_pool_t *p, apr_pool_t *ptemp, - apr_pool_t *plog, server_rec *s) -{ - - 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 = apr_pstrcat(p, "example_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 apr_status_t example_child_exit(void *sv) -{ - server_rec *s = sv; - 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 = apr_pstrcat(s->process->pool, "example_child_exit(", sname, ")", NULL); - trace_add(s, NULL, NULL, note); - return APR_SUCCESS; -} - -/* - * 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(apr_pool_t *p, server_rec *s) -{ - - 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 = apr_pstrcat(p, "example_child_init(", sname, ")", NULL); - trace_add(s, NULL, NULL, note); - - apr_pool_cleanup_register(p, s, example_child_exit, example_child_exit); -} - -/* - * This function gets called to create 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(apr_pool_t *p, char *dirspec) -{ - - excfg *cfg; - char *dname = dirspec; - - /* - * Allocate the space for our record from the pool supplied. - */ - cfg = (excfg *) apr_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 = apr_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(apr_pool_t *p, void *parent_conf, - void *newloc_conf) -{ - - excfg *merged_config = (excfg *) apr_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 = apr_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 = apr_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(apr_pool_t *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 *) apr_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 = apr_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(apr_pool_t *p, void *server1_conf, - void *server2_conf) -{ - - excfg *merged_config = (excfg *) apr_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 = apr_pstrdup(p, s2conf->loc); - /* - * Trace our call, including what we were asked to merge. - */ - note = apr_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; -} - -/*--------------------------------------------------------------------------*/ -/* */ -/* Which functions are responsible for which hooks in the server. */ -/* */ -/*--------------------------------------------------------------------------*/ -/* - * Each function our module provides to handle a particular hook is - * specified here. The functions are registered using - * ap_hook_foo(name, predecessors, successors, position) - * where foo is the name of the hook. - * - * The args are as follows: - * name -> the name of the function to call. - * predecessors -> a list of modules whose calls to this hook must come - * before this module. - * successors -> a list of modules whose calls to this hook must come - * after this module. - * position -> The relative position of this module. One of APR_HOOK_FIRST, - * APR_HOOK_MIDDLE, or APR_HOOK_LAST. Most modules will use - * APR_HOOK_MIDDLE. If multiple modules use the same relative - * position, Apache will determine which to call first. - * If your module relies on another module to run first, - * or another module running after yours, use the - * predecessors and/or successors. - * - * 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). - * The actual delivery of content to the browser [9] is not handled by - * a hook; see the handler declarations below. - */ -static void example_register_hooks(apr_pool_t *p) -{ - /* module initializer */ - ap_hook_post_config(example_init, - NULL, NULL, APR_HOOK_MIDDLE); - /* [1] post read_request handling */ - ap_hook_post_read_request(example_post_read_request, - NULL, NULL, APR_HOOK_MIDDLE); - /* [2] filename-to-URI translation */ - ap_hook_translate_name(example_translate_handler, - NULL, NULL, APR_HOOK_MIDDLE); - /* [3] header parser */ - ap_hook_header_parser(example_header_parser, - NULL, NULL, APR_HOOK_MIDDLE); - /* [4] check access by host address */ - ap_hook_access_checker(example_access_checker, - NULL, NULL, APR_HOOK_MIDDLE); - /* [5] check/validate user_id */ - ap_hook_check_user_id(example_check_user_id, - NULL, NULL, APR_HOOK_MIDDLE); - /* [6] check user_id is valid *here* */ - ap_hook_auth_checker(example_auth_checker, - NULL, NULL, APR_HOOK_MIDDLE); - /* [7] MIME type checker/setter */ - ap_hook_type_checker(example_type_checker, - NULL, NULL, APR_HOOK_MIDDLE); - /* [8] fixups */ - ap_hook_fixups(example_fixer_upper, - NULL, NULL, APR_HOOK_MIDDLE); - /* [9] is for the handlers; see below */ - - /* [10] logger */ - ap_hook_log_transaction(example_logger, - NULL, NULL, APR_HOOK_MIDDLE); - /* process initializer */ - ap_hook_child_init(example_child_init, - NULL, NULL, APR_HOOK_MIDDLE); -} - -/*--------------------------------------------------------------------------*/ -/* */ -/* 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[] = -{ - AP_INIT_NO_ARGS( - "Example", /* directive name */ - cmd_example, /* config action routine */ - NULL, /* argument to include in call */ - OR_OPTIONS, /* where available */ - "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 static 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. - */ -module example_module = -{ - STANDARD20_MODULE_STUFF, - 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, /* list of content delivery handlers */ - example_register_hooks, /* set up other request processing hooks */ -}; diff --git a/modules/experimental/mod_ext_filter.c b/modules/experimental/mod_ext_filter.c deleted file mode 100644 index 46b4b1e527..0000000000 --- a/modules/experimental/mod_ext_filter.c +++ /dev/null @@ -1,793 +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. - */ - -/* - * mod_ext_filter allows Unix-style filters to filter http content. - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" -#define CORE_PRIVATE -#include "http_core.h" -#include "apr_buckets.h" -#include "util_filter.h" -#include "apr_strings.h" -#include "apr_hash.h" -#include "apr_lib.h" -#define APR_WANT_STRFUNC -#include "apr_want.h" - -typedef struct ef_server_t { - apr_pool_t *p; - apr_hash_t *h; -} ef_server_t; - -typedef struct ef_filter_t { - const char *name; - enum {INPUT_FILTER=1, OUTPUT_FILTER} mode; - const char *command; - int numArgs; - char *args[30]; - const char *intype; /* list of IMTs we process (well, just one for now) */ -#define INTYPE_ALL (char *)1 - const char *outtype; /* IMT of filtered output */ -#define OUTTYPE_UNCHANGED (char *)1 - int preserves_content_length; -} ef_filter_t; - -typedef struct ef_dir_t { - int debug; - int log_stderr; -} ef_dir_t; - -typedef struct ef_ctx_t { - apr_pool_t *p; - apr_proc_t *proc; - apr_procattr_t *procattr; - ef_dir_t *dc; - ef_filter_t *filter; - int noop; -#if APR_FILES_AS_SOCKETS - apr_pollfd_t *pollset; -#endif -} ef_ctx_t; - -module ext_filter_module; - -static apr_status_t ef_output_filter(ap_filter_t *, apr_bucket_brigade *); - -#define DBGLVL_SHOWOPTIONS 1 -#define DBGLVL_GORY 9 - -static void *create_ef_dir_conf(apr_pool_t *p, char *dummy) -{ - ef_dir_t *dc = (ef_dir_t *)apr_pcalloc(p, sizeof(ef_dir_t)); - - dc->debug = -1; - dc->log_stderr = -1; - - return dc; -} - -static void *create_ef_server_conf(apr_pool_t *p, server_rec *s) -{ - ef_server_t *conf; - - conf = (ef_server_t *)apr_pcalloc(p, sizeof(ef_server_t)); - conf->p = p; - conf->h = apr_hash_make(conf->p); - return conf; -} - -static void *merge_ef_dir_conf(apr_pool_t *p, void *basev, void *overridesv) -{ - ef_dir_t *a = (ef_dir_t *)apr_pcalloc (p, sizeof(ef_dir_t)); - ef_dir_t *base = (ef_dir_t *)basev, *over = (ef_dir_t *)overridesv; - - if (over->debug != -1) { /* if admin coded something... */ - a->debug = over->debug; - } - else { - a->debug = base->debug; - } - - if (over->log_stderr != -1) { /* if admin coded something... */ - a->log_stderr = over->log_stderr; - } - else { - a->log_stderr = base->log_stderr; - } - - return a; -} - -static const char *add_options(cmd_parms *cmd, void *in_dc, - const char *arg) -{ - ef_dir_t *dc = in_dc; - - if (!strncasecmp(arg, "DebugLevel=", 11)) { - dc->debug = atoi(arg + 11); - } - else if (!strcasecmp(arg, "LogStderr")) { - dc->log_stderr = 1; - } - else if (!strcasecmp(arg, "NoLogStderr")) { - dc->log_stderr = 0; - } - else { - return apr_pstrcat(cmd->temp_pool, - "Invalid ExtFilterOptions option: ", - arg, - NULL); - } - - return NULL; -} - -static const char *parse_cmd(apr_pool_t *p, const char **args, ef_filter_t *filter) -{ - if (**args == '"') { - const char *start = *args + 1; - char *parms; - - ++*args; /* move past leading " */ - while (**args && **args != '"') { - ++*args; - } - if (**args != '"') { - return "Expected cmd= delimiter"; - } - parms = apr_pstrndup(p, start, *args - start); - ++*args; /* move past trailing " */ - - /* parms now has the command-line to parse */ - while (filter->numArgs < 30 && - strlen(filter->args[filter->numArgs] = ap_getword_white_nc(p, &parms))) { - ++filter->numArgs; - } - if (filter->numArgs < 1) { - return "cmd= parse error"; - } - filter->args[filter->numArgs] = NULL; /* we stored "" in the while() loop */ - filter->command = filter->args[0]; - } - else - { - /* simple path */ - filter->args[0] = ap_getword_white(p, args); - if (!filter->args[0]) { - return "Invalid cmd= parameter"; - } - filter->numArgs = 1; - filter->command = filter->args[0]; - } - return NULL; -} - -static const char *define_filter(cmd_parms *cmd, void *dummy, const char *args) -{ - ef_server_t *conf = ap_get_module_config(cmd->server->module_config, - &ext_filter_module); - const char *token; - const char *name; - ef_filter_t *filter; - - name = ap_getword_white(cmd->pool, &args); - if (!name) { - return "Filter name not found"; - } - - if (apr_hash_get(conf->h, name, APR_HASH_KEY_STRING)) { - return apr_psprintf(cmd->pool, "ExtFilter %s is already defined", - name); - } - - filter = (ef_filter_t *)apr_pcalloc(conf->p, sizeof(ef_filter_t)); - filter->name = name; - filter->mode = OUTPUT_FILTER; - apr_hash_set(conf->h, name, APR_HASH_KEY_STRING, filter); - - while (*args) { - while (apr_isspace(*args)) { - ++args; - } - - /* Nasty parsing... I wish I could simply use ap_getword_white() - * here and then look at the token, but ap_getword_white() doesn't - * do the right thing when we have cmd="word word word" - */ - if (!strncasecmp(args, "preservescontentlength", 22)) { - token = ap_getword_white(cmd->pool, &args); - if (!strcasecmp(token, "preservescontentlength")) { - filter->preserves_content_length = 1; - } - else { - return apr_psprintf(cmd->pool, - "mangled argument `%s'", - token); - } - continue; - } - - if (!strncasecmp(args, "mode=", 5)) { - args += 5; - token = ap_getword_white(cmd->pool, &args); - if (!strcasecmp(token, "output")) { - filter->mode = OUTPUT_FILTER; - } - else if (!strcasecmp(token, "input")) { - filter->mode = INPUT_FILTER; - } - else { - return apr_psprintf(cmd->pool, "Invalid mode: `%s'", - token); - } - continue; - } - - if (!strncasecmp(args, "intype=", 7)) { - args += 7; - filter->intype = ap_getword_white(cmd->pool, &args); - continue; - } - - if (!strncasecmp(args, "outtype=", 8)) { - args += 8; - filter->outtype = ap_getword_white(cmd->pool, &args); - continue; - } - - if (!strncasecmp(args, "cmd=", 4)) { - args += 4; - if ((token = parse_cmd(cmd->pool, &args, filter))) { - return token; - } - continue; - } - - return apr_psprintf(cmd->pool, "Unexpected parameter: `%s'", - args); - } - - /* parsing is done... register the filter - */ - if (filter->mode == OUTPUT_FILTER) { - /* XXX need a way to ensure uniqueness among all filters */ - ap_register_output_filter(filter->name, ef_output_filter, AP_FTYPE_CONTENT); - } -#if 0 /* no input filters yet */ - else if (filter->mode == INPUT_FILTER) { - /* XXX need a way to ensure uniqueness among all filters */ - ap_register_input_filter(filter->name, ef_input_filter, AP_FTYPE_CONTENT); - } -#endif - else { - ap_assert(1 != 1); /* we set the field wrong somehow */ - } - - return NULL; -} - -static const command_rec cmds[] = -{ - AP_INIT_ITERATE("ExtFilterOptions", - add_options, - NULL, - ACCESS_CONF, /* same as SetInputFilter/SetOutputFilter */ - "valid options: DebugLevel=n, LogStderr, NoLogStderr"), - AP_INIT_RAW_ARGS("ExtFilterDefine", - define_filter, - NULL, - RSRC_CONF, - "Define an external filter"), - {NULL} -}; - -static apr_status_t set_resource_limits(request_rec *r, - apr_procattr_t *procattr) -{ -#if defined(RLIMIT_CPU) || defined(RLIMIT_NPROC) || \ - defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined (RLIMIT_AS) - core_dir_config *conf = - (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - apr_status_t rv; - -#ifdef RLIMIT_CPU - rv = apr_procattr_limit_set(procattr, APR_LIMIT_CPU, conf->limit_cpu); - ap_assert(rv == APR_SUCCESS); /* otherwise, we're out of sync with APR */ -#endif -#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS) - rv = apr_procattr_limit_set(procattr, APR_LIMIT_MEM, conf->limit_mem); - ap_assert(rv == APR_SUCCESS); /* otherwise, we're out of sync with APR */ -#endif -#ifdef RLIMIT_NPROC - rv = apr_procattr_limit_set(procattr, APR_LIMIT_NPROC, conf->limit_nproc); - ap_assert(rv == APR_SUCCESS); /* otherwise, we're out of sync with APR */ -#endif - -#endif /* if at least one limit defined */ - - return APR_SUCCESS; -} - -static apr_status_t ef_close_file(void *vfile) -{ - return apr_file_close(vfile); -} - -/* init_ext_filter_process: get the external filter process going - * This is per-filter-instance (i.e., per-request) initialization. - */ -static apr_status_t init_ext_filter_process(ap_filter_t *f) -{ - ef_ctx_t *ctx = f->ctx; - apr_status_t rc; - ef_dir_t *dc = ctx->dc; - - ctx->proc = apr_pcalloc(ctx->p, sizeof(*ctx->proc)); - - rc = apr_procattr_create(&ctx->procattr, ctx->p); - ap_assert(rc == APR_SUCCESS); - - rc = apr_procattr_io_set(ctx->procattr, - APR_CHILD_BLOCK, - APR_CHILD_BLOCK, - APR_CHILD_BLOCK); - ap_assert(rc == APR_SUCCESS); - - rc = set_resource_limits(f->r, ctx->procattr); - ap_assert(rc == APR_SUCCESS); - - if (dc->log_stderr > 0) { - rc = apr_procattr_child_err_set(ctx->procattr, - f->r->server->error_log, /* stderr in child */ - NULL); - ap_assert(rc == APR_SUCCESS); - } - - rc = apr_proc_create(ctx->proc, - ctx->filter->command, - (const char * const *)ctx->filter->args, - NULL, /* environment */ - ctx->procattr, - ctx->p); - if (rc != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, f->r, - "couldn't create child process to run `%s'", - ctx->filter->command); - return rc; - } - - apr_pool_note_subprocess(ctx->p, ctx->proc, kill_after_timeout); - - /* We don't want the handle to the child's stdin inherited by any - * other processes created by httpd. Otherwise, when we close our - * handle, the child won't see EOF because another handle will still - * be open. - */ - - apr_pool_cleanup_register(ctx->p, ctx->proc->in, - apr_pool_cleanup_null, /* other mechanism */ - ef_close_file); - -#if APR_FILES_AS_SOCKETS - { - apr_socket_t *newsock; - - rc = apr_poll_setup(&ctx->pollset, 2, ctx->p); - ap_assert(rc == APR_SUCCESS); - rc = apr_socket_from_file(&newsock, ctx->proc->in); - ap_assert(rc == APR_SUCCESS); - rc = apr_poll_socket_add(ctx->pollset, newsock, APR_POLLOUT); - ap_assert(rc == APR_SUCCESS); - rc = apr_socket_from_file(&newsock, ctx->proc->out); - ap_assert(rc == APR_SUCCESS); - rc = apr_poll_socket_add(ctx->pollset, newsock, APR_POLLIN); - ap_assert(rc == APR_SUCCESS); - } -#endif - - return APR_SUCCESS; -} - -static const char *get_cfg_string(ef_dir_t *dc, ef_filter_t *filter, apr_pool_t *p) -{ - const char *debug_str = dc->debug == -1 ? - "DebugLevel=0" : apr_psprintf(p, "DebugLevel=%d", dc->debug); - const char *log_stderr_str = dc->log_stderr < 1 ? - "NoLogStderr" : "LogStderr"; - const char *preserve_content_length_str = filter->preserves_content_length ? - "PreservesContentLength" : "!PreserveContentLength"; - const char *intype_str = !filter->intype ? - "*/*" : filter->intype; - const char *outtype_str = !filter->outtype ? - "(unchanged)" : filter->outtype; - - return apr_psprintf(p, - "ExtFilterOptions %s %s %s ExtFilterInType %s " - "ExtFilterOuttype %s", - debug_str, log_stderr_str, preserve_content_length_str, - intype_str, outtype_str); -} - -static apr_status_t init_filter_instance(ap_filter_t *f) -{ - ef_ctx_t *ctx; - ef_dir_t *dc; - ef_server_t *sc; - apr_status_t rv; - - f->ctx = ctx = apr_pcalloc(f->r->pool, sizeof(ef_ctx_t)); - dc = ap_get_module_config(f->r->per_dir_config, - &ext_filter_module); - sc = ap_get_module_config(f->r->server->module_config, - &ext_filter_module); - ctx->dc = dc; - /* look for the user-defined filter */ - ctx->filter = apr_hash_get(sc->h, f->frec->name, APR_HASH_KEY_STRING); - if (!ctx->filter) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, f->r, - "couldn't find definition of filter '%s'", - f->frec->name); - return APR_EINVAL; - } - ctx->p = f->r->pool; - if (ctx->filter->intype && - ctx->filter->intype != INTYPE_ALL && - strcasecmp(ctx->filter->intype, f->r->content_type)) { - /* wrong IMT for us; don't mess with the output */ - ctx->noop = 1; - } - else { - rv = init_ext_filter_process(f); - if (rv != APR_SUCCESS) { - return rv; - } - if (ctx->filter->outtype && - ctx->filter->outtype != OUTTYPE_UNCHANGED) { - f->r->content_type = ctx->filter->outtype; - } - if (ctx->filter->preserves_content_length != 1) { - /* nasty, but needed to avoid confusing the browser - */ - apr_table_unset(f->r->headers_out, "Content-Length"); - } - } - - if (dc->debug >= DBGLVL_SHOWOPTIONS) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, f->r, - "%sfiltering `%s' through `%s', cfg %s", - ctx->noop ? "skipping: " : "", - f->r->uri ? f->r->uri : f->r->filename, - ctx->filter->command, - get_cfg_string(dc, ctx->filter, f->r->pool)); - } - - return APR_SUCCESS; -} - -/* drain_available_output(): - * - * if any data is available from the filter, read it and pass it - * to the next filter - */ -static apr_status_t drain_available_output(ap_filter_t *f) -{ - ef_ctx_t *ctx = f->ctx; - ef_dir_t *dc = ctx->dc; - apr_size_t len; - char buf[4096]; - apr_status_t rv; - apr_bucket_brigade *bb; - apr_bucket *b; - - while (1) { - len = sizeof(buf); - rv = apr_file_read(ctx->proc->out, - buf, - &len); - if ((rv && !APR_STATUS_IS_EAGAIN(rv)) || - dc->debug >= DBGLVL_GORY) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, f->r, - "apr_file_read(child output), len %" APR_SIZE_T_FMT, - !rv ? len : -1); - } - if (rv != APR_SUCCESS) { - return rv; - } - bb = apr_brigade_create(f->r->pool); - b = apr_bucket_transient_create(buf, len); - APR_BRIGADE_INSERT_TAIL(bb, b); - if ((rv = ap_pass_brigade(f->next, bb)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, f->r, - "ap_pass_brigade()"); - return rv; - } - } - /* we should never get here; if we do, a bogus error message would be - * the least of our problems - */ - return APR_ANONYMOUS; -} - -static apr_status_t pass_data_to_filter(ap_filter_t *f, const char *data, - apr_ssize_t len) -{ - ef_ctx_t *ctx = f->ctx; - ef_dir_t *dc = ctx->dc; - apr_status_t rv; - apr_size_t bytes_written = 0; - apr_size_t tmplen; - - do { - tmplen = len - bytes_written; - rv = apr_file_write(ctx->proc->in, - (const char *)data + bytes_written, - &tmplen); - bytes_written += tmplen; - if (rv != APR_SUCCESS && !APR_STATUS_IS_EAGAIN(rv)) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, f->r, - "apr_file_write(child input), len %" APR_SIZE_T_FMT, - tmplen); - return rv; - } - if (APR_STATUS_IS_EAGAIN(rv)) { - /* XXX handle blocking conditions here... if we block, we need - * to read data from the child process and pass it down to the - * next filter! - */ - rv = drain_available_output(f); - if (APR_STATUS_IS_EAGAIN(rv)) { -#if APR_FILES_AS_SOCKETS - int num_events; - - rv = apr_poll(ctx->pollset, - &num_events, - f->r->server->timeout * APR_USEC_PER_SEC); - if (rv || dc->debug >= DBGLVL_GORY) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, - rv, f->r, "apr_poll()"); - } - if (rv != APR_SUCCESS && !APR_STATUS_IS_EINTR(rv)) { - /* some error such as APR_TIMEUP */ - return rv; - } -#else /* APR_FILES_AS_SOCKETS */ - /* Yuck... I'd really like to wait until I can read - * or write, but instead I have to sleep and try again - */ - apr_sleep(100000); /* 100 milliseconds */ - if (dc->debug >= DBGLVL_GORY) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, - 0, f->r, "apr_sleep()"); - } -#endif /* APR_FILES_AS_SOCKETS */ - } - else if (rv != APR_SUCCESS) { - return rv; - } - } - } while (bytes_written < len); - return rv; -} - -static apr_status_t ef_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) -{ - ef_ctx_t *ctx = f->ctx; - apr_bucket *b; - ef_dir_t *dc; - apr_size_t len; - const char *data; - apr_status_t rv; - char buf[4096]; - apr_bucket *eos = NULL; - - if (!ctx) { - if ((rv = init_filter_instance(f)) != APR_SUCCESS) { - return rv; - } - ctx = f->ctx; - } - if (ctx->noop) { - ap_remove_output_filter(f); - return ap_pass_brigade(f->next, bb); - } - dc = ctx->dc; - - APR_BRIGADE_FOREACH(b, bb) { - - if (APR_BUCKET_IS_EOS(b)) { - eos = b; - break; - } - - rv = apr_bucket_read(b, &data, &len, APR_BLOCK_READ); - if (rv != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, f->r, "apr_bucket_read()"); - return rv; - } - - if (len > 0 && - (rv = pass_data_to_filter(f, data, len)) != APR_SUCCESS) { - return rv; - } - } - - apr_brigade_destroy(bb); - - /* XXX What we *really* need to do once we've hit eos is create a pipe bucket - * from the child output pipe and pass down the pipe bucket + eos. - */ - if (eos) { - /* close the child's stdin to signal that no more data is coming; - * that will cause the child to finish generating output - */ - if ((rv = apr_file_close(ctx->proc->in)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, f->r, - "apr_file_close(child input)"); - return rv; - } - /* since we've seen eos and closed the child's stdin, set the proper pipe - * timeout; we don't care if we don't return from apr_file_read() for a while... - */ - rv = apr_file_pipe_timeout_set(ctx->proc->out, - f->r->server->timeout * APR_USEC_PER_SEC); - if (rv) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, f->r, - "apr_file_pipe_timeout_set(child output)"); - return rv; - } - } - - do { - len = sizeof(buf); - rv = apr_file_read(ctx->proc->out, - buf, - &len); - if ((rv && !APR_STATUS_IS_EOF(rv) && !APR_STATUS_IS_EAGAIN(rv)) || - dc->debug >= DBGLVL_GORY) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, f->r, - "apr_file_read(child output), len %" APR_SIZE_T_FMT, - !rv ? len : -1); - } - if (APR_STATUS_IS_EAGAIN(rv)) { - if (eos) { - /* should not occur, because we have an APR timeout in place */ - AP_DEBUG_ASSERT(1 != 1); - } - return APR_SUCCESS; - } - - if (rv == APR_SUCCESS) { - bb = apr_brigade_create(f->r->pool); - b = apr_bucket_transient_create(buf, len); - APR_BRIGADE_INSERT_TAIL(bb, b); - if ((rv = ap_pass_brigade(f->next, bb)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, f->r, - "ap_pass_brigade(filtered buffer) failed"); - return rv; - } - } - } while (rv == APR_SUCCESS); - - if (!APR_STATUS_IS_EOF(rv)) { - return rv; - } - - if (eos) { - /* pass down eos */ - bb = apr_brigade_create(f->r->pool); - b = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(bb, b); - if ((rv = ap_pass_brigade(f->next, bb)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, f->r, - "ap_pass_brigade(eos) failed"); - return rv; - } - } - - return APR_SUCCESS; -} - -#if 0 -static int ef_input_filter(ap_filter_t *f, apr_bucket_brigade *bb, - ap_input_mode_t mode, apr_size_t *readbytes) -{ - apr_status_t rv; - apr_bucket *b; - char *buf; - apr_ssize_t len; - char *zero; - - rv = ap_get_brigade(f->next, bb, mode, readbytes); - if (rv != APR_SUCCESS) { - return rv; - } - - APR_BRIGADE_FOREACH(b, bb) { - if (!APR_BUCKET_IS_EOS(b)) { - if ((rv = apr_bucket_read(b, (const char **)&buf, &len, APR_BLOCK_READ)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, f->r, "apr_bucket_read() failed"); - return rv; - } - ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, "apr_bucket_read -> %d bytes", - len); - while ((zero = memchr(buf, '0', len))) { - *zero = 'a'; - } - } - else - ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, "got eos bucket"); - } - - return rv; -} -#endif - -module ext_filter_module = -{ - STANDARD20_MODULE_STUFF, - create_ef_dir_conf, - merge_ef_dir_conf, - create_ef_server_conf, - NULL, - cmds, -}; diff --git a/modules/experimental/mod_generic_hook_export.c b/modules/experimental/mod_generic_hook_export.c deleted file mode 100644 index 38ee86815d..0000000000 --- a/modules/experimental/mod_generic_hook_export.c +++ /dev/null @@ -1,82 +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_generic_hook_export.h" -#include "http_protocol.h" - -APR_IMPLEMENT_GENERIC_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 generic_hook_export_module = -{ - STANDARD20_MODULE_STUFF, - NULL, - NULL, - NULL, - NULL, - NULL, - ExportRegisterHooks -}; diff --git a/modules/experimental/mod_generic_hook_export.dsp b/modules/experimental/mod_generic_hook_export.dsp deleted file mode 100644 index 711a041565..0000000000 --- a/modules/experimental/mod_generic_hook_export.dsp +++ /dev/null @@ -1,95 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_generic_hook_export" - 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_generic_hook_export - 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_generic_hook_export.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_generic_hook_export.mak" CFG="mod_generic_hook_export - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_generic_hook_export - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_generic_hook_export - 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_generic_hook_export - 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_generic_hook_export" /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_generic_hook_export.so" /machine:I386 -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_generic_hook_export.so" /machine:I386 - -!ELSEIF "$(CFG)" == "mod_generic_hook_export - 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_generic_hook_export" /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_generic_hook_export.so" /machine:I386 -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map/debug /out:"Debug/mod_generic_hook_export.so" /machine:I386 - -!ENDIF - -# Begin Target - -# Name "mod_generic_hook_export - Win32 Release" -# Name "mod_generic_hook_export - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_generic_hook_export.c -# End Source File -# End Target -# End Project diff --git a/modules/experimental/mod_generic_hook_export.h b/modules/experimental/mod_generic_hook_export.h deleted file mode 100644 index a55d2f227c..0000000000 --- a/modules/experimental/mod_generic_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_generic_hook.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/experimental/mod_generic_hook_import.c b/modules/experimental/mod_generic_hook_import.c deleted file mode 100644 index f46fa44df5..0000000000 --- a/modules/experimental/mod_generic_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_generic_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_HOOK_GENERIC(ap,generic_hook_test,ImportGenericHookTestHook,NULL,NULL, - APR_HOOK_MIDDLE); -} - -module generic_hook_import_module= -{ - STANDARD20_MODULE_STUFF, - NULL, - NULL, - NULL, - NULL, - NULL, - ImportRegisterHooks -}; diff --git a/modules/experimental/mod_generic_hook_import.dsp b/modules/experimental/mod_generic_hook_import.dsp deleted file mode 100644 index 78068294ab..0000000000 --- a/modules/experimental/mod_generic_hook_import.dsp +++ /dev/null @@ -1,95 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_generic_hook_import" - 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_generic_hook_import - 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_generic_hook_import.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_generic_hook_import.mak" CFG="mod_generic_hook_import - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_generic_hook_import - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_generic_hook_import - 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_generic_hook_import - 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_generic_hook_import" /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_generic_hook_import.so" /machine:I386 -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_generic_hook_import.so" /machine:I386 - -!ELSEIF "$(CFG)" == "mod_generic_hook_import - 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_generic_hook_import" /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_generic_hook_import.so" /machine:I386 -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map/debug /out:"Debug/mod_generic_hook_import.so" /machine:I386 - -!ENDIF - -# Begin Target - -# Name "mod_generic_hook_import - Win32 Release" -# Name "mod_generic_hook_import - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_generic_hook_import.c -# End Source File -# End Target -# End Project diff --git a/modules/experimental/mod_optional_fn_export.c b/modules/experimental/mod_optional_fn_export.c deleted file mode 100644 index b214a36621..0000000000 --- a/modules/experimental/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/experimental/mod_optional_fn_export.h b/modules/experimental/mod_optional_fn_export.h deleted file mode 100644 index a1950f373b..0000000000 --- a/modules/experimental/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/experimental/mod_optional_fn_import.c b/modules/experimental/mod_optional_fn_import.c deleted file mode 100644 index 3be3b6be6d..0000000000 --- a/modules/experimental/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; -} - -static 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/filters/.cvsignore b/modules/filters/.cvsignore deleted file mode 100644 index 65f0cc30cf..0000000000 --- a/modules/filters/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -Debug -Release diff --git a/modules/filters/.indent.pro b/modules/filters/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- 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 167b343d0d..0000000000 --- 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 10fc0231ef..0000000000 --- a/modules/filters/config.m4 +++ /dev/null @@ -1,11 +0,0 @@ -dnl modules enabled in this directory by default - -dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]]) - -APACHE_MODPATH_INIT(filters) - -APACHE_MODULE(include, Server Side Includes, , , yes) - -APR_ADDTO(LTFLAGS,-export-dynamic) - -APACHE_MODPATH_FINISH diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c deleted file mode 100644 index ff3a1af295..0000000000 --- a/modules/filters/mod_include.c +++ /dev/null @@ -1,2854 +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_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. - * - */ - -#include "apr.h" -#include "apr_strings.h" -#include "apr_thread_proc.h" -#include "apr_hash.h" -#include "apr_user.h" -#include "apr_lib.h" -#include "apr_optional.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#define CORE_PRIVATE - -#include "ap_config.h" -#include "util_filter.h" -#include "httpd.h" -#include "http_config.h" -#include "http_core.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_include.h" -#include "util_ebcdic.h" - -module AP_MODULE_DECLARE_DATA include_module; -static apr_hash_t *include_hash; -static APR_OPTIONAL_FN_TYPE(ap_register_include_handler) *ssi_pfn_register; - -#define BYTE_COUNT_THRESHOLD AP_MIN_BYTES_TO_WRITE - -/* ------------------------ Environment function -------------------------- */ - -/* XXX: could use ap_table_overlap here */ -static void add_include_vars(request_rec *r, char *timefmt) -{ - char *pwname; - apr_table_t *e = r->subprocess_env; - char *t; - apr_time_t date = r->request_time; - - apr_table_setn(e, "DATE_LOCAL", ap_ht_time(r->pool, date, timefmt, 0)); - apr_table_setn(e, "DATE_GMT", ap_ht_time(r->pool, date, timefmt, 1)); - apr_table_setn(e, "LAST_MODIFIED", - ap_ht_time(r->pool, r->finfo.mtime, timefmt, 0)); - apr_table_setn(e, "DOCUMENT_URI", r->uri); - apr_table_setn(e, "DOCUMENT_PATH_INFO", r->path_info); - if (apr_get_username(&pwname, r->finfo.user, r->pool) == APR_SUCCESS) { - apr_table_setn(e, "USER_NAME", pwname); - } - else { - apr_table_setn(e, "USER_NAME", ""); - } - if ((t = strrchr(r->filename, '/'))) { - apr_table_setn(e, "DOCUMENT_NAME", ++t); - } - else { - apr_table_setn(e, "DOCUMENT_NAME", r->uri); - } - if (r->args) { - char *arg_copy = apr_pstrdup(r->pool, r->args); - - ap_unescape_url(arg_copy); - apr_table_setn(e, "QUERY_STRING_UNESCAPED", - ap_escape_shell_cmd(r->pool, arg_copy)); - } -} - - - -/* --------------------------- Parser functions --------------------------- */ - -/* This function returns either a pointer to the split bucket containing the - * first byte of the BEGINNING_SEQUENCE (after finding a complete match) or it - * returns NULL if no match found. - */ -static apr_bucket *find_start_sequence(apr_bucket *dptr, include_ctx_t *ctx, - apr_bucket_brigade *bb, int *do_cleanup) -{ - apr_size_t len; - const char *c; - const char *buf; - const char *str = STARTING_SEQUENCE; - apr_bucket *tmp_bkt; - apr_size_t start_index; - - *do_cleanup = 0; - - do { - if (APR_BUCKET_IS_EOS(dptr)) { - break; - } - apr_bucket_read(dptr, &buf, &len, APR_BLOCK_READ); - /* XXX handle retcodes */ - if (len == 0) { /* end of pipe? */ - break; - } - c = buf; - while (c - buf != len) { - if (ctx->bytes_parsed >= BYTE_COUNT_THRESHOLD) { - apr_bucket *start_bucket; - - if (ctx->head_start_index > 0) { - start_index = ctx->head_start_index; - start_bucket = ctx->head_start_bucket; - } - else { - start_index = (c - buf); - start_bucket = dptr; - } - apr_bucket_split(start_bucket, start_index); - tmp_bkt = APR_BUCKET_NEXT(start_bucket); - if (ctx->head_start_index > 0) { - ctx->head_start_index = 0; - ctx->head_start_bucket = tmp_bkt; - } - - return tmp_bkt; - } - - if (*c == str[ctx->parse_pos]) { - if (ctx->state == PRE_HEAD) { - ctx->state = PARSE_HEAD; - ctx->head_start_bucket = dptr; - ctx->head_start_index = c - buf; - } - ctx->parse_pos++; - } - else { - if (str[ctx->parse_pos] == '\0') { - /* We want to split the bucket at the '<'. */ - ctx->bytes_parsed++; - ctx->state = PARSE_DIRECTIVE; - ctx->tag_length = 0; - ctx->parse_pos = 0; - ctx->tag_start_bucket = dptr; - ctx->tag_start_index = c - buf; - if (ctx->head_start_index > 0) { - start_index = (c - buf) - ctx->head_start_index; - apr_bucket_split(ctx->head_start_bucket, ctx->head_start_index); - tmp_bkt = APR_BUCKET_NEXT(ctx->head_start_bucket); - if (dptr == ctx->head_start_bucket) { - ctx->tag_start_bucket = tmp_bkt; - ctx->tag_start_index = start_index; - } - ctx->head_start_bucket = tmp_bkt; - ctx->head_start_index = 0; - } - return ctx->head_start_bucket; - } - else if (ctx->parse_pos != 0) { - /* The reason for this, is that we need to make sure - * that we catch cases like <. This makes the - * second check after the original check fails. - * If parse_pos was already 0 then we already checked this. - */ - ctx->tag_length += ctx->parse_pos; - - if (*c == str[0]) { - ctx->state = PARSE_TAIL; - ctx->tail_start_bucket = dptr; - ctx->tail_start_index = c - buf; - ctx->tag_length += ctx->parse_pos; - ctx->parse_pos = 1; - } - else { - if (ctx->tag_length > ctx->directive_length) { - ctx->state = PARSE_TAG; - } - else { - ctx->state = PARSE_DIRECTIVE; - ctx->directive_length += ctx->parse_pos; - } - ctx->tail_start_bucket = NULL; - ctx->tail_start_index = 0; - ctx->tag_length += ctx->parse_pos; - ctx->parse_pos = 0; - } - } - } - } - c++; - ctx->bytes_parsed++; - } - dptr = APR_BUCKET_NEXT(dptr); - } while (dptr != APR_BRIGADE_SENTINEL(bb)); - return NULL; -} - -/* This function culls through the buckets that have been set aside in the - * ssi_tag_brigade and copies just the directive part of the SSI tag (none - * of the start and end delimiter bytes are copied). - */ -static apr_status_t get_combined_directive (include_ctx_t *ctx, - request_rec *r, - apr_bucket_brigade *bb, - char *tmp_buf, int tmp_buf_size) -{ - int done = 0; - apr_bucket *dptr; - const char *tmp_from; - apr_size_t tmp_from_len; - - /* If the tag length is longer than the tmp buffer, allocate space. */ - if (ctx->tag_length > tmp_buf_size-1) { - if ((ctx->combined_tag = apr_pcalloc(r->pool, ctx->tag_length + 1)) == NULL) { - return (APR_ENOMEM); - } - } /* Else, just use the temp buffer. */ - else { - ctx->combined_tag = tmp_buf; - } - - /* Prime the pump. Start at the beginning of the tag... */ - dptr = ctx->tag_start_bucket; - apr_bucket_read (dptr, &tmp_from, &tmp_from_len, 0); /* Read the bucket... */ - - /* Adjust the pointer to start at the tag within the bucket... */ - if (dptr == ctx->tail_start_bucket) { - tmp_from_len -= (tmp_from_len - ctx->tail_start_index); - } - tmp_from = &tmp_from[ctx->tag_start_index]; - tmp_from_len -= ctx->tag_start_index; - ctx->curr_tag_pos = ctx->combined_tag; - - /* Loop through the buckets from the tag_start_bucket until before - * the tail_start_bucket copying the contents into the buffer. - */ - do { - memcpy (ctx->curr_tag_pos, tmp_from, tmp_from_len); - ctx->curr_tag_pos += tmp_from_len; - - if (dptr == ctx->tail_start_bucket) { - done = 1; - } - else { - dptr = APR_BUCKET_NEXT (dptr); - apr_bucket_read (dptr, &tmp_from, &tmp_from_len, 0); - /* Adjust the count to stop at the beginning of the tail. */ - if (dptr == ctx->tail_start_bucket) { - tmp_from_len -= (tmp_from_len - ctx->tail_start_index); - } - } - } while ((!done) && - ((ctx->curr_tag_pos - ctx->combined_tag) < ctx->tag_length)); - - ctx->combined_tag[ctx->tag_length] = '\0'; - ctx->curr_tag_pos = ctx->combined_tag; - - return (APR_SUCCESS); -} - -/* - * 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 && apr_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 NULL. - * The tag value is html decoded if dodecode is non-zero. - * The tag value may be NULL if there is no tag value.. - * format: - * [WS][WS]=[WS]['|"]['|"|WS] - */ - -#define SKIP_TAG_WHITESPACE(ptr) while ((*ptr != '\0') && (apr_isspace (*ptr))) ptr++ - -static void ap_ssi_get_tag_and_value(include_ctx_t *ctx, char **tag, - char **tag_val, int dodecode) -{ - char *c = ctx->curr_tag_pos; - int shift_val = 0; - char term = '\0'; - - *tag_val = NULL; - SKIP_TAG_WHITESPACE(c); - *tag = c; /* First non-whitespace character (could be NULL). */ - - while ((*c != '\0') && (*c != '=') && (!apr_isspace(*c))) { - *c = apr_tolower(*c); /* find end of tag, lowercasing as we go... */ - c++; - } - - if ((*c == '\0') || (**tag == '=')) { - if ((**tag == '\0') || (**tag == '=')) { - *tag = NULL; - } - ctx->curr_tag_pos = c; - return; /* We have found the end of the buffer. */ - } /* We might have a tag, but definitely no value. */ - - if (*c == '=') { - *c++ = '\0'; /* Overwrite the '=' with a terminating byte after tag. */ - } - else { /* Try skipping WS to find the '='. */ - *c++ = '\0'; /* Terminate the tag... */ - SKIP_TAG_WHITESPACE(c); - - if (*c != '=') { /* There needs to be an equal sign if there's a value. */ - ctx->curr_tag_pos = c; - return; /* There apparently was no value. */ - } - else { - c++; /* Skip the equals sign. */ - } - } - - SKIP_TAG_WHITESPACE(c); - if (*c == '"' || *c == '\'') { /* Allow quoted values for space inclusion. */ - term = *c++; /* NOTE: This does not pass the quotes on return. */ - } - - *tag_val = c; - while ((*c != '\0') && - (((term != '\0') && (*c != term)) || - ((term == '\0') && (!apr_isspace(*c))))) { - if (*c == '\\') { /* Accept \" and \' as valid char in string. */ - c++; - if (*c == term) { /* Overwrite the "\" during the embedded */ - shift_val++; /* escape sequence of '\"' or "\'". Shift */ - } /* bytes from here to next delimiter. */ - if (shift_val > 0) { - *(c-shift_val) = *c; - } - } - - c++; - if (shift_val > 0) { - *(c-shift_val) = *c; - } - } - - *c++ = '\0'; /* Overwrites delimiter (term or WS) with NULL. */ - ctx->curr_tag_pos = c; - if (dodecode) { - decodehtml(*tag_val); - } - - return; -} - - -/* - * Do variable substitution on strings - */ -static void ap_ssi_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 '$': - { - const char *start_of_var_name; - char *end_of_var_name; /* end of var name + 1 */ - const char *expansion, *temp_end, *val; - char tmp_store; - size_t l; - - /* guess that the expansion won't happen */ - expansion = in - 1; - if (*in == '{') { - ++in; - start_of_var_name = in; - in = ap_strchr_c(in, '}'); - if (in == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, - 0, r, "Missing '}' on variable \"%s\"", - expansion); - *next = '\0'; - return; - } - temp_end = in; - end_of_var_name = (char *)temp_end; - ++in; - } - else { - start_of_var_name = in; - while (apr_isalnum(*in) || *in == '_') { - ++in; - } - temp_end = in; - end_of_var_name = (char *)temp_end; - } - /* 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) { - tmp_store = *end_of_var_name; - *end_of_var_name = '\0'; - val = apr_table_get(r->subprocess_env, start_of_var_name); - *end_of_var_name = tmp_store; - - 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 = ((int)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 ---------------------------- */ - -/* ensure that path is relative, and does not contain ".." elements - * ensentially ensure that it does not match the regex: - * (^/|(^|/)\.\.(/|$)) - * XXX: Needs to become apr_is_path_relative() test - */ -static int is_only_below(const char *path) -{ -#ifdef HAVE_DRIVE_LETTERS - if (path[1] == ':') - return 0; -#endif -#ifdef NETWARE - if (strchr(path, ':') - return 0; -#endif - if (path[0] == '/') { - return 0; - } - while (*path) { - int dots = 0; - while (path[dots] == '.') - ++dots; -#if defined(WIN32) - /* If the name is canonical this is redundant - * but in security, redundancy is worthwhile. - * Does OS2 belong here (accepts ... for ..)? - */ - if (dots > 1 && (!path[dots] || path[dots] == '/')) - return 0; -#else - if (dots == 2 && (!path[dots] || path[dots] == '/')) - return 0; -#endif - path += dots; - while (*path && *(path++) != '/') - ++path; - } - return 1; -} - -static int handle_include(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec *r, - ap_filter_t *f, apr_bucket *head_ptr, apr_bucket **inserted_head) -{ - char *tag = NULL; - char *tag_val = NULL; - apr_bucket *tmp_buck; - char parsed_string[MAX_STRING_LEN]; - - *inserted_head = NULL; - if (ctx->flags & FLAG_PRINTING) { - while (1) { - ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, 1); - if (tag_val == NULL) { - if (tag == NULL) { - return (0); - } - else { - return (1); - } - } - if (!strcmp(tag, "file") || !strcmp(tag, "virtual")) { - request_rec *rr = NULL; - char *error_fmt = NULL; - - ap_ssi_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, f->next); - } - } - else { - rr = ap_sub_req_lookup_uri(parsed_string, r, f->next); - } - - if (!error_fmt && rr->status != HTTP_OK) { - error_fmt = "unable to include \"%s\" in parsed file %s"; - } - - if (!error_fmt && (ctx->flags & FLAG_NO_EXEC) && 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 */ - /* Basically, it puts a bread crumb in here, then looks */ - /* for the crumb later to see if its been here. */ - if (rr) - ap_set_module_config(rr->request_config, &include_module, r); - - if (!error_fmt) { - SPLIT_AND_PASS_PRETAG_BUCKETS(*bb, ctx, f->next); - - if (ap_run_sub_req(rr)) { - error_fmt = "unable to include \"%s\" in parsed file %s"; - } - } - if (error_fmt) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, - 0, r, error_fmt, tag_val, r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - - /* destroy the sub request if it's not a nested include (crumb) */ - if (rr != NULL - && ap_get_module_config(rr->request_config, &include_module) - != NESTED_INCLUDE_MAGIC) { - ap_destroy_sub_req(rr); - } - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "unknown parameter \"%s\" to tag include in %s", - tag, r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - } - } - return 0; -} - - -static int handle_echo(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec *r, - ap_filter_t *f, apr_bucket *head_ptr, apr_bucket **inserted_head) -{ - char *tag = NULL; - char *tag_val = NULL; - const char *echo_text = NULL; - apr_bucket *tmp_buck; - apr_size_t e_len, e_wrt; - enum {E_NONE, E_URL, E_ENTITY} encode; - - encode = E_ENTITY; - - *inserted_head = NULL; - if (ctx->flags & FLAG_PRINTING) { - while (1) { - ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, 1); - if (tag_val == NULL) { - if (tag != NULL) { - return 1; - } - else { - return 0; - } - } - if (!strcmp(tag, "var")) { - const char *val = apr_table_get(r->subprocess_env, tag_val); - - if (val) { - switch(encode) { - case E_NONE: echo_text = val; break; - case E_URL: echo_text = ap_escape_uri(r->pool, val); break; - case E_ENTITY: echo_text = ap_escape_html(r->pool, val); break; - } - - e_len = strlen(echo_text); - tmp_buck = apr_bucket_heap_create(echo_text, e_len, 1, &e_wrt); - } - else { - tmp_buck = apr_bucket_immortal_create("(none)", sizeof("none")); - } - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck); - if (*inserted_head == NULL) { - *inserted_head = tmp_buck; - } - } - else if (!strcmp(tag, "encoding")) { - if (!strcasecmp(tag_val, "none")) encode = E_NONE; - else if (!strcasecmp(tag_val, "url")) encode = E_URL; - else if (!strcasecmp(tag_val, "entity")) encode = E_ENTITY; - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "unknown value \"%s\" to parameter \"encoding\" of " - "tag echo in %s", tag_val, r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "unknown parameter \"%s\" in tag echo of %s", - tag, r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - - } - } - return 0; -} - -/* error and tf must point to a string with room for at - * least MAX_STRING_LEN characters - */ -static int handle_config(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec *r, - ap_filter_t *f, apr_bucket *head_ptr, apr_bucket **inserted_head) -{ - char *tag = NULL; - char *tag_val = NULL; - char parsed_string[MAX_STRING_LEN]; - apr_table_t *env = r->subprocess_env; - - *inserted_head = NULL; - if (ctx->flags & FLAG_PRINTING) { - while (1) { - ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, 0); - if (tag_val == NULL) { - if (tag == NULL) { - return 0; /* Reached the end of the string. */ - } - else { - return 1; /* tags must have values. */ - } - } - if (!strcmp(tag, "errmsg")) { - ap_ssi_parse_string(r, tag_val, ctx->error_str, MAX_STRING_LEN, 0); - ctx->error_length = strlen(ctx->error_str); - } - else if (!strcmp(tag, "timefmt")) { - apr_time_t date = r->request_time; - - ap_ssi_parse_string(r, tag_val, ctx->time_str, MAX_STRING_LEN, 0); - apr_table_setn(env, "DATE_LOCAL", ap_ht_time(r->pool, date, ctx->time_str, 0)); - apr_table_setn(env, "DATE_GMT", ap_ht_time(r->pool, date, ctx->time_str, 1)); - apr_table_setn(env, "LAST_MODIFIED", - ap_ht_time(r->pool, r->finfo.mtime, ctx->time_str, 0)); - } - else if (!strcmp(tag, "sizefmt")) { - ap_ssi_parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 0); - decodehtml(parsed_string); - if (!strcmp(parsed_string, "bytes")) { - ctx->flags |= FLAG_SIZE_IN_BYTES; - } - else if (!strcmp(parsed_string, "abbrev")) { - ctx->flags &= FLAG_SIZE_ABBREV; - } - } - else { - apr_bucket *tmp_buck; - - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "unknown parameter \"%s\" to tag config in %s", - tag, r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - } - } - return 0; -} - - -static int find_file(request_rec *r, const char *directive, const char *tag, - char *tag_val, apr_finfo_t *finfo) -{ - char *to_send = tag_val; - request_rec *rr = NULL; - int ret=0; - char *error_fmt = NULL; - apr_status_t rv = APR_SUCCESS; - - 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 */ - - /* note: it is okay to pass NULL for the "next filter" since - we never attempt to "run" this sub request. */ - rr = ap_sub_req_lookup_file(tag_val, r, NULL); - - if (rr->status == HTTP_OK && rr->finfo.filetype != 0) { - to_send = rr->filename; - if ((rv = apr_stat(finfo, to_send, APR_FINFO_GPROT - | APR_FINFO_MIN, rr->pool)) != APR_SUCCESS - && rv != APR_INCOMPLETE) { - 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 | (rv ? 0 : APLOG_NOERRNO), - rv, r, error_fmt, to_send, r->filename); - } - - if (rr) ap_destroy_sub_req(rr); - - return ret; - } - else if (!strcmp(tag, "virtual")) { - /* note: it is okay to pass NULL for the "next filter" since - we never attempt to "run" this sub request. */ - rr = ap_sub_req_lookup_uri(tag_val, r, NULL); - - if (rr->status == HTTP_OK && rr->finfo.filetype != 0) { - memcpy((char *) finfo, (const char *) &rr->finfo, - sizeof(rr->finfo)); - ap_destroy_sub_req(rr); - return 0; - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "unable to get information about \"%s\" " - "in parsed file %s", - tag_val, r->filename); - ap_destroy_sub_req(rr); - return -1; - } - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "unknown parameter \"%s\" to tag %s in %s", - tag, directive, r->filename); - return -1; - } -} - -#define NEG_SIGN " -" -#define ZERO_K " 0k" -#define ONE_K " 1k" - -static void generate_size(apr_ssize_t size, char *buff, apr_size_t buff_size) -{ - /* XXX: this -1 thing is a gross hack */ - if (size == (apr_ssize_t)-1) { - memcpy (buff, NEG_SIGN, sizeof(NEG_SIGN)+1); - } - else if (!size) { - memcpy (buff, ZERO_K, sizeof(ZERO_K)+1); - } - else if (size < 1024) { - memcpy (buff, ONE_K, sizeof(ONE_K)+1); - } - else if (size < 1048576) { - apr_snprintf(buff, buff_size, "%4" APR_SSIZE_T_FMT "k", (size + 512) / 1024); - } - else if (size < 103809024) { - apr_snprintf(buff, buff_size, "%4.1fM", size / 1048576.0); - } - else { - apr_snprintf(buff, buff_size, "%4" APR_SSIZE_T_FMT "M", (size + 524288) / 1048576); - } -} - -static int handle_fsize(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec *r, - ap_filter_t *f, apr_bucket *head_ptr, apr_bucket **inserted_head) -{ - char *tag = NULL; - char *tag_val = NULL; - apr_finfo_t finfo; - apr_size_t s_len, s_wrt; - apr_bucket *tmp_buck; - char parsed_string[MAX_STRING_LEN]; - - *inserted_head = NULL; - if (ctx->flags & FLAG_PRINTING) { - while (1) { - ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, 1); - if (tag_val == NULL) { - if (tag == NULL) { - return 0; - } - else { - return 1; - } - } - else { - ap_ssi_parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 0); - if (!find_file(r, "fsize", tag, parsed_string, &finfo)) { - char buff[50]; - - if (!(ctx->flags & FLAG_SIZE_IN_BYTES)) { - generate_size(finfo.size, buff, sizeof(buff)); - s_len = strlen (buff); - } - else { - int l, x, pos = 0; - char tmp_buff[50]; - - apr_snprintf(tmp_buff, sizeof(tmp_buff), "%" APR_OFF_T_FMT, finfo.size); - l = strlen(tmp_buff); /* grrr */ - for (x = 0; x < l; x++) { - if (x && (!((l - x) % 3))) { - buff[pos++] = ','; - } - buff[pos++] = tmp_buff[x]; - } - buff[pos] = '\0'; - s_len = pos; - } - - tmp_buck = apr_bucket_heap_create(buff, s_len, 1, &s_wrt); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck); - if (*inserted_head == NULL) { - *inserted_head = tmp_buck; - } - } - else { - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - } - } - } - return 0; -} - -static int handle_flastmod(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec *r, - ap_filter_t *f, apr_bucket *head_ptr, apr_bucket **inserted_head) -{ - char *tag = NULL; - char *tag_val = NULL; - apr_finfo_t finfo; - apr_size_t t_len, t_wrt; - apr_bucket *tmp_buck; - char parsed_string[MAX_STRING_LEN]; - - *inserted_head = NULL; - if (ctx->flags & FLAG_PRINTING) { - while (1) { - ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, 1); - if (tag_val == NULL) { - if (tag == NULL) { - return 0; - } - else { - return 1; - } - } - else { - ap_ssi_parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 0); - if (!find_file(r, "flastmod", tag, parsed_string, &finfo)) { - char *t_val; - - t_val = ap_ht_time(r->pool, finfo.mtime, ctx->time_str, 0); - t_len = strlen(t_val); - - tmp_buck = apr_bucket_heap_create(t_val, t_len, 1, &t_wrt); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck); - if (*inserted_head == NULL) { - *inserted_head = tmp_buck; - } - } - else { - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - } - } - } - return 0; -} - -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, 0, 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, - int *unmatched) -{ - char ch; - int next = 0; - int qs = 0; - int tkn_fnd = 0; - - /* Skip leading white space */ - if (string == (char *) NULL) { - return (char *) NULL; - } - while ((ch = *string++)) { - if (!apr_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') && (!tkn_fnd)); ch = *++string) { - if (ch == '\\') { - if ((ch = *++string) == '\0') { - tkn_fnd = 1; - } - else { - token->value[next++] = ch; - } - } - else { - if (!qs) { - if (apr_isspace(ch)) { - tkn_fnd = 1; - } - else { - switch (ch) { - case '(': - case ')': - case '=': - case '!': - case '<': - case '>': - tkn_fnd = 1; - break; - case '|': - if (*(string + 1) == '|') { - tkn_fnd = 1; - } - break; - case '&': - if (*(string + 1) == '&') { - tkn_fnd = 1; - } - break; - } - if (!tkn_fnd) { - token->value[next++] = ch; - } - } - } - else { - if (ch == '\'') { - qs = 0; - ++string; - tkn_fnd = 1; - } - else { - token->value[next++] = ch; - } - } - } - } - - /* If qs is still set, I have an unmatched ' */ - if (qs) { - *unmatched = 1; - 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, int *was_error, - int *was_unmatched, char *debug) -{ - 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]; - apr_pool_t *expr_pool; - int retval = 0; - apr_size_t debug_pos = 0; - - debug[debug_pos] = '\0'; - *was_error = 0; - *was_unmatched = 0; - if ((parse = expr) == (char *) NULL) { - return (0); - } - root = current = (struct parse_node *) NULL; - if (apr_pool_create(&expr_pool, r->pool) != APR_SUCCESS) - return 0; - - /* Create Parse Tree */ - while (1) { - new = (struct parse_node *) apr_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, was_unmatched)) == (char *) NULL) { - break; - } - switch (new->token.type) { - - case token_string: -#ifdef DEBUG_INCLUDE - debug_pos += sprintf (&debug[debug_pos], " Token: string (%s)\n", - new->token.value); -#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, 0, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - *was_error = 1; - goto RETURN; - } - break; - - case token_and: - case token_or: -#ifdef DEBUG_INCLUDE - memcpy (&debug[debug_pos], " Token: and/or\n", - sizeof (" Token: and/or\n")); - debug_pos += sizeof (" Token: and/or\n"); -#endif - if (current == (struct parse_node *) NULL) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - *was_error = 1; - 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, 0, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - *was_error = 1; - 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 - memcpy (&debug[debug_pos], " Token: not\n", - sizeof (" Token: not\n")); - debug_pos += sizeof (" Token: not\n"); -#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, 0, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - *was_error = 1; - 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 - memcpy (&debug[debug_pos], " Token: eq/ne/ge/gt/le/lt\n", - sizeof (" Token: eq/ne/ge/gt/le/lt\n")); - debug_pos += sizeof (" Token: eq/ne/ge/gt/le/lt\n"); -#endif - if (current == (struct parse_node *) NULL) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - *was_error = 1; - 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, 0, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - *was_error = 1; - 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 - memcpy (&debug[debug_pos], " Token: rbrace\n", - sizeof (" Token: rbrace\n")); - debug_pos += sizeof (" Token: rbrace\n"); -#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, 0, r, - "Unmatched ')' in \"%s\" in file %s", - expr, r->filename); - *was_error = 1; - goto RETURN; - } - break; - - case token_lbrace: -#ifdef DEBUG_INCLUDE - memcpy (&debug[debug_pos], " Token: lbrace\n", - sizeof (" Token: lbrace\n")); - debug_pos += sizeof (" Token: lbrace\n"); -#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, 0, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - *was_error = 1; - 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 - memcpy (&debug[debug_pos], " Evaluate string\n", - sizeof (" Evaluate string\n")); - debug_pos += sizeof (" Evaluate string\n"); -#endif - ap_ssi_parse_string(r, current->token.value, buffer, sizeof(buffer), 0); - apr_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 - memcpy (&debug[debug_pos], " Evaluate and/or\n", - sizeof (" Evaluate and/or\n")); - debug_pos += sizeof (" Evaluate and/or\n"); -#endif - if (current->left == (struct parse_node *) NULL || - current->right == (struct parse_node *) NULL) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - *was_error = 1; - goto RETURN; - } - if (!current->left->done) { - switch (current->left->token.type) { - case token_string: - ap_ssi_parse_string(r, current->left->token.value, - buffer, sizeof(buffer), 0); - apr_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: - ap_ssi_parse_string(r, current->right->token.value, - buffer, sizeof(buffer), 0); - apr_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 - debug_pos += sprintf (&debug[debug_pos], " Left: %c\n", - current->left->value ? '1' : '0'); - debug_pos += sprintf (&debug[debug_pos], " Right: %c\n", - current->right->value ? '1' : '0'); -#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 - debug_pos += sprintf (&debug[debug_pos], " Returning %c\n", - current->value ? '1' : '0'); -#endif - current->done = 1; - current = current->parent; - break; - - case token_eq: - case token_ne: -#ifdef DEBUG_INCLUDE - memcpy (&debug[debug_pos], " Evaluate eq/ne\n", - sizeof (" Evaluate eq/ne\n")); - debug_pos += sizeof (" Evaluate eq/ne\n"); -#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, 0, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - *was_error = 1; - goto RETURN; - } - ap_ssi_parse_string(r, current->left->token.value, - buffer, sizeof(buffer), 0); - apr_cpystrn(current->left->token.value, buffer, - sizeof(current->left->token.value)); - ap_ssi_parse_string(r, current->right->token.value, - buffer, sizeof(buffer), 0); - apr_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, 0, r, - "Invalid rexp \"%s\" in file %s", - current->right->token.value, r->filename); - *was_error = 1; - goto RETURN; - } -#ifdef DEBUG_INCLUDE - debug_pos += sprintf (&debug[debug_pos], - " Re Compare (%s) with /%s/\n", - current->left->token.value, - ¤t->right->token.value[1]); -#endif - current->value = - re_check(r, current->left->token.value, - ¤t->right->token.value[1]); - } - else { -#ifdef DEBUG_INCLUDE - debug_pos += sprintf (&debug[debug_pos], - " Compare (%s) with (%s)\n", - current->left->token.value, - current->right->token.value); -#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 - debug_pos += sprintf (&debug[debug_pos], " Returning %c\n", - current->value ? '1' : '0'); -#endif - current->done = 1; - current = current->parent; - break; - case token_ge: - case token_gt: - case token_le: - case token_lt: -#ifdef DEBUG_INCLUDE - memcpy (&debug[debug_pos], " Evaluate ge/gt/le/lt\n", - sizeof (" Evaluate ge/gt/le/lt\n")); - debug_pos += sizeof (" Evaluate ge/gt/le/lt\n"); -#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, 0, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - *was_error = 1; - goto RETURN; - } - ap_ssi_parse_string(r, current->left->token.value, - buffer, sizeof(buffer), 0); - apr_cpystrn(current->left->token.value, buffer, - sizeof(current->left->token.value)); - ap_ssi_parse_string(r, current->right->token.value, - buffer, sizeof(buffer), 0); - apr_cpystrn(current->right->token.value, buffer, - sizeof(current->right->token.value)); -#ifdef DEBUG_INCLUDE - debug_pos += sprintf (&debug[debug_pos], - " Compare (%s) with (%s)\n", - current->left->token.value, - current->right->token.value); -#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 - debug_pos += sprintf (&debug[debug_pos], " Returning %c\n", - current->value ? '1' : '0'); -#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 - debug_pos += sprintf (&debug[debug_pos], " Evaluate !: %c\n", - current->value ? '1' : '0'); -#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 - debug_pos += sprintf (&debug[debug_pos], " Evaluate (): %c\n", - current->value ? '1' : '0'); -#endif - current->done = 1; - current = current->parent; - break; - - case token_lbrace: - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Unmatched '(' in \"%s\" in file %s", - expr, r->filename); - *was_error = 1; - goto RETURN; - - case token_rbrace: - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Unmatched ')' in \"%s\" in file %s", - expr, r->filename); - *was_error = 1; - goto RETURN; - - default: - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "bad token type"); - *was_error = 1; - goto RETURN; - } - } - - retval = (root == (struct parse_node *) NULL) ? 0 : root->value; - RETURN: - apr_pool_destroy(expr_pool); - return (retval); -} - -/*-------------------------------------------------------------------------*/ -#ifdef DEBUG_INCLUDE - -/* XXX overlaying the static string pointed to by cond_txt isn't cool */ - -#define MAX_DEBUG_SIZE MAX_STRING_LEN -#define LOG_COND_STATUS(cntx, t_buck, h_ptr, ins_head, tag_text) \ -{ \ - char *cond_txt = "**** X conditional_status=\"0\"\n"; \ - apr_size_t c_wrt; \ - \ - if (cntx->flags & FLAG_COND_TRUE) { \ - cond_txt[31] = '1'; \ - } \ - memcpy(&cond_txt[5], tag_text, sizeof(tag_text)); \ - t_buck = apr_bucket_heap_create(cond_txt, sizeof(cond_txt), 1, &c_wrt); \ - APR_BUCKET_INSERT_BEFORE(h_ptr, t_buck); \ - \ - if (ins_head == NULL) { \ - ins_head = t_buck; \ - } \ -} -#define DUMP_PARSE_EXPR_DEBUG(t_buck, h_ptr, d_buf, ins_head) \ -{ \ - apr_size_t b_wrt; \ - if (d_buf[0] != '\0') { \ - t_buck = apr_bucket_heap_create(d_buf, strlen(d_buf), 1, &b_wrt); \ - APR_BUCKET_INSERT_BEFORE(h_ptr, t_buck); \ - \ - if (ins_head == NULL) { \ - ins_head = t_buck; \ - } \ - } \ -} -#else - -#define MAX_DEBUG_SIZE 10 -#define LOG_COND_STATUS(cntx, t_buck, h_ptr, ins_head, tag_text) -#define DUMP_PARSE_EXPR_DEBUG(t_buck, h_ptr, d_buf, ins_head) - -#endif -/*-------------------------------------------------------------------------*/ - -/* pjr - These seem to allow expr="fred" expr="joe" where joe overwrites fred. */ -static int handle_if(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec *r, - ap_filter_t *f, apr_bucket *head_ptr, apr_bucket **inserted_head) -{ - char *tag = NULL; - char *tag_val = NULL; - char *expr = NULL; - int expr_ret, was_error, was_unmatched; - apr_bucket *tmp_buck; - char debug_buf[MAX_DEBUG_SIZE]; - - *inserted_head = NULL; - if (!ctx->flags & FLAG_PRINTING) { - ctx->if_nesting_level++; - } - else { - while (1) { - ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, 0); - if (tag == NULL) { - if (expr == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "missing expr in if statement: %s", r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - return 1; - } - expr_ret = parse_expr(r, expr, &was_error, &was_unmatched, debug_buf); - if (was_error) { - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - return 1; - } - if (was_unmatched) { - DUMP_PARSE_EXPR_DEBUG(tmp_buck, head_ptr, "\nUnmatched '\n", - *inserted_head); - } - DUMP_PARSE_EXPR_DEBUG(tmp_buck, head_ptr, debug_buf, *inserted_head); - - if (expr_ret) { - ctx->flags |= (FLAG_PRINTING | FLAG_COND_TRUE); - } - else { - ctx->flags &= FLAG_CLEAR_PRINT_COND; - } - LOG_COND_STATUS(ctx, tmp_buck, head_ptr, *inserted_head, " if"); - ctx->if_nesting_level = 0; - return 0; - } - else if (!strcmp(tag, "expr")) { - expr = tag_val; -#ifdef DEBUG_INCLUDE - if (1) { - apr_size_t d_len = 0, d_wrt = 0; - d_len = sprintf(debug_buf, "**** if expr=\"%s\"\n", expr); - tmp_buck = apr_bucket_heap_create(debug_buf, d_len, 1, &d_wrt); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck); - - if (*inserted_head == NULL) { - *inserted_head = tmp_buck; - } - } -#endif - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "unknown parameter \"%s\" to tag if in %s", tag, r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - - } - } - return 0; -} - -static int handle_elif(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec *r, - ap_filter_t *f, apr_bucket *head_ptr, apr_bucket **inserted_head) -{ - char *tag = NULL; - char *tag_val = NULL; - char *expr = NULL; - int expr_ret, was_error, was_unmatched; - apr_bucket *tmp_buck; - char debug_buf[MAX_DEBUG_SIZE]; - - *inserted_head = NULL; - if (!ctx->if_nesting_level) { - while (1) { - ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, 0); - if (tag == '\0') { - LOG_COND_STATUS(ctx, tmp_buck, head_ptr, *inserted_head, " elif"); - - if (ctx->flags & FLAG_COND_TRUE) { - ctx->flags &= FLAG_CLEAR_PRINTING; - return (0); - } - if (expr == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "missing expr in elif statement: %s", r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - return (1); - } - expr_ret = parse_expr(r, expr, &was_error, &was_unmatched, debug_buf); - if (was_error) { - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - return 1; - } - if (was_unmatched) { - DUMP_PARSE_EXPR_DEBUG(tmp_buck, head_ptr, "\nUnmatched '\n", - *inserted_head); - } - DUMP_PARSE_EXPR_DEBUG(tmp_buck, head_ptr, debug_buf, *inserted_head); - - if (expr_ret) { - ctx->flags |= (FLAG_PRINTING | FLAG_COND_TRUE); - } - else { - ctx->flags &= FLAG_CLEAR_PRINT_COND; - } - LOG_COND_STATUS(ctx, tmp_buck, head_ptr, *inserted_head, " elif"); - return (0); - } - else if (!strcmp(tag, "expr")) { - expr = tag_val; -#ifdef DEBUG_INCLUDE - if (1) { - apr_size_t d_len = 0, d_wrt = 0; - d_len = sprintf(debug_buf, "**** elif expr=\"%s\"\n", expr); - tmp_buck = apr_bucket_heap_create(debug_buf, d_len, 1, &d_wrt); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck); - - if (*inserted_head == NULL) { - *inserted_head = tmp_buck; - } - } -#endif - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "unknown parameter \"%s\" to tag if in %s", tag, r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - } - } - return 0; -} - -static int handle_else(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec *r, - ap_filter_t *f, apr_bucket *head_ptr, apr_bucket **inserted_head) -{ - char *tag = NULL; - char *tag_val = NULL; - apr_bucket *tmp_buck; - - *inserted_head = NULL; - if (!ctx->if_nesting_level) { - ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, 1); - if ((tag != NULL) || (tag_val != NULL)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "else directive does not take tags in %s", r->filename); - if (ctx->flags & FLAG_PRINTING) { - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - return -1; - } - else { - LOG_COND_STATUS(ctx, tmp_buck, head_ptr, *inserted_head, " else"); - - if (ctx->flags & FLAG_COND_TRUE) { - ctx->flags &= FLAG_CLEAR_PRINTING; - } - else { - ctx->flags |= (FLAG_PRINTING | FLAG_COND_TRUE); - } - return 0; - } - } - return 0; -} - -static int handle_endif(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec *r, - ap_filter_t *f, apr_bucket *head_ptr, apr_bucket **inserted_head) -{ - char *tag = NULL; - char *tag_val = NULL; - apr_bucket *tmp_buck; - - *inserted_head = NULL; - if (!ctx->if_nesting_level) { - ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, 1); - if ((tag != NULL) || (tag_val != NULL)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "endif directive does not take tags in %s", r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - return -1; - } - else { - LOG_COND_STATUS(ctx, tmp_buck, head_ptr, *inserted_head, "endif"); - ctx->flags |= (FLAG_PRINTING | FLAG_COND_TRUE); - return 0; - } - } - else { - ctx->if_nesting_level--; - return 0; - } -} - -static int handle_set(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec *r, - ap_filter_t *f, apr_bucket *head_ptr, apr_bucket **inserted_head) -{ - char *tag = NULL; - char *tag_val = NULL; - char *var = NULL; - apr_bucket *tmp_buck; - char parsed_string[MAX_STRING_LEN]; - - *inserted_head = NULL; - if (ctx->flags & FLAG_PRINTING) { - while (1) { - ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, 1); - if ((tag == NULL) && (tag_val == NULL)) { - return 0; - } - else if (tag_val == NULL) { - return 1; - } - 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, 0, r, - "variable must precede value in set directive in %s", - r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - return (-1); - } - ap_ssi_parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 0); - apr_table_setn(r->subprocess_env, apr_pstrdup(r->pool, var), - apr_pstrdup(r->pool, parsed_string)); - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Invalid tag for set directive in %s", r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - return -1; - } - } - } - return 0; -} - -static int handle_printenv(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec *r, - ap_filter_t *f, apr_bucket *head_ptr, apr_bucket **inserted_head) -{ - char *tag = NULL; - char *tag_val = NULL; - apr_bucket *tmp_buck; - - if (ctx->flags & FLAG_PRINTING) { - ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, 1); - if ((tag == NULL) && (tag_val == NULL)) { - apr_array_header_t *arr = apr_table_elts(r->subprocess_env); - apr_table_entry_t *elts = (apr_table_entry_t *)arr->elts; - int i; - char *key_text, *val_text; - apr_size_t k_len, v_len, t_wrt; - - *inserted_head = NULL; - for (i = 0; i < arr->nelts; ++i) { - key_text = ap_escape_html(r->pool, elts[i].key); - val_text = ap_escape_html(r->pool, elts[i].val); - k_len = strlen(key_text); - v_len = strlen(val_text); - - /* Key_text */ - tmp_buck = apr_bucket_heap_create(key_text, k_len, 1, &t_wrt); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck); - if (*inserted_head == NULL) { - *inserted_head = tmp_buck; - } - /* = */ - tmp_buck = apr_bucket_immortal_create("=", 1); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck); - /* Value_text */ - tmp_buck = apr_bucket_heap_create(val_text, v_len, 1, &t_wrt); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck); - /* newline... */ - tmp_buck = apr_bucket_immortal_create("\n", 1); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck); - } - return 0; - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "printenv directive does not take tags in %s", r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - return -1; - } - } - return 0; -} - -/* -------------------------- The main function --------------------------- */ - -static void send_parsed_content(apr_bucket_brigade **bb, request_rec *r, - ap_filter_t *f) -{ - include_ctx_t *ctx = f->ctx; - apr_bucket *dptr = APR_BRIGADE_FIRST(*bb); - apr_bucket *tmp_dptr; - apr_bucket_brigade *tag_and_after; - int ret; - - if (r->args) { /* add QUERY stuff to env cause it ain't yet */ - char *arg_copy = apr_pstrdup(r->pool, r->args); - - apr_table_setn(r->subprocess_env, "QUERY_STRING", r->args); - ap_unescape_url(arg_copy); - apr_table_setn(r->subprocess_env, "QUERY_STRING_UNESCAPED", - ap_escape_shell_cmd(r->pool, arg_copy)); - } - - while (dptr != APR_BRIGADE_SENTINEL(*bb)) { - /* State to check for the STARTING_SEQUENCE. */ - if ((ctx->state == PRE_HEAD) || (ctx->state == PARSE_HEAD)) { - int do_cleanup = 0; - apr_size_t cleanup_bytes = ctx->parse_pos; - - tmp_dptr = find_start_sequence(dptr, ctx, *bb, &do_cleanup); - - /* The few bytes stored in the ssi_tag_brigade turned out not to - * be a tag after all. This can only happen if the starting - * tag actually spans brigades. This should be very rare. - */ - if ((do_cleanup) && (!APR_BRIGADE_EMPTY(ctx->ssi_tag_brigade))) { - apr_bucket *tmp_bkt; - - tmp_bkt = apr_bucket_immortal_create(STARTING_SEQUENCE, - cleanup_bytes); - APR_BRIGADE_INSERT_HEAD(*bb, tmp_bkt); - apr_brigade_cleanup(ctx->ssi_tag_brigade); - } - - /* If I am inside a conditional (if, elif, else) that is false - * then I need to throw away anything contained in it. - */ - if ((!(ctx->flags & FLAG_PRINTING)) && (tmp_dptr != NULL) && - (dptr != APR_BRIGADE_SENTINEL(*bb))) { - while ((dptr != APR_BRIGADE_SENTINEL(*bb)) && - (dptr != tmp_dptr)) { - apr_bucket *free_bucket = dptr; - - dptr = APR_BUCKET_NEXT (dptr); - apr_bucket_delete(free_bucket); - } - } - - /* Adjust the current bucket position based on what was found... */ - if ((tmp_dptr != NULL) && (ctx->state == PARSE_DIRECTIVE)) { - if (ctx->tag_start_bucket != NULL) { - dptr = ctx->tag_start_bucket; - } - else { - dptr = APR_BRIGADE_SENTINEL(*bb); - } - } - else if ((tmp_dptr != NULL) && (ctx->bytes_parsed >= BYTE_COUNT_THRESHOLD)) { - /* Send the large chunk of pre-tag bytes... */ - tag_and_after = apr_brigade_split(*bb, tmp_dptr); - ap_pass_brigade(f->next, *bb); - *bb = tag_and_after; - dptr = tmp_dptr; - ctx->bytes_parsed = 0; - } - else if (tmp_dptr == NULL) { /* There was no possible SSI tag in the */ - dptr = APR_BRIGADE_SENTINEL(*bb); /* remainder of this brigade... */ - } - } - - /* State to check for the ENDING_SEQUENCE. */ - if (((ctx->state == PARSE_DIRECTIVE) || - (ctx->state == PARSE_TAG) || - (ctx->state == PARSE_TAIL)) && - (dptr != APR_BRIGADE_SENTINEL(*bb))) { - tmp_dptr = find_end_sequence(dptr, ctx, *bb); - - if (tmp_dptr != NULL) { - dptr = tmp_dptr; /* Adjust bucket pos... */ - - /* If some of the tag has already been set aside then set - * aside remainder of tag. Now the full tag is in ssi_tag_brigade. - * If none has yet been set aside, then leave it all where it is. - * In any event after this the entire set of tag buckets will be - * in one place or another. - */ - if (!APR_BRIGADE_EMPTY(ctx->ssi_tag_brigade)) { - tag_and_after = apr_brigade_split(*bb, dptr); - APR_BRIGADE_CONCAT(ctx->ssi_tag_brigade, *bb); - *bb = tag_and_after; - } - else if (ctx->bytes_parsed >= BYTE_COUNT_THRESHOLD) { - SPLIT_AND_PASS_PRETAG_BUCKETS(*bb, ctx, f->next); - } - } - else { - dptr = APR_BRIGADE_SENTINEL(*bb); /* remainder of this brigade... */ - } - } - - /* State to processed the directive... */ - if (ctx->state == PARSED) { - apr_bucket *content_head = NULL, *tmp_bkt; - apr_size_t tmp_i; - char tmp_buf[TMP_BUF_SIZE]; - int (*handle_func)(include_ctx_t *, apr_bucket_brigade **, request_rec *, - ap_filter_t *, apr_bucket *, apr_bucket **); - - /* By now the full tag (all buckets) should either be set aside into - * ssi_tag_brigade or contained within the current bb. All tag - * processing from here on can assume that. - */ - - /* At this point, everything between ctx->head_start_bucket and - * ctx->tail_start_bucket is an SSI - * directive, we just have to deal with it now. - */ - if (get_combined_directive(ctx, r, *bb, tmp_buf, - TMP_BUF_SIZE) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "mod_include: error copying directive in %s", - r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_bkt, dptr, content_head); - - /* DO CLEANUP HERE!!!!! */ - tmp_dptr = ctx->head_start_bucket; - if (!APR_BRIGADE_EMPTY(ctx->ssi_tag_brigade)) { - apr_brigade_cleanup(ctx->ssi_tag_brigade); - } - else { - do { - tmp_bkt = tmp_dptr; - tmp_dptr = APR_BUCKET_NEXT (tmp_dptr); - apr_bucket_delete(tmp_bkt); - } while ((tmp_dptr != dptr) && - (tmp_dptr != APR_BRIGADE_SENTINEL(*bb))); - } - - return; - } - - /* Can't destroy the tag buckets until I'm done processing - * because the combined_tag might just be pointing to - * the contents of a single bucket! - */ - - /* Retrieve the handler function to be called for this directive from the - * functions registered in the hash table. - * Need to lower case the directive for proper matching. Also need to have - * it NULL terminated (and include the NULL in the length) for proper - * hash matching. - */ - for (tmp_i = 0; tmp_i < ctx->directive_length; tmp_i++) { - ctx->combined_tag[tmp_i] = apr_tolower(ctx->combined_tag[tmp_i]); - } - ctx->combined_tag[ctx->directive_length] = '\0'; - ctx->curr_tag_pos = &ctx->combined_tag[ctx->directive_length+1]; - - handle_func = - (include_handler_fn_t *)apr_hash_get(include_hash, - ctx->combined_tag, - ctx->directive_length+1); - if (handle_func != NULL) { - ret = (*handle_func)(ctx, bb, r, f, dptr, &content_head); - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "unknown directive \"%s\" in parsed doc %s", - ctx->combined_tag, r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_bkt, dptr, content_head); - } - - /* This chunk of code starts at the first bucket in the chain - * of tag buckets (assuming that by this point the bucket for - * the STARTING_SEQUENCE has been split) and loops through to - * the end of the tag buckets freeing them all. - * - * Remember that some part of this may have been set aside - * into the ssi_tag_brigade and the remainder (possibly as - * little as one byte) will be in the current brigade. - * - * The value of dptr should have been set during the - * PARSE_TAIL state to the first bucket after the - * ENDING_SEQUENCE. - * - * The value of content_head may have been set during processing - * of the directive. If so, the content was inserted in front - * of the dptr bucket. The inserted buckets should not be thrown - * away here, but they should also not be parsed later. - */ - if (content_head == NULL) { - content_head = dptr; - } - tmp_dptr = ctx->head_start_bucket; - if (!APR_BRIGADE_EMPTY(ctx->ssi_tag_brigade)) { - apr_brigade_cleanup(ctx->ssi_tag_brigade); - } - else { - do { - tmp_bkt = tmp_dptr; - tmp_dptr = APR_BUCKET_NEXT (tmp_dptr); - apr_bucket_delete(tmp_bkt); - } while ((tmp_dptr != content_head) && - (tmp_dptr != APR_BRIGADE_SENTINEL(*bb))); - } - if (ctx->combined_tag == tmp_buf) { - memset (ctx->combined_tag, '\0', ctx->tag_length); - ctx->combined_tag = NULL; - } - - /* Don't reset the flags or the nesting level!!! */ - ctx->parse_pos = 0; - ctx->head_start_bucket = NULL; - ctx->head_start_index = 0; - ctx->tag_start_bucket = NULL; - ctx->tag_start_index = 0; - ctx->tail_start_bucket = NULL; - ctx->tail_start_index = 0; - ctx->curr_tag_pos = NULL; - ctx->tag_length = 0; - ctx->directive_length = 0; - - if (!APR_BRIGADE_EMPTY(ctx->ssi_tag_brigade)) { - apr_brigade_cleanup(ctx->ssi_tag_brigade); - } - - ctx->state = PRE_HEAD; - } - } - - /* If I am in the middle of parsing an SSI tag then I need to set aside - * the pertinent trailing buckets and pass on the initial part of the - * brigade. The pertinent parts of the next brigades will be added to - * these set aside buckets to form the whole tag and will be processed - * once the whole tag has been found. - */ - if (ctx->state == PRE_HEAD) { - /* Inside a false conditional (if, elif, else), so toss it all... */ - if ((dptr != APR_BRIGADE_SENTINEL(*bb)) && - (!(ctx->flags & FLAG_PRINTING))) { - apr_bucket *free_bucket; - do { - free_bucket = dptr; - dptr = APR_BUCKET_NEXT (dptr); - apr_bucket_delete(free_bucket); - } while (dptr != APR_BRIGADE_SENTINEL(*bb)); - } - else { /* Otherwise pass it along... */ - ap_pass_brigade(f->next, *bb); /* No SSI tags in this brigade... */ - ctx->bytes_parsed = 0; - } - } - else if (ctx->state == PARSED) { /* Invalid internal condition... */ - apr_bucket *content_head = NULL, *tmp_bkt; - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Invalid mod_include state during file %s", r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_bkt, APR_BRIGADE_FIRST(*bb), content_head); - } - else { /* Entire brigade is middle chunk of SSI tag... */ - if (!APR_BRIGADE_EMPTY(ctx->ssi_tag_brigade)) { - APR_BRIGADE_CONCAT(ctx->ssi_tag_brigade, *bb); - } - else { /* End of brigade contains part of SSI tag... */ - if (ctx->head_start_index > 0) { - apr_bucket_split(ctx->head_start_bucket, ctx->head_start_index); - ctx->head_start_bucket = APR_BUCKET_NEXT(ctx->head_start_bucket); - ctx->head_start_index = 0; - } - /* Set aside tag, pass pre-tag... */ - tag_and_after = apr_brigade_split(*bb, ctx->head_start_bucket); - ap_save_brigade(f, &ctx->ssi_tag_brigade, &tag_and_after); - ap_pass_brigade(f->next, *bb); - ctx->bytes_parsed = 0; - } - } -} - -/***************************************************************** - * - * XBITHACK. Sigh... NB it's configurable per-directory; the compile-time - * option only changes the default. - */ - -module include_module; -enum xbithack { - xbithack_off, xbithack_on, xbithack_full -}; - -typedef struct { - char *default_error_msg; - char *default_time_fmt; - enum xbithack *xbithack; -} include_dir_config; - -#ifdef XBITHACK -#define DEFAULT_XBITHACK xbithack_full -#else -#define DEFAULT_XBITHACK xbithack_off -#endif - -static void *create_includes_dir_config(apr_pool_t *p, char *dummy) -{ - include_dir_config *result = - (include_dir_config *)apr_palloc(p, sizeof(include_dir_config)); - enum xbithack *xbh = (enum xbithack *) apr_palloc(p, sizeof(enum xbithack)); - *xbh = DEFAULT_XBITHACK; - result->default_error_msg = DEFAULT_ERROR_MSG; - result->default_time_fmt = DEFAULT_TIME_FORMAT; - result->xbithack = xbh; - return result; - return result; -} - -static const char *set_xbithack(cmd_parms *cmd, void *xbp, const char *arg) -{ - include_dir_config *conf = (include_dir_config *)xbp; - - if (!strcasecmp(arg, "off")) { - *conf->xbithack = xbithack_off; - } - else if (!strcasecmp(arg, "on")) { - *conf->xbithack = xbithack_on; - } - else if (!strcasecmp(arg, "full")) { - *conf->xbithack = xbithack_full; - } - else { - return "XBitHack must be set to Off, On, or Full"; - } - - return NULL; -} - -static int includes_filter(ap_filter_t *f, apr_bucket_brigade *b) -{ - request_rec *r = f->r; - include_ctx_t *ctx = f->ctx; - request_rec *parent; - include_dir_config *conf = - (include_dir_config *)ap_get_module_config(r->per_dir_config, - &include_module); - - if (!(ap_allow_options(r) & OPT_INCLUDES)) { - return ap_pass_brigade(f->next, b); - } - r->allowed |= (1 << M_GET); - if (r->method_number != M_GET) { - return ap_pass_brigade(f->next, b); - } - - if (!f->ctx) { - f->ctx = ctx = apr_pcalloc(f->c->pool, sizeof(*ctx)); - if (ctx != NULL) { - ctx->state = PRE_HEAD; - ctx->flags = (FLAG_PRINTING | FLAG_COND_TRUE); - if (ap_allow_options(r) & OPT_INCNOEXEC) { - ctx->flags |= FLAG_NO_EXEC; - } - ctx->ssi_tag_brigade = apr_brigade_create(f->c->pool); - - apr_cpystrn(ctx->error_str, conf->default_error_msg, sizeof(ctx->error_str)); - apr_cpystrn(ctx->time_str, conf->default_time_fmt, sizeof(ctx->time_str)); - ctx->error_length = strlen(ctx->error_str); - } - else { - ap_pass_brigade(f->next, b); - return APR_ENOMEM; - } - } - else { - ctx->bytes_parsed = 0; - } - - /* Assure the platform supports Group protections */ - if ((*conf->xbithack == xbithack_full) - && (r->finfo.valid & APR_FINFO_GPROT) - && (r->finfo.protection & APR_GEXECUTE)) { - ap_update_mtime(r, r->finfo.mtime); - ap_set_last_modified(r); - } - - if ((parent = ap_get_module_config(r->request_config, &include_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 = r->main->subprocess_env; - apr_pool_join(r->main->pool, r->pool); - r->finfo.mtime = r->main->finfo.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, conf->default_time_fmt); - } - /* 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 - */ - - - /* Always unset the content-length. There is no way to know if - * the content will be modified at some point by send_parsed_content. - * It is very possible for us to not find any content in the first - * 9k of the file, but still have to modify the content of the file. - * If we are going to pass the file through send_parsed_content, then - * the content-length should just be unset. - */ - apr_table_unset(f->r->headers_out, "Content-Length"); - - send_parsed_content(&b, r, f); - - if (parent) { - /* signify that the sub request should not be killed */ - ap_set_module_config(r->request_config, &include_module, - NESTED_INCLUDE_MAGIC); - } - - return OK; -} - -static void ap_register_include_handler(char *tag, include_handler_fn_t *func) -{ - apr_hash_set(include_hash, tag, strlen(tag) + 1, (const void *)func); -} - -static void include_post_config(apr_pool_t *p, apr_pool_t *plog, - apr_pool_t *ptemp, server_rec *s) -{ - include_hash = apr_hash_make(p); - - ssi_pfn_register = APR_RETRIEVE_OPTIONAL_FN(ap_register_include_handler); - - if(ssi_pfn_register) { - ssi_pfn_register("if", handle_if); - ssi_pfn_register("set", handle_set); - ssi_pfn_register("else", handle_else); - ssi_pfn_register("elif", handle_elif); - ssi_pfn_register("echo", handle_echo); - ssi_pfn_register("endif", handle_endif); - ssi_pfn_register("fsize", handle_fsize); - ssi_pfn_register("config", handle_config); - ssi_pfn_register("include", handle_include); - ssi_pfn_register("flastmod", handle_flastmod); - ssi_pfn_register("printenv", handle_printenv); - } -} - -static const char *set_default_error_msg(cmd_parms *cmd, void *mconfig, const char *msg) -{ - include_dir_config *conf = (include_dir_config *)mconfig; - conf->default_error_msg = apr_pstrdup(cmd->pool, msg); - return NULL; -} - -static const char *set_default_time_fmt(cmd_parms *cmd, void *mconfig, const char *fmt) -{ - include_dir_config *conf = (include_dir_config *)mconfig; - conf->default_time_fmt = apr_pstrdup(cmd->pool, fmt); - return NULL; -} - -/* - * Module definition and configuration data structs... - */ -static const command_rec includes_cmds[] = -{ - AP_INIT_TAKE1("XBitHack", set_xbithack, NULL, OR_OPTIONS, - "Off, On, or Full"), - AP_INIT_TAKE1("SSIErrorMsg", set_default_error_msg, NULL, OR_ALL, - "a string"), - AP_INIT_TAKE1("SSITimeFormat", set_default_time_fmt, NULL, OR_ALL, - "a strftime(3) formatted string"), - {NULL} -}; - -static void register_hooks(apr_pool_t *p) -{ - APR_REGISTER_OPTIONAL_FN(ap_ssi_get_tag_and_value); - APR_REGISTER_OPTIONAL_FN(ap_ssi_parse_string); - APR_REGISTER_OPTIONAL_FN(ap_register_include_handler); - ap_hook_post_config(include_post_config, NULL, NULL, APR_HOOK_REALLY_FIRST); - ap_register_output_filter("INCLUDES", includes_filter, AP_FTYPE_CONTENT); -} - -module AP_MODULE_DECLARE_DATA include_module = -{ - STANDARD20_MODULE_STUFF, - create_includes_dir_config, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - includes_cmds, /* command apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/filters/mod_include.exp b/modules/filters/mod_include.exp deleted file mode 100644 index 335da742da..0000000000 --- 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 6a92e0a57b..0000000000 --- a/modules/filters/mod_include.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 - * . - * - * 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 -#if APR_CHARSET_EBCDIC -#define RAW_ASCII_CHAR(ch) apr_xlate_conv_byte(ap_hdrs_from_ascii, (unsigned char)ch) -#else /*APR_CHARSET_EBCDIC*/ -#define RAW_ASCII_CHAR(ch) (ch) -#endif /*APR_CHARSET_EBCDIC*/ - -/* just need some arbitrary non-NULL pointer which can't also be a request_rec */ -#define NESTED_INCLUDE_MAGIC (&include_module) - -/**************************************************************************** - * 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_DIRECTIVE, 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_size_t parse_pos; - int bytes_parsed; - - apr_bucket *head_start_bucket; - apr_size_t head_start_index; - - apr_bucket *tag_start_bucket; - apr_size_t tag_start_index; - - apr_bucket *tail_start_bucket; - apr_size_t tail_start_index; - - char *combined_tag; - char *curr_tag_pos; - apr_size_t directive_length; - apr_size_t tag_length; - - apr_size_t error_length; - char error_str[MAX_STRING_LEN]; - char time_str[MAX_STRING_LEN]; - - apr_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. */ - -#define CREATE_ERROR_BUCKET(cntx, t_buck, h_ptr, ins_head) \ -{ \ - apr_size_t e_wrt; \ - t_buck = apr_bucket_heap_create(cntx->error_str, \ - cntx->error_length, 1, &e_wrt); \ - APR_BUCKET_INSERT_BEFORE(h_ptr, t_buck); \ - \ - if (ins_head == NULL) { \ - ins_head = t_buck; \ - } \ -} - -#define SPLIT_AND_PASS_PRETAG_BUCKETS(brgd, cntxt, next) \ -if ((APR_BRIGADE_EMPTY(cntxt->ssi_tag_brigade)) && \ - (cntxt->head_start_bucket != NULL)) { \ - apr_bucket_brigade *tag_plus; \ - \ - tag_plus = apr_brigade_split(brgd, cntxt->head_start_bucket); \ - ap_pass_brigade(next, brgd); \ - cntxt->bytes_parsed = 0; \ - brgd = tag_plus; \ -} - - -typedef int (include_handler_fn_t)(include_ctx_t *ctx, apr_bucket_brigade **bb, - request_rec *r, ap_filter_t *f, apr_bucket *head_ptr, - apr_bucket **inserted_head); - -APR_DECLARE_OPTIONAL_FN(void, ap_ssi_get_tag_and_value, (include_ctx_t *ctx, - char **tag, - char **tag_val, - int dodecode)); -APR_DECLARE_OPTIONAL_FN(void, ap_ssi_parse_string, (request_rec *r, - const char *in, - char *out, - size_t length, - int leave_name)); -APR_DECLARE_OPTIONAL_FN(void, ap_register_include_handler, - (char *tag, include_handler_fn_t *func)); - -#endif /* MOD_INCLUDE */ diff --git a/modules/generators/.cvsignore b/modules/generators/.cvsignore deleted file mode 100644 index 65f0cc30cf..0000000000 --- a/modules/generators/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -Debug -Release diff --git a/modules/generators/.indent.pro b/modules/generators/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- 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 167b343d0d..0000000000 --- a/modules/generators/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ - -include $(top_srcdir)/build/special.mk - diff --git a/modules/generators/config5.m4 b/modules/generators/config5.m4 deleted file mode 100644 index 4e4379a681..0000000000 --- a/modules/generators/config5.m4 +++ /dev/null @@ -1,29 +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, , , yes) -APACHE_MODULE(autoindex, directory listing, , , yes) -APACHE_MODULE(asis, as-is filetypes, , , yes) -APACHE_MODULE(info, server information, , , most) -APACHE_MODULE(suexec, set uid and gid for spawned processes, , , no, [ - other_targets=suexec ] ) - -APR_ADDTO(LTFLAGS,-export-dynamic) - -if test "$apache_cv_mpm" = "threaded" -o "$apache_cv_mpm" = "perchild"; 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 63594236d5..0000000000 --- a/modules/generators/mod_asis.c +++ /dev/null @@ -1,142 +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 "ap_config.h" -#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" - -#include "mod_core.h" - -#define ASIS_MAGIC_TYPE "httpd/send-as-is" - -static int asis_handler(request_rec *r) -{ - apr_file_t *f = NULL; - apr_status_t status; - const char *location; - apr_size_t nbytes; - - if(strcmp(r->handler,ASIS_MAGIC_TYPE) && strcmp(r->handler,"send-as-is")) - return DECLINED; - - r->allowed |= (1 << M_GET); - if (r->method_number != M_GET) - return DECLINED; - if (r->finfo.filetype == 0) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "File does not exist: %s", r->filename); - return HTTP_NOT_FOUND; - } - - if ((status = apr_file_open(&f, r->filename, APR_READ, - APR_OS_DEFAULT, r->pool)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, - "file permissions deny server access: %s", r->filename); - return HTTP_FORBIDDEN; - } - - ap_scan_script_header_err(r, f, NULL); - location = apr_table_get(r->headers_out, "Location"); - - if (location && location[0] == '/' && - ((r->status == HTTP_OK) || ap_is_HTTP_REDIRECT(r->status))) { - - apr_file_close(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 = apr_pstrdup(r->pool, "GET"); - r->method_number = M_GET; - - ap_internal_redirect_handler(location, r); - return OK; - } - - if (!r->header_only) { - ap_send_fd(f, r, 0, r->finfo.size, &nbytes); - } - - apr_file_close(f); - return OK; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_handler(asis_handler,NULL,NULL,APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA asis_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 */ - register_hooks /* register hooks */ -}; diff --git a/modules/generators/mod_asis.exp b/modules/generators/mod_asis.exp deleted file mode 100644 index 4f347d921e..0000000000 --- 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 8ede153343..0000000000 --- a/modules/generators/mod_autoindex.c +++ /dev/null @@ -1,1713 +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. - */ - -/* - * mod_autoindex.c: Handles the on-the-fly html index generation - * - * Rob McCool - * 3/23/93 - * - * Adapted to Apache by rst. - * - * Version sort added by Martin Pool . - */ - -#include "apr_strings.h" -#include "apr_fnmatch.h" -#include "apr_strings.h" -#include "apr_lib.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "ap_config.h" -#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 "mod_core.h" - -module AP_MODULE_DECLARE_DATA 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 VERSION_SORT 512 - -#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; - - apr_array_header_t *icon_list; - apr_array_header_t *alt_list; - apr_array_header_t *desc_list; - apr_array_header_t *ign_list; - apr_array_header_t *hdr_list; - apr_array_header_t *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 APR_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(apr_array_header_t *arr, char *type, const char *to, - const char *path, const char *data) -{ - struct item *p = (struct item *) apr_array_push(arr); - - if (!to) { - to = ""; - } - if (!path) { - path = ""; - } - - p->type = type; - p->data = data ? apr_pstrdup(arr->cont, data) : NULL; - p->apply_path = apr_pstrcat(arr->cont, path, "*", NULL); - - if ((type == BY_PATH) && (!ap_is_matchexp(to))) { - p->apply_to = apr_pstrcat(arr->cont, "*", to, NULL); - } - else if (to) { - p->apply_to = apr_pstrdup(arr->cont, to); - } - else { - p->apply_to = NULL; - } -} - -static const char *add_alt(cmd_parms *cmd, void *d, const char *alt, - const char *to) -{ - if (cmd->info == BY_PATH) { - if (!strcmp(to, "**DIRECTORY**")) { - to = "^^DIRECTORY^^"; - } - } - if (cmd->info == BY_ENCODING) { - char *tmp = apr_pstrdup(cmd->pool, to); - ap_str_tolower(tmp); - to = tmp; - } - - 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, const char *icon, - const char *to) -{ - char *iconbak = apr_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) { - char *tmp = apr_pstrdup(cmd->pool, to); - ap_str_tolower(tmp); - to = tmp; - } - - 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, const char *desc, - const char *to) -{ - autoindex_config_rec *dcfg = (autoindex_config_rec *) d; - ai_desc_t *desc_entry; - char *prefix = ""; - - desc_entry = (ai_desc_t *) apr_array_push(dcfg->desc_list); - desc_entry->full_path = (ap_strchr_c(to, '/') == NULL) ? 0 : 1; - desc_entry->wildcards = (WILDCARDS_REQUIRED - || desc_entry->full_path - || apr_is_fnmatch(to)); - if (desc_entry->wildcards) { - prefix = desc_entry->full_path ? "*/" : "*"; - desc_entry->pattern = apr_pstrcat(dcfg->desc_list->cont, - prefix, to, "*", NULL); - } - else { - desc_entry->pattern = apr_pstrdup(dcfg->desc_list->cont, to); - } - desc_entry->description = apr_pstrdup(dcfg->desc_list->cont, desc); - return NULL; -} - -static const char *add_ignore(cmd_parms *cmd, void *d, const 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, const 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, const 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, "VersionSort")) { - option = VERSION_SORT; - } - 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, const char *direction, - const char *key) -{ - char temp[4]; - autoindex_config_rec *d_cfg = (autoindex_config_rec *) m; - - apr_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 = apr_palloc(cmd->pool, 4); - d_cfg->default_order[3] = '\0'; - } - apr_cpystrn(d_cfg->default_order, temp, sizeof(temp)); - return NULL; -} - -#define DIR_CMD_PERMS OR_INDEXES - -static const command_rec autoindex_cmds[] = -{ - AP_INIT_ITERATE2("AddIcon", add_icon, BY_PATH, DIR_CMD_PERMS, - "an icon URL followed by one or more filenames"), - AP_INIT_ITERATE2("AddIconByType", add_icon, BY_TYPE, DIR_CMD_PERMS, - "an icon URL followed by one or more MIME types"), - AP_INIT_ITERATE2("AddIconByEncoding", add_icon, BY_ENCODING, DIR_CMD_PERMS, - "an icon URL followed by one or more content encodings"), - AP_INIT_ITERATE2("AddAlt", add_alt, BY_PATH, DIR_CMD_PERMS, - "alternate descriptive text followed by one or more filenames"), - AP_INIT_ITERATE2("AddAltByType", add_alt, BY_TYPE, DIR_CMD_PERMS, - "alternate descriptive text followed by one or more MIME types"), - AP_INIT_ITERATE2("AddAltByEncoding", add_alt, BY_ENCODING, DIR_CMD_PERMS, - "alternate descriptive text followed by one or more content encodings"), - AP_INIT_RAW_ARGS("IndexOptions", add_opts, NULL, DIR_CMD_PERMS, - "one or more index options"), - AP_INIT_TAKE2("IndexOrderDefault", set_default_order, NULL, DIR_CMD_PERMS, - "{Ascending,Descending} {Name,Size,Description,Date}"), - AP_INIT_ITERATE("IndexIgnore", add_ignore, NULL, DIR_CMD_PERMS, - "one or more file extensions"), - AP_INIT_ITERATE2("AddDescription", add_desc, BY_PATH, DIR_CMD_PERMS, - "Descriptive text followed by one or more filenames"), - AP_INIT_TAKE1("HeaderName", add_header, NULL, DIR_CMD_PERMS, - "a filename"), - AP_INIT_TAKE1("ReadmeName", add_readme, NULL, DIR_CMD_PERMS, - "a filename"), - AP_INIT_FLAG("FancyIndexing", fancy_indexing, NULL, DIR_CMD_PERMS, - "Limited to 'on' or 'off' (superseded by IndexOptions FancyIndexing)"), - AP_INIT_TAKE1("DefaultIcon", ap_set_string_slot, - (void *) XtOffsetOf(autoindex_config_rec, default_icon), - DIR_CMD_PERMS, "an icon URL"), - {NULL} -}; - -static void *create_autoindex_config(apr_pool_t *p, char *dummy) -{ - autoindex_config_rec *new = - (autoindex_config_rec *) apr_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 = apr_array_make(p, 4, sizeof(struct item)); - new->alt_list = apr_array_make(p, 4, sizeof(struct item)); - new->desc_list = apr_array_make(p, 4, sizeof(ai_desc_t)); - new->ign_list = apr_array_make(p, 4, sizeof(struct item)); - new->hdr_list = apr_array_make(p, 4, sizeof(struct item)); - new->rdme_list = apr_array_make(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(apr_pool_t *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 *) apr_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 = apr_array_append(p, add->alt_list, base->alt_list); - new->ign_list = apr_array_append(p, add->ign_list, base->ign_list); - new->hdr_list = apr_array_append(p, add->hdr_list, base->hdr_list); - new->desc_list = apr_array_append(p, add->desc_list, base->desc_list); - new->icon_list = apr_array_append(p, add->icon_list, base->icon_list); - new->rdme_list = apr_array_append(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 nonincremental 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 nonincremental 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; - apr_time_t lm; - struct ent *next; - int ascending, version_sort; - char key; -}; - -static char *find_item(request_rec *r, apr_array_header_t *list, int path_only) -{ - const char *content_type = ap_field_noparam(r->pool, 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 = ap_strrchr_c(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 = (apr_fnmatch(tuple->pattern, filename, MATCH_FLAGS) == 0); - } - else { - found = (ap_strstr_c(filename, tuple->pattern) != NULL); - } - if (found) { - return tuple->description; - } - } - return NULL; -} - -static int ignore_entry(autoindex_config_rec *d, char *path) -{ - apr_array_header_t *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, apr_file_t *f) -{ - char buf[AP_IOBUFSIZE + 1]; - int i, c, ch; - apr_size_t n; - apr_status_t stat; - - ap_rputs("
        \n", r);
        -    while (!apr_file_eof(f)) {
        -	do {
        -            n = sizeof(char) * AP_IOBUFSIZE;
        -	    stat = apr_file_read(f, buf, &n);
        -	}
        -	while (stat != APR_SUCCESS && APR_STATUS_IS_EINTR(stat));
        -	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) -{ - apr_file_t *f = NULL; - 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, NULL)) - && (rr->status == HTTP_OK) - && (rr->filename != NULL) - && rr->finfo.filetype == APR_REG) { - /* - * 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 (apr_file_open(&f, rr->filename, APR_READ,
        -                            APR_OS_DEFAULT, r->pool) == APR_SUCCESS) {
        -		    emit_preamble(r, title);
        -		    emit_amble = 0;
        -		    do_emit_plain(r, f);
        -		    apr_file_close(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) -{ - apr_file_t *f = NULL; - 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, NULL)) - && (rr->status == HTTP_OK) - && (rr->filename != NULL) - && rr->finfo.filetype == APR_REG) { - /* - * 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 (apr_file_open(&f, rr->filename, APR_READ, - APR_OS_DEFAULT, r->pool) == APR_SUCCESS) { - do_emit_plain(r, f); - apr_file_close(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 = ""; - apr_file_t *thefile = NULL; - int x, y, p; - apr_size_t n; - - 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 (apr_file_open(&thefile, r->filename, APR_READ, - APR_OS_DEFAULT, r->pool) != APR_SUCCESS) { - return NULL; - } - n = sizeof(char) * (MAX_STRING_LEN - 1); - apr_file_read(thefile, titlebuf, &n); - if (n <= 0) { - apr_file_close(thefile); - return NULL; - } - titlebuf[n] = '\0'; - for (x = 0, p = 0; titlebuf[x]; x++) { - if (apr_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] = ' '; - } - } - } - apr_file_close(thefile); - return apr_pstrdup(r->pool, &titlebuf[x]); - } - } - else { - p = 0; - } - } - apr_file_close(thefile); - } - return NULL; -} - -static struct ent *make_autoindex_entry(const 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 *) apr_pcalloc(r->pool, sizeof(struct ent)); - p->name = apr_pstrdup(r->pool, name); - p->size = -1; - p->icon = NULL; - p->alt = NULL; - p->desc = NULL; - p->lm = -1; - p->key = apr_toupper(keyid); - p->ascending = (apr_toupper(direction) == D_ASCENDING); - p->version_sort = autoindex_opts & VERSION_SORT; - - if (autoindex_opts & FANCY_INDEXING) { - request_rec *rr = ap_sub_req_lookup_file(name, r, NULL); - - if (rr->finfo.filetype != 0) { - p->lm = rr->finfo.mtime; - if (rr->finfo.filetype == APR_DIR) { - 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 = apr_pstrcat(r->pool, name, "/", NULL); - } - else { - p->icon = find_icon(d, rr, 0); - p->alt = find_alt(d, rr, 0); - p->size = rr->finfo.size; - } - } - - p->desc = find_desc(d, rr); - - if ((!p->desc) && (autoindex_opts & SCAN_HTML_TITLES)) { - p->desc = apr_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; - apr_size_t rv; - char *name = r->uri; - char *tp; - int static_columns = (autoindex_opts & SUPPRESS_COLSORT); - apr_pool_t *scratch; - int name_width; - char *name_scratch; - char *pad_scratch; - - apr_pool_create(&scratch, r->pool); - 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 = apr_palloc(r->pool, name_width + 1); - pad_scratch = apr_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; - - apr_pool_clear(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]; - apr_exploded_time_t ts; - apr_explode_localtime(&ts, ar[x]->lm); - apr_strftime(time_str, &rv, 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: - if (c1->version_sort) - result = apr_strnatcmp(c1->desc ? c1->desc : "", c2->desc ? c2->desc : ""); - else - result = strcmp(c1->desc ? c1->desc : "", c2->desc ? c2->desc : ""); - if (result) { - return result; - } - break; - } - if (c1->version_sort) - return apr_strnatcmp(c1->name, c2->name); - else - 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; - apr_finfo_t dirent; - apr_dir_t *thedir; - apr_status_t status; - 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 ((status = apr_dir_open(&thedir, name, r->pool)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, - "Can't open directory for index: %s", r->filename); - return HTTP_FORBIDDEN; - } - -#if APR_HAS_UNICODE_FS - r->content_type = "text/html;charset=utf-8"; -#else - r->content_type = "text/html"; -#endif - ap_update_mtime(r, r->finfo.mtime); - ap_set_last_modified(r); - ap_set_etag(r); - - if (r->header_only) { - apr_dir_close(thedir); - return 0; - } - - /* 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 (apr_dir_read(&dirent, APR_FINFO_DIRENT, thedir) == APR_SUCCESS) { - p = make_autoindex_entry(dirent.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 **) apr_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); - apr_dir_close(thedir); - - if (autoindex_opts & FANCY_INDEXING) { - ap_rputs("<HR>\n", r); - } - emit_tail(r, find_readme(autoindex_conf, r), - autoindex_opts & SUPPRESS_PREAMBLE); - - return 0; -} - -/* The formal handler... */ - -static int handle_autoindex(request_rec *r) -{ - autoindex_config_rec *d; - int allow_opts; - - if(strcmp(r->handler,DIR_MAGIC_TYPE)) - return DECLINED; - - 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 = apr_pstrcat(r->pool, r->filename, "/", NULL); - } - return index_directory(r, d); - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Directory index forbidden by rule: %s", r->filename); - return HTTP_FORBIDDEN; - } -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_handler(handle_autoindex,NULL,NULL,APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA autoindex_module = -{ - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/generators/mod_autoindex.exp b/modules/generators/mod_autoindex.exp deleted file mode 100644 index 90f4057e9c..0000000000 --- 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 3431936985..0000000000 --- a/modules/generators/mod_cgi.c +++ /dev/null @@ -1,1005 +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. - */ - -/* - * 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 "apr.h" -#include "apr_strings.h" -#include "apr_thread_proc.h" /* for RLIMIT stuff */ -#include "apr_optional.h" -#include "apr_buckets.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#define CORE_PRIVATE - -#include "util_filter.h" -#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_main.h" -#include "http_log.h" -#include "util_script.h" -#include "ap_mpm.h" -#include "mod_core.h" -#include "../filters/mod_include.h" - - -module AP_MODULE_DECLARE_DATA cgi_module; - -static APR_OPTIONAL_FN_TYPE(ap_register_include_handler) *cgi_pfn_reg_with_ssi; -static APR_OPTIONAL_FN_TYPE(ap_ssi_get_tag_and_value) *cgi_pfn_gtv; -static APR_OPTIONAL_FN_TYPE(ap_ssi_parse_string) *cgi_pfn_ps; - -typedef enum {RUN_AS_SSI, RUN_AS_CGI} prog_types; - -typedef struct { - apr_int32_t in_pipe; - apr_int32_t out_pipe; - apr_int32_t err_pipe; - apr_cmdtype_e cmd_type; - prog_types prog_type; - apr_bucket_brigade **bb; - include_ctx_t *ctx; - ap_filter_t *next; -} exec_info; - -/* 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 = apr_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 { - const char *logname; - long logbytes; - int bufbytes; -} cgi_server_conf; - -static void *create_cgi_config(apr_pool_t *p, server_rec *s) -{ - cgi_server_conf *c = - (cgi_server_conf *) apr_pcalloc(p, sizeof(cgi_server_conf)); - - c->logname = NULL; - c->logbytes = DEFAULT_LOGBYTES; - c->bufbytes = DEFAULT_BUFBYTES; - - return c; -} - -static void *merge_cgi_config(apr_pool_t *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, const char *arg) -{ - server_rec *s = cmd->server; - cgi_server_conf *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, - const char *arg) -{ - server_rec *s = cmd->server; - cgi_server_conf *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, - const char *arg) -{ - server_rec *s = cmd->server; - cgi_server_conf *conf = ap_get_module_config(s->module_config, - &cgi_module); - - conf->bufbytes = atoi(arg); - return NULL; -} - -static const command_rec cgi_cmds[] = -{ -AP_INIT_TAKE1("ScriptLog", set_scriptlog, NULL, RSRC_CONF, - "the name of a log for script debugging info"), -AP_INIT_TAKE1("ScriptLogLength", set_scriptlog_length, NULL, RSRC_CONF, - "the maximum length (in bytes) of the script debug log"), -AP_INIT_TAKE1("ScriptLogBuffer", set_scriptlog_buffer, NULL, RSRC_CONF, - "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, - apr_status_t rv, char *error) -{ - apr_file_t *f = NULL; - apr_finfo_t finfo; - char time_str[APR_CTIME_LEN]; - int log_flags = rv ? APLOG_ERR : APLOG_NOERRNO | APLOG_ERR; - - ap_log_rerror(APLOG_MARK, log_flags, rv, r, - "%s: %s", error, r->filename); - - if (!conf->logname || - ((apr_stat(&finfo, ap_server_root_relative(r->pool, conf->logname), - APR_FINFO_SIZE, r->pool) == APR_SUCCESS) - && (finfo.size > conf->logbytes)) || - (apr_file_open(&f, ap_server_root_relative(r->pool, conf->logname), - APR_APPEND|APR_WRITE|APR_CREATE, APR_OS_DEFAULT, r->pool) - != APR_SUCCESS)) { - return ret; - } - - /* "%% [Wed Jun 19 10:53:21 1996] GET /cgi-bin/printenv HTTP/1.0" */ - apr_ctime(time_str, apr_time_now()); - apr_file_printf(f, "%%%% [%s] %s %s%s%s %s\n", time_str, r->method, r->uri, - r->args ? "?" : "", r->args ? r->args : "", r->protocol); - /* "%% 500 /usr/local/apache/cgi-bin */ - apr_file_printf(f, "%%%% %d %s\n", ret, r->filename); - - apr_file_printf(f, "%%error\n%s\n", error); - - apr_file_close(f); - return ret; -} - -/* Soak up stderr from a script and redirect it to the error log. - */ -static void log_script_err(request_rec *r, apr_file_t *script_err) -{ - char argsbuffer[HUGE_STRING_LEN]; - char *newline; - - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_err) == 0) { - newline = strchr(argsbuffer, '\n'); - if (newline) { - *newline = '\0'; - } - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "%s", argsbuffer); - } -} - -static int log_script(request_rec *r, cgi_server_conf * conf, int ret, - char *dbuf, const char *sbuf, apr_file_t *script_in, - apr_file_t *script_err) -{ - apr_array_header_t *hdrs_arr = apr_table_elts(r->headers_in); - apr_table_entry_t *hdrs = (apr_table_entry_t *) hdrs_arr->elts; - char argsbuffer[HUGE_STRING_LEN]; - apr_file_t *f = NULL; - int i; - apr_finfo_t finfo; - char time_str[APR_CTIME_LEN]; - - if (!conf->logname || - ((apr_stat(&finfo, ap_server_root_relative(r->pool, conf->logname), - APR_FINFO_SIZE, r->pool) == APR_SUCCESS) - && (finfo.size > conf->logbytes)) || - (apr_file_open(&f, ap_server_root_relative(r->pool, conf->logname), - APR_APPEND|APR_WRITE|APR_CREATE, APR_OS_DEFAULT, r->pool) != APR_SUCCESS)) { - /* Soak up script output */ - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_in) == 0) - continue; - - log_script_err(r, script_err); - return ret; - } - - /* "%% [Wed Jun 19 10:53:21 1996] GET /cgi-bin/printenv HTTP/1.0" */ - apr_ctime(time_str, apr_time_now()); - apr_file_printf(f, "%%%% [%s] %s %s%s%s %s\n", time_str, r->method, r->uri, - r->args ? "?" : "", r->args ? r->args : "", r->protocol); - /* "%% 500 /usr/local/apache/cgi-bin" */ - apr_file_printf(f, "%%%% %d %s\n", ret, r->filename); - - apr_file_puts("%request\n", f); - for (i = 0; i < hdrs_arr->nelts; ++i) { - if (!hdrs[i].key) - continue; - apr_file_printf(f, "%s: %s\n", hdrs[i].key, hdrs[i].val); - } - if ((r->method_number == M_POST || r->method_number == M_PUT) - && *dbuf) { - apr_file_printf(f, "\n%s\n", dbuf); - } - - apr_file_puts("%response\n", f); - hdrs_arr = apr_table_elts(r->err_headers_out); - hdrs = (apr_table_entry_t *) hdrs_arr->elts; - - for (i = 0; i < hdrs_arr->nelts; ++i) { - if (!hdrs[i].key) - continue; - apr_file_printf(f, "%s: %s\n", hdrs[i].key, hdrs[i].val); - } - - if (sbuf && *sbuf) - apr_file_printf(f, "%s\n", sbuf); - - if (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_in) == 0) { - apr_file_puts("%stdout\n", f); - apr_file_puts(argsbuffer, f); - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_in) == 0) - apr_file_puts(argsbuffer, f); - apr_file_puts("\n", f); - } - - if (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_err) == 0) { - apr_file_puts("%stderr\n", f); - apr_file_puts(argsbuffer, f); - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_err) == 0) - apr_file_puts(argsbuffer, f); - apr_file_puts("\n", f); - } - - apr_file_close(script_in); - apr_file_close(script_err); - - apr_file_close(f); - return ret; -} - - -/* This is the special environment used for running the "exec cmd=" - * variety of SSI directives. - */ -static void add_ssi_vars(request_rec *r, ap_filter_t *next) -{ - apr_table_t *e = r->subprocess_env; - - if (r->path_info && r->path_info[0] != '\0') { - request_rec *pa_req; - - apr_table_setn(e, "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, next); - if (pa_req->filename) { - apr_table_setn(e, "PATH_TRANSLATED", - apr_pstrcat(r->pool, pa_req->filename, pa_req->path_info, NULL)); - } - } - - if (r->args) { - char *arg_copy = apr_pstrdup(r->pool, r->args); - - apr_table_setn(e, "QUERY_STRING", r->args); - ap_unescape_url(arg_copy); - apr_table_setn(e, "QUERY_STRING_UNESCAPED", ap_escape_shell_cmd(r->pool, arg_copy)); - } -} - -static apr_status_t run_cgi_child(apr_file_t **script_out, - apr_file_t **script_in, - apr_file_t **script_err, - const char *command, - const char * const argv[], - request_rec *r, - apr_pool_t *p, - exec_info *e_info) -{ - const char * const *env; - apr_procattr_t *procattr; - apr_proc_t *procnew; - apr_status_t rc = APR_SUCCESS; - -#if defined(RLIMIT_CPU) || defined(RLIMIT_NPROC) || \ - defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined (RLIMIT_AS) - - core_dir_config *conf = ap_get_module_config(r->per_dir_config, - &core_module); -#endif - - -#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 - - 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 - - if (e_info->prog_type == RUN_AS_CGI) { - ap_add_cgi_vars(r); - } - else /* SSIs want a controlled environment and a special path. */ - { - add_ssi_vars(r, e_info->next); - } - env = (const char * const *)ap_create_environment(p, r->subprocess_env); - -#ifdef DEBUG_CGI - fprintf(dbg, "Environment: \n"); - for (i = 0; env[i]; ++i) - fprintf(dbg, "'%s'\n", env[i]); -#endif - - /* Transmute ourselves into the script. - * NB only ISINDEX scripts get decoded arguments. - */ - if (((rc = apr_procattr_create(&procattr, p)) != APR_SUCCESS) || - ((rc = apr_procattr_io_set(procattr, - e_info->in_pipe, - e_info->out_pipe, - e_info->err_pipe)) != APR_SUCCESS) || - ((rc = apr_procattr_dir_set(procattr, - ap_make_dirstr_parent(r->pool, r->filename))) != APR_SUCCESS) || -#ifdef RLIMIT_CPU - ((rc = apr_procattr_limit_set(procattr, APR_LIMIT_CPU, conf->limit_cpu)) != APR_SUCCESS) || -#endif -#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS) - ((rc = apr_procattr_limit_set(procattr, APR_LIMIT_MEM, conf->limit_mem)) != APR_SUCCESS) || -#endif -#ifdef RLIMIT_NPROC - ((rc = apr_procattr_limit_set(procattr, APR_LIMIT_NPROC, conf->limit_nproc)) != APR_SUCCESS) || -#endif - ((rc = apr_procattr_cmdtype_set(procattr, e_info->cmd_type)) != APR_SUCCESS)) { - /* Something bad happened, tell the world. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, - "couldn't set child process attributes: %s", r->filename); - } - else { - procnew = apr_pcalloc(p, sizeof(*procnew)); - if (e_info->prog_type == RUN_AS_SSI) { - SPLIT_AND_PASS_PRETAG_BUCKETS(*(e_info->bb), e_info->ctx, e_info->next); - } - - rc = ap_os_create_privileged_process(r, procnew, command, argv, env, procattr, p); - - if (rc != APR_SUCCESS) { - /* Bad things happened. Everyone should have cleaned up. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, - "couldn't create child process: %d: %s", rc, r->filename); - } - else { - apr_pool_note_subprocess(p, procnew, kill_after_timeout); - - *script_in = procnew->out; - if (!script_in) - return APR_EBADF; - apr_file_pipe_timeout_set(*script_in, (int)(r->server->timeout * APR_USEC_PER_SEC)); - - if (e_info->prog_type == RUN_AS_CGI) { - *script_out = procnew->in; - if (!*script_out) - return APR_EBADF; - apr_file_pipe_timeout_set(*script_out, (int)(r->server->timeout * APR_USEC_PER_SEC)); - - *script_err = procnew->err; - if (!*script_err) - return APR_EBADF; - apr_file_pipe_timeout_set(*script_err, (int)(r->server->timeout * APR_USEC_PER_SEC)); - } - } - } - return (rc); -} - -static apr_status_t build_argv_list(const char ***argv, request_rec *r, - apr_pool_t *p) -{ - int numwords, x, idx; - char *w; - const char *args = r->args; - - if (!args || !args[0] || ap_strchr_c(args, '=')) { - numwords = 1; - } - else { - /* count the number of keywords */ - for (x = 0, numwords = 2; args[x]; x++) { - if (args[x] == '+') { - ++numwords; - } - } - } - /* Everything is - 1 to account for the first parameter which is the - * program name. We didn't used to have to do this, but APR wants it. - */ - if (numwords > APACHE_ARG_MAX - 1) { - numwords = APACHE_ARG_MAX - 1; /* Truncate args to prevent overrun */ - } - *argv = apr_palloc(p, (numwords + 2) * sizeof(char *)); - - for (x = 1, idx = 1; x < numwords; x++) { - w = ap_getword_nulls(p, &args, '+'); - ap_unescape_url(w); - (*argv)[idx++] = ap_escape_shell_cmd(p, w); - } - (*argv)[idx] = NULL; - - return APR_SUCCESS; -} - -static apr_status_t build_command_line(const char **cmd, request_rec *r, - apr_pool_t *p) -{ -#ifdef WIN32 - char *quoted_filename = NULL; - char *interpreter = NULL; - char *arguments = NULL; - file_type_e fileType; -#endif - const char *argv0; - - /* Allow suexec's "/" check to succeed */ - if ((argv0 = strrchr(r->filename, '/')) != NULL) - argv0++; - else - argv0 = r->filename; - -#ifdef WIN32 - *cmd = NULL; - fileType = ap_get_win32_interpreter(r, &interpreter, &arguments); - - if (fileType == eFileTypeUNKNOWN) { - 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; - } - - /* - * Build the command string to pass to ap_os_create_privileged_process() - */ - quoted_filename = apr_pstrcat(p, "\"", r->filename, "\"", NULL); - if (interpreter && *interpreter) { - if (arguments && *arguments) - *cmd = apr_pstrcat(p, interpreter, " ", quoted_filename, " ", - arguments, NULL); - else - *cmd = apr_pstrcat(p, interpreter, " ", quoted_filename, " ", NULL); - } - else if (arguments && *arguments) { - *cmd = apr_pstrcat(p, quoted_filename, " ", arguments, NULL); - } - else { - *cmd = apr_pstrcat(p, quoted_filename, NULL); - } -#else - *cmd = argv0; -#endif - return APR_SUCCESS; -} - -static int cgi_handler(request_rec *r) -{ - int retval, nph, dbpos = 0; - const char *argv0; - const char *command; - const char **argv; - char *dbuf = NULL; - apr_file_t *script_out = NULL, *script_in = NULL, *script_err = NULL; - apr_bucket_brigade *bb; - apr_bucket *b; - char argsbuffer[HUGE_STRING_LEN]; - int is_included = !strcmp(r->protocol, "INCLUDED"); - apr_pool_t *p; - cgi_server_conf *conf; - apr_status_t rv; - exec_info e_info; - - if(strcmp(r->handler,CGI_MAGIC_TYPE) && strcmp(r->handler,"cgi-script")) - return DECLINED; - - p = r->main ? r->main->pool : r->pool; - - 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)); - conf = ap_get_module_config(r->server->module_config, &cgi_module); - - if (!(ap_allow_options(r) & OPT_EXECCGI) && !is_scriptaliased(r)) - return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, - "Options ExecCGI is off in this directory"); - if (nph && is_included) - return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, - "attempt to include NPH CGI script"); - -#if defined(OS2) || defined(WIN32) - /* XXX: This is wrong. As an option, perhaps, but not by default... - * we are back to the same argument that a url should be a unique - * entity until the sysadmin overrides that behavior. - * Allow for cgi files without the .EXE extension on them under OS/2 - */ - if (r->finfo.filetype == 0) { - apr_finfo_t finfo; - char *newfile; - apr_status_t rv; - - newfile = apr_pstrcat(r->pool, r->filename, ".EXE", NULL); - if (((rv = apr_stat(&finfo, newfile, APR_FINFO_TYPE, r->pool)) - != APR_SUCCESS) || (finfo.filetype != APR_REG)) { - return log_scripterror(r, conf, HTTP_NOT_FOUND, rv, - "script not found or unable to stat"); - } else { - r->filename = newfile; - } - } -#else - if (r->finfo.filetype == 0) - return log_scripterror(r, conf, HTTP_NOT_FOUND, 0, - "script not found or unable to stat"); -#endif - if (r->finfo.filetype == APR_DIR) - return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, - "attempt to invoke directory as script"); - -/* - if (!ap_suexec_enabled) { - if (!ap_can_exec(&r->finfo)) - return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, - "file permissions deny server execution"); - } - -*/ - if ((retval = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR))) - return retval; - - ap_add_common_vars(r); - - /* build the command line */ - if ((rv = build_command_line(&command, r, p)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "couldn't spawn child process: %s", r->filename); - return HTTP_INTERNAL_SERVER_ERROR; - } - /* build the argument list */ - else if ((rv = build_argv_list(&argv, r, p)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "couldn't spawn child process: %s", r->filename); - return HTTP_INTERNAL_SERVER_ERROR; - } - argv[0] = apr_pstrdup(p, command); - - e_info.cmd_type = APR_PROGRAM; - e_info.in_pipe = APR_CHILD_BLOCK; - e_info.out_pipe = APR_CHILD_BLOCK; - e_info.err_pipe = APR_CHILD_BLOCK; - e_info.prog_type = RUN_AS_CGI; - e_info.bb = NULL; - e_info.ctx = NULL; - e_info.next = NULL; - - /* run the script in its own process */ - if ((rv = run_cgi_child(&script_out, &script_in, &script_err, - command, argv, r, p, &e_info)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, 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; - apr_size_t bytes_written, bytes_to_write; - apr_status_t rv; - - if (conf->logname) { - dbuf = apr_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; - } - /* Keep writing data to the child until done or too much time - * elapses with no progress or an error occurs. - */ - bytes_written = 0; - do { - bytes_to_write = len_read - bytes_written; - rv = apr_file_write(script_out, argsbuffer + bytes_written, - &bytes_to_write); - bytes_written += bytes_to_write; - } while (rv == APR_SUCCESS && bytes_written < len_read); - if (rv != APR_SUCCESS || bytes_written < len_read) { - /* silly script stopped reading, soak up remaining message */ - while (ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN) > 0) { - /* dump it */ - } - break; - } - } - apr_file_flush(script_out); - } - - apr_file_close(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(r, script_in, sbuf))) { - return log_script(r, conf, ret, dbuf, sbuf, script_in, script_err); - } - - location = apr_table_get(r->headers_out, "Location"); - - if (location && location[0] == '/' && r->status == 200) { - - /* Soak up all the script output */ - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_in) == 0) { - continue; - } - log_script_err(r, script_err); - /* This redirect needs to be a GET no matter what the original - * method was. - */ - r->method = apr_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. - */ - apr_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 HTTP_MOVED_TEMPORARILY; - } - - if (!r->header_only) { - bb = apr_brigade_create(r->pool); - b = apr_bucket_pipe_create(script_in); - APR_BRIGADE_INSERT_TAIL(bb, b); - b = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(bb, b); - ap_pass_brigade(r->output_filters, bb); - } - - log_script_err(r, script_err); - apr_file_close(script_err); - } - - if (script_in && nph) { - bb = apr_brigade_create(r->pool); - b = apr_bucket_pipe_create(script_in); - APR_BRIGADE_INSERT_TAIL(bb, b); - b = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(bb, b); - ap_pass_brigade(r->output_filters, bb); - } - - return OK; /* NOT r->status, even if it has changed. */ -} - -/*============================================================================ - *============================================================================ - * This is the beginning of the cgi filter code moved from mod_include. This - * is the code required to handle the "exec" SSI directive. - *============================================================================ - *============================================================================*/ -static int include_cgi(char *s, request_rec *r, ap_filter_t *next, - apr_bucket *head_ptr, apr_bucket **inserted_head) -{ - request_rec *rr = ap_sub_req_lookup_uri(s, r, next); - int rr_status; - apr_bucket *tmp_buck, *tmp2_buck; - - 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.protection == 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)) { - apr_size_t len_loc, h_wrt; - const char *location = apr_table_get(rr->headers_out, "Location"); - - location = ap_escape_html(rr->pool, location); - len_loc = strlen(location); - - tmp_buck = apr_bucket_immortal_create("<A HREF=\"", sizeof("<A HREF=\"")); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck); - tmp2_buck = apr_bucket_heap_create(location, len_loc, 1, &h_wrt); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp2_buck); - tmp2_buck = apr_bucket_immortal_create("\">", sizeof("\">")); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp2_buck); - tmp2_buck = apr_bucket_heap_create(location, len_loc, 1, &h_wrt); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp2_buck); - tmp2_buck = apr_bucket_immortal_create("</A>", sizeof("</A>")); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp2_buck); - - if (*inserted_head == NULL) { - *inserted_head = tmp_buck; - } - } - - ap_destroy_sub_req(rr); - - return 0; -} - - -static int include_cmd(include_ctx_t *ctx, apr_bucket_brigade **bb, char *command, - request_rec *r, ap_filter_t *f) -{ - exec_info e_info; - const char **argv; - apr_file_t *script_out = NULL, *script_in = NULL, *script_err = NULL; - apr_bucket_brigade *bcgi; - apr_bucket *b; - - if (build_argv_list(&argv, r, r->pool) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, - "couldn't spawn cmd child process: %s", r->filename); - return HTTP_INTERNAL_SERVER_ERROR; - } - argv[0] = apr_pstrdup(r->pool, command); - - e_info.cmd_type = APR_SHELLCMD; - e_info.in_pipe = APR_NO_PIPE; - e_info.out_pipe = APR_FULL_BLOCK; - e_info.err_pipe = APR_NO_PIPE; - e_info.prog_type = RUN_AS_SSI; - e_info.bb = bb; - e_info.ctx = ctx; - e_info.next = f->next; - - /* run the script in its own process */ - if (run_cgi_child(&script_out, &script_in, &script_err, - command, argv, r, r->pool, &e_info) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, - "couldn't spawn child process: %s", r->filename); - return HTTP_INTERNAL_SERVER_ERROR; - } - - bcgi = apr_brigade_create(r->pool); - b = apr_bucket_pipe_create(script_in); - APR_BRIGADE_INSERT_TAIL(bcgi, b); - ap_pass_brigade(f->next, bcgi); - - /* We can't close the pipe here, because we may return before the - * full CGI has been sent to the network. That's okay though, - * because we can rely on the pool to close the pipe for us. - */ - - return 0; -} - -static int handle_exec(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec *r, - ap_filter_t *f, apr_bucket *head_ptr, apr_bucket **inserted_head) -{ - char *tag = NULL; - char *tag_val = NULL; - char *file = r->filename; - apr_bucket *tmp_buck; - char parsed_string[MAX_STRING_LEN]; - - *inserted_head = NULL; - if (ctx->flags & FLAG_PRINTING) { - if (ctx->flags & FLAG_NO_EXEC) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "exec used but not allowed in %s", r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - else { - while (1) { - cgi_pfn_gtv(ctx, &tag, &tag_val, 1); - if (tag_val == NULL) { - if (tag == NULL) { - return (0); - } - else { - return 1; - } - } - if (!strcmp(tag, "cmd")) { - cgi_pfn_ps(r, tag_val, parsed_string, sizeof(parsed_string), 1); - if (include_cmd(ctx, bb, parsed_string, r, f) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "execution failure for parameter \"%s\" " - "to tag exec in file %s", tag, r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - } - else if (!strcmp(tag, "cgi")) { - cgi_pfn_ps(r, tag_val, parsed_string, sizeof(parsed_string), 0); - SPLIT_AND_PASS_PRETAG_BUCKETS(*bb, ctx, f->next); - if (include_cgi(parsed_string, r, f->next, head_ptr, inserted_head) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "invalid CGI ref \"%s\" in %s", tag_val, file); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "unknown parameter \"%s\" to tag exec in %s", tag, file); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - } - } - } - return 0; -} - - -/*============================================================================ - *============================================================================ - * This is the end of the cgi filter code moved from mod_include. - *============================================================================ - *============================================================================*/ - - -static void cgi_post_config(apr_pool_t *p, apr_pool_t *plog, - apr_pool_t *ptemp, server_rec *s) -{ - cgi_pfn_reg_with_ssi = APR_RETRIEVE_OPTIONAL_FN(ap_register_include_handler); - cgi_pfn_gtv = APR_RETRIEVE_OPTIONAL_FN(ap_ssi_get_tag_and_value); - cgi_pfn_ps = APR_RETRIEVE_OPTIONAL_FN(ap_ssi_parse_string); - - if ((cgi_pfn_reg_with_ssi) && (cgi_pfn_gtv) && (cgi_pfn_ps)) { - /* Required by mod_include filter. This is how mod_cgi registers - * with mod_include to provide processing of the exec directive. - */ - cgi_pfn_reg_with_ssi("exec", handle_exec); - } -} - -static void register_hooks(apr_pool_t *p) -{ - static const char * const aszPre[] = { "mod_include.c", NULL }; - ap_hook_handler(cgi_handler, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_post_config(cgi_post_config, aszPre, NULL, APR_HOOK_REALLY_FIRST); -} - -module AP_MODULE_DECLARE_DATA cgi_module = -{ - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/generators/mod_cgi.exp b/modules/generators/mod_cgi.exp deleted file mode 100644 index 96ea0c2348..0000000000 --- a/modules/generators/mod_cgi.exp +++ /dev/null @@ -1 +0,0 @@ -cgi_module diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c deleted file mode 100644 index cbb09d3525..0000000000 --- a/modules/generators/mod_cgid.c +++ /dev/null @@ -1,1300 +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. - */ - -/* - * 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 "apr_lib.h" -#include "apr_strings.h" -#include "apr_general.h" -#include "apr_file_io.h" -#include "apr_portable.h" -#include "apr_buckets.h" -#include "apr_optional.h" -#include "apr_signal.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if APR_HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#endif -#if APR_HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -#define CORE_PRIVATE - -#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_main.h" -#include "http_log.h" -#include "util_script.h" -#include "ap_mpm.h" -#include "unixd.h" -#include "mod_suexec.h" -#include "../filters/mod_include.h" - -#include "mod_core.h" - - -/* ### should be tossed in favor of APR */ -#include <sys/stat.h> -#include <sys/un.h> /* for sockaddr_un */ - - -module AP_MODULE_DECLARE_DATA cgid_module; - -static void cgid_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *main_server); -static int handle_exec(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec *r, - ap_filter_t *f, apr_bucket *head_ptr, apr_bucket **inserted_head); - -static APR_OPTIONAL_FN_TYPE(ap_register_include_handler) *cgid_pfn_reg_with_ssi; -static APR_OPTIONAL_FN_TYPE(ap_ssi_get_tag_and_value) *cgid_pfn_gtv; -static APR_OPTIONAL_FN_TYPE(ap_ssi_parse_string) *cgid_pfn_ps; - -static apr_pool_t *pcgi; -static int total_modules = 0; - -/* 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 = apr_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" - -#define SHELL_PATH "/bin/sh" - -#define CGI_REQ 1 -#define SSI_REQ 2 - -/* DEFAULT_CGID_LISTENBACKLOG controls the max depth on the unix socket's - * pending connection queue. If a bunch of cgi requests arrive at about - * the same time, connections from httpd threads/processes will back up - * in the queue while the cgid process slowly forks off a child to process - * each connection on the unix socket. If the queue is too short, the - * httpd process will get ECONNREFUSED when trying to connect. - */ -#ifndef DEFAULT_CGID_LISTENBACKLOG -#define DEFAULT_CGID_LISTENBACKLOG 100 -#endif - -typedef struct { - const char *sockname; - const char *logname; - long logbytes; - int bufbytes; -} 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(apr_pool_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 **) apr_pcalloc(p, (numwords + 5) * sizeof(char *)); - - if (path) { - av[idx++] = path; - } - if (user) { - av[idx++] = user; - } - if (group) { - av[idx++] = group; - } - - av[idx++] = apr_pstrdup(p, av0); - - for (x = 1; x <= numwords; x++) { - w = ap_getword_nulls(p, &args, '+'); - if (strcmp(w, "")) { - ap_unescape_url(w); - av[idx++] = ap_escape_shell_cmd(p, w); - } - } - av[idx] = NULL; - return av; -} - -#if APR_HAS_OTHER_CHILD -static void cgid_maint(int reason, void *data, apr_wait_t status) -{ - pid_t *sd = data; - switch (reason) { - case APR_OC_REASON_DEATH: - case APR_OC_REASON_LOST: - /* stop gap to make sure everything else works. In the end, - * we'll just restart the cgid server. */ - apr_pool_destroy(pcgi); - kill(getpid(), SIGWINCH); /* yes, to ourself */ - break; - case APR_OC_REASON_RESTART: - apr_proc_other_child_unregister(data); - break; - case APR_OC_REASON_UNREGISTER: - apr_pool_destroy(pcgi); - kill(*sd, SIGHUP); - break; - } -} -#endif - -static void get_req(int fd, request_rec *r, char **argv0, char ***env, int *req_type) -{ - int i, len, j; - unsigned char *data; - char **environ; - core_dir_config *temp_core; - void **dconf; - module *suexec_mod = ap_find_linked_module("mod_suexec.c"); - - r->server = apr_pcalloc(r->pool, sizeof(server_rec)); - - read(fd, req_type, sizeof(int)); - read(fd, &j, sizeof(int)); - read(fd, &len, sizeof(int)); - data = apr_pcalloc(r->pool, len + 1); /* get a cleared byte for final '\0' */ - 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 = apr_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, &i, sizeof(int)); - - /* add 1, so that if i == 0, we still malloc something. */ - - dconf = (void **) apr_pcalloc(r->pool, sizeof(void *) * (total_modules + DYNAMIC_MODULE_LIMIT)); - - temp_core = (core_dir_config *)apr_palloc(r->pool, sizeof(core_module)); - - dconf[i] = (void *)temp_core; - - if (suexec_mod) { - suexec_config_t *suexec_cfg = apr_pcalloc(r->pool, sizeof(*suexec_cfg)); - - read(fd, &i, sizeof(int)); - read(fd, &suexec_cfg->ugid.uid, sizeof(uid_t)); - read(fd, &suexec_cfg->ugid.gid, sizeof(gid_t)); - read(fd, &suexec_cfg->active, sizeof(int)); - dconf[i] = (void *)suexec_cfg; - } - - r->per_dir_config = (ap_conf_vector_t *)dconf; -#if 0 -#ifdef RLIMIT_CPU - read(fd, &j, sizeof(int)); - if (j) { - temp_core->limit_cpu = (struct rlimit *)apr_palloc (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 *)apr_palloc(r->pool, 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 *)apr_palloc(r->pool, sizeof(struct rlimit)); - read(fd, temp_core->limit_nproc, sizeof(struct rlimit)); - } - else { - temp_core->limit_nproc = NULL; - } -#endif -#endif - /* For right now, just make the notes table. At some point we will need - * to actually fill this out, but for now we just don't want suexec to - * seg fault. - */ - r->notes = apr_table_make(r->pool, 1); -} - - - -static void send_req(int fd, request_rec *r, char *argv0, char **env, int req_type) -{ - int len, r_type = req_type; - int i = 0; - char *data; - module *suexec_mod = ap_find_linked_module("mod_suexec.c"); - - data = apr_pstrcat(r->pool, r->filename, "\n", argv0, "\n", r->uri, "\n", - NULL); - - for (i =0; env[i]; i++) { - continue; - } - - /* Write the request type (SSI "exec cmd" or cgi). */ - if (write(fd, &r_type, sizeof(int)) < 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, - "write to cgi daemon process"); - } - - /* Write the number of entries in the environment. */ - 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 = apr_pstrcat(r->pool, data, env[i], "\n", NULL); - } - data = apr_pstrcat(r->pool, data, r->args, NULL); - len = strlen(data); - /* Write the length of the concatenated env string. */ - if (write(fd, &len, sizeof(int)) < 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, - "write to cgi daemon process"); - } - /* Write the concatted env string. */ - if (write(fd, data, len) < 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, - "write to cgi daemon process"); - } - /* Write module_index id value. */ - 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 (suexec_mod) { - suexec_config_t *suexec_cfg = ap_get_module_config(r->per_dir_config, - suexec_mod); - - write(fd, &suexec_mod->module_index, sizeof(int)); - write(fd, &suexec_cfg->ugid.uid, sizeof(uid_t)); - write(fd, &suexec_cfg->ugid.gid, sizeof(gid_t)); - write(fd, &suexec_cfg->active, sizeof(int)); - } - -#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(void *data) -{ - struct sockaddr_un unix_addr; - int sd, sd2, rc, req_type; - mode_t omask; - apr_socklen_t len; - apr_pool_t *ptrans; - server_rec *main_server = data; - cgid_server_conf *sconf = ap_get_module_config(main_server->module_config, - &cgid_module); - - apr_pool_create(&ptrans, pcgi); - - apr_signal(SIGCHLD, SIG_IGN); - 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)); - umask(omask); /* can't fail, so can't clobber errno */ - if (rc < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server, - "Couldn't bind unix domain socket %s", - sconf->sockname); - return errno; - } - - if (listen(sd, DEFAULT_CGID_LISTENBACKLOG) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server, - "Couldn't listen on unix domain socket"); - return errno; - } - - if (!geteuid()) { - if (chown(sconf->sockname, unixd_config.user_id, -1) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server, - "Couldn't change owner of unix domain socket %s", - sconf->sockname); - return errno; - } - } - - unixd_setup_child(); /* if running as root, switch to configured user/group */ - while (1) { - int errfileno = STDERR_FILENO; - char *argv0; - char **env; - const char * const *argv; - apr_int32_t in_pipe = APR_CHILD_BLOCK; - apr_int32_t out_pipe = APR_CHILD_BLOCK; - apr_int32_t err_pipe = APR_CHILD_BLOCK; - apr_cmdtype_e cmd_type = APR_PROGRAM; - request_rec *r; - apr_procattr_t *procattr = NULL; - apr_proc_t *procnew = NULL; - apr_file_t *inout; - - apr_pool_clear(ptrans); - - len = sizeof(unix_addr); - sd2 = accept(sd, (struct sockaddr *)&unix_addr, &len); - if (sd2 < 0) { - if (errno != EINTR) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, - (server_rec *)data, - "Error accepting on cgid socket."); - } - continue; - } - - r = apr_pcalloc(ptrans, sizeof(request_rec)); - procnew = apr_pcalloc(ptrans, sizeof(*procnew)); - r->pool = ptrans; - get_req(sd2, r, &argv0, &env, &req_type); - apr_os_file_put(&r->server->error_log, &errfileno, r->pool); - apr_os_file_put(&inout, &sd2, r->pool); - - if (req_type == SSI_REQ) { - in_pipe = APR_NO_PIPE; - out_pipe = APR_FULL_BLOCK; - err_pipe = APR_NO_PIPE; - cmd_type = APR_SHELLCMD; - } - - if (((rc = apr_procattr_create(&procattr, ptrans)) != APR_SUCCESS) || - ((req_type == CGI_REQ) && - (((rc = apr_procattr_io_set(procattr, - in_pipe, - out_pipe, - err_pipe)) != APR_SUCCESS) || - /* XXX apr_procattr_child_*_set() is creating an unnecessary - * pipe between this process and the child being created... - * It is cleaned up with the temporary pool for this request. - */ - ((rc = apr_procattr_child_err_set(procattr, r->server->error_log, NULL)) != APR_SUCCESS) || - ((rc = apr_procattr_child_in_set(procattr, inout, NULL)) != APR_SUCCESS))) || - ((rc = apr_procattr_child_out_set(procattr, inout, NULL)) != APR_SUCCESS) || - ((rc = apr_procattr_dir_set(procattr, - ap_make_dirstr_parent(r->pool, r->filename))) != APR_SUCCESS) || - ((rc = apr_procattr_cmdtype_set(procattr, cmd_type)) != APR_SUCCESS)) { - /* Something bad happened, tell the world. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, - "couldn't set child process attributes: %s", r->filename); - } - else { - argv = (const char * const *)create_argv(r->pool, NULL, NULL, NULL, argv0, r->args); - - /* We want to sd2 close for new CGI process too. - * If it's remained open it'll make ap_pass_brigade() block - * waiting for EOF if CGI forked something running long. - * close(sd2) here should be okay, as CGI channel - * is already dup()ed by apr_procattr_child_{in,out}_set() - * above. - */ - close(sd2); - - rc = ap_os_create_privileged_process(r, procnew, argv0, argv, - (const char * const *)env, - procattr, ptrans); - - if (rc != APR_SUCCESS) { - /* Bad things happened. Everyone should have cleaned up. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, - "couldn't create child process: %d: %s", rc, r->filename); - } - } - } - return -1; -} - -static void cgid_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, - server_rec *main_server) -{ - pid_t pid; - apr_proc_t *procnew; - void *data; - int first_time = 0; - const char *userdata_key = "cgid_init"; - module **m; - - apr_pool_userdata_get(&data, userdata_key, main_server->process->pool); - if (!data) { - first_time = 1; - apr_pool_userdata_set((const void *)1, userdata_key, - apr_pool_cleanup_null, main_server->process->pool); - } - - if (!first_time) { - apr_pool_create(&pcgi, p); - - total_modules = 0; - for (m = ap_preloaded_modules; *m != NULL; m++) - total_modules++; - - - 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); - } - procnew = apr_pcalloc(p, sizeof(*procnew)); - procnew->pid = pid; - procnew->err = procnew->in = procnew->out = NULL; - apr_pool_note_subprocess(p, procnew, kill_after_timeout); -#if APR_HAS_OTHER_CHILD - apr_proc_other_child_register(procnew, cgid_maint, &procnew->pid, NULL, p); -#endif - - cgid_pfn_reg_with_ssi = APR_RETRIEVE_OPTIONAL_FN(ap_register_include_handler); - cgid_pfn_gtv = APR_RETRIEVE_OPTIONAL_FN(ap_ssi_get_tag_and_value); - cgid_pfn_ps = APR_RETRIEVE_OPTIONAL_FN(ap_ssi_parse_string); - - if ((cgid_pfn_reg_with_ssi) && (cgid_pfn_gtv) && (cgid_pfn_ps)) { - /* Required by mod_include filter. This is how mod_cgid registers - * with mod_include to provide processing of the exec directive. - */ - cgid_pfn_reg_with_ssi("exec", handle_exec); - } - } -} - -static void *create_cgid_config(apr_pool_t *p, server_rec *s) -{ - cgid_server_conf *c = - (cgid_server_conf *) apr_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); - return c; -} - -static void *merge_cgid_config(apr_pool_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, const char *arg) -{ - server_rec *s = cmd->server; - cgid_server_conf *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, const char *arg) -{ - server_rec *s = cmd->server; - cgid_server_conf *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, const char *arg) -{ - server_rec *s = cmd->server; - cgid_server_conf *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, const char *arg) -{ - server_rec *s = cmd->server; - cgid_server_conf *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[] = -{ - AP_INIT_TAKE1("ScriptLog", set_scriptlog, NULL, RSRC_CONF, - "the name of a log for script debugging info"), - AP_INIT_TAKE1("ScriptLogLength", set_scriptlog_length, NULL, RSRC_CONF, - "the maximum length (in bytes) of the script debug log"), - AP_INIT_TAKE1("ScriptLogBuffer", set_scriptlog_buffer, NULL, RSRC_CONF, - "the maximum size (in bytes) to record of a POST request"), - AP_INIT_TAKE1("Scriptsock", set_script_socket, NULL, RSRC_CONF, - "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, - apr_status_t rv, char *error) -{ - apr_file_t *f = NULL; - struct stat finfo; - char time_str[APR_CTIME_LEN]; - int log_flags = rv ? APLOG_ERR : APLOG_NOERRNO | APLOG_ERR; - - ap_log_rerror(APLOG_MARK, log_flags, rv, 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)) || - (apr_file_open(&f, ap_server_root_relative(r->pool, conf->logname), - APR_APPEND|APR_WRITE|APR_CREATE, APR_OS_DEFAULT, r->pool) != APR_SUCCESS)) { - return ret; - } - - /* "%% [Wed Jun 19 10:53:21 1996] GET /cgid-bin/printenv HTTP/1.0" */ - apr_ctime(time_str, apr_time_now()); - apr_file_printf(f, "%%%% [%s] %s %s%s%s %s\n", time_str, r->method, r->uri, - r->args ? "?" : "", r->args ? r->args : "", r->protocol); - /* "%% 500 /usr/local/apache/cgid-bin */ - apr_file_printf(f, "%%%% %d %s\n", ret, r->filename); - - apr_file_printf(f, "%%error\n%s\n", error); - - apr_file_close(f); - return ret; -} - -static int log_script(request_rec *r, cgid_server_conf * conf, int ret, - char *dbuf, const char *sbuf, apr_file_t *script_in, apr_file_t *script_err) -{ - apr_array_header_t *hdrs_arr = apr_table_elts(r->headers_in); - apr_table_entry_t *hdrs = (apr_table_entry_t *) hdrs_arr->elts; - char argsbuffer[HUGE_STRING_LEN]; - apr_file_t *f = NULL; - int i; - struct stat finfo; - char time_str[APR_CTIME_LEN]; - - if (!conf->logname || - ((stat(ap_server_root_relative(r->pool, conf->logname), &finfo) == 0) - && (finfo.st_size > conf->logbytes)) || - (apr_file_open(&f, ap_server_root_relative(r->pool, conf->logname), - APR_APPEND|APR_WRITE|APR_CREATE, APR_OS_DEFAULT, r->pool) != APR_SUCCESS)) { - /* Soak up script output */ - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_in) == 0) - continue; - if (script_err) { - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_err) == 0) - continue; - } - return ret; - } - - /* "%% [Wed Jun 19 10:53:21 1996] GET /cgid-bin/printenv HTTP/1.0" */ - apr_ctime(time_str, apr_time_now()); - apr_file_printf(f, "%%%% [%s] %s %s%s%s %s\n", time_str, r->method, r->uri, - r->args ? "?" : "", r->args ? r->args : "", r->protocol); - /* "%% 500 /usr/local/apache/cgid-bin" */ - apr_file_printf(f, "%%%% %d %s\n", ret, r->filename); - - apr_file_puts("%request\n", f); - for (i = 0; i < hdrs_arr->nelts; ++i) { - if (!hdrs[i].key) - continue; - apr_file_printf(f, "%s: %s\n", hdrs[i].key, hdrs[i].val); - } - if ((r->method_number == M_POST || r->method_number == M_PUT) - && *dbuf) { - apr_file_printf(f, "\n%s\n", dbuf); - } - - apr_file_puts("%response\n", f); - hdrs_arr = apr_table_elts(r->err_headers_out); - hdrs = (apr_table_entry_t *) hdrs_arr->elts; - - for (i = 0; i < hdrs_arr->nelts; ++i) { - if (!hdrs[i].key) - continue; - apr_file_printf(f, "%s: %s\n", hdrs[i].key, hdrs[i].val); - } - - if (sbuf && *sbuf) - apr_file_printf(f, "%s\n", sbuf); - - if (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_in) == 0) { - apr_file_puts("%stdout\n", f); - apr_file_puts(argsbuffer, f); - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_in) == 0) - apr_file_puts(argsbuffer, f); - apr_file_puts("\n", f); - } - - if (script_err) { - if (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_err) == 0) { - apr_file_puts("%stderr\n", f); - apr_file_puts(argsbuffer, f); - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_err) == 0) - apr_file_puts(argsbuffer, f); - apr_file_puts("\n", f); - } - } - - apr_file_close(script_in); - if (script_err) { - apr_file_close(script_err); - } - - apr_file_close(f); - return ret; -} - - - -/**************************************************************** - * - * Actual cgid handling... - */ -static int cgid_handler(request_rec *r) -{ - int retval, nph, dbpos = 0; - char *argv0, *dbuf = NULL; - apr_bucket_brigade *bb; - apr_bucket *b; - char argsbuffer[HUGE_STRING_LEN]; - cgid_server_conf *conf; - int is_included; - int sd; - char **env; - struct sockaddr_un unix_addr; - apr_file_t *tempsock; - apr_size_t nbytes; - - if(strcmp(r->handler,CGI_MAGIC_TYPE) && strcmp(r->handler,"cgi-script")) - return DECLINED; - - 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; - } - - conf = ap_get_module_config(r->server->module_config, &cgid_module); - is_included = !strcmp(r->protocol, "INCLUDED"); - - 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, HTTP_FORBIDDEN, 0, - "Options ExecCGI is off in this directory"); - if (nph && is_included) - return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, - "attempt to include NPH CGI script"); - -#if defined(OS2) || defined(WIN32) -#error mod_cgid does not work on this platform. If you teach it to, look -#error at mod_cgi.c for required code in this path. -#else - if (r->finfo.filetype == 0) - return log_scripterror(r, conf, HTTP_NOT_FOUND, 0, - "script not found or unable to stat"); -#endif - if (r->finfo.filetype == APR_DIR) - return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, - "attempt to invoke directory as script"); -/* - if (!ap_suexec_enabled) { - if (!ap_can_exec(&r->finfo)) - return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, - "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, HTTP_INTERNAL_SERVER_ERROR, errno, - "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, HTTP_INTERNAL_SERVER_ERROR, errno, - "unable to connect to cgi daemon"); - } - - send_req(sd, r, argv0, env, CGI_REQ); - - /* We are putting the tempsock variable into a file so that we can use - * a pipe bucket to send the data to the client. - */ - apr_os_file_put(&tempsock, &sd, r->pool); - - 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 = apr_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; - } - nbytes = len_read; - apr_file_write(tempsock, argsbuffer, &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; - } - } - } - /* we're done writing, or maybe we didn't write at all; - * force EOF on child's stdin so that the cgi detects end (or - * absence) of data - */ - shutdown(sd, 1); - - /* Handle script return... */ - if (!nph) { - const char *location; - char sbuf[MAX_STRING_LEN]; - int ret; - - if ((ret = ap_scan_script_header_err(r, tempsock, sbuf))) { - return log_script(r, conf, ret, dbuf, sbuf, tempsock, NULL); - } - - location = apr_table_get(r->headers_out, "Location"); - - if (location && location[0] == '/' && r->status == 200) { - - /* Soak up all the script output */ - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, tempsock) > 0) { - continue; - } - /* This redirect needs to be a GET no matter what the original - * method was. - */ - r->method = apr_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. - */ - apr_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 HTTP_MOVED_TEMPORARILY; - } - - if (!r->header_only) { - bb = apr_brigade_create(r->pool); - b = apr_bucket_pipe_create(tempsock); - APR_BRIGADE_INSERT_TAIL(bb, b); - b = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(bb, b); - ap_pass_brigade(r->output_filters, bb); - } - } - - if (nph) { - bb = apr_brigade_create(r->pool); - b = apr_bucket_pipe_create(tempsock); - APR_BRIGADE_INSERT_TAIL(bb, b); - b = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(bb, b); - ap_pass_brigade(r->output_filters, bb); - } - - apr_file_close(tempsock); - - return OK; /* NOT r->status, even if it has changed. */ -} - - - - -/*============================================================================ - *============================================================================ - * This is the beginning of the cgi filter code moved from mod_include. This - * is the code required to handle the "exec" SSI directive. - *============================================================================ - *============================================================================*/ -static int include_cgi(char *s, request_rec *r, ap_filter_t *next, - apr_bucket *head_ptr, apr_bucket **inserted_head) -{ - request_rec *rr = ap_sub_req_lookup_uri(s, r, next); - int rr_status; - apr_bucket *tmp_buck, *tmp2_buck; - - 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.protection == 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)) { - apr_size_t len_loc, h_wrt; - const char *location = apr_table_get(rr->headers_out, "Location"); - - location = ap_escape_html(rr->pool, location); - len_loc = strlen(location); - - tmp_buck = apr_bucket_immortal_create("<A HREF=\"", sizeof("<A HREF=\"")); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck); - tmp2_buck = apr_bucket_heap_create(location, len_loc, 1, &h_wrt); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp2_buck); - tmp2_buck = apr_bucket_immortal_create("\">", sizeof("\">")); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp2_buck); - tmp2_buck = apr_bucket_heap_create(location, len_loc, 1, &h_wrt); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp2_buck); - tmp2_buck = apr_bucket_immortal_create("</A>", sizeof("</A>")); - APR_BUCKET_INSERT_BEFORE(head_ptr, tmp2_buck); - - if (*inserted_head == NULL) { - *inserted_head = tmp_buck; - } - } - - ap_destroy_sub_req(rr); - - return 0; -} - - -/* This is the special environment used for running the "exec cmd=" - * variety of SSI directives. - */ -static void add_ssi_vars(request_rec *r, ap_filter_t *next) -{ - apr_table_t *e = r->subprocess_env; - - if (r->path_info && r->path_info[0] != '\0') { - request_rec *pa_req; - - apr_table_setn(e, "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, next); - if (pa_req->filename) { - apr_table_setn(e, "PATH_TRANSLATED", - apr_pstrcat(r->pool, pa_req->filename, pa_req->path_info, NULL)); - } - } - - if (r->args) { - char *arg_copy = apr_pstrdup(r->pool, r->args); - - apr_table_setn(e, "QUERY_STRING", r->args); - ap_unescape_url(arg_copy); - apr_table_setn(e, "QUERY_STRING_UNESCAPED", ap_escape_shell_cmd(r->pool, arg_copy)); - } -} - -static int include_cmd(include_ctx_t *ctx, apr_bucket_brigade **bb, char *command, - request_rec *r, ap_filter_t *f) -{ - char **env; - const char *location; - int sd; - int retval; - apr_bucket_brigade *bcgi; - apr_bucket *b; - struct sockaddr_un unix_addr; - apr_file_t *tempsock = NULL; - cgid_server_conf *conf = ap_get_module_config(r->server->module_config, - &cgid_module); - - add_ssi_vars(r, f->next); - env = ap_create_environment(r->pool, r->subprocess_env); - - if ((sd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { - return log_scripterror(r, conf, HTTP_INTERNAL_SERVER_ERROR, 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, HTTP_INTERNAL_SERVER_ERROR, 0, - "unable to connect to cgi daemon"); - } - - SPLIT_AND_PASS_PRETAG_BUCKETS(*bb, ctx, f->next); - - send_req(sd, r, command, env, SSI_REQ); - - /* We are putting the tempsock variable into a file so that we can use - * a pipe bucket to send the data to the client. - */ - apr_os_file_put(&tempsock, &sd, r->pool); - - if ((retval = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR))) - return retval; - - location = apr_table_get(r->headers_out, "Location"); - - if (location && location[0] == '/' && r->status == 200) { - char argsbuffer[HUGE_STRING_LEN]; - - /* Soak up all the script output */ - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, tempsock) > 0) { - continue; - } - /* This redirect needs to be a GET no matter what the original - * method was. - */ - r->method = apr_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. - */ - apr_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 HTTP_MOVED_TEMPORARILY; - } - - if (!r->header_only) { - bcgi = apr_brigade_create(r->pool); - b = apr_bucket_pipe_create(tempsock); - APR_BRIGADE_INSERT_TAIL(bcgi, b); - ap_pass_brigade(f->next, bcgi); - } - - return 0; -} - -static int handle_exec(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec *r, - ap_filter_t *f, apr_bucket *head_ptr, apr_bucket **inserted_head) -{ - char *tag = NULL; - char *tag_val = NULL; - char *file = r->filename; - apr_bucket *tmp_buck; - char parsed_string[MAX_STRING_LEN]; - - *inserted_head = NULL; - if (ctx->flags & FLAG_PRINTING) { - if (ctx->flags & FLAG_NO_EXEC) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "exec used but not allowed in %s", r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - else { - while (1) { - cgid_pfn_gtv(ctx, &tag, &tag_val, 1); - if (tag_val == NULL) { - if (tag == NULL) { - return (0); - } - else { - return 1; - } - } - if (!strcmp(tag, "cmd")) { - cgid_pfn_ps(r, tag_val, parsed_string, sizeof(parsed_string), 1); - if (include_cmd(ctx, bb, parsed_string, r, f) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "execution failure for parameter \"%s\" " - "to tag exec in file %s", tag, r->filename); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - /* just in case some stooge changed directories */ - } - else if (!strcmp(tag, "cgi")) { - cgid_pfn_ps(r, tag_val, parsed_string, sizeof(parsed_string), 0); - SPLIT_AND_PASS_PRETAG_BUCKETS(*bb, ctx, f->next); - if (include_cgi(parsed_string, r, f->next, head_ptr, inserted_head) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "invalid CGI ref \"%s\" in %s", tag_val, file); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "unknown parameter \"%s\" to tag exec in %s", tag, file); - CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head); - } - } - } - } - return 0; -} -/*============================================================================ - *============================================================================ - * This is the end of the cgi filter code moved from mod_include. - *============================================================================ - *============================================================================*/ - - -static void register_hook(apr_pool_t *p) -{ - static const char * const aszPre[] = { "mod_include.c", NULL }; - - ap_hook_post_config(cgid_init, aszPre, NULL, APR_HOOK_MIDDLE); - ap_hook_handler(cgid_handler, NULL, NULL, APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA 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 */ - register_hook /* register_handlers */ -}; - diff --git a/modules/generators/mod_info.c b/modules/generators/mod_info.c deleted file mode 100644 index 3c5e014fcf..0000000000 --- a/modules/generators/mod_info.c +++ /dev/null @@ -1,491 +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. - */ - -/* - * 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 - * - * Ryan Morgan <rmorgan@covalent.net> - * - * 8.11.00 Port to Apache 2.0. Read configuation from the configuration - * tree rather than reparse the entire configuation file. - * - */ - -#define CORE_PRIVATE - -#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 "apr_strings.h" -#include "apr_lib.h" -#define APR_WANT_STRFUNC -#include "apr_want.h" -#include "ap_mpm.h" - -typedef struct { - const char *name; /* matching module name */ - const char *info; /* additional info */ -} info_entry; - -typedef struct { - apr_array_header_t *more_info; -} info_svr_conf; - -module AP_MODULE_DECLARE_DATA info_module; - -static void *create_info_config(apr_pool_t *p, server_rec *s) -{ - info_svr_conf *conf = (info_svr_conf *) apr_pcalloc(p, sizeof(info_svr_conf)); - - conf->more_info = apr_array_make(p, 20, sizeof(info_entry)); - return conf; -} - -static void *merge_info_config(apr_pool_t *p, void *basev, void *overridesv) -{ - info_svr_conf *new = (info_svr_conf *) apr_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 = apr_array_append(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, int close) -{ - 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 == '<') { - if (close) { - strncpy(t, "</,", end_buf -t); - t += 5; - } else { - 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 if (*s == ' ') { - if (close) { - strncpy(t, ">", end_buf -t); - t += 4; - break; - } else { - *t++ = *s; - } - } else { - *t++ = *s; - } - s++; - } - /* oops, overflowed... don't overwrite */ - if (t > end_buf) { - *end_buf = '\0'; - } - else { - *t = '\0'; - } - return (buf); -} - -static void mod_info_module_cmds(request_rec * r, const command_rec * cmds, - ap_directive_t * conftree) -{ - const command_rec *cmd; - ap_directive_t *tmptree = conftree; - - char buf[MAX_STRING_LEN]; - char htmlstring[MAX_STRING_LEN]; - int block_start = 0; - int nest = 0; - - while (tmptree != NULL) { - cmd = cmds; - while (cmd->name) { - if ((cmd->name[0] != '<') && - (strcasecmp(cmd->name, tmptree->directive) == 0)) { - if (nest > block_start) { - block_start++; - apr_snprintf(htmlstring, sizeof(htmlstring), "%s %s", - tmptree->parent->directive, - tmptree->parent->args); - ap_rprintf(r, "<dd><tt>%s</tt><br>\n", - mod_info_html_cmd_string(htmlstring, buf, - sizeof(buf), 0)); - } - if (nest == 2) { - ap_rprintf(r, "<dd><tt>    %s " - "<i>%s</i></tt><br>\n", - tmptree->directive, tmptree->args); - } else if (nest == 1) { - ap_rprintf(r, - "<dd><tt>  %s <i>%s</i></tt><br>\n", - tmptree->directive, tmptree->args); - } else { - ap_rprintf(r, "<dd><tt>%s <i>%s</i></tt><br>\n", - mod_info_html_cmd_string(tmptree->directive, - buf, sizeof(buf), - 0), tmptree->args); - } - } - ++cmd; - } - if (tmptree->first_child != NULL) { - tmptree = tmptree->first_child; - nest++; - } else if (tmptree->next != NULL) { - tmptree = tmptree->next; - } else { - if (block_start) { - apr_snprintf(htmlstring, sizeof(htmlstring), "%s %s", - tmptree->parent->directive, - tmptree->parent->args); - ap_rprintf(r, "<dd><tt>%s</tt><br>\n", - mod_info_html_cmd_string(htmlstring, buf, - sizeof(buf), 1)); - block_start--; - } - if (tmptree->parent) { - tmptree = tmptree->parent->next; - } - else { - tmptree = NULL; - } - nest--; - } - - } -} -static const 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]; - const char *more_info; - const command_rec *cmd = NULL; -#ifdef NEVERMORE - const handler_rec *hand = NULL; -#endif - server_rec *serv = r->server; - int comma = 0; - - if (strcmp(r->handler, "server-info")) - return DECLINED; - - r->allowed |= (1 << M_GET); - if (r->method_number != M_GET) - return DECLINED; - - r->content_type = "text/html"; - if (r->header_only) { - return 0; - } - - 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")) { - if (!r->args) { - ap_rputs("Server Settings, ", r); - for (modp = ap_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")) { - int max_daemons, forked, threaded; - - 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, "Hostname/port: " - "%s:%u
        \n", - serv->server_hostname, serv->port); - ap_rprintf(r, "Timeouts: " - "connection: %d    " - "keep-alive: %d
        ", - serv->timeout, serv->keep_alive_timeout); - ap_mpm_query(AP_MPMQ_MAX_DAEMONS, &max_daemons); - ap_mpm_query(AP_MPMQ_IS_THREADED, &threaded); - ap_mpm_query(AP_MPMQ_IS_FORKED, &forked); - ap_rprintf(r, "MPM used is %s
        \n", ap_show_mpm()); - ap_rprintf(r, "MPM Information: " - "Max Daemons: %d Threaded: %s Forked: %s
        \n", - max_daemons, threaded ? "yes" : "no", - forked ? "yes" : "no"); - ap_rprintf(r, "Server Root: " - "%s
        \n", ap_server_root); - ap_rprintf(r, "Config File: " - "%s
        \n", SERVER_CONFIG_FILE); - } - ap_rputs("
        ", r); - for (modp = ap_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); -#ifdef NEVERMORE - 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); - } -#else - ap_rputs(" (code broken)", r); -#endif - ap_rputs("
        Configuration Phase Participation: \n", - r); - 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 (!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), 0)); - 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, modp->cmds, ap_conftree); - } - 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 = ap_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 */ - return 0; -} - -static const char *add_module_info(cmd_parms *cmd, void *dummy, - const char *name, const 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 = apr_array_push(conf->more_info); - - new->name = name; - new->info = info; - return NULL; -} - -static const command_rec info_cmds[] = -{ - AP_INIT_TAKE2("AddModuleInfo", add_module_info, NULL, RSRC_CONF, - "a module name and additional information on that module"), - {NULL} -}; - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_handler(display_info, NULL, NULL, APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA info_module = -{ - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks -}; diff --git a/modules/generators/mod_info.dsp b/modules/generators/mod_info.dsp deleted file mode 100644 index e36e2df870..0000000000 --- a/modules/generators/mod_info.dsp +++ /dev/null @@ -1,95 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_info" - 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_info - 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_info.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_info.mak" CFG="mod_info - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_info - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_info - 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_info - 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_info" /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_info.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_info -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_info.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_info - -!ELSEIF "$(CFG)" == "mod_info - 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_info" /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_info.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_info -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_info.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_info - -!ENDIF - -# Begin Target - -# Name "mod_info - Win32 Release" -# Name "mod_info - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_info.c -# End Source File -# End Target -# End Project diff --git a/modules/generators/mod_info.exp b/modules/generators/mod_info.exp deleted file mode 100644 index c304fa776d..0000000000 --- a/modules/generators/mod_info.exp +++ /dev/null @@ -1 +0,0 @@ -info_module diff --git a/modules/generators/mod_info.mak b/modules/generators/mod_info.mak deleted file mode 100644 index 0a1411ebbd..0000000000 --- a/modules/generators/mod_info.mak +++ /dev/null @@ -1,326 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on mod_info.dsp -!IF "$(CFG)" == "" -CFG=mod_info - Win32 Release -!MESSAGE No configuration specified. Defaulting to mod_info - Win32 Release. -!ENDIF - -!IF "$(CFG)" != "mod_info - Win32 Release" && "$(CFG)" !=\ - "mod_info - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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_info.mak" CFG="mod_info - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_info - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_info - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "mod_info - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_info.so" - -!ELSE - -ALL : "libapr - Win32 Release" "libhttpd - Win32 Release"\ - "$(OUTDIR)\mod_info.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libhttpd - Win32 ReleaseCLEAN" "libapr - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_info.idb" - -@erase "$(INTDIR)\mod_info.obj" - -@erase "$(OUTDIR)\mod_info.exp" - -@erase "$(OUTDIR)\mod_info.lib" - -@erase "$(OUTDIR)\mod_info.map" - -@erase "$(OUTDIR)\mod_info.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I\ - "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D\ - "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_info" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_info.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_info.pdb" /map:"$(INTDIR)\mod_info.map" /machine:I386\ - /out:"$(OUTDIR)\mod_info.so" /implib:"$(OUTDIR)\mod_info.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_info -LINK32_OBJS= \ - "$(INTDIR)\mod_info.obj" \ - "..\..\Release\libhttpd.lib" \ - "..\..\srclib\apr\Release\libapr.lib" - -"$(OUTDIR)\mod_info.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "mod_info - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_info.so" - -!ELSE - -ALL : "libapr - Win32 Debug" "libhttpd - Win32 Debug" "$(OUTDIR)\mod_info.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libhttpd - Win32 DebugCLEAN" "libapr - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_info.idb" - -@erase "$(INTDIR)\mod_info.obj" - -@erase "$(OUTDIR)\mod_info.exp" - -@erase "$(OUTDIR)\mod_info.lib" - -@erase "$(OUTDIR)\mod_info.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Od /I "..\..\include" /I "..\..\os\win32" /I\ - "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D\ - "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_info" /FD /ZI /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_info.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_info.pdb" /machine:I386 /out:"$(OUTDIR)\mod_info.so"\ - /implib:"$(OUTDIR)\mod_info.lib" /map/debug\ - /base:@..\..\os\win32\BaseAddr.ref,mod_info -LINK32_OBJS= \ - "$(INTDIR)\mod_info.obj" \ - "..\..\Debug\libhttpd.lib" \ - "..\..\srclib\apr\Debug\libapr.lib" - -"$(OUTDIR)\mod_info.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "mod_info - Win32 Release" || "$(CFG)" ==\ - "mod_info - Win32 Debug" - -!IF "$(CFG)" == "mod_info - Win32 Release" - -"libhttpd - Win32 Release" : - cd "\clean\httpd-2.0" - $(MAKE) /$(MAKEFLAGS) /F ".\libhttpd.mak" CFG="libhttpd - Win32 Release" - cd ".\modules\generators" - -"libhttpd - Win32 ReleaseCLEAN" : - cd "\clean\httpd-2.0" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libhttpd.mak"\ - CFG="libhttpd - Win32 Release" RECURSE=1 - cd ".\modules\generators" - -!ELSEIF "$(CFG)" == "mod_info - Win32 Debug" - -"libhttpd - Win32 Debug" : - cd "\clean\httpd-2.0" - $(MAKE) /$(MAKEFLAGS) /F ".\libhttpd.mak" CFG="libhttpd - Win32 Debug" - cd ".\modules\generators" - -"libhttpd - Win32 DebugCLEAN" : - cd "\clean\httpd-2.0" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libhttpd.mak" CFG="libhttpd - Win32 Debug"\ - RECURSE=1 - cd ".\modules\generators" - -!ENDIF - -!IF "$(CFG)" == "mod_info - Win32 Release" - -"libapr - Win32 Release" : - cd "\clean\httpd-2.0\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F ".\libapr.mak" CFG="libapr - Win32 Release" - cd "..\..\modules\generators" - -"libapr - Win32 ReleaseCLEAN" : - cd "\clean\httpd-2.0\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libapr.mak" CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\..\modules\generators" - -!ELSEIF "$(CFG)" == "mod_info - Win32 Debug" - -"libapr - Win32 Debug" : - cd "\clean\httpd-2.0\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F ".\libapr.mak" CFG="libapr - Win32 Debug" - cd "..\..\modules\generators" - -"libapr - Win32 DebugCLEAN" : - cd "\clean\httpd-2.0\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libapr.mak" CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\..\modules\generators" - -!ENDIF - -SOURCE=.\mod_info.c -DEP_CPP_MOD_I=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.h"\ - "..\..\include\ap_mpm.h"\ - "..\..\include\ap_release.h"\ - "..\..\include\http_config.h"\ - "..\..\include\http_core.h"\ - "..\..\include\http_log.h"\ - "..\..\include\http_main.h"\ - "..\..\include\http_protocol.h"\ - "..\..\include\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_script.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\srclib\apr-util\include\apu.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_dso.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_lib.h"\ - "..\..\srclib\apr\include\apr_lock.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_portable.h"\ - "..\..\srclib\apr\include\apr_strings.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\include\apr_user.h"\ - "..\..\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_I=\ - "..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_info.obj" : $(SOURCE) $(DEP_CPP_MOD_I) "$(INTDIR)" - - - -!ENDIF - diff --git a/modules/generators/mod_status.c b/modules/generators/mod_status.c deleted file mode 100644 index 17f07e888f..0000000000 --- a/modules/generators/mod_status.c +++ /dev/null @@ -1,787 +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. - */ - -/* 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_main.h" -#include "util_script.h" -#include -#include "scoreboard.h" -#include "http_log.h" -#if APR_HAVE_UNISTD_H -#include -#endif -#define APR_WANT_STRFUNC -#include "apr_want.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 - -#define STATUS_MAGIC_TYPE "application/x-httpd-status" - -module AP_MODULE_DECLARE_DATA 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, int arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - ap_extended_status = arg; - return NULL; -} - -static const command_rec status_module_cmds[] = -{ - AP_INIT_FLAG("ExtendedStatus", set_extended_status, NULL, RSRC_CONF, - "\"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, apr_interval_time_t tsecs) -{ - int 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, " %d day%s", days, days == 1 ? "" : "s"); - if (hrs) - ap_rprintf(r, " %d hour%s", hrs, hrs == 1 ? "" : "s"); - if (mins) - ap_rprintf(r, " %d minute%s", mins, mins == 1 ? "" : "s"); - if (secs) - ap_rprintf(r, " %d 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) -{ - const char *loc; - apr_time_t nowtime; - apr_interval_time_t up_time; - int j, 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; -#ifdef HAVE_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 * HARD_THREAD_LIMIT]; - int pid_buffer[HARD_SERVER_LIMIT * HARD_THREAD_LIMIT]; - clock_t tu, ts, tcu, tcs; - server_rec *vhost; - - if (strcmp(r->handler, STATUS_MAGIC_TYPE) && strcmp(r->handler, "server-status")) { - return DECLINED; - } - - nowtime = apr_time_now(); - tu = ts = tcu = tcs = 0; - - if (!ap_exists_scoreboard_image()) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, 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 = ap_strstr_c(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)) == '=' - && atol(loc + strlen(status_options[i].form_data_str) - + 1) > 0) - apr_table_set(r->headers_out, - status_options[i].hdr_out_str, - loc + strlen(status_options[i].hdr_out_str) + 1); - else - apr_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++; - } - } - - if (r->header_only) - return 0; - -/* ap_sync_scoreboard_image(); */ - for (i = 0; i < HARD_SERVER_LIMIT; ++i) { - for (j = 0; j < HARD_THREAD_LIMIT; ++j) { - int indx = (i * HARD_THREAD_LIMIT) + j; - - score_record = ap_scoreboard_image->servers[i][j]; - ps_record = ap_scoreboard_image->parent[i]; - res = score_record.status; - stat_buffer[indx] = status_flags[res]; - pid_buffer[indx] = (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)) { -#ifdef HAVE_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 /* HAVE_TIMES */ - count += lres; - bcount += bytes; - if (bcount >= KBYTE) { - kbcount += (bcount >> 10); - bcount = bcount & 0x3ff; - } - } - } - } - } - - /* up_time in seconds */ - up_time = (apr_uint32_t) ((nowtime - ap_restart_time)/1000000); - - 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); - -#ifdef HAVE_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); - -#ifdef HAVE_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) {
        -        for (j = 0; j < HARD_THREAD_LIMIT; ++j) {
        -            int indx = (i * HARD_THREAD_LIMIT) + j;
        -	    ap_rputc(stat_buffer[indx], r);
        -	    if ((indx % 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("\"I\" Idle cleanup of worker, \n", r); - ap_rputs("\".\" Open slot with no current process

        \n", r); - ap_rputs("

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

        \n", r);
        -	    for (i = 0; i < HARD_SERVER_LIMIT; ++i) {
        -                for (j = 0; j < HARD_THREAD_LIMIT; ++j) {
        -                    int indx = (i * HARD_THREAD_LIMIT) + j;
        -
        -		    if (stat_buffer[indx] != '.') {
        -		        ap_rprintf(r, "   %d in state: %c ", pid_buffer[i],
        -		        stat_buffer[indx]);
        -		        if (++k >= 3) {
        -		    	    ap_rputs("\n", r);
        -			    k = 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 -#ifndef HAVE_TIMES - /* Allow for OS/2 not having CPU stats */ - ap_rputs("

        \n\n\n\n", r); -#else - ap_rputs("

        \n\n

        SrvPIDAccM\nSSReqConnChildSlotClientVHostRequest
        \n\n", r); -#endif - } - - for (i = 0; i < HARD_SERVER_LIMIT; ++i) { - for (j = 0; j < HARD_THREAD_LIMIT; ++j) { - score_record = ap_scoreboard_image->servers[i][j]; - ps_record = ap_scoreboard_image->parent[i]; - vhost = score_record.vhostrec; - if (ps_record.generation != ap_my_generation) { - vhost = NULL; - } - - -#if defined(NO_GETTIMEOFDAY) -#ifdef HAVE_TIMES - if (score_record.start_time == (clock_t) 0) -#endif /* HAVE_TIMES */ - req_time = 0L; -#ifdef HAVE_TIMES - else { - req_time = score_record.stop_time - score_record.start_time; - req_time = (req_time * 1000) / (int) tick; - } -#endif /* HAVE_TIMES */ -#else - if (score_record.start_time == 0L && - score_record.start_time == 0L) - req_time = 0L; - else - req_time = - ((score_record.stop_time - score_record.start_time) * 1000) + - ((score_record.stop_time - score_record.start_time) / 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; - } -#ifndef HAVE_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", - ap_escape_html(r->pool, score_record.client), - ap_escape_html(r->pool, score_record.request), - vhost ? ap_escape_html(r->pool, - 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", - ap_escape_html(r->pool, score_record.client), - vhost ? ap_escape_html(r->pool, - 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)) { -#ifndef HAVE_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; - } -#ifndef HAVE_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 { - - if (!short_report) { - 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); - } - - return 0; -} - - -static void status_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) -{ - 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'; - status_flags[SERVER_IDLE_KILL] = 'I'; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_handler(status_handler, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_post_config(status_init, NULL, NULL, APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA status_module = -{ - STANDARD20_MODULE_STUFF, - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - status_module_cmds, /* command table */ - register_hooks /* register_hooks */ -}; - diff --git a/modules/generators/mod_status.dsp b/modules/generators/mod_status.dsp deleted file mode 100644 index 01e117238b..0000000000 --- a/modules/generators/mod_status.dsp +++ /dev/null @@ -1,95 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_status" - 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_status - 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_status.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_status.mak" CFG="mod_status - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_status - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_status - 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_status - 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" /I "../../server/mpm/winnt" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_status" /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 /map /machine:I386 /out:"Release/mod_status.so" /base:@..\..\os\win32\BaseAddr.ref,mod_status -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_status.so" /base:@..\..\os\win32\BaseAddr.ref,mod_status - -!ELSEIF "$(CFG)" == "mod_status - 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" /I "../../server/mpm/winnt" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_status" /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 /machine:I386 /out:"Debug/mod_status.so" /base:@..\..\os\win32\BaseAddr.ref,mod_status -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_status.so" /base:@..\..\os\win32\BaseAddr.ref,mod_status - -!ENDIF - -# Begin Target - -# Name "mod_status - Win32 Release" -# Name "mod_status - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_status.c -# End Source File -# End Target -# End Project diff --git a/modules/generators/mod_status.exp b/modules/generators/mod_status.exp deleted file mode 100644 index 5438093686..0000000000 --- a/modules/generators/mod_status.exp +++ /dev/null @@ -1 +0,0 @@ -status_module diff --git a/modules/generators/mod_status.mak b/modules/generators/mod_status.mak deleted file mode 100644 index ec22087ff3..0000000000 --- a/modules/generators/mod_status.mak +++ /dev/null @@ -1,330 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on mod_status.dsp -!IF "$(CFG)" == "" -CFG=mod_status - Win32 Release -!MESSAGE No configuration specified. Defaulting to mod_status - Win32 Release. -!ENDIF - -!IF "$(CFG)" != "mod_status - Win32 Release" && "$(CFG)" !=\ - "mod_status - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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_status.mak" CFG="mod_status - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_status - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_status - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "mod_status - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_status.so" - -!ELSE - -ALL : "libhttpd - Win32 Release" "libapr - Win32 Release"\ - "$(OUTDIR)\mod_status.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 ReleaseCLEAN" "libhttpd - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_status.idb" - -@erase "$(INTDIR)\mod_status.obj" - -@erase "$(OUTDIR)\mod_status.exp" - -@erase "$(OUTDIR)\mod_status.lib" - -@erase "$(OUTDIR)\mod_status.map" - -@erase "$(OUTDIR)\mod_status.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I\ - "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /I\ - "../../server/mpm/winnt" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\mod_status" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_status.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_status.pdb" /map:"$(INTDIR)\mod_status.map" /machine:I386\ - /out:"$(OUTDIR)\mod_status.so" /implib:"$(OUTDIR)\mod_status.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_status -LINK32_OBJS= \ - "$(INTDIR)\mod_status.obj" \ - "..\..\Release\libhttpd.lib" \ - "..\..\srclib\apr\Release\libapr.lib" - -"$(OUTDIR)\mod_status.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "mod_status - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_status.so" - -!ELSE - -ALL : "libhttpd - Win32 Debug" "libapr - Win32 Debug" "$(OUTDIR)\mod_status.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 DebugCLEAN" "libhttpd - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_status.idb" - -@erase "$(INTDIR)\mod_status.obj" - -@erase "$(OUTDIR)\mod_status.exp" - -@erase "$(OUTDIR)\mod_status.lib" - -@erase "$(OUTDIR)\mod_status.map" - -@erase "$(OUTDIR)\mod_status.pdb" - -@erase "$(OUTDIR)\mod_status.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Zi /Od /I "..\..\include" /I "..\..\os\win32" /I\ - "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /I\ - "../../server/mpm/winnt" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\mod_status" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_status.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_status.pdb" /map:"$(INTDIR)\mod_status.map" /debug\ - /machine:I386 /out:"$(OUTDIR)\mod_status.so" /implib:"$(OUTDIR)\mod_status.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_status -LINK32_OBJS= \ - "$(INTDIR)\mod_status.obj" \ - "..\..\Debug\libhttpd.lib" \ - "..\..\srclib\apr\Debug\libapr.lib" - -"$(OUTDIR)\mod_status.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "mod_status - Win32 Release" || "$(CFG)" ==\ - "mod_status - Win32 Debug" - -!IF "$(CFG)" == "mod_status - Win32 Release" - -"libapr - Win32 Release" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Release" - cd "..\..\modules\generators" - -"libapr - Win32 ReleaseCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\..\modules\generators" - -!ELSEIF "$(CFG)" == "mod_status - Win32 Debug" - -"libapr - Win32 Debug" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Debug" - cd "..\..\modules\generators" - -"libapr - Win32 DebugCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\..\modules\generators" - -!ENDIF - -!IF "$(CFG)" == "mod_status - Win32 Release" - -"libhttpd - Win32 Release" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Release" - cd ".\modules\generators" - -"libhttpd - Win32 ReleaseCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Release"\ - RECURSE=1 - cd ".\modules\generators" - -!ELSEIF "$(CFG)" == "mod_status - Win32 Debug" - -"libhttpd - Win32 Debug" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Debug" - cd ".\modules\generators" - -"libhttpd - Win32 DebugCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Debug"\ - RECURSE=1 - cd ".\modules\generators" - -!ENDIF - -SOURCE=.\mod_status.c -DEP_CPP_MOD_S=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.h"\ - "..\..\include\ap_release.h"\ - "..\..\include\http_config.h"\ - "..\..\include\http_core.h"\ - "..\..\include\http_log.h"\ - "..\..\include\http_main.h"\ - "..\..\include\http_protocol.h"\ - "..\..\include\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\scoreboard.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_script.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\server\mpm\winnt\mpm_default.h"\ - "..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\srclib\apr-util\include\apu.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_dso.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_lock.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_portable.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\include\apr_user.h"\ - "..\..\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_S=\ - "..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_status.obj" : $(SOURCE) $(DEP_CPP_MOD_S) "$(INTDIR)" - - - -!ENDIF - diff --git a/modules/generators/mod_suexec.c b/modules/generators/mod_suexec.c deleted file mode 100644 index e902fd2b20..0000000000 --- a/modules/generators/mod_suexec.c +++ /dev/null @@ -1,155 +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_config.h" -#include "http_core.h" -#include "http_request.h" -#include "apr_strings.h" -#include "unixd.h" -#include "mpm_common.h" -#include "mod_suexec.h" - -module AP_MODULE_DECLARE_DATA suexec_module; - -/* - * 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, - const char *uid, const 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(apr_pool_t *p) -{ - ap_hook_get_suexec_identity(get_suexec_id_doer,NULL,NULL,APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA 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 */ - suexec_hooks /* register hooks */ -}; diff --git a/modules/generators/mod_suexec.h b/modules/generators/mod_suexec.h deleted file mode 100644 index 87a77eaa24..0000000000 --- a/modules/generators/mod_suexec.h +++ /dev/null @@ -1,64 +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 "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 65f0cc30cf..0000000000 --- a/modules/http/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -Debug -Release diff --git a/modules/http/.indent.pro b/modules/http/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- 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 167b343d0d..0000000000 --- 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 5fec30cc47..0000000000 --- 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 f5948973ab..0000000000 --- a/modules/http/http_core.c +++ /dev/null @@ -1,324 +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_thread_proc.h" /* for RLIMIT stuff */ - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#define CORE_PRIVATE -#include "httpd.h" -#include "http_config.h" -#include "http_connection.h" -#include "http_protocol.h" /* For index_of_response(). Grump. */ -#include "http_request.h" - -#include "util_filter.h" -#include "util_ebcdic.h" -#include "ap_mpm.h" -#include "scoreboard.h" - -#include "mod_core.h" - -static const char *set_keep_alive_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->keep_alive_timeout = atoi(arg); - return NULL; -} - -static const char *set_keep_alive(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; - } - - /* 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, - 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->keep_alive_max = atoi(arg); - return NULL; -} - -static const command_rec http_cmds[] = { - AP_INIT_TAKE1("KeepAliveTimeout", set_keep_alive_timeout, NULL, RSRC_CONF, - "Keep-Alive timeout duration (sec)"), - AP_INIT_TAKE1("MaxKeepAliveRequests", set_keep_alive_max, NULL, RSRC_CONF, - "Maximum number of Keep-Alive requests per connection, or 0 for infinite"), - AP_INIT_TAKE1("KeepAlive", set_keep_alive, NULL, RSRC_CONF, - "Whether persistent connections should be On or Off"), - { NULL } -}; - -/* - * HTTP/1.1 chunked transfer encoding filter. - */ -static apr_status_t chunk_filter(ap_filter_t *f, apr_bucket_brigade *b) -{ -#define ASCII_CRLF "\015\012" -#define ASCII_ZERO "\060" - apr_bucket_brigade *more = NULL; - apr_bucket *e; - apr_status_t rv; - - for (more = NULL; b; b = more, more = NULL) { - apr_off_t bytes = 0; - apr_bucket *eos = NULL; - char chunk_hdr[20]; /* enough space for the snprintf below */ - - APR_BRIGADE_FOREACH(e, b) { - if (APR_BUCKET_IS_EOS(e)) { - /* there shouldn't be anything after the eos */ - eos = e; - break; - } - else if (e->length == -1) { - /* unknown amount of data (e.g. a pipe) */ - const char *data; - apr_size_t len; - - rv = apr_bucket_read(e, &data, &len, APR_BLOCK_READ); - if (rv != APR_SUCCESS) { - return rv; - } - if (len > 0) { - /* - * There may be a new next bucket representing the - * rest of the data stream on which a read() may - * block so we pass down what we have so far. - */ - bytes += len; - more = apr_brigade_split(b, APR_BUCKET_NEXT(e)); - break; - } - else { - /* If there was nothing in this bucket then we can - * safely move on to the next one without pausing - * to pass down what we have counted up so far. - */ - continue; - } - } - else { - bytes += e->length; - } - } - - /* - * XXX: if there aren't very many bytes at this point it may - * be a good idea to set them aside and return for more, - * unless we haven't finished counting this brigade yet. - */ - - /* if there are content bytes, then wrap them in a chunk */ - if (bytes > 0) { - apr_size_t hdr_len; - - /* - * Insert the chunk header, specifying the number of bytes in - * the chunk. - */ - /* XXX might be nice to have APR_OFF_T_FMT_HEX */ - hdr_len = apr_snprintf(chunk_hdr, sizeof(chunk_hdr), - "%qx" CRLF, (apr_uint64_t)bytes); - ap_xlate_proto_to_ascii(chunk_hdr, hdr_len); - e = apr_bucket_transient_create(chunk_hdr, hdr_len); - APR_BRIGADE_INSERT_HEAD(b, e); - - /* - * Insert the end-of-chunk CRLF before the EOS bucket, or - * appended to the brigade - */ - e = apr_bucket_immortal_create(ASCII_CRLF, 2); - if (eos != NULL) { - APR_BUCKET_INSERT_BEFORE(eos, e); - } - else { - APR_BRIGADE_INSERT_TAIL(b, e); - } - } - - /* RFC 2616, Section 3.6.1 - * - * If there is an EOS bucket, then prefix it with: - * 1) the last-chunk marker ("0" CRLF) - * 2) the trailer - * 3) the end-of-chunked body CRLF - * - * If there is no EOS bucket, then do nothing. - * - * XXX: it would be nice to combine this with the end-of-chunk - * marker above, but this is a bit more straight-forward for - * now. - */ - if (eos != NULL) { - /* XXX: (2) trailers ... does not yet exist */ - e = apr_bucket_immortal_create(ASCII_ZERO ASCII_CRLF /* */ ASCII_CRLF, 5); - APR_BUCKET_INSERT_BEFORE(eos, e); - } - - /* pass the brigade to the next filter. */ - rv = ap_pass_brigade(f->next, b); - if (rv != APR_SUCCESS || eos != NULL) { - return rv; - } - } - - return APR_SUCCESS; -} - -static const char *http_method(const request_rec *r) - { return "http"; } - -static unsigned short http_port(const request_rec *r) - { return DEFAULT_HTTP_PORT; } - -static int ap_pre_http_connection(conn_rec *c) -{ - ap_add_input_filter("HTTP_IN", NULL, NULL, c); - ap_add_input_filter("CORE_IN", NULL, NULL, c); - ap_add_output_filter("CORE", NULL, NULL, c); - return OK; -} - -static int ap_process_http_connection(conn_rec *c) -{ - request_rec *r; - - /* - * Read and process each request found on our connection - * until no requests are left or we decide to close. - */ - - ap_update_child_status(AP_CHILD_THREAD_FROM_ID(c->id), SERVER_BUSY_READ, NULL); - while ((r = ap_read_request(c)) != NULL) { - - /* process the request if it was read without error */ - - ap_update_child_status(AP_CHILD_THREAD_FROM_ID(c->id), SERVER_BUSY_WRITE, NULL); - if (r->status == HTTP_OK) - ap_process_request(r); - - if (ap_extended_status) - ap_increment_counts(AP_CHILD_THREAD_FROM_ID(c->id), r); - - if (!c->keepalive || c->aborted) - break; - - ap_update_child_status(AP_CHILD_THREAD_FROM_ID(c->id), SERVER_BUSY_KEEPALIVE, NULL); - apr_pool_destroy(r->pool); - - if (ap_graceful_stop_signalled()) - break; - } - - return OK; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_pre_connection(ap_pre_http_connection,NULL,NULL, - APR_HOOK_REALLY_LAST); - ap_hook_process_connection(ap_process_http_connection,NULL,NULL, - APR_HOOK_REALLY_LAST); - ap_hook_http_method(http_method,NULL,NULL,APR_HOOK_REALLY_LAST); - ap_hook_default_port(http_port,NULL,NULL,APR_HOOK_REALLY_LAST); - - ap_register_input_filter("HTTP_IN", ap_http_filter, AP_FTYPE_CONNECTION); - ap_register_input_filter("DECHUNK", ap_dechunk_filter, AP_FTYPE_TRANSCODE); - ap_register_output_filter("HTTP_HEADER", ap_http_header_filter, - AP_FTYPE_HTTP_HEADER); - ap_register_output_filter("CHUNK", chunk_filter, AP_FTYPE_TRANSCODE); - ap_register_output_filter("BYTERANGE", ap_byterange_filter, - AP_FTYPE_HTTP_HEADER); -} - -AP_DECLARE_DATA module http_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 */ - http_cmds, /* command apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c deleted file mode 100644 index a4426466be..0000000000 --- a/modules/http/http_protocol.c +++ /dev/null @@ -1,2439 +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" - -#include "mod_core.h" - -#if APR_HAVE_STDARG_H -#include -#endif -#if APR_HAVE_UNISTD_H -#include -#endif - - -AP_DECLARE(int) ap_set_keepalive(request_rec *r) -{ - int ka_sent = 0; - int wimpy = ap_find_token(r->pool, - apr_table_get(r->headers_out, "Connection"), "close"); - const char *conn = apr_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 - || apr_table_get(r->headers_out, "Content-Length") - || ap_find_last_token(r->pool, - apr_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") - && (!apr_table_get(r->subprocess_env, "nokeepalive") - || apr_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) - apr_table_setn(r->headers_out, "Keep-Alive", - apr_psprintf(r->pool, "timeout=%d, max=%d", - r->server->keep_alive_timeout, left)); - else - apr_table_setn(r->headers_out, "Keep-Alive", - apr_psprintf(r->pool, "timeout=%d", - r->server->keep_alive_timeout)); - apr_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) - apr_table_mergen(r->headers_out, "Connection", "close"); - - r->connection->keepalive = 0; - - return 0; -} - -AP_DECLARE(int) ap_meets_conditions(request_rec *r) -{ - const char *etag = apr_table_get(r->headers_out, "ETag"); - const char *if_match, *if_modified_since, *if_unmodified, *if_nonematch; - apr_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; - } - - /* XXX: we should define a "time unset" constant */ - mtime = (r->mtime != 0) ? r->mtime : apr_time_now(); - - /* 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 = apr_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 = apr_table_get(r->headers_in, "If-Unmodified-Since"); - if (if_unmodified != NULL) { - apr_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 = apr_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 (apr_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 (ap_strstr_c(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 = - apr_table_get(r->headers_in, - "If-Modified-Since")) != NULL)) { - apr_time_t ims = ap_parseHTTPdate(if_modified_since); - - if ((ims >= mtime) && (ims <= r->request_time)) { - return HTTP_NOT_MODIFIED; - } - } - return OK; -} - -/* 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. - */ -AP_DECLARE(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; -} - -/* - * Turn a known method number into a name. Doesn't work for - * extension methods, obviously. - */ -AP_DECLARE(const char *) ap_method_name_of(int methnum) -{ - static const char *AP_HTTP_METHODS[METHODS] = { NULL }; - - /* - * This is ugly, but the previous incantation made Windows C - * varf. I'm not even sure it was ANSI C. However, ugly as it - * is, this works, and we only have to do it once. - */ - if (AP_HTTP_METHODS[0] == NULL) { - AP_HTTP_METHODS[M_GET] = "GET"; - AP_HTTP_METHODS[M_PUT] = "PUT"; - AP_HTTP_METHODS[M_POST] = "POST"; - AP_HTTP_METHODS[M_DELETE] = "DELETE"; - AP_HTTP_METHODS[M_CONNECT] = "CONNECT"; - AP_HTTP_METHODS[M_OPTIONS] = "OPTIONS"; - AP_HTTP_METHODS[M_TRACE] = "TRACE"; - AP_HTTP_METHODS[M_PATCH] = "PATCH"; - AP_HTTP_METHODS[M_PROPFIND] = "PROPFIND"; - AP_HTTP_METHODS[M_PROPPATCH] = "PROPPATCH"; - AP_HTTP_METHODS[M_MKCOL] = "MKCOL"; - AP_HTTP_METHODS[M_COPY] = "COPY"; - AP_HTTP_METHODS[M_MOVE] = "MOVE"; - AP_HTTP_METHODS[M_LOCK] = "LOCK"; - AP_HTTP_METHODS[M_UNLOCK] = "UNLOCK"; - AP_HTTP_METHODS[M_INVALID] = NULL; - /* - * Since we're using symbolic names, make sure we only do - * this once by forcing a value into the first slot IFF it's - * still NULL. - */ - if (AP_HTTP_METHODS[0] == NULL) { - AP_HTTP_METHODS[0] = "INVALID"; - } - } - - if ((methnum == M_INVALID) || (methnum >= METHODS)) { - return NULL; - } - return AP_HTTP_METHODS[methnum]; -} - -struct dechunk_ctx { - apr_size_t chunk_size; - apr_size_t bytes_delivered; - enum {WANT_HDR /* must have value zero */, WANT_BODY, WANT_TRL} state; -}; - -static long get_chunk_size(char *); - -apr_status_t ap_dechunk_filter(ap_filter_t *f, apr_bucket_brigade *bb, - ap_input_mode_t mode, apr_size_t *readbytes) -{ - apr_status_t rv; - struct dechunk_ctx *ctx = f->ctx; - apr_bucket *b; - const char *buf; - apr_size_t len; - - if (!ctx) { - f->ctx = ctx = apr_pcalloc(f->r->pool, sizeof(struct dechunk_ctx)); - } - - do { - if (ctx->chunk_size == ctx->bytes_delivered) { - /* Time to read another chunk header or trailer... ap_http_filter() is - * the next filter in line and it knows how to return a brigade with - * one line. - */ - char line[30]; - - if ((rv = ap_getline(line, sizeof(line), f->r, 0)) < 0) { - return rv; - } - switch(ctx->state) { - case WANT_HDR: - ctx->chunk_size = get_chunk_size(line); - ctx->bytes_delivered = 0; - if (ctx->chunk_size == 0) { - ctx->state = WANT_TRL; - } - else { - ctx->state = WANT_BODY; - } - break; - case WANT_TRL: - /* XXX sanity check end chunk here */ - if (strlen(line)) { - /* bad trailer */ - } - if (ctx->chunk_size == 0) { /* we just finished the last chunk? */ - /* append eos bucket and get out */ - b = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(bb, b); - return APR_SUCCESS; - } - ctx->state = WANT_HDR; - break; - default: - ap_assert(ctx->state == WANT_HDR || ctx->state == WANT_TRL); - } - } - } while (ctx->state != WANT_BODY); - - if (ctx->state == WANT_BODY) { - /* Tell ap_http_filter() how many bytes to deliver. */ - apr_size_t readbytes = ctx->chunk_size - ctx->bytes_delivered; - if ((rv = ap_get_brigade(f->next, bb, mode, &readbytes)) != APR_SUCCESS) { - return rv; - } - /* Walk through the body, accounting for bytes, and removing an eos bucket if - * ap_http_filter() delivered the entire chunk. - */ - b = APR_BRIGADE_FIRST(bb); - while (b != APR_BRIGADE_SENTINEL(bb) && !APR_BUCKET_IS_EOS(b)) { - apr_bucket_read(b, &buf, &len, mode); - AP_DEBUG_ASSERT(len <= ctx->chunk_size - ctx->bytes_delivered); - ctx->bytes_delivered += len; - b = APR_BUCKET_NEXT(b); - } - if (ctx->bytes_delivered == ctx->chunk_size) { - AP_DEBUG_ASSERT(APR_BUCKET_IS_EOS(b)); - apr_bucket_delete(b); - ctx->state = WANT_TRL; - } - } - - return APR_SUCCESS; -} - -typedef struct http_filter_ctx { - apr_bucket_brigade *b; -} http_ctx_t; - -apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_size_t *readbytes) -{ - apr_bucket *e; - char *buff; - apr_size_t len; - char *pos; - http_ctx_t *ctx = f->ctx; - apr_status_t rv; - - if (!ctx) { - f->ctx = ctx = apr_pcalloc(f->c->pool, sizeof(*ctx)); - ctx->b = apr_brigade_create(f->c->pool); - } - - if (mode == AP_MODE_PEEK) { - apr_bucket *e; - const char *str; - apr_size_t length; - - /* The purpose of this loop is to ignore any CRLF (or LF) at the end - * of a request. Many browsers send extra lines at the end of POST - * requests. We use the PEEK method to determine if there is more - * data on the socket, so that we know if we should delay sending the - * end of one request until we have served the second request in a - * pipelined situation. We don't want to actually delay sending a - * response if the server finds a CRLF (or LF), becuause that doesn't - * mean that there is another request, just a blank line. - */ - while (1) { - if (APR_BRIGADE_EMPTY(ctx->b)) { - e = NULL; - } - else { - e = APR_BRIGADE_FIRST(ctx->b); - } - if (!e || apr_bucket_read(e, &str, &length, APR_NONBLOCK_READ) != APR_SUCCESS) { - return APR_EOF; - } - else { - const char *c = str; - while (c - str < length) { - if (*c == APR_ASCII_LF) - c++; - else if (*c == APR_ASCII_CR && *(c + 1) == APR_ASCII_LF) - c += 2; - else return APR_SUCCESS; - } - apr_bucket_delete(e); - } - } - } - - if (APR_BRIGADE_EMPTY(ctx->b)) { - if ((rv = ap_get_brigade(f->next, ctx->b, mode, readbytes)) != APR_SUCCESS) { - return rv; - } - } - - if (*readbytes) { - while (!APR_BRIGADE_EMPTY(ctx->b)) { - const char *ignore; - - e = APR_BRIGADE_FIRST(ctx->b); - if ((rv = apr_bucket_read(e, &ignore, &len, mode)) != APR_SUCCESS) { - /* probably APR_IS_EAGAIN(rv); socket state isn't correct; - * remove log once we get this squared away */ - ap_log_error(APLOG_MARK, APLOG_ERR, rv, f->c->base_server, - "apr_bucket_read"); - return rv; - } - - if (len) { - /* note: this can sometimes insert empty buckets into the - * brigade, or the data might come in a few characters at - * a time - don't assume that one call to apr_bucket_read() - * will return the full string. - */ - if (*readbytes < len) { - apr_bucket_split(e, *readbytes); - *readbytes = 0; - } - else { - *readbytes -= len; - } - APR_BUCKET_REMOVE(e); - APR_BRIGADE_INSERT_TAIL(b, e); - break; /* once we've gotten some data, deliver it to caller */ - } - apr_bucket_delete(e); - } - if (*readbytes == 0) { - apr_bucket *eos = apr_bucket_eos_create(); - - APR_BRIGADE_INSERT_TAIL(b, eos); - } - return APR_SUCCESS; - } - - while (!APR_BRIGADE_EMPTY(ctx->b)) { - e = APR_BRIGADE_FIRST(ctx->b); - if ((rv = apr_bucket_read(e, (const char **)&buff, &len, mode)) != APR_SUCCESS) { - return rv; - } - - pos = memchr(buff, APR_ASCII_LF, len); - if (pos != NULL) { - apr_bucket_split(e, pos - buff + 1); - APR_BUCKET_REMOVE(e); - APR_BRIGADE_INSERT_TAIL(b, e); - return APR_SUCCESS; - } - APR_BUCKET_REMOVE(e); - APR_BRIGADE_INSERT_TAIL(b, e); - } - return APR_SUCCESS; -} - -/* 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]; - */ -AP_DECLARE(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 */ -} - -AP_DECLARE(const char *) ap_get_status_line(int status) -{ - return status_lines[ap_index_of_response(status)]; -} - -typedef struct header_struct { - apr_pool_t *pool; - apr_bucket_brigade *bb; -} header_struct; - -/* 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. - */ -static int form_header_field(header_struct *h, - const char *fieldname, const char *fieldval) -{ - char *headfield; - - headfield = apr_pstrcat(h->pool, fieldname, ": ", fieldval, CRLF, NULL); - ap_xlate_proto_to_ascii(headfield, strlen(headfield)); - apr_brigade_puts(h->bb, NULL, NULL, headfield); - return 1; -} - -/* - * Determine the protocol to use for the response. Potentially downgrade - * to HTTP/1.0 in some situations and/or turn off keepalives. - * - * also prepare r->status_line. - */ -static void basic_http_header_check(request_rec *r, - const char **protocol) -{ - if (r->assbackwards) { - /* no such thing as a response protocol */ - return; - } - - if (!r->status_line) - r->status_line = status_lines[ap_index_of_response(r->status)]; - - /* kluge around broken browsers when indicated by force-response-1.0 - */ - if (r->proto_num == HTTP_VERSION(1,0) - && apr_table_get(r->subprocess_env, "force-response-1.0")) { - - *protocol = "HTTP/1.0"; - r->connection->keepalive = -1; - } - else { - *protocol = AP_SERVER_PROTOCOL; - } -} - -/* fill "bb" with a barebones/initial HTTP response header */ -static void basic_http_header(request_rec *r, apr_bucket_brigade *bb, - const char *protocol) -{ - char *date = NULL; - char *tmp; - header_struct h; - - if (r->assbackwards) { - /* there are no headers to send */ - return; - } - - /* Output the HTTP/1.x Status-Line and the Date and Server fields */ - - tmp = apr_pstrcat(r->pool, protocol, " ", r->status_line, CRLF, NULL); - ap_xlate_proto_to_ascii(tmp, strlen(tmp)); - apr_brigade_puts(bb, NULL, NULL, tmp); - - date = apr_palloc(r->pool, APR_RFC822_DATE_LEN); - apr_rfc822_date(date, r->request_time); - - h.pool = r->pool; - h.bb = bb; - form_header_field(&h, "Date", date); - form_header_field(&h, "Server", ap_get_server_version()); - - apr_table_unset(r->headers_out, "Date"); /* Avoid bogosity */ - apr_table_unset(r->headers_out, "Server"); -} - -AP_DECLARE(void) ap_basic_http_header(request_rec *r, apr_bucket_brigade *bb) -{ - const char *protocol; - - basic_http_header_check(r, &protocol); - basic_http_header(r, bb, protocol); -} - -/* 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(apr_bucket_brigade *bb) -{ - char tmp[] = "X-Pad: avoid browser bug" CRLF; - char crlf[] = CRLF; - apr_ssize_t len; - - (void) apr_brigade_length(bb, 1, &len); - - if (len >= 255 && len <= 257) { - ap_xlate_proto_to_ascii(tmp, strlen(tmp)); - apr_brigade_puts(bb, NULL, NULL, tmp); - } - ap_xlate_proto_to_ascii(crlf, strlen(crlf)); - apr_brigade_puts(bb, NULL, NULL, crlf); -} - -/* 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) -{ - char *list; - int mask; - - mask = r->allowed_methods->method_mask; - list = apr_pstrcat(r->pool, - (mask & (1 << M_GET)) ? ", GET, HEAD" : "", - (mask & (1 << M_POST)) ? ", POST" : "", - (mask & (1 << M_PUT)) ? ", PUT" : "", - (mask & (1 << M_DELETE)) ? ", DELETE" : "", - (mask & (1 << M_CONNECT)) ? ", CONNECT" : "", - (mask & (1 << M_OPTIONS)) ? ", OPTIONS" : "", - (mask & (1 << M_PATCH)) ? ", PATCH" : "", - (mask & (1 << M_PROPFIND)) ? ", PROPFIND" : "", - (mask & (1 << M_PROPPATCH)) ? ", PROPPATCH" : "", - (mask & (1 << M_MKCOL)) ? ", MKCOL" : "", - (mask & (1 << M_COPY)) ? ", COPY" : "", - (mask & (1 << M_MOVE)) ? ", MOVE" : "", - (mask & (1 << M_LOCK)) ? ", LOCK" : "", - (mask & (1 << M_UNLOCK)) ? ", UNLOCK" : "", - ", TRACE", - NULL); - if ((mask & (1 << M_INVALID)) - && (r->allowed_methods->method_list != NULL) - && (r->allowed_methods->method_list->nelts != 0)) { - int i; - char **xmethod = (char **) r->allowed_methods->method_list->elts; - - /* - * Append all of the elements of r->allowed_methods->method_list - */ - for (i = 0; i < r->allowed_methods->method_list->nelts; ++i) { - list = apr_pstrcat(r->pool, list, ", ", xmethod[i], NULL); - } - } - /* - * Space past the leading ", ". Wastes two bytes, but that's better - * than futzing around to find the actual length. - */ - return list + 2; -} - -AP_DECLARE(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; - - r->content_type = "message/http"; - - /* Now we recreate the request, and echo it back */ - - ap_rvputs(r, r->the_request, CRLF, NULL); - - apr_table_do((int (*) (void *, const char *, const char *)) - form_header_field, (void *) r, r->headers_in, NULL); - ap_rputs(CRLF, r); - - return OK; -} - -int ap_send_http_options(request_rec *r) -{ - if (r->assbackwards) - return DECLINED; - - apr_table_setn(r->headers_out, "Allow", make_allow(r)); - - /* the request finalization will send an EOS, which will flush all - the headers out (including the Allow header) */ - - return OK; -} - -/* This routine is called by apr_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) -{ - apr_array_header_t *values; - char *start; - char *e; - char **strpp; - int i; - - values = (apr_array_header_t *)d; - - e = apr_pstrdup(values->cont, val); - - do { - /* Find a non-empty fieldname */ - - while (*e == ',' || apr_isspace(*e)) { - ++e; - } - if (*e == '\0') { - break; - } - start = e; - while (*e != '\0' && *e != ',' && !apr_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 **)apr_array_push(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) -{ - apr_array_header_t *varies; - - varies = apr_array_make(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. - */ - apr_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) { - apr_table_setn(r->headers_out, "Vary", - apr_array_pstrcat(r->pool, varies, ',')); - } -} - -AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter( - ap_filter_t *f, - apr_bucket_brigade *b) -{ - int i; - char *date = NULL; - request_rec *r = f->r; - const char *clheader; - const char *protocol; - apr_bucket *e; - apr_bucket_brigade *b2; - header_struct h; - - AP_DEBUG_ASSERT(!r->main); - - APR_BRIGADE_FOREACH(e, b) { - if (e->type == &ap_bucket_type_error) { - ap_bucket_error *eb = e->data; - - ap_die(eb->status, r); - return AP_FILTER_ERROR; - } - } - - if (r->assbackwards) { - r->bytes_sent = 0; - r->sent_bodyct = 1; - ap_remove_output_filter(f); - return ap_pass_brigade(f->next, b); - } - - /* - * 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 (!apr_is_empty_table(r->err_headers_out)) - r->headers_out = apr_table_overlay(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. - * - * Note: the force-response-1.0 should come before the call to - * basic_http_header_check() - */ - if (apr_table_get(r->subprocess_env, "force-no-vary") != NULL) { - apr_table_unset(r->headers_out, "Vary"); - r->proto_num = HTTP_VERSION(1,0); - apr_table_set(r->subprocess_env, "force-response-1.0", "1"); - } - else { - fixup_vary(r); - } - - /* determine the protocol and whether we should use keepalives. */ - basic_http_header_check(r, &protocol); - ap_set_keepalive(r); - - if (r->chunked) { - apr_table_mergen(r->headers_out, "Transfer-Encoding", "chunked"); - apr_table_unset(r->headers_out, "Content-Length"); - - } - - apr_table_setn(r->headers_out, "Content-Type", ap_make_content_type(r, - r->content_type)); - - if (r->content_encoding) { - apr_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) { - apr_table_mergen(r->headers_out, "Content-Language", - ((char **) (r->content_languages->elts))[i]); - } - } - else if (r->content_language) { - apr_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 && !apr_table_get(r->headers_out, "Expires")) { - date = apr_palloc(r->pool, APR_RFC822_DATE_LEN); - apr_rfc822_date(date, r->request_time); - apr_table_addn(r->headers_out, "Expires", date); - } - - /* This is a hack, but I can't find anyway around it. The idea is that - * we don't want to send out 0 Content-Lengths if it is a head request. - * This happens when modules try to outsmart the server, and return - * if they see a HEAD request. Apache 1.3 handlers were supposed to - * just return in that situation, and the core handled the HEAD. In - * 2.0, if a handler returns, then the core sends an EOS bucket down - * the filter stack, and the content-length filter computes a C-L of - * zero and that gets put in the headers, and we end up sending a - * zero C-L to the client. We can't just remove the C-L filter, - * because well behaved 2.0 handlers will send their data down the stack, - * and we will compute a real C-L for the head request. RBB - */ - if (r->header_only && - (clheader = apr_table_get(r->headers_out, "Content-Length")) && - !strcmp(clheader, "0")) { - apr_table_unset(r->headers_out, "Content-Length"); - } - - b2 = apr_brigade_create(r->pool); - basic_http_header(r, b2, protocol); - - h.pool = r->pool; - h.bb = b2; - - if (r->status == HTTP_NOT_MODIFIED) { - apr_table_do((int (*)(void *, const char *, const char *)) form_header_field, - (void *) &h, r->headers_out, - "Connection", - "Keep-Alive", - "ETag", - "Content-Location", - "Expires", - "Cache-Control", - "Vary", - "Warning", - "WWW-Authenticate", - "Proxy-Authenticate", - NULL); - } - else { - apr_table_do((int (*) (void *, const char *, const char *)) form_header_field, - (void *) &h, r->headers_out, NULL); - } - - terminate_header(b2); - - r->sent_bodyct = 1; /* Whatever follows is real body stuff... */ - - ap_pass_brigade(f->next, b2); - - if (r->header_only) { - apr_brigade_destroy(b); - return OK; - } - - if (r->chunked) { - /* We can't add this filter until we have already sent the headers. - * If we add it before this point, then the headers will be chunked - * as well, and that is just wrong. - */ - ap_add_output_filter("CHUNK", NULL, r, r->connection); - } - - /* Don't remove this filter until after we have added the CHUNK filter. - * Otherwise, f->next won't be the CHUNK filter and thus the first - * brigade won't be chunked properly. - */ - ap_remove_output_filter(f); - return ap_pass_brigade(f->next, b); -} - -/* 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. - * - * 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. - */ - -AP_DECLARE(int) ap_setup_client_block(request_rec *r, int read_policy) -{ - const char *tenc = apr_table_get(r->headers_in, "Transfer-Encoding"); - const char *lenp = apr_table_get(r->headers_in, "Content-Length"); - 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, 0, 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, 0, r, - "chunked Transfer-Encoding forbidden: %s", r->uri); - return (lenp) ? HTTP_BAD_REQUEST : HTTP_LENGTH_REQUIRED; - } - - r->read_chunked = 1; - ap_add_input_filter("DECHUNK", NULL, r, r->connection); - } - else if (lenp) { - const char *pos = lenp; - - while (apr_isdigit(*pos) || apr_isspace(*pos)) { - ++pos; - } - if (*pos != '\0') { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, 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, 0, 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, 0, r, - "Request content-length of %s is larger than " - "the configured limit of %lu", lenp, max_body); - return HTTP_REQUEST_ENTITY_TOO_LARGE; - } - -#ifdef AP_DEBUG - { - /* Make sure ap_getline() didn't leave any droppings. */ - core_request_config *req_cfg = - (core_request_config *)ap_get_module_config(r->request_config, - &core_module); - AP_DEBUG_ASSERT(APR_BRIGADE_EMPTY(req_cfg->bb)); - } -#endif - - return OK; -} - -AP_DECLARE(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)) { - char *tmp; - apr_bucket *e; - apr_bucket_brigade *bb; - - /* sending 100 Continue interim response */ - tmp = apr_pstrcat(r->pool, AP_SERVER_PROTOCOL, " ", status_lines[0], - CRLF CRLF, NULL); - bb = apr_brigade_create(r->pool); - e = apr_bucket_pool_create(tmp, strlen(tmp), r->pool); - APR_BRIGADE_INSERT_HEAD(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - - ap_pass_brigade(r->connection->output_filters, bb); - } - - return 1; -} - -static long get_chunk_size(char *b) -{ - long chunksize = 0; - - while (apr_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. - */ -AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz) -{ - apr_size_t len_read, total; - apr_status_t rv; - apr_bucket *b, *old; - const char *tempbuf; - core_request_config *req_cfg = - (core_request_config *)ap_get_module_config(r->request_config, - &core_module); - apr_bucket_brigade *bb = req_cfg->bb; - - do { - if (APR_BRIGADE_EMPTY(bb)) { - if (ap_get_brigade(r->input_filters, bb, AP_MODE_BLOCKING, &r->remaining) != APR_SUCCESS) { - /* if we actually fail here, we want to just return and - * stop trying to read data from the client. - */ - r->connection->keepalive = -1; - apr_brigade_destroy(bb); - return -1; - } - } - b = APR_BRIGADE_FIRST(bb); - } while (APR_BRIGADE_EMPTY(bb)); - - if (APR_BUCKET_IS_EOS(b)) { /* reached eos on previous invocation */ - apr_bucket_delete(b); - return 0; - } - - total = 0; - while (total < bufsiz && b != APR_BRIGADE_SENTINEL(bb) && !APR_BUCKET_IS_EOS(b)) { - if ((rv = apr_bucket_read(b, &tempbuf, &len_read, APR_BLOCK_READ)) != APR_SUCCESS) { - return -1; - } - if (total + len_read > bufsiz) { - apr_bucket_split(b, bufsiz - total); - len_read = bufsiz - total; - } - memcpy(buffer, tempbuf, len_read); - buffer += len_read; - total += len_read; - /* XXX the next two fields shouldn't be mucked with here, as they are in terms - * of bytes in the unfiltered body; gotta see if anybody else actually uses - * these - */ - r->read_length += len_read; /* XXX yank me? */ - r->remaining -= len_read; /* XXX yank me? */ - old = b; - b = APR_BUCKET_NEXT(b); - apr_bucket_delete(old); - } - - return total; -} - -/* 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; - */ -AP_DECLARE(int) ap_discard_request_body(request_rec *r) -{ - int rv; - - if (r->read_length == 0) { /* if not read already */ - if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK))) - 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; - } - - while ((rv = ap_get_client_block(r, dumpbuf, HUGE_STRING_LEN)) > 0) - continue; - - if (rv < 0) - return HTTP_BAD_REQUEST; - } - return OK; -} - -static const char *add_optional_notes(request_rec *r, - const char *prefix, - const char *key, - const char *suffix) -{ - const char *notes, *result; - - if ((notes = apr_table_get(r->notes, key)) == NULL) { - result = prefix; - } - else { - result = apr_pstrcat(r->pool, prefix, notes, suffix, NULL); - } - - return result; -} - -static const char *get_canned_error_string(int status, - request_rec *r, - const char *location) - -/* construct and return the default error message for a given - * HTTP defined error code - */ -{ - apr_pool_t *p = r->pool; - const char *error_notes, *h1, *s1; - - switch (status) { - case HTTP_MOVED_PERMANENTLY: - case HTTP_MOVED_TEMPORARILY: - case HTTP_TEMPORARY_REDIRECT: - return(apr_pstrcat(p, - "The document has moved pool, location), - "\">here.

    \n", - NULL)); - case HTTP_SEE_OTHER: - return(apr_pstrcat(p, - "The answer to your request is located pool, location), - "\">here.

    \n", - NULL)); - case HTTP_USE_PROXY: - return(apr_pstrcat(p, - "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)); - case HTTP_PROXY_AUTHENTICATION_REQUIRED: - case HTTP_UNAUTHORIZED: - return("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"); - case HTTP_BAD_REQUEST: - return(add_optional_notes(r, - "Your browser sent a request that " - "this server could not understand.

    \n", - "error-notes", - "

    \n")); - case HTTP_FORBIDDEN: - return(apr_pstrcat(p, - "You don't have permission to access ", - ap_escape_html(r->pool, r->uri), - "\non this server.

    \n", - NULL)); - case HTTP_NOT_FOUND: - return(apr_pstrcat(p, - "The requested URL ", - ap_escape_html(r->pool, r->uri), - " was not found on this server.

    \n", - NULL)); - case HTTP_METHOD_NOT_ALLOWED: - return(apr_pstrcat(p, - "The requested method ", r->method, - " is not allowed for the URL ", - ap_escape_html(r->pool, r->uri), - ".

    \n", - NULL)); - case HTTP_NOT_ACCEPTABLE: - s1 = apr_pstrcat(p, - "An appropriate representation of the " - "requested resource ", - ap_escape_html(r->pool, r->uri), - " could not be found on this server.

    \n", - NULL); - return(add_optional_notes(r, s1, "variant-list", "")); - case HTTP_MULTIPLE_CHOICES: - return(add_optional_notes(r, "", "variant-list", "")); - case HTTP_LENGTH_REQUIRED: - s1 = apr_pstrcat(p, - "A request of the requested method ", - r->method, - " requires a valid Content-length.

    \n", - NULL); - return(add_optional_notes(r, s1, "error-notes", "

    \n")); - case HTTP_PRECONDITION_FAILED: - return(apr_pstrcat(p, - "The precondition on the request for the URL ", - ap_escape_html(r->pool, r->uri), - " evaluated to false.

    \n", - NULL)); - case HTTP_NOT_IMPLEMENTED: - s1 = apr_pstrcat(p, - ap_escape_html(r->pool, r->method), " to ", - ap_escape_html(r->pool, r->uri), - " not supported.

    \n", - NULL); - return(add_optional_notes(r, s1, "error-notes", "

    \n")); - case HTTP_BAD_GATEWAY: - s1 = "The proxy server received an invalid" CRLF - "response from an upstream server.

    " CRLF; - return(add_optional_notes(r, s1, "error-notes", "

    \n")); - case HTTP_VARIANT_ALSO_VARIES: - return(apr_pstrcat(p, - "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)); - case HTTP_REQUEST_TIME_OUT: - return("I'm tired of waiting for your request.\n"); - case HTTP_GONE: - return(apr_pstrcat(p, - "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)); - case HTTP_REQUEST_ENTITY_TOO_LARGE: - return(apr_pstrcat(p, - "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)); - case HTTP_REQUEST_URI_TOO_LARGE: - s1 = "The requested URL's length exceeds the capacity\n" - "limit for this server.

    \n"; - return(add_optional_notes(r, s1, "error-notes", "

    \n")); - case HTTP_UNSUPPORTED_MEDIA_TYPE: - return("The supplied request data is not in a format\n" - "acceptable for processing by this resource.\n"); - case HTTP_RANGE_NOT_SATISFIABLE: - return("None of the range-specifier values in the Range\n" - "request-header field overlap the current extent\n" - "of the selected resource.\n"); - case HTTP_EXPECTATION_FAILED: - return(apr_pstrcat(p, - "The expectation given in the Expect request-header" - "\nfield could not be met by this server.

    \n" - "The client sent

    \n    Expect: ",
    -	                       apr_table_get(r->headers_in, "Expect"), "\n
    \n" - "but we only allow the 100-continue expectation.\n", - NULL)); - case HTTP_UNPROCESSABLE_ENTITY: - return("The server understands the media type of the\n" - "request entity, but was unable to process the\n" - "contained instructions.\n"); - case HTTP_LOCKED: - return("The requested resource is currently locked.\n" - "The lock must be released or proper identification\n" - "given before the method can be applied.\n"); - case HTTP_FAILED_DEPENDENCY: - return("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"); - case HTTP_INSUFFICIENT_STORAGE: - return("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"); - case HTTP_SERVICE_UNAVAILABLE: - return("The server is temporarily unable to service your\n" - "request due to maintenance downtime or capacity\n" - "problems. Please try again later.\n"); - case HTTP_GATEWAY_TIME_OUT: - return("The proxy server did not receive a timely response\n" - "from the upstream server.\n"); - case HTTP_NOT_EXTENDED: - return("A mandatory extension policy in the request is not\n" - "accepted by the server for this resource.\n"); - 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 = apr_table_get(r->notes, "error-notes")) != NULL) - && (h1 = apr_table_get(r->notes, "verbose-error-to")) != NULL - && (strcmp(h1, "*") == 0)) { - return(apr_pstrcat(p, error_notes, "

    \n", NULL)); - } - else { - return(apr_pstrcat(p, - "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 - e 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 = apr_table_get(r->notes, "error-notes")) != NULL) { - * return(apr_pstrcat(p, error_notes, "

    \n", NULL); - * } - * else { - * return ""; - * } - */ - } -} - -static void reset_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; - } - } -} - -/* 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. - */ -AP_DECLARE(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 = apr_table_get(r->headers_out, "Location"); - - /* At this point, we are starting the response over, so we have to reset - * this value. - */ - r->eos_sent = 0; - reset_filters(r); - - /* - * 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 = apr_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) { - ap_finalize_request_protocol(r); - return; - } - - if (status == HTTP_NO_CONTENT) { - ap_finalize_request_protocol(r); - return; - } - - if (!r->assbackwards) { - apr_table_t *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; - apr_table_clear(r->err_headers_out); - - if (ap_is_HTTP_REDIRECT(status) || (status == HTTP_CREATED)) { - if ((location != NULL) && *location) { - apr_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; charset=iso-8859-1"; - - if ((status == HTTP_METHOD_NOT_ALLOWED) - || (status == HTTP_NOT_IMPLEMENTED)) { - apr_table_setn(r->headers_out, "Allow", make_allow(r)); - } - - if (r->header_only) { - ap_finalize_request_protocol(r); - return; - } - } - - 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_finalize_request_protocol(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; - - /* XXX This is a major hack that should be fixed cleanly. The - * problem is that we have the information we need in a previous - * request, but the text of the page must be sent down the last - * request_rec's filter stack. rbb - */ - request_rec *rlast = r; - while (rlast->next) { - rlast = rlast->next; - } - - /* 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 */ - && apr_isdigit(r->status_line[0]) - && apr_isdigit(r->status_line[1]) - && apr_isdigit(r->status_line[2]) - && apr_isspace(r->status_line[3]) - && apr_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]; - - /* can't count on a charset filter being in place here, - * so do ebcdic->ascii translation explicitly (if needed) - */ - - ap_rvputs_proto_in_ascii(rlast, - DOCTYPE_HTML_2_0 - "\n", title, - "\n\n

    ", h1, "

    \n", - NULL); - - ap_rvputs_proto_in_ascii(rlast, - get_canned_error_string(status, r, location), - NULL); - - if (recursive_error) { - ap_rvputs_proto_in_ascii(rlast, "

    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_rvputs_proto_in_ascii(rlast, ap_psignature("


    \n", r), NULL); - ap_rvputs_proto_in_ascii(rlast, "\n", NULL); - } - ap_finalize_request_protocol(r); -} - -/* - * Create a new method list with the specified number of preallocated - * extension slots. - */ -AP_DECLARE(ap_method_list_t *) ap_make_method_list(apr_pool_t *p, int nelts) -{ - ap_method_list_t *ml; - - ml = (ap_method_list_t *) apr_palloc(p, sizeof(ap_method_list_t)); - ml->method_mask = 0; - ml->method_list = apr_array_make(p, sizeof(char *), nelts); - return ml; -} - -/* - * Make a copy of a method list (primarily for subrequests that may - * subsequently change it; don't want them changing the parent's, too!). - */ -AP_DECLARE(void) ap_copy_method_list(ap_method_list_t *dest, - ap_method_list_t *src) -{ - int i; - char **imethods; - char **omethods; - - dest->method_mask = src->method_mask; - imethods = (char **) src->method_list->elts; - for (i = 0; i < src->method_list->nelts; ++i) { - omethods = (char **) apr_array_push(dest->method_list); - *omethods = apr_pstrdup(dest->method_list->cont, imethods[i]); - } -} - -/* - * Invoke a callback routine for each method in the specified list. - */ -AP_DECLARE_NONSTD(void) ap_method_list_do(int (*comp) (void *urec, const char *mname, - int mnum), - void *rec, - const ap_method_list_t *ml, ...) -{ - va_list vp; - va_start(vp, ml); - ap_method_list_vdo(comp, rec, ml, vp); - va_end(vp); -} - -AP_DECLARE(void) ap_method_list_vdo(int (*comp) (void *mrec, - const char *mname, - int mnum), - void *rec, const ap_method_list_t *ml, - va_list vp) -{ - -} - -/* - * Return true if the specified HTTP method is in the provided - * method list. - */ -AP_DECLARE(int) ap_method_in_list(ap_method_list_t *l, const char *method) -{ - int methnum; - int i; - char **methods; - - /* - * If it's one of our known methods, use the shortcut and check the - * bitmask. - */ - methnum = ap_method_number_of(method); - if (methnum != M_INVALID) { - return (l->method_mask & (1 << methnum)); - } - /* - * Otherwise, see if the method name is in the array or string names - */ - if ((l->method_list == NULL) || (l->method_list->nelts == 0)) { - return 0; - } - methods = (char **)l->method_list->elts; - for (i = 0; i < l->method_list->nelts; ++i) { - if (strcmp(method, methods[i]) == 0) { - return 1; - } - } - return 0; -} - -/* - * Add the specified method to a method list (if it isn't already there). - */ -AP_DECLARE(void) ap_method_list_add(ap_method_list_t *l, const char *method) -{ - int methnum; - int i; - const char **xmethod; - char **methods; - - /* - * If it's one of our known methods, use the shortcut and use the - * bitmask. - */ - methnum = ap_method_number_of(method); - l->method_mask |= (1 << methnum); - if (methnum != M_INVALID) { - return; - } - /* - * Otherwise, see if the method name is in the array of string names. - */ - if (l->method_list->nelts != 0) { - methods = (char **)l->method_list->elts; - for (i = 0; i < l->method_list->nelts; ++i) { - if (strcmp(method, methods[i]) == 0) { - return; - } - } - } - xmethod = (const char **) apr_array_push(l->method_list); - *xmethod = method; -} - -/* - * Remove the specified method from a method list. - */ -AP_DECLARE(void) ap_method_list_remove(ap_method_list_t *l, - const char *method) -{ - int methnum; - char **methods; - - /* - * If it's one of our known methods, use the shortcut and use the - * bitmask. - */ - methnum = ap_method_number_of(method); - l->method_mask |= ~(1 << methnum); - if (methnum != M_INVALID) { - return; - } - /* - * Otherwise, see if the method name is in the array of string names. - */ - if (l->method_list->nelts != 0) { - register int i, j, k; - methods = (char **)l->method_list->elts; - for (i = 0; i < l->method_list->nelts; ) { - if (strcmp(method, methods[i]) == 0) { - for (j = i, k = i + 1; k < l->method_list->nelts; ++j, ++k) { - methods[j] = methods[k]; - } - --l->method_list->nelts; - } - else { - ++i; - } - } - } -} - -/* - * Reset a method list to be completely empty. - */ -AP_DECLARE(void) ap_clear_method_list(ap_method_list_t *l) -{ - l->method_mask = 0; - l->method_list->nelts = 0; -} - -/* - * 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); -} - -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); -} - -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; - - /* is content already a single range? */ - if (apr_table_get(r->headers_out, "Content-Range")) { - return 0; - } - - /* is content already a multiple range? */ - if ((ct = apr_table_get(r->headers_out, "Content-Type")) && - (!strncasecmp(ct, "multipart/byteranges", 20) || - !strncasecmp(ct, "multipart/x-byteranges", 22))) { - 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; -} - diff --git a/modules/http/http_request.c b/modules/http/http_request.c deleted file mode 100644 index 56064c451b..0000000000 --- a/modules/http/http_request.c +++ /dev/null @@ -1,574 +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 - -/***************************************************************** - * - * Mainline request processing... - */ - -AP_DECLARE(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 == AP_FILTER_ERROR) { - return; - } - - 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 (HTTP_UNAUTHORIZED == r->status && PROXYREQ_PROXY == 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 = HTTP_MOVED_TEMPORARILY; - apr_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 HTTP_NOT_MODIFIED for - * error documents! */ - /* - * This redirect needs to be a GET no matter what the original - * method was. - */ - apr_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 = apr_table_get(r->notes, "error-notes")) != NULL) { - apr_table_setn(r->subprocess_env, "ERROR_NOTES", error_notes); - } - r->method = apr_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 = HTTP_INTERNAL_SERVER_ERROR; - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, 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, 0, r, - "configuration error: couldn't %s: %s", phase, r->uri); - ap_die(HTTP_INTERNAL_SERVER_ERROR, r); - } - else - ap_die(status, r); -} - -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_run_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) && apr_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_run_header_parser(r))) { - ap_die(access_status, r); - return; - } - - switch (ap_satisfies(r)) { - case SATISFY_ALL: - case SATISFY_NOSPEC: - if ((access_status = ap_run_access_checker(r)) != 0) { - decl_die(access_status, "check access", r); - return; - } - if (ap_some_auth_required(r)) { - if (((access_status = ap_run_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_run_auth_checker(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_run_access_checker(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_run_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_run_auth_checker(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_run_type_checker(r)) != 0) { - decl_die(access_status, "find types", r); - return; - } - } - - if ((access_status = ap_run_fixups(r)) != 0) { - ap_die(access_status, r); - return; - } - - /* The new insert_filter stage makes sense here IMHO. We are sure that - * we are going to run the request now, so we may as well insert filters - * if any are available. Since the goal of this phase is to allow all - * modules to insert a filter if they want to, this filter returns - * void. I just can't see any way that this filter can reasonably - * fail, either your modules inserts something or it doesn't. rbb - */ - ap_run_insert_filter(r); - - 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); -} - -static void check_pipeline_flush(request_rec *r) -{ - /* ### if would be nice if we could PEEK without a brigade. that would - ### allow us to defer creation of the brigade to when we actually - ### need to send a FLUSH. */ - apr_bucket_brigade *bb = apr_brigade_create(r->pool); - apr_size_t zero = 0; - - /* Flush the filter contents if: - * - * 1) the connection will be closed - * 2) there isn't a request ready to be read - */ - /* ### shouldn't this read from the connection input filters? */ - if (!r->connection->keepalive || - ap_get_brigade(r->input_filters, bb, AP_MODE_PEEK, &zero) != APR_SUCCESS) { - apr_bucket *e = apr_bucket_flush_create(); - - /* We just send directly to the connection based filters. At - * this point, we know that we have seen all of the data - * (request finalization sent an EOS bucket, which empties all - * of the request filters). We just want to flush the buckets - * if something hasn't been sent to the network yet. - */ - APR_BRIGADE_INSERT_HEAD(bb, e); - ap_pass_brigade(r->connection->output_filters, bb); - } -} - -void ap_process_request(request_rec *r) -{ - int access_status; - - /* Give quick handlers a shot at serving the request on the fast - * path, bypassing all of the other Apache hooks. - * - * This hook was added to enable serving files out of a URI keyed - * content cache ( e.g., Mike Abbott's Quick Shortcut Cache, - * described here: http://oss.sgi.com/projects/apache/mod_qsc.html ) - * - * It may have other uses as well, such as routing requests directly to - * content handlers that have the ability to grok HTTP and do their - * own access checking, etc (e.g. servlet engines). - * - * Use this hook with extreme care and only if you know what you are - * doing. - * - * Consider moving this hook to after the first location_walk in order - * to enable the quick handler to make decisions based on config - * directives in Location blocks. - */ - access_status = ap_run_quick_handler(r); - if (access_status == OK) { - ap_finalize_request_protocol(r); - } - else if (access_status == DECLINED) { - process_request_internal(r); - } - else { - ap_die(access_status, 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. - */ - check_pipeline_flush(r); - ap_run_log_transaction(r); -} - -static apr_table_t *rename_original_env(apr_pool_t *p, apr_table_t *t) -{ - apr_array_header_t *env_arr = apr_table_elts(t); - apr_table_entry_t *elts = (apr_table_entry_t *) env_arr->elts; - apr_table_t *new = apr_table_make(p, env_arr->nalloc); - int i; - - for (i = 0; i < env_arr->nelts; ++i) { - if (!elts[i].key) - continue; - apr_table_setn(new, apr_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 *) apr_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; - new->allowed_methods = ap_make_method_list(new->pool, 2); - 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; - - /* Must have prev and next pointers set before calling create_request - * hook. - */ - ap_run_create_request(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 = apr_table_make(r->pool, 12); - new->err_headers_out = r->err_headers_out; - new->subprocess_env = rename_original_env(r->pool, r->subprocess_env); - new->notes = apr_table_make(r->pool, 5); - new->allowed_methods = ap_make_method_list(new->pool, 2); - - 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; - - new->output_filters = r->connection->output_filters; - new->input_filters = r->connection->input_filters; - - ap_add_output_filter("BYTERANGE", NULL, new, new->connection); - ap_add_output_filter("CONTENT_LENGTH", NULL, new, new->connection); - ap_add_output_filter("HTTP_HEADER", NULL, new, new->connection); - - apr_table_setn(new->subprocess_env, "REDIRECT_STATUS", - apr_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; -} - -AP_DECLARE(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. - */ -AP_DECLARE(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); -} - -AP_DECLARE(void) ap_allow_methods(request_rec *r, int reset, ...) -{ - const char *method; - va_list methods; - - /* - * Get rid of any current settings if requested; not just the - * well-known methods but any extensions as well. - */ - if (reset) { - ap_clear_method_list(r->allowed_methods); - } - - va_start(methods, reset); - while ((method = va_arg(methods, const char *)) != NULL) { - ap_method_list_add(r->allowed_methods, method); - } -} diff --git a/modules/http/mod_core.h b/modules/http/mod_core.h deleted file mode 100644 index 29fef07b65..0000000000 --- a/modules/http/mod_core.h +++ /dev/null @@ -1,99 +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_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 (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_size_t *readbytes); -apr_status_t ap_dechunk_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_size_t *readbytes); - -char *ap_response_code_string(request_rec *r, int error_index); - -/** - * Send the minimal part of an HTTP response header. - * @param r The current request - * @param bb The brigade to add the header to. - * @warning Modules should be very careful about using this, and should - * the default behavior. Much of the HTTP/1.1 implementation - * correctness depends on the full headers. - * @deffunc void ap_basic_http_header(request_rec *r, apr_bucket_brigade *bb) - */ -AP_DECLARE(void) ap_basic_http_header(request_rec *r, apr_bucket_brigade *bb); - -AP_DECLARE(int) ap_send_http_trace(request_rec *r); -int ap_send_http_options(request_rec *r); - -#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 bbeee8fe3d..0000000000 --- a/modules/http/mod_mime.c +++ /dev/null @@ -1,823 +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_mime.c: Sends/gets MIME headers for requests - * - * Rob McCool - * - */ - -#include "apr.h" -#include "apr_strings.h" -#include "apr_lib.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" -#include "http_request.h" - - -/* XXXX - fix me / EBCDIC - * there was a cludge here which would use its - * own version apr_isascii(). Indicating that - * on some platforms that might be needed. - * - * #define OS_ASC(c) (c) -- for mere mortals - * or - * #define OS_ASC(c) (ebcdic2ascii[c]) -- for dino's - * - * #define apr_isascii(c) ((OS_ASC(c) & 0x80) == 0) - */ - -/* XXXXX - fix me - See note with NOT_PROXY - */ - -typedef struct attrib_info { - char *name; -} attrib_info; - -typedef struct { - apr_table_t *forced_types; /* Additional AddTyped stuff */ - apr_table_t *encoding_types; /* Added with AddEncoding... */ - apr_table_t *language_types; /* Added with AddLanguage... */ - apr_table_t *handlers; /* Added with AddHandler... */ - apr_table_t *charset_types; /* Added with AddCharset... */ - apr_array_header_t *handlers_remove; /* List of handlers to remove */ - apr_array_header_t *types_remove; /* List of MIME types to remove */ - apr_array_header_t *encodings_remove; /* List of encodings to remove */ - - char *type; /* Type forced with ForceType */ - char *handler; /* Handler forced with SetHandler */ - char *default_language; /* Language if no AddLanguage ext found */ - /* Due to the FUD about JS and charsets - * default_charset is actually in src/main */ -} mime_dir_config; - -typedef struct param_s { - char *attr; - char *val; - struct param_s *next; -} param; - -typedef struct { - char *type; - char *subtype; - param *param; -} content_type; - -static char tspecial[] = { - '(', ')', '<', '>', '@', ',', ';', ':', - '\\', '"', '/', '[', ']', '?', '=', - '\0' -}; - -module AP_MODULE_DECLARE_DATA mime_module; - -static void *create_mime_dir_config(apr_pool_t *p, char *dummy) -{ - mime_dir_config *new = - (mime_dir_config *) apr_palloc(p, sizeof(mime_dir_config)); - - new->forced_types = apr_table_make(p, 4); - new->encoding_types = apr_table_make(p, 4); - new->charset_types = apr_table_make(p, 4); - new->language_types = apr_table_make(p, 4); - new->handlers = apr_table_make(p, 4); - new->handlers_remove = apr_array_make(p, 4, sizeof(attrib_info)); - new->types_remove = apr_array_make(p, 4, sizeof(attrib_info)); - new->encodings_remove = apr_array_make(p, 4, sizeof(attrib_info)); - - new->type = NULL; - new->handler = NULL; - new->default_language = NULL; - - return new; -} - -static void *merge_mime_dir_configs(apr_pool_t *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 *) apr_palloc(p, sizeof(mime_dir_config)); - int i; - attrib_info *suffix; - - new->forced_types = apr_table_overlay(p, add->forced_types, - base->forced_types); - new->encoding_types = apr_table_overlay(p, add->encoding_types, - base->encoding_types); - new->charset_types = apr_table_overlay(p, add->charset_types, - base->charset_types); - new->language_types = apr_table_overlay(p, add->language_types, - base->language_types); - new->handlers = apr_table_overlay(p, add->handlers, - base->handlers); - - suffix = (attrib_info *) add->handlers_remove->elts; - for (i = 0; i < add->handlers_remove->nelts; i++) { - apr_table_unset(new->handlers, suffix[i].name); - } - - suffix = (attrib_info *) add->types_remove->elts; - for (i = 0; i < add->types_remove->nelts; i++) { - apr_table_unset(new->forced_types, suffix[i].name); - } - - suffix = (attrib_info *) add->encodings_remove->elts; - for (i = 0; i < add->encodings_remove->nelts; i++) { - apr_table_unset(new->encoding_types, suffix[i].name); - } - - - 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, void *m_, const char *ct_, - const char *ext) -{ - mime_dir_config *m=m_; - char *ct=apr_pstrdup(cmd->pool,ct_); - - if (*ext == '.') - ++ext; - - ap_str_tolower(ct); - apr_table_setn(m->forced_types, ext, ct); - return NULL; -} - -static const char *add_encoding(cmd_parms *cmd, void *m_, const char *enc_, - const char *ext) -{ - mime_dir_config *m=m_; - char *enc=apr_pstrdup(cmd->pool,enc_); - - if (*ext == '.') - ++ext; - ap_str_tolower(enc); - apr_table_setn(m->encoding_types, ext, enc); - return NULL; -} - -static const char *add_charset(cmd_parms *cmd, void *m_, const char *charset_, - const char *ext) -{ - mime_dir_config *m=m_; - char *charset=apr_pstrdup(cmd->pool,charset_); - - if (*ext == '.') { - ++ext; - } - ap_str_tolower(charset); - apr_table_setn(m->charset_types, ext, charset); - return NULL; -} - -static const char *add_language(cmd_parms *cmd, void *m_, const char *lang_, - const char *ext) -{ - mime_dir_config *m=m_; - char *lang=apr_pstrdup(cmd->pool,lang_); - - if (*ext == '.') { - ++ext; - } - ap_str_tolower(lang); - apr_table_setn(m->language_types, ext, lang); - return NULL; -} - -static const char *add_handler(cmd_parms *cmd, void *m_, const char *hdlr_, - const char *ext) -{ - mime_dir_config *m=m_; - char *hdlr=apr_pstrdup(cmd->pool,hdlr_); - - if (*ext == '.') - ++ext; - ap_str_tolower(hdlr); - apr_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, const char *ext) -{ - mime_dir_config *mcfg = (mime_dir_config *) m; - attrib_info *suffix; - - if (*ext == '.') { - ++ext; - } - suffix = (attrib_info *) apr_array_push(mcfg->handlers_remove); - suffix->name = apr_pstrdup(cmd->pool, ext); - return NULL; -} - -/* - * Just like the previous function, except that it records encoding - * associations to be undone. - */ -static const char *remove_encoding(cmd_parms *cmd, void *m, const char *ext) -{ - mime_dir_config *mcfg = (mime_dir_config *) m; - attrib_info *suffix; - - if (*ext == '.') { - ++ext; - } - suffix = (attrib_info *) apr_array_push(mcfg->encodings_remove); - suffix->name = apr_pstrdup(cmd->pool, ext); - return NULL; -} - -/* - * Similar to the previous functions, except that it deals with filename - * suffix/MIME-type associations. - */ -static const char *remove_type(cmd_parms *cmd, void *m, const char *ext) -{ - mime_dir_config *mcfg = (mime_dir_config *) m; - attrib_info *suffix; - - if (*ext == '.') { - ++ext; - } - suffix = (attrib_info *) apr_array_push(mcfg->types_remove); - suffix->name = apr_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, - const char *arg) -{ - ap_set_module_config(cmd->server->module_config, &mime_module, - (void *)arg); - return NULL; -} - -static const command_rec mime_cmds[] = -{ -AP_INIT_ITERATE2("AddType", add_type, NULL, OR_FILEINFO, - "a mime type followed by one or more file extensions"), -AP_INIT_ITERATE2("AddEncoding", add_encoding, NULL, OR_FILEINFO, - "an encoding (e.g., gzip), followed by one or more file extensions"), -AP_INIT_ITERATE2("AddCharset", add_charset, NULL, OR_FILEINFO, - "a charset (e.g., iso-2022-jp), followed by one or more file extensions"), -AP_INIT_ITERATE2("AddLanguage", add_language, NULL, OR_FILEINFO, - "a language (e.g., fr), followed by one or more file extensions"), -AP_INIT_ITERATE2("AddHandler", add_handler, NULL, OR_FILEINFO, - "a handler name followed by one or more file extensions"), -AP_INIT_TAKE1("ForceType", ap_set_string_slot_lower, - (void *)XtOffsetOf(mime_dir_config, type), OR_FILEINFO, - "a media type"), -AP_INIT_ITERATE("RemoveHandler", remove_handler, NULL, OR_FILEINFO, - "one or more file extensions"), -AP_INIT_ITERATE("RemoveEncoding", remove_encoding, NULL, OR_FILEINFO, - "one or more file extensions"), -AP_INIT_ITERATE("RemoveType", remove_type, NULL, OR_FILEINFO, - "one or more file extensions"), -AP_INIT_TAKE1("SetHandler", ap_set_string_slot_lower, - (void *)XtOffsetOf(mime_dir_config, handler), OR_FILEINFO, - "a handler name"), -AP_INIT_TAKE1("TypesConfig", set_types_config, NULL, RSRC_CONF, - "the MIME types config file"), -AP_INIT_TAKE1("DefaultLanguage", ap_set_string_slot, - (void*)XtOffsetOf(mime_dir_config, default_language), OR_FILEINFO, - "language to use for documents with no other language file extension"), - {NULL} -}; - -/* Hash apr_table_t --- only one of these per daemon; virtual hosts can - * get private versions through AddType... - */ - -#define MIME_HASHSIZE (32) -#define hash(i) (apr_tolower(i) % MIME_HASHSIZE) - -static apr_table_t *hash_buckets[MIME_HASHSIZE]; - -static void mime_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) -{ - ap_configfile_t *f; - char l[MAX_STRING_LEN]; - int x; - const char *types_confname = ap_get_module_config(s->module_config, &mime_module); - apr_status_t status; - - if (!types_confname) - types_confname = AP_TYPES_CONFIG_FILE; - - types_confname = ap_server_root_relative(p, types_confname); - - if ((status = ap_pcfg_openfile(&f, p, types_confname)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, status, s, - "could not open mime types config file %s.", types_confname); - exit(1); - } - - for (x = 0; x < MIME_HASHSIZE; x++) - hash_buckets[x] = apr_table_make(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); /* ??? */ - apr_table_setn(hash_buckets[hash(ext[0])], ext, ct); - } - } - ap_cfg_closefile(f); -} - -static char *zap_sp(char *s) -{ - char *tp; - - if (s == NULL) { - return (NULL); - } - if (*s == '\0') { - return (s); - } - - /* delete prefixed white space */ - for (; *s == ' ' || *s == '\t' || *s == '\n'; s++); - - /* delete postfixed white space */ - for (tp = s; *tp != '\0'; tp++); - for (tp--; tp != s && (*tp == ' ' || *tp == '\t' || *tp == '\n'); tp--) { - *tp = '\0'; - } - return (s); -} - -static int is_token(char c) -{ - int res; - - res = (apr_isascii(c) && apr_isgraph(c) - && (strchr(tspecial, c) == NULL)) ? 1 : -1; - return res; -} - -static int is_qtext(char c) -{ - int res; - - res = (apr_isascii(c) && (c != '"') && (c != '\\') && (c != '\n')) - ? 1 : -1; - return res; -} - -static int is_quoted_pair(char *s) -{ - int res = -1; - int c; - - if (((s + 1) != NULL) && (*s == '\\')) { - c = (int) *(s + 1); - if (apr_isascii(c)) { - res = 1; - } - } - return (res); -} - -static content_type *analyze_ct(request_rec *r, char *s) -{ - char *tp, *mp, *cp; - char *attribute, *value; - int quoted = 0; - server_rec * ss = r->server; - apr_pool_t * p = r->pool; - - content_type *ctp; - param *pp, *npp; - - /* initialize ctp */ - ctp = (content_type *) apr_palloc(p, sizeof(content_type)); - ctp->type = NULL; - ctp->subtype = NULL; - ctp->param = NULL; - - tp = apr_pstrdup(p, s); - - mp = tp; - cp = mp; - - /* getting a type */ - if (!(cp = strchr(mp, '/'))) { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ss, - "mod_mime: analyze_ct: cannot get media type from '%s'", - (const char *) mp); - return (NULL); - } - ctp->type = apr_pstrndup(p, mp, cp - mp); - ctp->type = zap_sp(ctp->type); - if (ctp->type == NULL || *(ctp->type) == '\0' || - strchr(ctp->type, ';') || strchr(ctp->type, ' ') || - strchr(ctp->type, '\t')) { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ss, - "Cannot get media subtype."); - return (NULL); - } - - /* getting a subtype */ - cp++; - mp = cp; - - for (; *cp != ';' && *cp != '\0'; cp++) - continue; - ctp->subtype = apr_pstrndup(p, mp, cp - mp); - ctp->subtype = zap_sp(ctp->subtype); - if ((ctp->subtype == NULL) || (*(ctp->subtype) == '\0') || - strchr(ctp->subtype, ' ') || strchr(ctp->subtype, '\t')) { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ss, - "Cannot get media subtype."); - return (NULL); - } - cp = zap_sp(cp); - if (cp == NULL || *cp == '\0') { - return (ctp); - } - - /* getting parameters */ - cp++; - cp = zap_sp(cp); - if (cp == NULL || *cp == '\0') { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ss, - "Cannot get media parameter."); - return (NULL); - } - mp = cp; - attribute = NULL; - value = NULL; - - while (cp != NULL && *cp != '\0') { - if (attribute == NULL) { - if (is_token(*cp) > 0) { - cp++; - continue; - } - else if (*cp == ' ' || *cp == '\t' || *cp == '\n') { - cp++; - continue; - } - else if (*cp == '=') { - attribute = apr_pstrndup(p, mp, cp - mp); - attribute = zap_sp(attribute); - if (attribute == NULL || *attribute == '\0') { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ss, - "Cannot get media parameter."); - return (NULL); - } - cp++; - cp = zap_sp(cp); - if (cp == NULL || *cp == '\0') { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ss, - "Cannot get media parameter."); - return (NULL); - } - mp = cp; - continue; - } - else { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ss, - "Cannot get media parameter."); - return (NULL); - } - } - else { - if (mp == cp) { - if (*cp == '"') { - quoted = 1; - cp++; - } - else { - quoted = 0; - } - } - if (quoted > 0) { - while (quoted && *cp != '\0') { - if (is_qtext(*cp) > 0) { - cp++; - } - else if (is_quoted_pair(cp) > 0) { - cp += 2; - } - else if (*cp == '"') { - cp++; - while (*cp == ' ' || *cp == '\t' || *cp == '\n') { - cp++; - } - if (*cp != ';' && *cp != '\0') { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ss, - "Cannot get media parameter."); - return(NULL); - } - quoted = 0; - } - else { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ss, - "Cannot get media parameter."); - return (NULL); - } - } - } - else { - while (1) { - if (is_token(*cp) > 0) { - cp++; - } - else if (*cp == '\0' || *cp == ';') { - break; - } - else { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ss, - "Cannot get media parameter."); - return (NULL); - } - } - } - value = apr_pstrndup(p, mp, cp - mp); - value = zap_sp(value); - if (value == NULL || *value == '\0') { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ss, - "Cannot get media parameter."); - return (NULL); - } - - pp = apr_palloc(p, sizeof(param)); - pp->attr = attribute; - pp->val = value; - pp->next = NULL; - - if (ctp->param == NULL) { - ctp->param = pp; - } - else { - npp = ctp->param; - while (npp->next) { - npp = npp->next; - } - npp->next = pp; - } - quoted = 0; - attribute = NULL; - value = NULL; - if (*cp == '\0') { - break; - } - cp++; - mp = cp; - } - } - return (ctp); -} - -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; - const char *charset = NULL; - - if (r->finfo.filetype == APR_DIR) { - 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 = apr_table_get(conf->forced_types, ext)) - || (type = apr_table_get(hash_buckets[hash(*ext)], ext))) { - r->content_type = type; - found = 1; - } - - /* Add charset to Content-Type */ - if ((type = apr_table_get(conf->charset_types, ext))) { - charset = type; - found = 1; - } - - /* Check for Content-Language */ - if ((type = apr_table_get(conf->language_types, ext))) { - const char **new; - - r->content_language = type; /* back compat. only */ - if (!r->content_languages) - r->content_languages = apr_array_make(r->pool, 2, sizeof(char *)); - new = (const char **) apr_array_push(r->content_languages); - *new = type; - found = 1; - } - - /* Check for Content-Encoding */ - if ((type = apr_table_get(conf->encoding_types, ext))) { - if (!r->content_encoding) - r->content_encoding = type; - else - r->content_encoding = apr_pstrcat(r->pool, r->content_encoding, - ", ", type, NULL); - found = 1; - } - - /* Check for a special handler, but not for proxy request */ - if ((type = apr_table_get(conf->handlers, ext)) - && (PROXYREQ_NONE == 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; - charset = NULL; - } - } - - if (r->content_type) { - content_type *ctp; - char *ct; - int override = 0; - - ct = (char *) apr_palloc(r->pool, - sizeof(char) * (strlen(r->content_type) + 1)); - strcpy(ct, r->content_type); - - if ((ctp = analyze_ct(r, ct))) { - param *pp = ctp->param; - r->content_type = apr_pstrcat(r->pool, ctp->type, "/", - ctp->subtype, NULL); - while (pp != NULL) { - if (charset && !strcmp(pp->attr, "charset")) { - if (!override) { - r->content_type = apr_pstrcat(r->pool, r->content_type, - "; charset=", charset, - NULL); - override = 1; - } - } - else { - r->content_type = apr_pstrcat(r->pool, r->content_type, - "; ", pp->attr, - "=", pp->val, - NULL); - } - pp = pp->next; - } - if (charset && !override) { - r->content_type = apr_pstrcat(r->pool, r->content_type, - "; charset=", charset, - NULL); - } - } - } - - /* 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 = apr_array_make(r->pool, 2, sizeof(char *)); - new = (const char **) apr_array_push(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; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_type_checker(find_ct,NULL,NULL,APR_HOOK_MIDDLE); - ap_hook_post_config(mime_post_config,NULL,NULL,APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA mime_module = { - STANDARD20_MODULE_STUFF, - create_mime_dir_config, /* create per-directory config structure */ - merge_mime_dir_configs, /* merge per-directory config structures */ - NULL, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - mime_cmds, /* command apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/http/mod_mime.exp b/modules/http/mod_mime.exp deleted file mode 100644 index f2e38dbdda..0000000000 --- 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 65f0cc30cf..0000000000 --- a/modules/loggers/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -Debug -Release diff --git a/modules/loggers/.indent.pro b/modules/loggers/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- 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 167b343d0d..0000000000 --- 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 8d4304abc4..0000000000 --- a/modules/loggers/config.m4 +++ /dev/null @@ -1,9 +0,0 @@ -dnl modules enabled in this directory by default - -dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]]) - -APACHE_MODPATH_INIT(loggers) - -APACHE_MODULE(log_config, logging configuration, , , yes) - -APACHE_MODPATH_FINISH diff --git a/modules/loggers/mod_log_config.c b/modules/loggers/mod_log_config.c deleted file mode 100644 index c2b655c455..0000000000 --- a/modules/loggers/mod_log_config.c +++ /dev/null @@ -1,1229 +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. - */ - -/* - * 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. - * %...b: bytes sent, excluding HTTP headers in CLF format, i.e. a '-' - * when no bytes where sent (rather than a '0'. - * %...c: Status of the connection. - * '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. - * %...{FOOBAR}C: The contents of the HTTP cookie FOOBAR - * %...{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. - * %...D: the time taken to serve the request, in micro 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 - * %...m: the request method - * %...H: the request protocol - * %...q: the query string prepended by "?", or empty if no query string - * - * 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 */ - -#include "apr_strings.h" -#include "apr_lib.h" -#include "apr_hash.h" -#include "apr_optional.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "ap_config.h" -#include "mod_log_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" /* For REMOTE_NAME */ -#include "http_log.h" -#include "http_protocol.h" - -#if APR_HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_LIMITS_H -#include -#endif - -#define DEFAULT_LOG_FORMAT "%h %l %u %t \"%r\" %>s %b" - -module AP_MODULE_DECLARE_DATA log_config_module; - -static int xfer_flags = (APR_WRITE | APR_APPEND | APR_CREATE); -static apr_fileperms_t xfer_perms = APR_OS_DEFAULT; -static apr_hash_t *log_hash; - -/* 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 { - const char *default_format_string; - apr_array_header_t *default_format; - apr_array_header_t *config_logs; - apr_array_header_t *server_config_logs; - apr_table_t *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 NULL before the log file is opened and - * set to a valid fd after it is opened. - */ - -typedef struct { - const char *fname; - const char *format_string; - apr_array_header_t *format; - apr_file_t *log_fd; - char *condition_var; -#ifdef BUFFERED_LOGS - apr_size_t 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 struct { - ap_log_handler_fn_t *func; - char *arg; - int condition_sense; - int want_orig; - apr_array_header_t *conditions; -} log_format_item; - -static char *format_integer(apr_pool_t *p, int i) -{ - return apr_psprintf(p, "%d", i); -} - -static char *pfmt(apr_pool_t *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, NULL); -} - -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->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) ? apr_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_request_method(request_rec *r, char *a) -{ - return r->method; -} -static const char *log_request_protocol(request_rec *r, char *a) -{ - return r->protocol; -} -static const char *log_request_query(request_rec *r, char *a) -{ - return (r->args != NULL) ? apr_pstrcat(r->pool, "?", r->args, NULL) - : ""; -} -static const char *log_status(request_rec *r, char *a) -{ - return pfmt(r->pool, r->status); -} - -static const char *clf_log_bytes_sent(request_rec *r, char *a) -{ - if (!r->sent_bodyct) { - return "-"; - } - else { - return apr_psprintf(r->pool, "%ld", r->bytes_sent); - } -} - -static const char *log_bytes_sent(request_rec *r, char *a) -{ - if (!r->sent_bodyct) { - return "0"; - } - else { - return apr_psprintf(r->pool, "%ld", r->bytes_sent); - } -} - - -static const char *log_header_in(request_rec *r, char *a) -{ - return apr_table_get(r->headers_in, a); -} - -static const char *log_header_out(request_rec *r, char *a) -{ - const char *cp = apr_table_get(r->headers_out, a); - if (!strcasecmp(a, "Content-type") && r->content_type) { - cp = ap_field_noparam(r->pool, r->content_type); - } - if (cp) { - return cp; - } - return apr_table_get(r->err_headers_out, a); -} - -static const char *log_note(request_rec *r, char *a) -{ - return apr_table_get(r->notes, a); -} -static const char *log_env_var(request_rec *r, char *a) -{ - return apr_table_get(r->subprocess_env, a); -} - -static const char *log_cookie(request_rec *r, char *a) -{ - const char *cookies; - const char *start_cookie; - - if ((cookies = apr_table_get(r->headers_in, "Cookie"))) { - if ((start_cookie = ap_strstr_c(cookies,a))) { - char *cookie, *end_cookie; - start_cookie += strlen(a) + 1; /* cookie_name + '=' */ - cookie = apr_pstrdup(r->pool, start_cookie); - /* kill everything in cookie after ';' */ - end_cookie = strchr(cookie, ';'); - if (end_cookie) { - *end_cookie = '\0'; - } - return cookie; - } - } - return NULL; -} - -static const char *log_request_time(request_rec *r, char *a) -{ - apr_exploded_time_t xt; - apr_size_t retcode; - char tstr[MAX_STRING_LEN]; - - /* - hi. i think getting the time again at the end of the request - just for logging is dumb. i know it's "required" for CLF. - folks writing log parsing tools don't realise that out of order - times have always been possible (consider what happens if one - process calculates the time to log, but then there's a context - switch before it writes and before that process is run again the - log rotation occurs) and they should just fix their tools rather - than force the server to pay extra cpu cycles. if you've got - a problem with this, you can set the define. -djg - */ -#ifdef I_INSIST_ON_EXTRA_CYCLES_FOR_CLF_COMPLIANCE - apr_explode_localtime(&xt, apr_time_now()); -#else - apr_explode_localtime(&xt, r->request_time); -#endif - if (a && *a) { /* Custom format */ - apr_strftime(tstr, &retcode, MAX_STRING_LEN, a, &xt); - } - else { /* CLF format */ - char sign; - int timz; - - timz = xt.tm_gmtoff; - if (timz < 0) { - timz = -timz; - sign = '-'; - } - else { - sign = '+'; - } - - apr_snprintf(tstr, sizeof(tstr), "[%02d/%s/%d:%02d:%02d:%02d %c%.2d%.2d]", - xt.tm_mday, apr_month_snames[xt.tm_mon], xt.tm_year+1900, - xt.tm_hour, xt.tm_min, xt.tm_sec, - sign, timz / (60*60), timz % (60*60)); - } - - return apr_pstrdup(r->pool, tstr); -} - -static const char *log_request_duration(request_rec *r, char *a) -{ - return apr_psprintf(r->pool, "%qd", (apr_time_now() - r->request_time) - / APR_USEC_PER_SEC); -} - -static const char *log_request_duration_microseconds(request_rec *r, char *a) -{ - return apr_psprintf(r->pool, "%qd", (apr_time_now() - 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 apr_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 apr_psprintf(r->pool, "%ld", (long) getpid()); -} - -static const char *log_connection_status(request_rec *r, char *a) -{ - if (r->connection->aborted) - return "X"; - - if (r->connection->keepalive && - (!r->server->keep_alive_max || - (r->server->keep_alive_max - r->connection->keepalives) > 0)) { - return "+"; - } - return "-"; -} - -/***************************************************************** - * - * Parsing the log format string - */ - -static char *parse_log_misc_string(apr_pool_t *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 = apr_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 'r': - *d++ = '\r'; - 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(apr_pool_t *p, log_format_item *it, const char **sa) -{ - const char *s = *sa; - ap_log_handler *handler; - - 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; - - 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 (apr_isdigit(*++s)) { - i = i * 10 + (*s) - '0'; - } - if (!it->conditions) { - it->conditions = apr_array_make(p, 4, sizeof(int)); - } - *(int *) apr_array_push(it->conditions) = i; - break; - - default: - handler = (ap_log_handler *)apr_hash_get(log_hash, s++, 1); - if (!handler) { - char dummy[2]; - - dummy[0] = s[-1]; - dummy[1] = '\0'; - return apr_pstrcat(p, "Unrecognized LogFormat directive %", - dummy, NULL); - } - it->func = handler->func; - if (it->want_orig == -1) { - it->want_orig = handler->want_orig_default; - } - *sa = s; - return NULL; - } - } - - return "Ran off end of LogFormat parsing args to some directive"; -} - -static apr_array_header_t *parse_log_string(apr_pool_t *p, const char *s, const char **err) -{ - apr_array_header_t *a = apr_array_make(p, 30, sizeof(log_format_item)); - char *res; - - while (*s) { - if ((res = parse_log_item(p, (log_format_item *) apr_array_push(a), &s))) { - *err = res; - return NULL; - } - } - - s = APR_EOL_STR; - parse_log_item(p, (log_format_item *) apr_array_push(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 != NULL) { - apr_file_write(cls->log_fd, cls->outbuf, &cls->outcnt); - cls->outcnt = 0; - } -} -#endif - -static int config_log_transaction(request_rec *r, config_log_state *cls, - apr_array_header_t *default_format) -{ - log_format_item *items; - char *str, *s; - const char **strs; - int *strl; - request_rec *orig; - int i; - apr_size_t len = 0; - apr_array_header_t *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 (apr_table_get(r->subprocess_env, envar) == NULL) { - return DECLINED; - } - } - else { - if (apr_table_get(r->subprocess_env, &envar[1]) != NULL) { - return DECLINED; - } - } - } - - format = cls->format ? cls->format : default_format; - - strs = apr_palloc(r->pool, sizeof(char *) * (format->nelts)); - strl = apr_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) { - apr_size_t w; - - str = apr_palloc(r->pool, len + 1); - for (i = 0, s = str; i < format->nelts; ++i) { - memcpy(s, strs[i], strl[i]); - s += strl[i]; - } - w = len; - apr_file_write(cls->log_fd, str, &w); - } - 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 = apr_palloc(r->pool, len + 1); - - for (i = 0, s = str; i < format->nelts; ++i) { - memcpy(s, strs[i], strl[i]); - s += strl[i]; - } - - apr_file_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, - &log_config_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(apr_pool_t *p, server_rec *s) -{ - multi_log_state *mls; - - mls = (multi_log_state *) apr_palloc(p, sizeof(multi_log_state)); - mls->config_logs = apr_array_make(p, 1, sizeof(config_log_state)); - mls->default_format_string = NULL; - mls->default_format = NULL; - mls->server_config_logs = NULL; - mls->formats = apr_table_make(p, 4); - apr_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(apr_pool_t *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 = apr_table_overlay(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, const char *fmt, - const char *name) -{ - const char *err_string = NULL; - multi_log_state *mls = ap_get_module_config(cmd->server->module_config, - &log_config_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) { - apr_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, const char *fn, - const char *fmt, const char *envclause) -{ - const char *err_string = NULL; - multi_log_state *mls = ap_get_module_config(cmd->server->module_config, - &log_config_module); - config_log_state *cls; - - cls = (config_log_state *) apr_array_push(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 = apr_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 = NULL; - - return err_string; -} - -static const char *set_transfer_log(cmd_parms *cmd, void *dummy, - const char *fn) -{ - return add_custom_log(cmd, dummy, fn, NULL, NULL); -} - -static const char *set_cookie_log(cmd_parms *cmd, void *dummy, const char *fn) -{ - return add_custom_log(cmd, dummy, fn, "%{Cookie}n \"%r\" %t", NULL); -} - -static const command_rec config_log_cmds[] = -{ -AP_INIT_TAKE23("CustomLog", add_custom_log, NULL, RSRC_CONF, - "a file name, a custom log format string or format name, " - "and an optional \"env=\" clause (see docs)"), -AP_INIT_TAKE1("TransferLog", set_transfer_log, NULL, RSRC_CONF, - "the filename of the access log"), -AP_INIT_TAKE12("LogFormat", log_format, NULL, RSRC_CONF, - "a log format string (see docs) and an optional format name"), -AP_INIT_TAKE1("CookieLog", set_cookie_log, NULL, RSRC_CONF, - "the filename of the cookie log"), - {NULL} -}; - -static config_log_state *open_config_log(server_rec *s, apr_pool_t *p, - config_log_state *cls, - apr_array_header_t *default_format) -{ - apr_status_t status; - - if (cls->log_fd != NULL) { - 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 { - const char *fname = ap_server_root_relative(p, cls->fname); - if ((status = apr_file_open(&cls->log_fd, fname, xfer_flags, xfer_perms, p)) - != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, status, 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, apr_pool_t *p) -{ - int i; - multi_log_state *mls = ap_get_module_config(s->module_config, - &log_config_module); - config_log_state *clsarray; - const char *dummy; - const char *format; - - if (mls->default_format_string) { - format = apr_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 = apr_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 = apr_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; -} - -#ifdef BUFFERED_LOGS -static apr_status_t flush_all_logs(void *data) -{ - server_rec *s = data; - multi_log_state *mls; - apr_array_header_t *log_list; - config_log_state *clsarray; - int i; - - for (; s; s = s->next) { - mls = ap_get_module_config(s->module_config, &log_config_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]); - } - } - } - return APR_SUCCESS; -} -#endif - -static void init_config_log(apr_pool_t *pc, apr_pool_t *p, apr_pool_t *pt, server_rec *s) -{ - /* 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); - } -} - -static void init_child(apr_pool_t *p, server_rec *s) -{ -#ifdef BUFFERED_LOGS - /* Now register the last buffer flush with the cleanup engine */ - apr_pool_cleanup_register(p, s, flush_all_logs, flush_all_logs); -#endif -} - -static void ap_register_log_handler(apr_pool_t *p, char *tag, - ap_log_handler_fn_t *handler, int def) -{ - ap_log_handler *log_struct = apr_palloc(p, sizeof(*log_struct)); - log_struct->func = handler; - log_struct->want_orig_default = def; - - apr_hash_set(log_hash, tag, 1, (const void *)log_struct); -} - -static void log_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp) -{ - static APR_OPTIONAL_FN_TYPE(ap_register_log_handler) *log_pfn_register; - - log_pfn_register = APR_RETRIEVE_OPTIONAL_FN(ap_register_log_handler); - - if (log_pfn_register) { - log_pfn_register(p, "h", log_remote_host, 0); - log_pfn_register(p, "a", log_remote_address, 0 ); - log_pfn_register(p, "A", log_local_address, 0 ); - log_pfn_register(p, "l", log_remote_logname, 0); - log_pfn_register(p, "u", log_remote_user, 0); - log_pfn_register(p, "t", log_request_time, 0); - log_pfn_register(p, "f", log_request_file, 0); - log_pfn_register(p, "b", clf_log_bytes_sent, 0); - log_pfn_register(p, "B", log_bytes_sent, 0); - log_pfn_register(p, "i", log_header_in, 0); - log_pfn_register(p, "o", log_header_out, 0); - log_pfn_register(p, "n", log_note, 0); - log_pfn_register(p, "e", log_env_var, 0); - log_pfn_register(p, "V", log_server_name, 0); - log_pfn_register(p, "v", log_virtual_host, 0); - log_pfn_register(p, "p", log_server_port, 0); - log_pfn_register(p, "P", log_child_pid, 0); - log_pfn_register(p, "H", log_request_protocol, 0); - log_pfn_register(p, "m", log_request_method, 0); - log_pfn_register(p, "q", log_request_query, 0); - log_pfn_register(p, "c", log_connection_status, 0); - log_pfn_register(p, "C", log_cookie, 0); - log_pfn_register(p, "r", log_request_line, 1); - log_pfn_register(p, "D", log_request_duration_microseconds, 1); - log_pfn_register(p, "T", log_request_duration, 1); - log_pfn_register(p, "U", log_request_uri, 1); - log_pfn_register(p, "s", log_status, 1); - } -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_pre_config(log_pre_config,NULL,NULL,APR_HOOK_REALLY_FIRST); - ap_hook_child_init(init_child,NULL,NULL,APR_HOOK_MIDDLE); - ap_hook_open_logs(init_config_log,NULL,NULL,APR_HOOK_MIDDLE); - ap_hook_log_transaction(multi_log_transaction,NULL,NULL,APR_HOOK_MIDDLE); - - /* Init log_hash before we register the optional function. It is - * possible for the optional function, ap_register_log_handler, - * to be called before any other mod_log_config hooks are called. - * As a policy, we should init everything required by an optional function - * before calling APR_REGISTER_OPTIONAL_FN. - */ - log_hash = apr_hash_make(p); - APR_REGISTER_OPTIONAL_FN(ap_register_log_handler); -} - -module AP_MODULE_DECLARE_DATA log_config_module = -{ - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/loggers/mod_log_config.exp b/modules/loggers/mod_log_config.exp deleted file mode 100644 index 01b926f4bb..0000000000 --- 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 d30409f804..0000000000 --- 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 65f0cc30cf..0000000000 --- a/modules/mappers/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -Debug -Release diff --git a/modules/mappers/.indent.pro b/modules/mappers/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- 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 167b343d0d..0000000000 --- a/modules/mappers/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ - -include $(top_srcdir)/build/special.mk - diff --git a/modules/mappers/config9.m4 b/modules/mappers/config9.m4 deleted file mode 100644 index 170a2944db..0000000000 --- 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, , , most) -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, , , most) -APACHE_MODULE(userdir, mapping of user requests, , , yes) -APACHE_MODULE(alias, translation of requests, , , yes) - -APACHE_MODULE(rewrite, regex URL translation, , , most, [ - APR_ADDTO(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 d6a31ddeb1..0000000000 --- a/modules/mappers/mod_actions.c +++ /dev/null @@ -1,226 +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. - */ - -/* - * 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 "apr_strings.h" -#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_main.h" -#include "http_log.h" -#include "util_script.h" - -typedef struct { - apr_table_t *action_types; /* Added with Action... */ - const char *scripted[METHODS]; /* Added with Script... */ -} action_dir_config; - -module actions_module; - -static void *create_action_dir_config(apr_pool_t *p, char *dummy) -{ - action_dir_config *new = - (action_dir_config *) apr_pcalloc(p, sizeof(action_dir_config)); - - new->action_types = apr_table_make(p, 4); - - return new; -} - -static void *merge_action_dir_configs(apr_pool_t *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 *) apr_palloc(p, - sizeof(action_dir_config)); - int i; - - new->action_types = apr_table_overlay(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, void *m_v, - const char *type, const char *script) -{ - action_dir_config *m = (action_dir_config *)m_v; - apr_table_setn(m->action_types, type, script); - return NULL; -} - -static const char *set_script(cmd_parms *cmd, void *m_v, - const char *method, const char *script) -{ - action_dir_config *m = (action_dir_config *)m_v; - 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[] = -{ - AP_INIT_TAKE2("Action", add_action, NULL, OR_FILEINFO, - "a media type followed by a script name"), - AP_INIT_TAKE2("Script", set_script, NULL, ACCESS_CONF | RSRC_CONF, - "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, &actions_module); - const char *t, *action = r->handler ? r->handler : - ap_field_noparam(r->pool, r->content_type); - const char *script; - int i; - - /* Note that this handler handles _all_ types, so handler is unchecked */ - - /* 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 = apr_table_get(conf->action_types, - action ? action : ap_default_type(r)))) { - script = t; - if (r->finfo.filetype == 0) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "File does not exist: %s", r->filename); - return HTTP_NOT_FOUND; - } - } - - if (script == NULL) - return DECLINED; - - ap_internal_redirect_handler(apr_pstrcat(r->pool, script, ap_escape_uri(r->pool, - r->uri), r->args ? "?" : NULL, r->args, NULL), r); - return OK; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_handler(action_handler,NULL,NULL,APR_HOOK_LAST); -} - -module actions_module = -{ - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/mappers/mod_actions.exp b/modules/mappers/mod_actions.exp deleted file mode 100644 index 815dff29a8..0000000000 --- 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 a5752e3c1e..0000000000 --- a/modules/mappers/mod_alias.c +++ /dev/null @@ -1,443 +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_alias.c: Stuff for dealing with directory aliases - * - * Original by Rob McCool, rewritten in succession by David Robinson - * and rst. - * - */ - -#include "apr_strings.h" -#include "apr_lib.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_request.h" - - -typedef struct { - const char *real; - const char *fake; - char *handler; - regex_t *regexp; - int redir_status; /* 301, 302, 303, 410, etc */ -} alias_entry; - -typedef struct { - apr_array_header_t *aliases; - apr_array_header_t *redirects; -} alias_server_conf; - -typedef struct { - apr_array_header_t *redirects; -} alias_dir_conf; - -module AP_MODULE_DECLARE_DATA alias_module; - -static void *create_alias_config(apr_pool_t *p, server_rec *s) -{ - alias_server_conf *a = - (alias_server_conf *) apr_pcalloc(p, sizeof(alias_server_conf)); - - a->aliases = apr_array_make(p, 20, sizeof(alias_entry)); - a->redirects = apr_array_make(p, 20, sizeof(alias_entry)); - return a; -} - -static void *create_alias_dir_config(apr_pool_t *p, char *d) -{ - alias_dir_conf *a = - (alias_dir_conf *) apr_pcalloc(p, sizeof(alias_dir_conf)); - a->redirects = apr_array_make(p, 2, sizeof(alias_entry)); - return a; -} - -static void *merge_alias_config(apr_pool_t *p, void *basev, void *overridesv) -{ - alias_server_conf *a = - (alias_server_conf *) apr_pcalloc(p, sizeof(alias_server_conf)); - alias_server_conf *base = (alias_server_conf *) basev, *overrides = (alias_server_conf *) overridesv; - - a->aliases = apr_array_append(p, overrides->aliases, base->aliases); - a->redirects = apr_array_append(p, overrides->redirects, base->redirects); - return a; -} - -static void *merge_alias_dir_config(apr_pool_t *p, void *basev, void *overridesv) -{ - alias_dir_conf *a = - (alias_dir_conf *) apr_pcalloc(p, sizeof(alias_dir_conf)); - alias_dir_conf *base = (alias_dir_conf *) basev, *overrides = (alias_dir_conf *) overridesv; - a->redirects = apr_array_append(p, overrides->redirects, base->redirects); - return a; -} - -static const char *add_alias_internal(cmd_parms *cmd, void *dummy, - const char *f, const char *r, - int use_regex) -{ - server_rec *s = cmd->server; - alias_server_conf *conf = ap_get_module_config(s->module_config, - &alias_module); - alias_entry *new = apr_array_push(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->real = r; - } -#ifndef OS2 - else - new->real = ap_os_canonical_filename(cmd->pool, r); -#else - new->real = r; -#endif - - new->fake = f; - new->handler = cmd->info; - - return NULL; -} - -static const char *add_alias(cmd_parms *cmd, void *dummy, const char *f, - const char *r) -{ - return add_alias_internal(cmd, dummy, f, r, 0); -} - -static const char *add_alias_regex(cmd_parms *cmd, void *dummy, const char *f, - const char *r) -{ - return add_alias_internal(cmd, dummy, f, r, 1); -} - -static const char *add_redirect_internal(cmd_parms *cmd, - alias_dir_conf *dirconf, - const char *arg1, const char *arg2, - const char *arg3, int use_regex) -{ - alias_entry *new; - server_rec *s = cmd->server; - alias_server_conf *serverconf = ap_get_module_config(s->module_config, - &alias_module); - int status = (int) (long) cmd->info; - regex_t *r = NULL; - const char *f = arg2; - const 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 (apr_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 = apr_array_push(dirconf->redirects); - else - new = apr_array_push(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, void *dirconf, - const char *arg1, const char *arg2, - const char *arg3) -{ - return add_redirect_internal(cmd, dirconf, arg1, arg2, arg3, 0); -} - -static const char *add_redirect2(cmd_parms *cmd, void *dirconf, - const char *arg1, const char *arg2) -{ - return add_redirect_internal(cmd, dirconf, arg1, arg2, NULL, 0); -} - -static const char *add_redirect_regex(cmd_parms *cmd, void *dirconf, - const char *arg1, const char *arg2, - const char *arg3) -{ - return add_redirect_internal(cmd, dirconf, arg1, arg2, arg3, 1); -} - -static const command_rec alias_cmds[] = -{ - AP_INIT_TAKE2("Alias", add_alias, NULL, RSRC_CONF, - "a fakename and a realname"), - AP_INIT_TAKE2("ScriptAlias", add_alias, "cgi-script", RSRC_CONF, - "a fakename and a realname"), - AP_INIT_TAKE23("Redirect", add_redirect, (void *) HTTP_MOVED_TEMPORARILY, - OR_FILEINFO, - "an optional status, then document to be redirected and " - "destination URL"), - AP_INIT_TAKE2("AliasMatch", add_alias_regex, NULL, RSRC_CONF, - "a regular expression and a filename"), - AP_INIT_TAKE2("ScriptAliasMatch", add_alias_regex, "cgi-script", RSRC_CONF, - "a regular expression and a filename"), - AP_INIT_TAKE23("RedirectMatch", add_redirect_regex, - (void *) HTTP_MOVED_TEMPORARILY, OR_FILEINFO, - "an optional status, then a regular expression and " - "destination URL"), - AP_INIT_TAKE2("RedirectTemp", add_redirect2, - (void *) HTTP_MOVED_TEMPORARILY, OR_FILEINFO, - "a document to be redirected, then the destination URL"), - AP_INIT_TAKE2("RedirectPermanent", add_redirect2, - (void *) HTTP_MOVED_PERMANENTLY, OR_FILEINFO, - "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, apr_array_header_t *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 = apr_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 = apr_pstrcat(r->pool, p->real, escurl, NULL); - } - else - found = apr_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; - apr_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) -{ - ap_conf_vector_t *sconf = r->server->module_config; - alias_server_conf *serverconf = 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 = apr_pstrcat(r->pool, ret, "?", r->args, NULL); - } - apr_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)) - apr_table_setn(r->headers_out, "Location", ret); - return status; - } - - return DECLINED; -} - -static void register_hooks(apr_pool_t *p) -{ - static const char * const aszPre[]={ "mod_userdir.c",NULL }; - - ap_hook_translate_name(translate_alias_redir,aszPre,NULL,APR_HOOK_MIDDLE); - ap_hook_fixups(fixup_redir,NULL,NULL,APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA alias_module = -{ - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/mappers/mod_alias.exp b/modules/mappers/mod_alias.exp deleted file mode 100644 index ac386ec3fa..0000000000 --- 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 b216622018..0000000000 --- a/modules/mappers/mod_dir.c +++ /dev/null @@ -1,252 +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. - */ - -/* - * mod_dir.c: handle default index files, and trailing-/ redirects - */ - -#include "apr_strings.h" -#include "ap_config.h" -#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 AP_MODULE_DECLARE_DATA dir_module; - -typedef struct dir_config_struct { - apr_array_header_t *index_names; -} dir_config_rec; - -#define DIR_CMD_PERMS OR_INDEXES - -static const char *add_index(cmd_parms *cmd, void *dummy, const char *arg) -{ - dir_config_rec *d = dummy; - - if (!d->index_names) { - d->index_names = apr_array_make(cmd->pool, 2, sizeof(char *)); - } - *(const char **)apr_array_push(d->index_names) = arg; - return NULL; -} - -static const command_rec dir_cmds[] = -{ - AP_INIT_ITERATE("DirectoryIndex", add_index, NULL, DIR_CMD_PERMS, - "a list of file names"), - {NULL} -}; - -static void *create_dir_config(apr_pool_t *p, char *dummy) -{ - dir_config_rec *new = - (dir_config_rec *) apr_pcalloc(p, sizeof(dir_config_rec)); - - new->index_names = NULL; - return (void *) new; -} - -static void *merge_dir_configs(apr_pool_t *p, void *basev, void *addv) -{ - dir_config_rec *new = (dir_config_rec *) apr_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 fixup_dir(request_rec *r) -{ - /* only (potentially) redirect for GET requests against directories */ - if (r->method_number != M_GET || r->finfo.filetype != APR_DIR) { - return DECLINED; - } - - if (r->uri[0] == '\0' || r->uri[strlen(r->uri) - 1] != '/') { - char *ifile; - if (r->args != NULL) - ifile = apr_pstrcat(r->pool, ap_escape_uri(r->pool, r->uri), - "/", "?", r->args, NULL); - else - ifile = apr_pstrcat(r->pool, ap_escape_uri(r->pool, r->uri), - "/", NULL); - - apr_table_setn(r->headers_out, "Location", - ap_construct_url(r->pool, ifile, r)); - return HTTP_MOVED_PERMANENTLY; - } - - return OK; -} - -static int handle_dir(request_rec *r) -{ - dir_config_rec *d; - char *dummy_ptr[1]; - char **names_ptr; - int num_names; - int error_notfound = 0; - - if (strcmp(r->handler,DIR_MAGIC_TYPE)) { - return DECLINED; - } - - d = (dir_config_rec *) ap_get_module_config(r->per_dir_config, - &dir_module); - - /* 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 = apr_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] = AP_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, NULL); - - if (rr->status == HTTP_OK && rr->finfo.filetype == APR_REG) { - char *new_uri = ap_escape_uri(r->pool, rr->uri); - - if (rr->args != NULL) - new_uri = apr_pstrcat(r->pool, new_uri, "?", rr->args, NULL); - else if (r->args != NULL) - new_uri = apr_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) || - (rr->status == HTTP_UNAUTHORIZED && num_names == 1)) { - - apr_pool_join(r->pool, rr->pool); - error_notfound = rr->status; - r->notes = apr_table_overlay(r->pool, r->notes, rr->notes); - r->headers_out = apr_table_overlay(r->pool, r->headers_out, - rr->headers_out); - r->err_headers_out = apr_table_overlay(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 void register_hooks(apr_pool_t *p) -{ - static const char * const aszSucc[]={"mod_autoindex.c", NULL}; - - ap_hook_fixups(fixup_dir,NULL,NULL,APR_HOOK_MIDDLE); - ap_hook_handler(handle_dir,NULL,aszSucc,APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA dir_module = { - STANDARD20_MODULE_STUFF, - create_dir_config, /* create per-directory config structure */ - merge_dir_configs, /* merge per-directory config structures */ - NULL, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - dir_cmds, /* command apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/mappers/mod_dir.exp b/modules/mappers/mod_dir.exp deleted file mode 100644 index 5fbf772991..0000000000 --- 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 c29567e90f..0000000000 --- a/modules/mappers/mod_imap.c +++ /dev/null @@ -1,925 +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. - */ - -/* - * 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 "apr.h" -#include "apr_strings.h" -#include "apr_lib.h" - -#define APR_WANT_STDIO /* for sscanf() */ -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#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_main.h" -#include "http_log.h" -#include "util_script.h" -#include "mod_core.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 AP_MODULE_DECLARE_DATA imap_module; - -typedef struct { - char *imap_menu; - char *imap_default; - char *imap_base; -} imap_conf_rec; - -static void *create_imap_dir_config(apr_pool_t *p, char *dummy) -{ - imap_conf_rec *icr = - (imap_conf_rec *) apr_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(apr_pool_t *p, void *basev, void *addv) -{ - imap_conf_rec *new = (imap_conf_rec *) apr_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[] = -{ - AP_INIT_TAKE1("ImapMenu", ap_set_string_slot, - (void *) XtOffsetOf(imap_conf_rec, imap_menu), OR_INDEXES, - "the type of menu generated: none, formatted, semiformatted, " - "unformatted"), - AP_INIT_TAKE1("ImapDefault", ap_set_string_slot, - (void *) XtOffsetOf(imap_conf_rec, imap_default), OR_INDEXES, - "the action taken if no match: error, nocontent, referer, " - "menu, URL"), - AP_INIT_TAKE1("ImapBase", ap_set_string_slot, - (void *) XtOffsetOf(imap_conf_rec, imap_base), OR_INDEXES, - "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 && !apr_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 */ - const 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 = ap_strchr_c(args, ','); /* the comma */ - - if (start_of_y) { - - start_of_y++; /* start looking at the character after - the comma */ - - while (*start_of_y && !apr_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 (apr_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 apr_pstrdup(r->pool, value); /* these are handled elsewhere, - so just copy them */ - } - - if (!strcasecmp(value, "referer")) { - referer = apr_table_get(r->headers_in, "Referer"); - if (referer && *referer) { - return apr_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 (apr_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 apr_pstrdup(r->pool, value); - } - - if (!base || !*base) { - if (value && *value) { - return apr_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 (ap_strchr_c(base, '/') == NULL && (!strncmp(value, "../", 3) - || !strcmp(value, ".."))) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "invalid base directive in map file: %s", r->uri); - return NULL; - } - my_base = apr_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, 0, 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 apr_pstrcat(r->pool, my_base, value, NULL); - } - return my_base; -} - -static int imap_reply(request_rec *r, char *redirect) -{ - if (!strcasecmp(redirect, "error")) { - /* they actually requested an error! */ - return HTTP_INTERNAL_SERVER_ERROR; - } - if (!strcasecmp(redirect, "nocontent")) { - /* tell the client to keep the page it has */ - return HTTP_NO_CONTENT; - } - if (redirect && *redirect) { - /* must be a URL, so redirect to it */ - apr_table_setn(r->headers_out, "Location", redirect); - return HTTP_MOVED_TEMPORARILY; - } - return HTTP_INTERNAL_SERVER_ERROR; -} - -static void menu_header(request_rec *r, char *menu) -{ - r->content_type = "text/html"; - - 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 */ -} - -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; - apr_status_t status; - - double testpoint[2]; - double pointarray[MAXVERTS + 1][2]; - int vertex; - - char *string_pos; - int showmenu = 0; - - imap_conf_rec *icr; - - char *imap_menu; - char *imap_default; - char *imap_base; - - ap_configfile_t *imap; - - if (r->method_number != M_GET || (strcmp(r->handler,IMAP_MAGIC_TYPE) - && strcmp(r->handler, "imap-file"))) - return DECLINED; - - icr = ap_get_module_config(r->per_dir_config, &imap_module); - - imap_menu = icr->imap_menu ? icr->imap_menu : IMAP_MENU_DEFAULT; - imap_default = icr->imap_default - ? icr->imap_default : IMAP_DEFAULT_DEFAULT; - imap_base = icr->imap_base ? icr->imap_base : IMAP_BASE_DEFAULT; - - status = ap_pcfg_openfile(&imap, r->pool, r->filename); - - if (status != APR_SUCCESS) { - return HTTP_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 && !apr_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 && apr_isspace(*string_pos)) { /* past whitespace */ - ++string_pos; - } - - value = string_pos; - while (*string_pos && !apr_isspace(*string_pos)) { /* past value */ - ++string_pos; - } - if (apr_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 (apr_isspace(*string_pos)) { /* past whitespace */ - string_pos++; - } - while (apr_isdigit(*string_pos)) { /* and the 1st number */ - string_pos++; - } - string_pos++; /* skip the ',' */ - while (apr_isspace(*string_pos)) { /* past any more whitespace */ - string_pos++; - } - while (apr_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 = apr_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, 0, 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 void register_hooks(apr_pool_t *p) -{ - ap_hook_handler(imap_handler,NULL,NULL,APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA imap_module = -{ - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/mappers/mod_imap.exp b/modules/mappers/mod_imap.exp deleted file mode 100644 index 1e0e0b83d0..0000000000 --- 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 679460c088..0000000000 --- a/modules/mappers/mod_negotiation.c +++ /dev/null @@ -1,2756 +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. - */ - -/* - * mod_negotiation.c: keeps track of MIME types the client is willing to - * accept, and contains code to handle type arbitration. - * - * rst - */ - -#include "apr.h" -#include "apr_strings.h" -#include "apr_file_io.h" -#include "apr_lib.h" - -#define APR_WANT_STDIO /* for EOF */ -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "ap_config.h" -#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" - - -#define MAP_FILE_MAGIC_TYPE "application/x-type-map" - -/* Commands --- configuring document caching on a per (virtual?) - * server basis... - */ - -typedef struct { - apr_array_header_t *language_priority; -} neg_dir_config; - -module AP_MODULE_DECLARE_DATA negotiation_module; - -static void *create_neg_dir_config(apr_pool_t *p, char *dummy) -{ - neg_dir_config *new = (neg_dir_config *) apr_palloc(p, sizeof(neg_dir_config)); - - new->language_priority = apr_array_make(p, 4, sizeof(char *)); - return new; -} - -static void *merge_neg_dir_configs(apr_pool_t *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 *) apr_palloc(p, sizeof(neg_dir_config)); - - /* give priority to the config in the subdirectory */ - new->language_priority = apr_array_append(p, add->language_priority, - base->language_priority); - return new; -} - -static const char *set_language_priority(cmd_parms *cmd, void *n, - const char *lang) -{ - apr_array_header_t *arr = ((neg_dir_config *) n)->language_priority; - const char **langp = (const char **) apr_array_push(arr); - - *langp = lang; - return NULL; -} - -static const char *cache_negotiated_docs(cmd_parms *cmd, void *dummy, - int arg) -{ - ap_set_module_config(cmd->server->module_config, &negotiation_module, - (arg ? "Cache" : NULL)); - 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[] = -{ - AP_INIT_FLAG("CacheNegotiatedDocs", cache_negotiated_docs, NULL, RSRC_CONF, - "Either 'on' or 'off' (default)"), - AP_INIT_ITERATE("LanguagePriority", set_language_priority, NULL, OR_FILEINFO, - "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; - apr_array_header_t *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... */ - long 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 { - apr_pool_t *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 - */ - apr_array_header_t *accepts; /* accept_recs */ - apr_array_header_t *accept_encodings; /* accept_recs */ - apr_array_header_t *accept_charsets; /* accept_recs */ - apr_array_header_t *accept_langs; /* accept_recs */ - - apr_array_header_t *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; - 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.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(apr_pool_t *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 && !apr_isspace(*cp) && *cp != '='); ++cp) { - *cp = apr_tolower(*cp); - } - - if (!*cp) { - continue; /* No '='; just ignore it. */ - } - - *cp++ = '\0'; /* Delimit var */ - while (*cp && (apr_isspace(*cp) || *cp == '=')) { - ++cp; - } - - if (*cp == '"') { - ++cp; - for (end = cp; - (*end && *end != '\n' && *end != '\r' && *end != '\"'); - end++); - } - else { - for (end = cp; (*end && !apr_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 = (float)atof(cp); - } - else if (parm[0] == 'l' && !strcmp(&parm[1], "evel")) { - result->level = (float)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 apr_array_header_t *do_header_line(apr_pool_t *p, const char *accept_line) -{ - apr_array_header_t *accept_recs; - - if (!accept_line) { - return NULL; - } - - accept_recs = apr_array_make(p, 40, sizeof(accept_rec)); - - while (*accept_line) { - accept_rec *new = (accept_rec *) apr_array_push(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 apr_array_header_t *do_languages_line(apr_pool_t *p, const char **lang_line) -{ - apr_array_header_t *lang_recs = apr_array_make(p, 2, sizeof(char *)); - - if (!lang_line) { - return lang_recs; - } - - while (**lang_line) { - char **new = (char **) apr_array_push(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 *) apr_pcalloc(r->pool, sizeof(negotiation_state)); - accept_rec *elts; - apr_table_t *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, apr_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, apr_table_get(hdrs, "Accept-Encoding")); - new->accept_langs = - do_header_line(r->pool, apr_table_get(hdrs, "Accept-Language")); - new->accept_charsets = - do_header_line(r->pool, apr_table_get(hdrs, "Accept-Charset")); - - new->avail_vars = apr_array_make(r->pool, 40, sizeof(var_rec)); - - return new; -} - - -static void parse_negotiate_header(request_rec *r, negotiation_state *neg) -{ - const char *negotiate = apr_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 = apr_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 || - apr_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 - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "dont_fiddle_headers=%d use_rvsa=%d ua_supports_trans=%d " - "send_alternates=%d, may_choose=%d", - 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 = apr_array_make(neg->pool, 4, sizeof(accept_rec)); - - new_accept = (accept_rec *) apr_array_push(neg->accepts); - - new_accept->name = "*/*"; - new_accept->quality = 1.0f; - new_accept->level = 0.0f; - } - - new_accept = (accept_rec *) apr_array_push(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, apr_file_t *map) -{ - char *buf_end = buffer + len; - char *cp; - char c; - - /* Get a noncommented line */ - - do { - if (apr_file_gets(buffer, MAX_STRING_LEN, map) != APR_SUCCESS) { - return header_eof; - } - } while (buffer[0] == '#'); - - /* If blank, just return it --- this ends information on this variant */ - - for (cp = buffer; (*cp && apr_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 (apr_file_getc(&c, map) != APR_EOF) { - if (c == '#') { - /* Comment line */ - while (apr_file_getc(&c, map) != EOF && c != '\n') { - continue; - } - } - else if (apr_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 != '\n' && apr_isspace(c)) { - if(apr_file_getc(&c, map) != APR_SUCCESS) - break; - } - - apr_file_ungetc(c, map); - - if (c == '\n') { - return header_seen; /* Blank line */ - } - - /* Continuation */ - - while (cp < buf_end - 2 && (apr_file_getc(&c, map)) != EOF && c != '\n') { - *cp++ = c; - } - - *cp++ = '\n'; - *cp = '\0'; - } - else { - - /* Line beginning with something other than whitespace */ - - apr_file_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 = apr_tolower(*cp); - } - - if (!*cp) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Syntax error in type map --- no ':': %s", r->filename); - return NULL; - } - - do { - ++cp; - } while (*cp && apr_isspace(*cp)); - - if (!*cp) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, 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; - apr_file_t *map = NULL; - apr_status_t status; - 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; - - if ((status = apr_file_open(&map, rr->filename, APR_READ, - APR_OS_DEFAULT, neg->pool)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, status, 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 HTTP_INTERNAL_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 = atol(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 = apr_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 = apr_array_push(neg->avail_vars); - - memcpy(new_var, (void *) &mime_info, sizeof(var_rec)); - } - - clean_var_rec(&mime_info); - has_content = 0; - } - } while (hstate != header_eof); - - apr_file_close(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; - apr_dir_t *dirp; - apr_finfo_t dirent; - apr_status_t status; - 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); - - if ((status = apr_dir_open(&dirp, neg->dir_name, neg->pool)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, - "cannot read directory for multi: %s", neg->dir_name); - return HTTP_FORBIDDEN; - } - - while (apr_dir_read(&dirent, APR_FINFO_DIRENT, dirp) == APR_SUCCESS) { - request_rec *sub_req; - - /* Do we have a match? */ - if (strncmp(dirent.name, filp, prefix_len)) { - continue; - } - if (dirent.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(dirent.name, r, NULL); - - /* 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"))) { - - apr_dir_close(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 = apr_pstrdup(neg->pool, dirent.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 = apr_array_push(neg->avail_vars); - memcpy(new_var, (void *) &mime_info, sizeof(var_rec)); - - neg->count_multiviews_variants++; - - clean_var_rec(&mime_info); - } - - apr_dir_close(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(apr_array_header_t *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) -{ - apr_array_header_t *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; - size_t 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 long find_content_length(negotiation_state *neg, var_rec *variant) -{ - apr_finfo_t statb; - - if (variant->bytes == 0) { - char *fullname = ap_make_full_path(neg->pool, neg->dir_name, - variant->file_name); - - if (apr_stat(&statb, fullname, - APR_FINFO_SIZE, neg->pool) == APR_SUCCESS) { - variant->bytes = statb.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 - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "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", - (variant->file_name ? variant->file_name : ""), - (variant->mime_type ? variant->mime_type : ""), - (variant->content_languages - ? apr_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 - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Variant: file=%s type=%s lang=%s sourceq=%1.3f " - "mimeq=%1.3f langq=%1.3f langidx=%d charq=%1.3f encq=%1.3f ", - (variant->file_name ? variant->file_name : ""), - (variant->mime_type ? variant->mime_type : ""), - (variant->content_languages - ? apr_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) -{ - apr_table_t *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; - apr_array_header_t *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 apr_table_t 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 = apr_array_make(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 = apr_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 **) apr_array_push(arr)) = "{\""; - *((const char **) apr_array_push(arr)) = variant->file_name; - *((const char **) apr_array_push(arr)) = "\" "; - - qstr = (char *) apr_palloc(r->pool, 6); - apr_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 **) apr_array_push(arr)) = qstr; - - if (variant->mime_type && *variant->mime_type) { - *((const char **) apr_array_push(arr)) = " {type "; - *((const char **) apr_array_push(arr)) = variant->mime_type; - *((const char **) apr_array_push(arr)) = "}"; - } - if (variant->content_charset && *variant->content_charset) { - *((const char **) apr_array_push(arr)) = " {charset "; - *((const char **) apr_array_push(arr)) = variant->content_charset; - *((const char **) apr_array_push(arr)) = "}"; - } - if (lang) { - *((const char **) apr_array_push(arr)) = " {language "; - *((const char **) apr_array_push(arr)) = lang; - *((const char **) apr_array_push(arr)) = "}"; - } - if (variant->content_encoding && *variant->content_encoding) { - /* Strictly speaking, this is non-standard, but so is TCN */ - - *((const char **) apr_array_push(arr)) = " {encoding "; - *((const char **) apr_array_push(arr)) = variant->content_encoding; - *((const char **) apr_array_push(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 *) apr_palloc(r->pool, 22); - apr_snprintf(lenstr, 22, "%ld", len); - *((const char **) apr_array_push(arr)) = " {length "; - *((const char **) apr_array_push(arr)) = lenstr; - *((const char **) apr_array_push(arr)) = "}"; - } - - *((const char **) apr_array_push(arr)) = "}"; - *((const char **) apr_array_push(arr)) = ", "; /* trimmed below */ - } - - if (neg->send_alternates && neg->avail_vars->nelts) { - arr->nelts--; /* remove last comma */ - apr_table_mergen(hdrs, "Alternates", - apr_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) { - - apr_table_mergen(hdrs, "Vary", 2 + apr_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 */ - apr_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) -{ - apr_array_header_t *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 apr_table_t with the maximum substrings possible, - * fill it with the variant list, and then concatenate the entire array. - */ - arr = apr_array_make(r->pool, max_vlist_array, sizeof(char *)); - - *((const char **) apr_array_push(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 : ""; - apr_array_header_t *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 **) apr_array_push(arr)) = "
    • "; - *((const char **) apr_array_push(arr)) = filename; - *((const char **) apr_array_push(arr)) = " "; - *((const char **) apr_array_push(arr)) = description; - - if (variant->mime_type && *variant->mime_type) { - *((const char **) apr_array_push(arr)) = ", type "; - *((const char **) apr_array_push(arr)) = variant->mime_type; - } - if (languages && languages->nelts) { - *((const char **) apr_array_push(arr)) = ", language "; - *((const char **) apr_array_push(arr)) = apr_array_pstrcat(r->pool, - languages, ','); - } - if (variant->content_charset && *variant->content_charset) { - *((const char **) apr_array_push(arr)) = ", charset "; - *((const char **) apr_array_push(arr)) = variant->content_charset; - } - if (variant->content_encoding) { - *((const char **) apr_array_push(arr)) = ", encoding "; - *((const char **) apr_array_push(arr)) = variant->content_encoding; - } - *((const char **) apr_array_push(arr)) = "\n"; - } - *((const char **) apr_array_push(arr)) = "
    \n"; - - return apr_array_pstrcat(r->pool, arr, '\0'); -} - -static void store_variant_list(request_rec *r, negotiation_state *neg) -{ - if (r->main == NULL) { - apr_table_setn(r->notes, "variant-list", make_variant_list(r, neg)); - } - else { - apr_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 HTTP_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, NULL); - status = sub_req->status; - - if (status != HTTP_OK && - !apr_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 HTTP_VARIANT_ALSO_VARIES - * for this type of recursive negotiation too. - */ - if (neg->is_transparent && - apr_table_get(sub_req->err_headers_out, "TCN")) { - return HTTP_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 HTTP_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 = apr_table_get(sub_req->err_headers_out, "Vary")) != NULL) { - apr_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. - */ - apr_table_setn(r->err_headers_out, "Vary", sub_vary); - apr_table_unset(sub_req->err_headers_out, "Vary"); - } - - apr_table_setn(r->err_headers_out, "Content-Location", - apr_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 HTTP_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 HTTP_MULTIPLE_CHOICES; - } - - if (!*bestp) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "no acceptable variant: %s", r->filename); - return HTTP_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; - var_rec *best; - int res; - char *udir; - - if(strcmp(r->handler,MAP_FILE_MAGIC_TYPE) && strcmp(r->handler,"type-map")) - return DECLINED; - - neg = parse_accept_headers(r); - 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(apr_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.filetype != 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, NULL); - 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 (sub_req->finfo.filetype != APR_REG) { - res = HTTP_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. - */ - apr_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 = apr_table_overlay(r->pool, sub_req->notes, r->notes); - r->headers_out = apr_table_overlay(r->pool, sub_req->headers_out, - r->headers_out); - r->err_headers_out = apr_table_overlay(r->pool, sub_req->err_headers_out, - r->err_headers_out); - r->subprocess_env = apr_table_overlay(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; - apr_array_header_t *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, - apr_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 void register_hooks(apr_pool_t *p) -{ - ap_hook_fixups(fix_encoding,NULL,NULL,APR_HOOK_MIDDLE); - ap_hook_type_checker(handle_multi,NULL,NULL,APR_HOOK_FIRST); - ap_hook_handler(handle_map_file,NULL,NULL,APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA negotiation_module = -{ - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/mappers/mod_negotiation.exp b/modules/mappers/mod_negotiation.exp deleted file mode 100644 index a7c18da1de..0000000000 --- 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 a5c4563bff..0000000000 --- a/modules/mappers/mod_rewrite.c +++ /dev/null @@ -1,4132 +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. - */ - -/* _ _ _ -** _ __ ___ ___ __| | _ __ _____ ___ __(_) |_ ___ -** | '_ ` _ \ / _ \ / _` | | '__/ _ \ \ /\ / / '__| | __/ _ \ -** | | | | | | (_) | (_| | | | | __/\ 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 Software Foundation in July 1997 by -** -** Ralf S. Engelschall -** rse@engelschall.com -** www.engelschall.com -*/ - -#include "apr.h" -#include "apr_strings.h" -#include "apr_user.h" -#include "apr_lib.h" -#include "apr_signal.h" - -#define APR_WANT_STRFUNC -#define APR_WANT_IOVEC -#include "apr_want.h" - -#if APR_HAVE_UNISTD_H -#include -#endif -#if APR_HAVE_SYS_TYPES_H -#include -#endif - -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_request.h" -#include "http_core.h" -#include "http_log.h" -#include "http_protocol.h" -#include "mod_rewrite.h" - -#if !defined(OS2) && !defined(WIN32) && !defined(BEOS) -#include "unixd.h" -#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 "HTTP_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: - * XXX: this needs updating for apache-2.0 configuration method - * MODULE-DEFINITION-START - * Name: rewrite_module - * ConfigStart - . ./build/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 module (predeclaration) */ -module AP_MODULE_DECLARE_DATA rewrite_module; - - /* the cache */ -static cache *cachep; - - /* whether proxy module is available or not */ -static int proxy_available; - -static const char *lockname; -static apr_lock_t *rewrite_mapr_lock_acquire = NULL; -static apr_lock_t *rewrite_log_lock = NULL; - -/* -** +-------------------------------------------------------+ -** | | -** | configuration directive handling -** | | -** +-------------------------------------------------------+ -*/ - -/* -** -** per-server configuration structure handling -** -*/ - -static void *config_server_create(apr_pool_t *p, server_rec *s) -{ - rewrite_server_conf *a; - - a = (rewrite_server_conf *)apr_pcalloc(p, sizeof(rewrite_server_conf)); - - a->state = ENGINE_DISABLED; - a->options = OPTION_NONE; - a->rewritelogfile = NULL; - a->rewritelogfp = NULL; - a->rewriteloglevel = 0; - a->rewritemaps = apr_array_make(p, 2, sizeof(rewritemap_entry)); - a->rewriteconds = apr_array_make(p, 2, sizeof(rewritecond_entry)); - a->rewriterules = apr_array_make(p, 2, sizeof(rewriterule_entry)); - a->server = s; - - return (void *)a; -} - -static void *config_server_merge(apr_pool_t *p, void *basev, void *overridesv) -{ - rewrite_server_conf *a, *base, *overrides; - - a = (rewrite_server_conf *)apr_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 != NULL - ? overrides->rewritelogfp - : base->rewritelogfp; - a->rewritemaps = apr_array_append(p, overrides->rewritemaps, - base->rewritemaps); - a->rewriteconds = apr_array_append(p, overrides->rewriteconds, - base->rewriteconds); - a->rewriterules = apr_array_append(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(apr_pool_t *p, char *path) -{ - rewrite_perdir_conf *a; - - a = (rewrite_perdir_conf *)apr_pcalloc(p, sizeof(rewrite_perdir_conf)); - - a->state = ENGINE_DISABLED; - a->options = OPTION_NONE; - a->baseurl = NULL; - a->rewriteconds = apr_array_make(p, 2, sizeof(rewritecond_entry)); - a->rewriterules = apr_array_make(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 = apr_pstrdup(p, path); - } - else { - a->directory = apr_pstrcat(p, path, "/", NULL); - } - } - - return (void *)a; -} - -static void *config_perdir_merge(apr_pool_t *p, void *basev, void *overridesv) -{ - rewrite_perdir_conf *a, *base, *overrides; - - a = (rewrite_perdir_conf *)apr_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 = apr_array_append(p, overrides->rewriteconds, - base->rewriteconds); - a->rewriterules = apr_array_append(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, - void *in_dconf, int flag) -{ - rewrite_perdir_conf *dconf = in_dconf; - rewrite_server_conf *sconf; - - sconf = 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, - void *in_dconf, const char *option) -{ - rewrite_perdir_conf *dconf = in_dconf; - rewrite_server_conf *sconf; - const char *err; - - sconf = 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(apr_pool_t *p, int *options, - const char *name) -{ - if (strcasecmp(name, "inherit") == 0) { - *options |= OPTION_INHERIT; - } - else { - return apr_pstrcat(p, "RewriteOptions: unknown option '", - name, "'", NULL); - } - return NULL; -} - -static const char *cmd_rewritelog(cmd_parms *cmd, void *dconf, const char *a1) -{ - rewrite_server_conf *sconf; - - sconf = 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, const char *a1) -{ - rewrite_server_conf *sconf; - - sconf = 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, const char *a1, - const char *a2) -{ - rewrite_server_conf *sconf; - rewritemap_entry *newmap; - apr_finfo_t st; - - sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module); - - newmap = apr_array_push(sconf->rewritemaps); - - newmap->name = a1; - newmap->func = NULL; - if (strncmp(a2, "txt:", 4) == 0) { - newmap->type = MAPTYPE_TXT; - newmap->datafile = a2+4; - newmap->checkfile = a2+4; - } - else if (strncmp(a2, "rnd:", 4) == 0) { - newmap->type = MAPTYPE_RND; - newmap->datafile = a2+4; - newmap->checkfile = a2+4; - } - else if (strncmp(a2, "dbm:", 4) == 0) { -#ifndef NO_DBM_REWRITEMAP - newmap->type = MAPTYPE_DBM; - newmap->datafile = a2+4; - newmap->checkfile = apr_pstrcat(cmd->pool, a2+4, NDBM_FILE_SUFFIX, NULL); -#else - return apr_pstrdup(cmd->pool, "RewriteMap: cannot use NDBM mapfile, " - "because no NDBM support is compiled in"); -#endif - } - else if (strncmp(a2, "prg:", 4) == 0) { - newmap->type = MAPTYPE_PRG; - newmap->datafile = a2+4; - newmap->checkfile = a2+4; - } - else if (strncmp(a2, "int:", 4) == 0) { - newmap->type = MAPTYPE_INT; - newmap->datafile = NULL; - newmap->checkfile = NULL; - if (strcmp(a2+4, "tolower") == 0) { - newmap->func = rewrite_mapfunc_tolower; - } - else if (strcmp(a2+4, "toupper") == 0) { - newmap->func = rewrite_mapfunc_toupper; - } - else if (strcmp(a2+4, "escape") == 0) { - newmap->func = rewrite_mapfunc_escape; - } - else if (strcmp(a2+4, "unescape") == 0) { - newmap->func = rewrite_mapfunc_unescape; - } - else if (sconf->state == ENGINE_ENABLED) { - return apr_pstrcat(cmd->pool, "RewriteMap: internal map not found:", - a2+4, NULL); - } - } - else { - newmap->type = MAPTYPE_TXT; - newmap->datafile = a2; - newmap->checkfile = a2; - } - newmap->fpin = NULL; - newmap->fpout = NULL; - - if (newmap->checkfile && (sconf->state == ENGINE_ENABLED) - && (apr_stat(&st, newmap->checkfile, APR_FINFO_MIN, - cmd->pool) != APR_SUCCESS)) { - return apr_pstrcat(cmd->pool, - "RewriteMap: map file or program not found:", - newmap->checkfile, NULL); - } - - return NULL; -} - -static const char *cmd_rewritelock(cmd_parms *cmd, void *dconf, const 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, void *in_dconf, - const char *a1) -{ - rewrite_perdir_conf *dconf = in_dconf; - - 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, void *in_dconf, - const char *in_str) -{ - rewrite_perdir_conf *dconf = in_dconf; - char *str = apr_pstrdup(cmd->pool, in_str); - rewrite_server_conf *sconf; - rewritecond_entry *newcond; - regex_t *regexp; - char *a1; - char *a2; - char *a3; - char *cp; - const char *err; - int rc; - - sconf = 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 */ - newcond = apr_array_push(sconf->rewriteconds); - } - else { /* is per-directory command */ - newcond = apr_array_push(dconf->rewriteconds); - } - - /* parse the argument line ourself */ - if (parseargline(str, &a1, &a2, &a3)) { - return apr_pstrcat(cmd->pool, "RewriteCond: bad argument line '", str, - "'", NULL); - } - - /* arg1: the input string */ - newcond->input = apr_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!) */ - newcond->flags = CONDFLAG_NONE; - if (a3 != NULL) { - if ((err = cmd_rewritecond_parseflagfield(cmd->pool, newcond, - a3)) != NULL) { - return err; - } - } - - /* arg2: the pattern - try to compile the regexp to test if is ok */ - cp = a2; - if (cp[0] == '!') { - newcond->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 (newcond->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 apr_pstrcat(cmd->pool, - "RewriteCond: cannot compile regular expression '", - a2, "'", NULL); - } - - newcond->pattern = apr_pstrdup(cmd->pool, cp); - newcond->regexp = regexp; - - return NULL; -} - -static const char *cmd_rewritecond_parseflagfield(apr_pool_t *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(apr_pool_t *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 apr_pstrcat(p, "RewriteCond: unknown flag '", key, "'", NULL); - } - return NULL; -} - -static const char *cmd_rewriterule(cmd_parms *cmd, void *in_dconf, - const char *in_str) -{ - rewrite_perdir_conf *dconf = in_dconf; - char *str = apr_pstrdup(cmd->pool, in_str); - rewrite_server_conf *sconf; - rewriterule_entry *newrule; - regex_t *regexp; - char *a1; - char *a2; - char *a3; - char *cp; - const char *err; - int mode; - - sconf = 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 */ - newrule = apr_array_push(sconf->rewriterules); - } - else { /* is per-directory command */ - newrule = apr_array_push(dconf->rewriterules); - } - - /* parse the argument line ourself */ - if (parseargline(str, &a1, &a2, &a3)) { - return apr_pstrcat(cmd->pool, "RewriteRule: bad argument line '", str, - "'", NULL); - } - - /* arg3: optional flags field */ - newrule->forced_mimetype = NULL; - newrule->forced_responsecode = HTTP_MOVED_TEMPORARILY; - newrule->flags = RULEFLAG_NONE; - newrule->env[0] = NULL; - newrule->skip = 0; - if (a3 != NULL) { - if ((err = cmd_rewriterule_parseflagfield(cmd->pool, newrule, - a3)) != NULL) { - return err; - } - } - - /* arg1: the pattern - * try to compile the regexp to test if is ok - */ - cp = a1; - if (cp[0] == '!') { - newrule->flags |= RULEFLAG_NOTMATCH; - cp++; - } - mode = REG_EXTENDED; - if (newrule->flags & RULEFLAG_NOCASE) { - mode |= REG_ICASE; - } - if ((regexp = ap_pregcomp(cmd->pool, cp, mode)) == NULL) { - return apr_pstrcat(cmd->pool, - "RewriteRule: cannot compile regular expression '", - a1, "'", NULL); - } - newrule->pattern = apr_pstrdup(cmd->pool, cp); - newrule->regexp = regexp; - - /* arg2: the output string - * replace the $ by \ which is needed by the currently - * used Regular Expression library - * - * TODO: Is this still required for PCRE? If not, does it *work* with PCRE? - */ - newrule->output = apr_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 */ - newrule->rewriteconds = sconf->rewriteconds; - sconf->rewriteconds = apr_array_make(cmd->pool, 2, - sizeof(rewritecond_entry)); - } - else { /* is per-directory command */ - newrule->rewriteconds = dconf->rewriteconds; - dconf->rewriteconds = apr_array_make(cmd->pool, 2, - sizeof(rewritecond_entry)); - } - - return NULL; -} - -static const char *cmd_rewriterule_parseflagfield(apr_pool_t *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(apr_pool_t *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 (apr_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 = apr_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] = apr_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 apr_pstrcat(p, "RewriteRule: unknown flag '", key, "'", NULL); - } - return NULL; -} - - -/* -** -** Global Module Initialization -** [called from read_config() after all -** config commands were already called] -** -*/ - -static void init_module(apr_pool_t *p, - apr_pool_t *plog, - apr_pool_t *ptemp, - server_rec *s) -{ - apr_status_t rv; - void *data; - int first_time = 0; - const char *userdata_key = "rewrite_init_module"; - - apr_pool_userdata_get(&data, userdata_key, s->process->pool); - if (!data) { - first_time = 1; - apr_pool_userdata_set((const void *)1, userdata_key, - apr_pool_cleanup_null, s->process->pool); - } - - /* check if proxy module is available */ - proxy_available = (ap_find_linked_module("mod_proxy.c") != NULL); - - /* create the rewriting lockfiles in the parent */ - if ((rv = apr_lock_create (&rewrite_log_lock, APR_MUTEX, APR_LOCKALL, - NULL, p)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, - "mod_rewrite: could not create rewrite_log_lock"); - exit(1); - } - - rewritelock_create(s, p); - apr_pool_cleanup_register(p, (void *)s, rewritelock_remove, apr_pool_cleanup_null); - - /* step through the servers and - * - open each rewriting logfile - * - open the RewriteMap prg:xxx programs - */ - for (; s; s = s->next) { - open_rewritelog(s, p); - if (!first_time) - run_rewritemap_programs(s, p); - } -} - - -/* -** -** Per-Child Module Initialization -** [called after a child process is spawned] -** -*/ - -static void init_child(apr_pool_t *p, server_rec *s) -{ - apr_status_t rv; - - if (lockname != NULL && *(lockname) != '\0') - { - rv = apr_lock_child_init (&rewrite_mapr_lock_acquire, lockname, p); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, - "mod_rewrite: could not init rewrite_mapr_lock_acquire " - "in child"); - } - } - - /* 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) -{ - 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; - apr_finfo_t finfo; - unsigned int port; - int n; - int l; - - /* - * retrieve the config structures - */ - conf = ap_get_module_config(r->server->module_config, &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 = apr_pstrcat(r->pool, "REDIRECT_", ENVVAR_SCRIPT_URL, NULL); - var = apr_table_get(r->subprocess_env, var); - if (var == NULL) { - apr_table_setn(r->subprocess_env, ENVVAR_SCRIPT_URL, r->uri); - } - else { - apr_table_setn(r->subprocess_env, ENVVAR_SCRIPT_URL, var); - } - } - else { - var = apr_table_get(r->main->subprocess_env, ENVVAR_SCRIPT_URL); - apr_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 { - apr_snprintf(buf, sizeof(buf), ":%u", port); - thisport = buf; - } - thisurl = apr_table_get(r->subprocess_env, ENVVAR_SCRIPT_URL); - - /* set the variable */ - var = apr_pstrcat(r->pool, ap_http_method(r), "://", thisserver, thisport, - thisurl, NULL); - apr_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 = apr_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, 0, r, - "attempt to make remote request from mod_rewrite " - "without proxy enabled: %s", r->filename); - return HTTP_FORBIDDEN; - } - - /* make sure the QUERY_STRING and - * PATH_INFO parts get incorporated - */ - if (r->path_info != NULL) { - r->filename = apr_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 = apr_pstrcat(r->pool, r->filename, - "?", r->args, NULL); - } - - /* now make sure the request gets handled by the proxy handler */ - r->proxyreq = PROXYREQ_REVERSE; - r->handler = "proxy-server"; - - rewritelog(r, 1, "go-ahead with proxy request %s [OK]", - r->filename); - return OK; - } - else if (is_absolute_uri(r->filename)) { - /* 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 = apr_pstrcat(r->pool, r->filename, cp2, NULL); - } - - /* append the QUERY_STRING part */ - if (r->args != NULL) { - r->filename = apr_pstrcat(r->pool, r->filename, "?", - ap_escape_uri(r->pool, 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 = HTTP_MOVED_TEMPORARILY; - } - - /* now do the redirection */ - apr_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 HTTP_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 = apr_pstrdup(r->pool, r->filename+12); - return DECLINED; - } - else { - /* it was finally rewritten to a local path */ - - /* expand "/~user" prefix */ -#if APR_HAS_USER - 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 HTTP_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 = apr_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 = apr_pstrcat(r->pool, docroot, - (r->filename + - r->server->pathlen), NULL); - } - else { - r->filename = apr_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 = apr_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, 0, r, - "Options FollowSymLinks or SymLinksIfOwnerMatch is off " - "which implies that RewriteRule directive is forbidden: " - "%s", r->filename); - return HTTP_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->filename = apr_pstrcat(r->pool, r->filename, - "?", r->args, NULL); - } - - /* now make sure the request gets handled by the proxy handler */ - r->proxyreq = PROXYREQ_REVERSE; - 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 (is_absolute_uri(r->filename)) { - /* 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 = apr_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 = apr_pstrcat(r->pool, r->filename, cp2, NULL); - } - - /* append the QUERY_STRING part */ - if (r->args != NULL) { - r->filename = apr_pstrcat(r->pool, r->filename, "?", - ap_escape_uri(r->pool, 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 = HTTP_MOVED_TEMPORARILY; - } - - /* now do the redirection */ - apr_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 HTTP_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 = apr_pstrdup(r->pool, r->filename+12); - } - - /* the filename has to start with a slash! */ - if (r->filename[0] != '/') { - return HTTP_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 = apr_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 = apr_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 = apr_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) -{ - if (strcmp(r->handler, "redirect-handler")) { - return DECLINED; - } - - /* 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(apr_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, apr_array_header_t *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 = apr_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 = apr_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 = apr_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]; - regex_t *regexp; - regmatch_t regmatch[MAX_NMATCH]; - backrefinfo *briRR = NULL; - backrefinfo *briRC = NULL; - int prefixstrip; - int failed; - apr_array_header_t *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 = apr_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 *)apr_palloc(r->pool, sizeof(backrefinfo)); - if (!rc && (p->flags & RULEFLAG_NOTMATCH)) { - /* empty info on negative patterns */ - briRR->source = ""; - briRR->nsub = 0; - } - else { - briRR->source = apr_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 *)apr_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... - */ - apr_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 = apr_table_get(r->notes, VARY_KEY_THIS); - if (vary != NULL) { - apr_table_merge(r->notes, VARY_KEY, vary); - apr_table_unset(r->notes, VARY_KEY_THIS); - } - } - /* if any condition fails the complete rule fails */ - if (failed) { - apr_table_unset(r->notes, VARY_KEY); - apr_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 = apr_table_get(r->notes, VARY_KEY)) != NULL) { - apr_table_merge(r->headers_out, "Vary", vary); - apr_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) { - do_expand_env(r, p->env, briRR, briRC); - 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); - apr_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'. - */ - do_expand(r, output, newuri, sizeof(newuri), briRR, briRC); - 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=]'). - */ - do_expand_env(r, p->env, briRR, briRC); - - /* - * 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 = apr_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. - */ - if (prefixstrip && r->filename[0] != '/' - && !is_absolute_uri(r->filename)) { - rewritelog(r, 3, "[per-dir %s] add per-dir prefix: %s -> %s%s", - perdir, r->filename, perdir, r->filename); - r->filename = apr_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 = apr_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. - */ - if (is_absolute_uri(r->filename)) { - 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 = apr_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) { - apr_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]; - apr_finfo_t sb; - request_rec *rsub; - regmatch_t regmatch[MAX_NMATCH]; - int rc; - - /* - * Construct the string we match against - */ - - do_expand(r, p->input, input, sizeof(input), briRR, briRC); - - /* - * Apply the patterns - */ - - rc = 0; - if (strcmp(p->pattern, "-f") == 0) { - if (apr_stat(&sb, input, APR_FINFO_MIN, r->pool) == APR_SUCCESS) { - if (sb.filetype == APR_REG) { - rc = 1; - } - } - } - else if (strcmp(p->pattern, "-s") == 0) { - if (apr_stat(&sb, input, APR_FINFO_MIN, r->pool) == APR_SUCCESS) { - if ((sb.filetype == APR_REG) && sb.size > 0) { - rc = 1; - } - } - } - else if (strcmp(p->pattern, "-l") == 0) { -#if !defined(OS2) - if (apr_lstat(&sb, input, APR_FINFO_MIN, r->pool) == APR_SUCCESS) { - if (sb.filetype == APR_LNK) { - rc = 1; - } - } -#endif - } - else if (strcmp(p->pattern, "-d") == 0) { - if (apr_stat(&sb, input, APR_FINFO_MIN, r->pool) == APR_SUCCESS) { - if (sb.filetype == APR_DIR) { - rc = 1; - } - } - } - else if (strcmp(p->pattern, "-U") == 0) { - /* avoid infinite subrequest recursion */ - if (strlen(input) > 0 && subreq_ok(r)) { - - /* run a URI-based subrequest */ - rsub = ap_sub_req_lookup_uri(input, r, NULL); - - /* 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 && subreq_ok(r)) { - - /* process a file-based subrequest: - * this differs from -U in that no path translation is done. - */ - rsub = ap_sub_req_lookup_file(input, r, NULL); - - /* file exists for any result up to 2xx, no redirects */ - if (rsub->status < 300 && - /* double-check that file exists since default result is 200 */ - apr_stat(&sb, rsub->filename, APR_FINFO_MIN, - r->pool) == APR_SUCCESS) { - 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 = apr_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 -** | | -** +-------------------------------------------------------+ -*/ - - -/* -** -** perform all the expansions on the input string -** leaving the result in the supplied buffer -** -*/ - -static void do_expand(request_rec *r, char *input, char *buffer, int nbuf, - backrefinfo *briRR, backrefinfo *briRC) -{ - char *inp, *outp; - size_t span, space; - - /* - * for security reasons this expansion must be perfomed in a - * single pass, otherwise an attacker can arrange for the result - * of an earlier expansion to include expansion specifiers that - * are interpreted by a later expansion, producing results that - * were not intended by the administrator. - */ - - inp = input; - outp = buffer; - space = nbuf - 1; /* room for '\0' */ - - for (;;) { - span = strcspn(inp, "$%"); - if (span > space) { - span = space; - } - memcpy(outp, inp, span); - inp += span; - outp += span; - space -= span; - if (space == 0 || *inp == '\0') { - break; - } - /* now we have a '$' or a '%' */ - if (inp[1] == '{') { - char *endp; - endp = find_closing_bracket(inp+2, '{', '}'); - if (endp == NULL) { - goto skip; - } - /* - * These lookups may be recursive in a very convoluted - * fashion -- see the LA-U and LA-F variable expansion - * prefixes -- so we copy lookup keys to a separate buffer - * rather than adding zero bytes in order to use them in - * place. - */ - if (inp[0] == '$') { - /* ${...} map lookup expansion */ - /* - * To make rewrite maps useful the lookup key and - * default values must be expanded, so we make - * recursive calls to do the work. For security - * reasons we must never expand a string that includes - * verbatim data from the network. The recursion here - * isn't a problem because the result of expansion is - * only passed to lookup_map() so it cannot be - * re-expanded, only re-looked-up. Another way of - * looking at it is that the recursion is entirely - * driven by the syntax of the nested curly brackets. - */ - char *map, *key, *dflt, *result; - char xkey[MAX_STRING_LEN]; - char xdflt[MAX_STRING_LEN]; - key = find_char_in_brackets(inp+2, ':', '{', '}'); - if (key == NULL) - goto skip; - map = apr_pstrndup(r->pool, inp+2, key-inp-2); - dflt = find_char_in_brackets(key+1, '|', '{', '}'); - if (dflt == NULL) { - key = apr_pstrndup(r->pool, key+1, endp-key-1); - dflt = ""; - } else { - key = apr_pstrndup(r->pool, key+1, dflt-key-1); - dflt = apr_pstrndup(r->pool, dflt+1, endp-dflt-1); - } - do_expand(r, key, xkey, sizeof(xkey), briRR, briRC); - result = lookup_map(r, map, xkey); - if (result) { - span = apr_cpystrn(outp, result, space) - outp; - } else { - do_expand(r, dflt, xdflt, sizeof(xdflt), briRR, briRC); - span = apr_cpystrn(outp, xdflt, space) - outp; - } - } - else if (inp[0] == '%') { - /* %{...} variable lookup expansion */ - char *var; - var = apr_pstrndup(r->pool, inp+2, endp-inp-2); - span = apr_cpystrn(outp, lookup_variable(r, var), space) - outp; - } - else { - span = 0; - } - inp = endp+1; - outp += span; - space -= span; - continue; - } - else if (apr_isdigit(inp[1])) { - int n = inp[1] - '0'; - backrefinfo *bri = NULL; - if (inp[0] == '$') { - /* $N RewriteRule regexp backref expansion */ - bri = briRR; - } - else if (inp[0] == '%') { - /* %N RewriteCond regexp backref expansion */ - bri = briRC; - } - /* see ap_pregsub() in src/main/util.c */ - if (bri && n <= bri->nsub && - bri->regmatch[n].rm_eo > bri->regmatch[n].rm_so) { - span = bri->regmatch[n].rm_eo - bri->regmatch[n].rm_so; - if (span > space) { - span = space; - } - memcpy(outp, bri->source + bri->regmatch[n].rm_so, span); - outp += span; - space -= span; - } - inp += 2; - continue; - } - skip: - *outp++ = *inp++; - space--; - } - *outp++ = '\0'; -} - - -/* -** -** perform all the expansions on the environment variables -** -*/ - -static void do_expand_env(request_rec *r, char *env[], - backrefinfo *briRR, backrefinfo *briRC) -{ - int i; - char buf[MAX_STRING_LEN]; - - for (i = 0; env[i] != NULL; i++) { - do_expand(r, env[i], buf, sizeof(buf), briRR, briRC); - add_env_variable(r, buf); - } -} - - -/* -** -** 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 = apr_pstrdup(r->pool, r->filename); - *q++ = '\0'; - if (qsappend) { - r->args = apr_pstrcat(r->pool, q, "&", r->args, NULL); - } - else { - r->args = apr_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 = (char *)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 = apr_pstrdup(r->pool, r->filename); /* save for logging */ - - /* cut the hostname and port out of the URI */ - apr_cpystrn(buf, r->filename+(l+3), sizeof(buf)); - hostp = buf; - for (cp = hostp; *cp != '\0' && *cp != '/' && *cp != ':'; cp++) - ; - if (*cp == ':') { - /* set host */ - *cp++ = '\0'; - apr_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'; - apr_cpystrn(host, hostp, sizeof(host)); - *cp = '/'; - /* set port */ - port = ap_default_port(r); - /* set remaining url */ - url = cp; - } - else { - /* set host */ - apr_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 = apr_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) -{ - char buf[32]; - const char *thisserver; - char *thisport; - int port; - - if (!is_absolute_uri(r->filename)) { - - thisserver = ap_get_server_name(r); - port = ap_get_server_port(r); - if (ap_is_default_port(port,r)) { - thisport = ""; - } - else { - apr_snprintf(buf, sizeof(buf), ":%u", port); - thisport = buf; - } - - if (r->filename[0] == '/') { - r->filename = apr_psprintf(r->pool, "%s://%s%s%s", - ap_http_method(r), thisserver, - thisport, r->filename); - } - else { - r->filename = apr_psprintf(r->pool, "%s://%s%s/%s", - ap_http_method(r), thisserver, - thisport, r->filename); - } - } - return; -} - - -/* -** -** return non-zero if the URI is absolute (includes a scheme etc.) -** -*/ - -static int is_absolute_uri(char *uri) -{ - int i = strlen(uri); - if ( (i > 7 && strncasecmp(uri, "http://", 7) == 0) - || (i > 8 && strncasecmp(uri, "https://", 8) == 0) - || (i > 9 && strncasecmp(uri, "gopher://", 9) == 0) - || (i > 6 && strncasecmp(uri, "ftp://", 6) == 0) - || (i > 5 && strncasecmp(uri, "ldap:", 5) == 0) - || (i > 5 && strncasecmp(uri, "news:", 5) == 0) - || (i > 7 && strncasecmp(uri, "mailto:", 7) == 0) ) { - return 1; - } - else { - return 0; - } -} - - -/* -** -** Expand tilde-paths (/~user) through Unix /etc/passwd -** database information (or other OS-specific database) -** -*/ -#if APR_HAS_USER -static char *expand_tildepaths(request_rec *r, char *uri) -{ - char user[LONG_STRING_LEN]; - char *newuri; - int i, j; - char *homedir; - - 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 (apr_get_home_directory(&homedir, user, r->pool) == APR_SUCCESS) { - /* ok, user was found, so expand the ~user string */ - if (uri[i] != '\0') { - /* ~user/anything... has to be expanded */ - if (homedir[strlen(homedir)-1] == '/') { - homedir[strlen(homedir)-1] = '\0'; - } - newuri = apr_pstrcat(r->pool, homedir, uri+i, NULL); - } - else { - /* only ~user has to be expanded */ - newuri = homedir; - } - } - } - return newuri; -} -#endif /* if APR_HAS_USER */ - - - -/* -** +-------------------------------------------------------+ -** | | -** | DBM hashfile support -** | | -** +-------------------------------------------------------+ -*/ - - -static char *lookup_map(request_rec *r, char *name, char *key) -{ - rewrite_server_conf *conf; - apr_array_header_t *rewritemaps; - rewritemap_entry *entries; - rewritemap_entry *s; - char *value; - apr_finfo_t st; - apr_status_t rv; - int i; - - /* get map configuration */ - conf = ap_get_module_config(r->server->module_config, &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 ((rv = apr_stat(&st, s->checkfile, - APR_FINFO_MIN, r->pool)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, 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.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.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.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 ((rv = apr_stat(&st, s->checkfile, - APR_FINFO_MIN, r->pool)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, 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.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.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.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 ((rv = apr_stat(&st, s->checkfile, - APR_FINFO_MIN, r->pool)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, 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.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.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.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, const char *file, char *key) -{ - apr_file_t *fp = NULL; - apr_status_t rc; - char line[1024]; - char *value = NULL; - char *cpT; - size_t skip; - char *curkey; - char *curval; - - rc = apr_file_open(&fp, file, APR_READ, APR_OS_DEFAULT, r->pool); - if (rc != APR_SUCCESS) { - return NULL; - } - - while (apr_file_gets(line, sizeof(line), fp) == APR_SUCCESS) { - 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 = apr_pstrdup(r->pool, curval); - break; - } - apr_file_close(fp); - return value; -} - -#ifndef NO_DBM_REWRITEMAP -static char *lookup_map_dbmfile(request_rec *r, const 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 = apr_pstrdup(r->pool, buf); - } - dbm_close(dbmfp); - } - return value; -} -#endif - -static char *lookup_map_program(request_rec *r, apr_file_t *fpin, - apr_file_t *fpout, char *key) -{ - char buf[LONG_STRING_LEN]; - char c; - int i; - apr_size_t nbytes; - -#ifndef NO_WRITEV - struct iovec iova[2]; - apr_size_t niov; -#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 == NULL || fpout == NULL) { - return NULL; - } - - /* take the lock */ - - if (rewrite_mapr_lock_acquire) { - apr_lock_acquire(rewrite_mapr_lock_acquire); - } - - /* write out the request key */ -#ifdef NO_WRITEV - nbytes = strlen(key); - apr_file_write(fpin, key, &nbytes); - nbytes = 1; - apr_file_write(fpin, "\n", &nbytes); -#else - iova[0].iov_base = key; - iova[0].iov_len = strlen(key); - iova[1].iov_base = "\n"; - iova[1].iov_len = 1; - - niov = 2; - apr_file_writev(fpin, iova, niov, &nbytes); -#endif - - /* read in the response value */ - i = 0; - nbytes = 1; - apr_file_read(fpout, &c, &nbytes); - while (nbytes == 1 && (i < LONG_STRING_LEN-1)) { - if (c == '\n') { - break; - } - buf[i++] = c; - - apr_file_read(fpout, &c, &nbytes); - } - buf[i] = '\0'; - - /* give the lock back */ - if (rewrite_mapr_lock_acquire) { - apr_lock_release(rewrite_mapr_lock_acquire); - } - - if (strcasecmp(buf, "NULL") == 0) { - return NULL; - } - else { - return apr_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 = apr_pstrdup(r->pool, key); cp != NULL && *cp != '\0'; - cp++) { - *cp = apr_toupper(*cp); - } - return value; -} - -static char *rewrite_mapfunc_tolower(request_rec *r, char *key) -{ - char *value, *cp; - - for (cp = value = apr_pstrdup(r->pool, key); cp != NULL && *cp != '\0'; - cp++) { - *cp = apr_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 = apr_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) -{ - rewrite_rand_init(); - - /* Get [0,1) and then scale to the appropriate range. Note that using - * a floating point value ensures that we use all bits of the rand() - * result. Doing an integer modulus would only use the lower-order bits - * which may not be as uniformly random. - */ - return ((double)(rand() % RAND_MAX) / RAND_MAX) * (h - l + 1) + l; -} - -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 = apr_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, apr_pool_t *p) -{ - rewrite_server_conf *conf; - const char *fname; - apr_status_t rc; - piped_log *pl; - int rewritelog_flags = ( APR_WRITE | APR_APPEND | APR_CREATE ); - apr_fileperms_t rewritelog_mode = ( APR_UREAD | APR_UWRITE | APR_GREAD | APR_WREAD ); - - conf = ap_get_module_config(s->module_config, &rewrite_module); - - if (conf->rewritelogfile == NULL) { - return; - } - if (*(conf->rewritelogfile) == '\0') { - return; - } - if (conf->rewritelogfp != NULL) { - 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|APLOG_NOERRNO, 0, 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') { - rc = apr_file_open(&conf->rewritelogfp, fname, rewritelog_flags, rewritelog_mode, p); - if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rc, 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; - apr_size_t nbytes; - 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 == NULL) { - return; - } - if (conf->rewritelogfile == NULL) { - return; - } - if (*(conf->rewritelogfile) == '\0') { - return; - } - - if (level > conf->rewriteloglevel) { - return; - } - - if (r->user == NULL) { - ruser = "-"; - } - else if (strlen(r->user) != 0) { - ruser = r->user; - } - else { - ruser = "\"\""; - } - - rhost = ap_get_remote_host(conn, r->server->module_config, - REMOTE_NOLOOKUP, NULL); - if (rhost == NULL) { - rhost = "UNKNOWN-HOST"; - } - - str1 = apr_pstrcat(r->pool, rhost, " ", - (conn->remote_logname != NULL ? - conn->remote_logname : "-"), " ", - ruser, NULL); - apr_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 { - apr_snprintf(redir, sizeof(redir), "/redir#%d", i); - } - - apr_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); - - apr_lock_acquire(rewrite_log_lock); - nbytes = strlen(str3); - apr_file_write(conf->rewritelogfp, str3, &nbytes); - apr_lock_release(rewrite_log_lock); - - va_end(ap); - return; -} - -static char *current_logtime(request_rec *r) -{ - apr_exploded_time_t t; - char tstr[80]; - apr_size_t len; - - apr_explode_localtime(&t, apr_time_now()); - - apr_strftime(tstr, &len, 80, "[%d/%b/%Y:%H:%M:%S ", &t); - apr_snprintf(tstr + strlen(tstr), 80-strlen(tstr), "%c%.2d%.2d]", - t.tm_gmtoff < 0 ? '-' : '+', - t.tm_gmtoff / (60*60), t.tm_gmtoff % (60*60)); - return apr_pstrdup(r->pool, tstr); -} - - - - -/* -** +-------------------------------------------------------+ -** | | -** | rewriting lockfile support -** | | -** +-------------------------------------------------------+ -*/ - -#define REWRITELOCK_MODE ( APR_UREAD | APR_UWRITE | APR_GREAD | APR_WREAD ) - -static void rewritelock_create(server_rec *s, apr_pool_t *p) -{ - apr_status_t rc; - - /* 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 */ - rc = apr_lock_create (&rewrite_mapr_lock_acquire, APR_MUTEX, APR_LOCKALL, lockname, p); - if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rc, s, - "mod_rewrite: Parent could not create RewriteLock " - "file %s", lockname); - exit(1); - } - - return; -} - -static apr_status_t rewritelock_remove(void *data) -{ - /* only operate if a lockfile is used */ - if (lockname == NULL || *(lockname) == '\0') { - return APR_SUCCESS; - } - - /* destroy the rewritelock */ - apr_lock_destroy (rewrite_mapr_lock_acquire); - rewrite_mapr_lock_acquire = NULL; - lockname = NULL; - return(0); -} - - -/* -** +-------------------------------------------------------+ -** | | -** | program map support -** | | -** +-------------------------------------------------------+ -*/ - -static void run_rewritemap_programs(server_rec *s, apr_pool_t *p) -{ - rewrite_server_conf *conf; - apr_file_t *fpin = NULL; - apr_file_t *fpout = NULL; - apr_file_t *fperr = NULL; - apr_array_header_t *rewritemaps; - rewritemap_entry *entries; - rewritemap_entry *map; - int i; - apr_status_t 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 != NULL - || map->fpout != NULL ) { - continue; - } - fpin = NULL; - fpout = NULL; - rc = rewritemap_program_child(p, map->datafile, - &fpout, &fpin, &fperr); - if (rc != APR_SUCCESS || fpin == NULL || fpout == NULL) { - ap_log_error(APLOG_MARK, APLOG_ERR, rc, s, - "mod_rewrite: could not fork child for " - "RewriteMap process"); - exit(1); - } - map->fpin = fpin; - map->fpout = fpout; - map->fperr = fperr; - } - return; -} - -/* child process code */ -static apr_status_t rewritemap_program_child(apr_pool_t *p, const char *progname, - apr_file_t **fpout, apr_file_t **fpin, - apr_file_t **fperr) -{ - apr_status_t rc; - apr_procattr_t *procattr; - apr_proc_t *procnew; - -#ifdef SIGHUP - apr_signal(SIGHUP, SIG_IGN); -#endif - - - if (((rc = apr_procattr_create(&procattr, p)) != APR_SUCCESS) || - ((rc = apr_procattr_io_set(procattr, APR_FULL_BLOCK, - APR_FULL_NONBLOCK, - APR_FULL_NONBLOCK)) != APR_SUCCESS) || - ((rc = apr_procattr_dir_set(procattr, - ap_make_dirstr_parent(p, progname))) - != APR_SUCCESS) || - ((rc = apr_procattr_cmdtype_set(procattr, APR_PROGRAM)) != APR_SUCCESS)) { - /* Something bad happened, give up and go away. */ - } - else { - procnew = apr_pcalloc(p, sizeof(*procnew)); - rc = apr_proc_create(procnew, progname, NULL, NULL, procattr, p); - - if (rc == APR_SUCCESS) { - apr_pool_note_subprocess(p, procnew, kill_after_timeout); - - if (fpin) { - (*fpin) = procnew->in; - } - - if (fpout) { - (*fpout) = procnew->out; - } - - if (fperr) { - (*fperr) = procnew->err; - } - } - } - - return (rc); -} - - - - -/* -** +-------------------------------------------------------+ -** | | -** | environment variable support -** | | -** +-------------------------------------------------------+ -*/ - - -static char *lookup_variable(request_rec *r, char *var) -{ - const char *result; - char resultbuf[LONG_STRING_LEN]; - apr_exploded_time_t tm; - request_rec *rsub; - - 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, NULL); - } - else if (strcasecmp(var, "REMOTE_USER") == 0) { - result = r->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->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) { - apr_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 */ - apr_snprintf(resultbuf, sizeof(resultbuf), "%d:%d", - MODULE_MAGIC_NUMBER_MAJOR, MODULE_MAGIC_NUMBER_MINOR); - result = resultbuf; - } - -/* XXX: wow this has gotta be slow if you actually use it for a lot, recalculates exploded time for each variable */ - /* underlaying Unix system stuff */ - else if (strcasecmp(var, "TIME_YEAR") == 0) { - apr_explode_localtime(&tm, apr_time_now()); - apr_snprintf(resultbuf, sizeof(resultbuf), "%04d", tm.tm_year + 1900); - result = resultbuf; - } -#define MKTIMESTR(format, tmfield) \ - apr_explode_localtime(&tm, apr_time_now()); \ - apr_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) { - apr_explode_localtime(&tm, apr_time_now()); - apr_snprintf(resultbuf, sizeof(resultbuf), - "%04d%02d%02d%02d%02d%02d", tm.tm_year + 1900, - 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 = apr_table_get(r->notes, var+4); - /* second try the internal Apache env structure */ - if (result == NULL) { - result = apr_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, NULL); \ - /* 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 apr_pool_t */ \ - result = apr_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) - } - - /* file stuff */ - else if (strcasecmp(var, "SCRIPT_USER") == 0) { - result = ""; - if (r->finfo.valid & APR_FINFO_USER) { - apr_get_username((char **)&result, r->finfo.user, r->pool); - } - } - else if (strcasecmp(var, "SCRIPT_GROUP") == 0) { - result = ""; - if (r->finfo.valid & APR_FINFO_GROUP) { - apr_get_groupname((char **)&result, r->finfo.group, r->pool); - } - } - - if (result == NULL) { - return apr_pstrdup(r->pool, ""); - } - else { - return apr_pstrdup(r->pool, result); - } -} - -static char *lookup_header(request_rec *r, const char *name) -{ - apr_array_header_t *hdrs_arr; - apr_table_entry_t *hdrs; - int i; - - hdrs_arr = apr_table_elts(r->headers_in); - hdrs = (apr_table_entry_t *)hdrs_arr->elts; - for (i = 0; i < hdrs_arr->nelts; ++i) { - if (hdrs[i].key == NULL) { - continue; - } - if (strcasecmp(hdrs[i].key, name) == 0) { - apr_table_merge(r->notes, VARY_KEY_THIS, name); - return hdrs[i].val; - } - } - return NULL; -} - - - - -/* -** +-------------------------------------------------------+ -** | | -** | caching support -** | | -** +-------------------------------------------------------+ -*/ - - -static cache *init_cache(apr_pool_t *p) -{ - cache *c; - - c = (cache *)apr_palloc(p, sizeof(cache)); - if (apr_pool_create(&c->pool, p) != APR_SUCCESS) - return NULL; - c->lists = apr_array_make(c->pool, 2, sizeof(cachelist)); - return c; -} - -static void set_cache_string(cache *c, const char *res, int mode, apr_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, const char *res, int mode, - apr_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 apr_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 << 5) + n) ^ (unsigned long)(*p++); - } - - 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, const 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 = apr_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 = apr_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 = apr_array_push(c->lists); - l->resource = apr_pstrdup(c->pool, res); - l->entries = apr_array_make(c->pool, 2, sizeof(cacheentry)); - l->tlb = apr_array_make(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 = apr_array_push(l->entries); - e->time = ce->time; - e->key = apr_pstrdup(c->pool, ce->key); - e->value = apr_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, const 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, - const 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 = apr_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 = apr_pstrdup(r->pool, output+l); - - /* and now add the base-URL as replacement prefix */ - l = apr_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 = apr_pstrcat(r->pool, substbuf, output+1, NULL); - } - else { - rewritelog(r, 4, "add subst prefix: %s -> %s%s", - output, substbuf, output); - output = apr_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'; - apr_cpystrn(val, cp+1, sizeof(val)); - apr_table_set(r->subprocess_env, var, val); - rewritelog(r, 5, "setting env variable '%s' to '%s'", var, val); - } -} - - -/* -** -** check that a subrequest won't cause infinite recursion -** -*/ - -static int subreq_ok(request_rec *r) -{ - /* - * either not in a subrequest, or in a subrequest - * and URIs aren't NULL and sub/main URIs differ - */ - return (r->main == NULL || - (r->main->uri != NULL && r->uri != NULL && - strcmp(r->main->uri, r->uri) != 0)); -} - - -/* -** -** stat() for only the prefix of a path -** -*/ - -static int prefix_stat(const char *path, apr_finfo_t *sb) -{ - char curpath[LONG_STRING_LEN]; - char *cp; - - apr_cpystrn(curpath, path, sizeof(curpath)); - if (curpath[0] != '/') { - return 0; - } - if ((cp = strchr(curpath+1, '/')) != NULL) { - *cp = '\0'; - } - if (apr_stat(sb, curpath, APR_FINFO_MIN, NULL) == APR_SUCCESS) { - return 1; - } - else { - return 0; - } -} - - -/* -** -** 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; -} - -/* -** -** Bracketed expression handling -** s points after the opening bracket -** -*/ - -static char *find_closing_bracket(char *s, int left, int right) -{ - int depth; - - for (depth = 1; *s; ++s) { - if (*s == right && --depth == 0) { - return s; - } - else if (*s == left) { - ++depth; - } - } - return NULL; -} - -static char *find_char_in_brackets(char *s, int c, int left, int right) -{ - int depth; - - for (depth = 1; *s; ++s) { - if (*s == c && depth == 1) { - return s; - } - else if (*s == right && --depth == 0) { - return NULL; - } - else if (*s == left) { - ++depth; - } - } - return NULL; -} - -/* -** -** Module paraphernalia -** -*/ - -#ifdef NETWARE -int main(int argc, char *argv[]) -{ - ExitThread(TSR_THREAD, 0); -} -#endif - - /* the apr_table_t of commands we provide */ -static const command_rec command_table[] = { - AP_INIT_FLAG( "RewriteEngine", cmd_rewriteengine, NULL, OR_FILEINFO, - "On or Off to enable or disable (default) the whole " - "rewriting engine"), - AP_INIT_ITERATE( "RewriteOptions", cmd_rewriteoptions, NULL, OR_FILEINFO, - "List of option strings to set"), - AP_INIT_TAKE1( "RewriteBase", cmd_rewritebase, NULL, OR_FILEINFO, - "the base URL of the per-directory context"), - AP_INIT_RAW_ARGS("RewriteCond", cmd_rewritecond, NULL, OR_FILEINFO, - "an input string and a to be applied regexp-pattern"), - AP_INIT_RAW_ARGS("RewriteRule", cmd_rewriterule, NULL, OR_FILEINFO, - "an URL-applied regexp-pattern and a substitution URL"), - AP_INIT_TAKE2( "RewriteMap", cmd_rewritemap, NULL, RSRC_CONF, - "a mapname and a filename"), - AP_INIT_TAKE1( "RewriteLock", cmd_rewritelock, NULL, RSRC_CONF, - "the filename of a lockfile used for inter-process " - "synchronization"), - AP_INIT_TAKE1( "RewriteLog", cmd_rewritelog, NULL, RSRC_CONF, - "the filename of the rewriting logfile"), - AP_INIT_TAKE1( "RewriteLogLevel", cmd_rewriteloglevel, NULL, RSRC_CONF, - "the level of the rewriting logfile verbosity " - "(0=none, 1=std, .., 9=max)"), - { NULL } -}; - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_handler(handler_redirect, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_post_config(init_module,NULL,NULL,APR_HOOK_MIDDLE); - ap_hook_child_init(init_child,NULL,NULL,APR_HOOK_MIDDLE); - - ap_hook_fixups(hook_fixup,NULL,NULL,APR_HOOK_FIRST); - ap_hook_translate_name(hook_uri2file,NULL,NULL,APR_HOOK_FIRST); - ap_hook_type_checker(hook_mimetype,NULL,NULL,APR_HOOK_MIDDLE); -} - - /* the main config structure */ -module AP_MODULE_DECLARE_DATA rewrite_module = { - STANDARD20_MODULE_STUFF, - 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, /* apr_table_t of config file commands */ - register_hooks /* register hooks */ -}; - -/*EOF*/ diff --git a/modules/mappers/mod_rewrite.dsp b/modules/mappers/mod_rewrite.dsp deleted file mode 100644 index b88f0b0fce..0000000000 --- a/modules/mappers/mod_rewrite.dsp +++ /dev/null @@ -1,95 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_rewrite" - 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_rewrite - 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_rewrite.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_rewrite.mak" CFG="mod_rewrite - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_rewrite - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_rewrite - 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_rewrite - 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" /D "NO_DBM_REWRITEMAP" /Fd"Release\mod_rewrite" /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_rewrite.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_rewrite -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_rewrite.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_rewrite - -!ELSEIF "$(CFG)" == "mod_rewrite - 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" /D "NO_DBM_REWRITEMAP" /Fd"Debug\mod_rewrite" /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_rewrite.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_rewrite -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_rewrite.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_rewrite - -!ENDIF - -# Begin Target - -# Name "mod_rewrite - Win32 Release" -# Name "mod_rewrite - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_rewrite.c -# End Source File -# End Target -# End Project diff --git a/modules/mappers/mod_rewrite.exp b/modules/mappers/mod_rewrite.exp deleted file mode 100644 index 8f2165bfe0..0000000000 --- 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 f139877978..0000000000 --- a/modules/mappers/mod_rewrite.h +++ /dev/null @@ -1,473 +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 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 Software Foundation in July 1997 by -** -** Ralf S. Engelschall -** rse@engelschall.com -** www.engelschall.com -*/ - -#include "apr.h" - -#define APR_WANT_STRFUNC -#define APR_WANT_MEMFUNC -#include "apr_want.h" - - /* Include from the underlaying Unix system ... */ -#if APR_HAVE_STDARG_H -#include -#endif -#if APR_HAVE_STDLIB_H -#include -#endif -#if APR_HAVE_CTYPE_H -#include -#endif -#if APR_HAVE_SYS_TYPES_H -#include -#endif - -#include "ap_config.h" - - /* Include from the Apache server ... */ -#define CORE_PRIVATE -#include "httpd.h" -#include "http_config.h" -#include "http_request.h" -#include "http_core.h" -#include "http_log.h" -#include "http_vhost.h" - - /* - * The key in the r->notes apr_table_t 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 - - -/* -** -** 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 { - const char *name; /* the name of the map */ - const char *datafile; /* filename for map data files */ - const char *checkfile; /* filename to check for map existence */ - int type; /* the type of the map */ - apr_file_t *fpin; /* in file pointer for program maps */ - apr_file_t *fpout; /* out file pointer for program maps */ - apr_file_t *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 { - apr_array_header_t *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 */ - const char *rewritelogfile; /* the RewriteLog filename */ - apr_file_t *rewritelogfp; /* the RewriteLog open filepointer */ - int rewriteloglevel; /* the RewriteLog level of verbosity */ - apr_array_header_t *rewritemaps; /* the RewriteMap entries */ - apr_array_header_t *rewriteconds; /* the RewriteCond entries (temporary) */ - apr_array_header_t *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 */ - apr_array_header_t *rewriteconds; /* the RewriteCond entries (temporary) */ - apr_array_header_t *rewriterules; /* the RewriteRule entries */ - char *directory; /* the directory where it applies */ - const char *baseurl; /* the base-URL where it applies */ -} rewrite_perdir_conf; - - - /* the cache structures, - * a 4-way hash apr_table_t with LRU functionality - */ -typedef struct cacheentry { - apr_time_t time; - char *key; - char *value; -} cacheentry; - -typedef struct tlbentry { - int t[CACHE_TLB_COLS]; -} cachetlbentry; - -typedef struct cachelist { - char *resource; - apr_array_header_t *entries; - apr_array_header_t *tlb; -} cachelist; - -typedef struct cache { - apr_pool_t *pool; - apr_array_header_t *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(apr_pool_t *p, server_rec *s); -static void *config_server_merge (apr_pool_t *p, void *basev, void *overridesv); -static void *config_perdir_create(apr_pool_t *p, char *path); -static void *config_perdir_merge (apr_pool_t *p, void *basev, void *overridesv); - - /* config directive handling */ -static const char *cmd_rewriteengine(cmd_parms *cmd, - void *dconf, int flag); -static const char *cmd_rewriteoptions(cmd_parms *cmd, - void *dconf, - const char *option); -static const char *cmd_rewriteoptions_setoption(apr_pool_t *p, int *options, - const char *name); -static const char *cmd_rewritelog (cmd_parms *cmd, void *dconf, const char *a1); -static const char *cmd_rewriteloglevel(cmd_parms *cmd, void *dconf, const char *a1); -static const char *cmd_rewritemap (cmd_parms *cmd, void *dconf, - const char *a1, const char *a2); -static const char *cmd_rewritelock(cmd_parms *cmd, void *dconf, const char *a1); -static const char *cmd_rewritebase(cmd_parms *cmd, void *dconf, - const char *a1); -static const char *cmd_rewritecond(cmd_parms *cmd, void *dconf, - const char *str); -static const char *cmd_rewritecond_parseflagfield(apr_pool_t *p, - rewritecond_entry *new, - char *str); -static const char *cmd_rewritecond_setflag(apr_pool_t *p, rewritecond_entry *cfg, - char *key, char *val); -static const char *cmd_rewriterule(cmd_parms *cmd, void *dconf, - const char *str); -static const char *cmd_rewriterule_parseflagfield(apr_pool_t *p, - rewriterule_entry *new, - char *str); -static const char *cmd_rewriterule_setflag(apr_pool_t *p, rewriterule_entry *cfg, - char *key, char *val); - - /* initialisation */ -static void init_module(apr_pool_t *p, - apr_pool_t *plog, - apr_pool_t *ptemp, - server_rec *s); -static void init_child(apr_pool_t *p, server_rec *s); - - /* 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, apr_array_header_t *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); - -static void do_expand(request_rec *r, char *input, char *buffer, int nbuf, - backrefinfo *briRR, backrefinfo *briRC); -static void do_expand_env(request_rec *r, char *env[], - 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 int is_absolute_uri(char *uri); -static char *expand_tildepaths(request_rec *r, char *uri); - - /* rewrite map support functions */ -static char *lookup_map(request_rec *r, char *name, char *key); -static char *lookup_map_txtfile(request_rec *r, const char *file, char *key); -#ifndef NO_DBM_REWRITEMAP -static char *lookup_map_dbmfile(request_rec *r, const char *file, char *key); -#endif -static char *lookup_map_program(request_rec *r, apr_file_t *fpin, - apr_file_t *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, apr_pool_t *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, apr_pool_t *p); -static apr_status_t rewritelock_remove(void *data); - - /* program map support */ -static void run_rewritemap_programs(server_rec *s, apr_pool_t *p); -static apr_status_t rewritemap_program_child(apr_pool_t *p, const char *progname, - apr_file_t **fpout, apr_file_t **fpin, - apr_file_t **fperr); - - /* env variable support */ -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(apr_pool_t *p); -static char *get_cache_string(cache *c, const char *res, int mode, apr_time_t mtime, - char *key); -static void set_cache_string(cache *c, const char *res, int mode, apr_time_t mtime, - char *key, char *value); -static cacheentry *retrieve_cache_string(cache *c, const char *res, char *key); -static void store_cache_string(cache *c, const char *res, cacheentry *ce); - - /* misc functions */ -static char *subst_prefix_path(request_rec *r, char *input, char *match, - const char *subst); -static int parseargline(char *str, char **a1, char **a2, char **a3); -static int prefix_stat(const char *path, apr_finfo_t *sb); -static void add_env_variable(request_rec *r, char *s); -static int subreq_ok(request_rec *r); - - /* Lexicographic Comparison */ -static int compare_lexicography(char *cpNum1, char *cpNum2); - - /* Bracketed expression handling */ -static char *find_closing_bracket(char *s, int left, int right); -static char *find_char_in_brackets(char *s, int c, int left, int right); - -#endif /* MOD_REWRITE_H */ diff --git a/modules/mappers/mod_rewrite.mak b/modules/mappers/mod_rewrite.mak deleted file mode 100644 index 135063b48d..0000000000 --- a/modules/mappers/mod_rewrite.mak +++ /dev/null @@ -1,335 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on mod_rewrite.dsp -!IF "$(CFG)" == "" -CFG=mod_rewrite - Win32 Release -!MESSAGE No configuration specified. Defaulting to mod_rewrite - Win32 Release. -!ENDIF - -!IF "$(CFG)" != "mod_rewrite - Win32 Release" && "$(CFG)" !=\ - "mod_rewrite - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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_rewrite.mak" CFG="mod_rewrite - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_rewrite - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_rewrite - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "mod_rewrite - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_rewrite.so" - -!ELSE - -ALL : "libhttpd - Win32 Release" "libapr - Win32 Release"\ - "$(OUTDIR)\mod_rewrite.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 ReleaseCLEAN" "libhttpd - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_rewrite.idb" - -@erase "$(INTDIR)\mod_rewrite.obj" - -@erase "$(OUTDIR)\mod_rewrite.exp" - -@erase "$(OUTDIR)\mod_rewrite.lib" - -@erase "$(OUTDIR)\mod_rewrite.map" - -@erase "$(OUTDIR)\mod_rewrite.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I\ - "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D\ - "WIN32" /D "_WINDOWS" /D "NO_DBM_REWRITEMAP" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\mod_rewrite" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_rewrite.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_rewrite.pdb" /map:"$(INTDIR)\mod_rewrite.map" /machine:I386\ - /out:"$(OUTDIR)\mod_rewrite.so" /implib:"$(OUTDIR)\mod_rewrite.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_rewrite -LINK32_OBJS= \ - "$(INTDIR)\mod_rewrite.obj" \ - "..\..\Release\libhttpd.lib" \ - "..\..\srclib\apr\Release\libapr.lib" - -"$(OUTDIR)\mod_rewrite.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "mod_rewrite - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_rewrite.so" - -!ELSE - -ALL : "libhttpd - Win32 Debug" "libapr - Win32 Debug"\ - "$(OUTDIR)\mod_rewrite.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 DebugCLEAN" "libhttpd - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_rewrite.idb" - -@erase "$(INTDIR)\mod_rewrite.obj" - -@erase "$(OUTDIR)\mod_rewrite.exp" - -@erase "$(OUTDIR)\mod_rewrite.lib" - -@erase "$(OUTDIR)\mod_rewrite.map" - -@erase "$(OUTDIR)\mod_rewrite.pdb" - -@erase "$(OUTDIR)\mod_rewrite.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /D "NO_DBM_REWRITEMAP" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\mod_rewrite" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_rewrite.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_rewrite.pdb" /map:"$(INTDIR)\mod_rewrite.map" /debug\ - /machine:I386 /out:"$(OUTDIR)\mod_rewrite.so"\ - /implib:"$(OUTDIR)\mod_rewrite.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_rewrite -LINK32_OBJS= \ - "$(INTDIR)\mod_rewrite.obj" \ - "..\..\Debug\libhttpd.lib" \ - "..\..\srclib\apr\Debug\libapr.lib" - -"$(OUTDIR)\mod_rewrite.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "mod_rewrite - Win32 Release" || "$(CFG)" ==\ - "mod_rewrite - Win32 Debug" - -!IF "$(CFG)" == "mod_rewrite - Win32 Release" - -"libapr - Win32 Release" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Release" - cd "..\..\modules\mappers" - -"libapr - Win32 ReleaseCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\..\modules\mappers" - -!ELSEIF "$(CFG)" == "mod_rewrite - Win32 Debug" - -"libapr - Win32 Debug" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Debug" - cd "..\..\modules\mappers" - -"libapr - Win32 DebugCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\..\modules\mappers" - -!ENDIF - -!IF "$(CFG)" == "mod_rewrite - Win32 Release" - -"libhttpd - Win32 Release" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Release" - cd ".\modules\mappers" - -"libhttpd - Win32 ReleaseCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Release"\ - RECURSE=1 - cd ".\modules\mappers" - -!ELSEIF "$(CFG)" == "mod_rewrite - Win32 Debug" - -"libhttpd - Win32 Debug" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Debug" - cd ".\modules\mappers" - -"libhttpd - Win32 DebugCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Debug"\ - RECURSE=1 - cd ".\modules\mappers" - -!ENDIF - -SOURCE=.\mod_rewrite.c -DEP_CPP_MOD_R=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.h"\ - "..\..\include\ap_release.h"\ - "..\..\include\http_config.h"\ - "..\..\include\http_core.h"\ - "..\..\include\http_log.h"\ - "..\..\include\http_protocol.h"\ - "..\..\include\http_request.h"\ - "..\..\include\http_vhost.h"\ - "..\..\include\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\srclib\apr-util\include\apu.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_dso.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_lib.h"\ - "..\..\srclib\apr\include\apr_lock.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_portable.h"\ - "..\..\srclib\apr\include\apr_signal.h"\ - "..\..\srclib\apr\include\apr_strings.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\include\apr_user.h"\ - "..\..\srclib\apr\include\apr_want.h"\ - ".\mod_rewrite.h"\ - -NODEP_CPP_MOD_R=\ - "..\..\include\ap_config_auto.h"\ - ".\unixd.h"\ - - -"$(INTDIR)\mod_rewrite.obj" : $(SOURCE) $(DEP_CPP_MOD_R) "$(INTDIR)" - - - -!ENDIF - diff --git a/modules/mappers/mod_so.c b/modules/mappers/mod_so.c deleted file mode 100644 index ba9466f622..0000000000 --- a/modules/mappers/mod_so.c +++ /dev/null @@ -1,353 +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. - */ - -/* - * 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 WINCH 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 WINCH 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 builtin 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. - * - */ - -#include "apr.h" -#include "apr_dso.h" -#include "apr_strings.h" -#include "apr_errno.h" - -#define CORE_PRIVATE -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" -#include "ap_config.h" - -module AP_MODULE_DECLARE_DATA so_module; - - -/* - * Server configuration to keep track of actually - * loaded modules and the corresponding module name. - */ - -typedef struct moduleinfo { - const char *name; - module *modp; -} moduleinfo; - -typedef struct so_server_conf { - apr_array_header_t *loaded_modules; -} so_server_conf; - -static void *so_sconf_create(apr_pool_t *p, server_rec *s) -{ - so_server_conf *soc; - - soc = (so_server_conf *)apr_pcalloc(p, sizeof(so_server_conf)); - soc->loaded_modules = apr_array_make(p, DYNAMIC_MODULE_LIMIT, - sizeof(moduleinfo)); - - 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 apr_status_t unload_module(void *data) -{ - moduleinfo *modi = (moduleinfo*)data; - - /* only unload if module information is still existing */ - if (modi->modp == NULL) - return APR_SUCCESS; - - /* remove the module pointer from the core structure */ - ap_remove_loaded_module(modi->modp); - - /* destroy the module information */ - modi->modp = NULL; - modi->name = NULL; - return APR_SUCCESS; -} - -/* - * 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, - const char *modname, const char *filename) -{ - apr_dso_handle_t *modhandle; - apr_dso_handle_sym_t modsym; - module *modp; - const char *szModuleFile=ap_server_root_relative(cmd->pool, filename); - so_server_conf *sconf; - moduleinfo *modi; - moduleinfo *modie; - int i; - - /* we need to setup this value for dummy to make sure that we don't try - * to add a non-existant tree into the build when we return to - * execute_now. - */ - *(ap_directive_t **)dummy = NULL; - - /* - * 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 = apr_array_push(sconf->loaded_modules); - modi->name = modname; - - /* - * Load the file into the Apache address space - */ - if (apr_dso_load(&modhandle, szModuleFile, cmd->pool) != APR_SUCCESS) { - char my_error[256]; - - return apr_pstrcat(cmd->pool, "Cannot load ", szModuleFile, - " into server: ", - apr_dso_error(modhandle, my_error, sizeof(my_error)), - NULL); - } - ap_log_perror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, cmd->pool, - "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 (apr_dso_sym(&modsym, modhandle, modname) != APR_SUCCESS) { - char my_error[256]; - - return apr_pstrcat(cmd->pool, "Can't locate API module structure `", - modname, "' in file ", szModuleFile, ": ", - apr_dso_error(modhandle, my_error, sizeof(my_error)), - NULL); - } - modp = (module*) modsym; - modp->dynamic_load_handle = (apr_dso_handle_t *)modhandle; - modi->modp = modp; - - /* - * Make sure the found module structure is really a module structure - * - */ - if (modp->magic != MODULE_MAGIC_COOKIE) { - return apr_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, cmd->pool); - - /* - * Register a cleanup in the config apr_pool_t (normally pconf). When - * we do a restart (or shutdown) this cleanup will cause the - * shared object to be unloaded. - */ - apr_pool_cleanup_register(cmd->pool, modi, unload_module, apr_pool_cleanup_null); - - /* - * 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, const char *filename) -{ - apr_dso_handle_t *handle; - const char *file; - - file = ap_server_root_relative(cmd->pool, filename); - - if (apr_dso_load(&handle, file, cmd->pool) != APR_SUCCESS) { - char my_error[256]; - - return apr_pstrcat(cmd->pool, "Cannot load ", filename, - " into server: ", - apr_dso_error(handle, my_error, sizeof(my_error)), - NULL); - } - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL, - "loaded file %s", filename); - - return NULL; -} - -#else /* not NO_DLOPEN */ - -static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename) -{ - ap_log_perror(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, cmd->pool, - "WARNING: LoadFile not supported on this platform"); - return NULL; -} - -static const char *load_module(cmd_parms *cmd, void *dummy, - const char *modname, const char *filename) -{ - ap_log_perror(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, cmd->pool, - "WARNING: LoadModule not supported on this platform"); - return NULL; -} - -#endif /* NO_DLOPEN */ - -static const command_rec so_cmds[] = { - AP_INIT_TAKE2("LoadModule", load_module, NULL, RSRC_CONF | EXEC_ON_READ, - "a module name and the name of a shared object file to load it from"), - AP_INIT_ITERATE("LoadFile", load_file, NULL, RSRC_CONF, - "shared object file or library to load into the server at runtime"), - { NULL } -}; - -module AP_MODULE_DECLARE_DATA so_module = { - STANDARD20_MODULE_STUFF, - NULL, /* create per-dir config */ - NULL, /* merge per-dir config */ - so_sconf_create, /* server config */ - NULL, /* merge server config */ - so_cmds, /* command apr_table_t */ - NULL /* register hooks */ -}; diff --git a/modules/mappers/mod_speling.c b/modules/mappers/mod_speling.c deleted file mode 100644 index d89a86923d..0000000000 --- a/modules/mappers/mod_speling.c +++ /dev/null @@ -1,569 +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_file_io.h" -#include "apr_strings.h" -#include "apr_lib.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#define WANT_BASENAME_MATCH - -#include "httpd.h" -#include "http_core.h" -#include "http_config.h" -#include "http_request.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" - */ - -AP_MODULE_DECLARE_DATA 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(apr_pool_t *p) -{ - spconfig *cfg = apr_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(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); -} - -/* - * 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[] = -{ - AP_INIT_FLAG("CheckSpelling", set_speling, NULL, OR_OPTIONS, - "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 (; apr_tolower(*s) == apr_tolower(*t); t++, s++) { - if (*t == '\0') { - return SP_MISCAPITALIZED; /* exact match (sans case) */ - } - } - if (*s) { - if (*t) { - if (s[1] && t[1] && apr_tolower(*s) == apr_tolower(t[1]) - && apr_tolower(*t) == apr_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; - apr_finfo_t dirent; - int filoc, dotloc, urlen, pglen; - apr_array_header_t *candidates = NULL; - apr_dir_t *dir; - - 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.filetype != 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 = apr_pstrndup(r->pool, r->filename, filoc); - /* bad = mispelling */ - bad = apr_pstrdup(r->pool, r->filename + filoc + 1); - /* postgood = mispelling/more */ - postgood = apr_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 = apr_pstrndup(r->pool, r->uri, (urlen - pglen)); - - /* Now open the directory and do ourselves a check... */ - if (apr_dir_open(&dir, good, r->pool) != APR_SUCCESS) { - /* Oops, not a directory... */ - return DECLINED; - } - - candidates = apr_array_make(r->pool, 2, sizeof(misspelled_file)); - - dotloc = ap_ind(bad, '.'); - if (dotloc == -1) { - dotloc = strlen(bad); - } - - while (apr_dir_read(&dirent, APR_FINFO_DIRENT, dir) == APR_SUCCESS) { - 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, dirent.name) == 0) { - apr_dir_close(dir); - return OK; - } - - /* - * miscapitalization errors are checked first (like, e.g., lower case - * file, upper case request) - */ - else if (strcasecmp(bad, dirent.name) == 0) { - misspelled_file *sp_new; - - sp_new = (misspelled_file *) apr_array_push(candidates); - sp_new->name = apr_pstrdup(r->pool, dirent.name); - sp_new->quality = SP_MISCAPITALIZED; - } - - /* - * simple typing errors are checked next (like, e.g., - * missing/extra/transposed char) - */ - else if ((q = spdist(bad, dirent.name)) != SP_VERYDIFFERENT) { - misspelled_file *sp_new; - - sp_new = (misspelled_file *) apr_array_push(candidates); - sp_new->name = apr_pstrdup(r->pool, dirent.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(dirent.name, '.'); - if (entloc == -1) { - entloc = strlen(dirent.name); - } - - if ((dotloc == entloc) - && !strncasecmp(bad, dirent.name, dotloc)) { - misspelled_file *sp_new; - - sp_new = (misspelled_file *) apr_array_push(candidates); - sp_new->name = apr_pstrdup(r->pool, dirent.name); - sp_new->quality = SP_VERYDIFFERENT; - } -#endif - } - } - apr_dir_close(dir); - - 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 = apr_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_escape_uri(r->pool, apr_pstrcat(r->pool, url, - variant[0].name, - r->path_info, NULL)); - if (r->parsed_uri.query) - nuri = apr_pstrcat(r->pool, nuri, "?", r->parsed_uri.query, NULL); - - apr_table_setn(r->headers_out, "Location", - ap_construct_url(r->pool, nuri, r)); - - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_INFO, APR_SUCCESS, - 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 { - apr_pool_t *p; - apr_table_t *notes; - apr_pool_t *sub_pool; - apr_array_header_t *t; - apr_array_header_t *v; - - - if (r->main == NULL) { - p = r->pool; - notes = r->notes; - } - else { - p = r->main->pool; - notes = r->main->notes; - } - - if (apr_pool_create(&sub_pool, p) != APR_SUCCESS) - return DECLINED; - - t = apr_array_make(sub_pool, candidates->nelts * 8 + 8, - sizeof(char *)); - v = apr_array_make(sub_pool, candidates->nelts * 5, - sizeof(char *)); - - /* Generate the response text. */ - - *(const char **)apr_array_push(t) = - "The document name you requested ("; - *(const char **)apr_array_push(t) = ap_escape_html(sub_pool, r->uri); - *(const char **)apr_array_push(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 = apr_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 **)apr_array_push(v) = "\""; - *(const char **)apr_array_push(v) = ap_escape_uri(sub_pool, vuri); - *(const char **)apr_array_push(v) = "\";\""; - *(const char **)apr_array_push(v) = reason; - *(const char **)apr_array_push(v) = "\""; - - *(const char **)apr_array_push(t) = "
    • "; - *(const char **)apr_array_push(t) = ap_escape_html(sub_pool, vuri); - *(const char **)apr_array_push(t) = " ("; - *(const char **)apr_array_push(t) = reason; - *(const char **)apr_array_push(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 **)apr_array_push(t) = - "
    \nFurthermore, the following related " - "documents were found:\n
      \n"; - } - } - *(const char **)apr_array_push(t) = "
    \n"; - - /* If we know there was a referring page, add a note: */ - if (ref != NULL) { - *(const char **)apr_array_push(t) = - "Please consider informing the owner of the " - "referring page " - "about the broken link.\n"; - } - - - /* Pass our apr_table_t to http_protocol.c (see mod_negotiation): */ - apr_table_setn(notes, "variant-list", apr_array_pstrcat(p, t, 0)); - - apr_table_mergen(r->subprocess_env, "VARIANTS", - apr_array_pstrcat(p, v, ',')); - - apr_pool_destroy(sub_pool); - - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_INFO, 0, 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; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_fixups(check_speling,NULL,NULL,APR_HOOK_LAST); -} - -module AP_MODULE_DECLARE_DATA speling_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 */ - speling_cmds, /* command apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/mappers/mod_speling.dsp b/modules/mappers/mod_speling.dsp deleted file mode 100644 index 15c098ca02..0000000000 --- a/modules/mappers/mod_speling.dsp +++ /dev/null @@ -1,95 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_speling" - 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_speling - 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_speling.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_speling.mak" CFG="mod_speling - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_speling - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_speling - 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_speling - 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_speling" /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_speling.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_speling -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_speling.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_speling - -!ELSEIF "$(CFG)" == "mod_speling - 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_speling" /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_speling.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_speling -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_speling.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_speling - -!ENDIF - -# Begin Target - -# Name "mod_speling - Win32 Release" -# Name "mod_speling - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_speling.c -# End Source File -# End Target -# End Project diff --git a/modules/mappers/mod_speling.exp b/modules/mappers/mod_speling.exp deleted file mode 100644 index a6ee8b5034..0000000000 --- a/modules/mappers/mod_speling.exp +++ /dev/null @@ -1 +0,0 @@ -speling_module diff --git a/modules/mappers/mod_speling.mak b/modules/mappers/mod_speling.mak deleted file mode 100644 index bc9460d0c3..0000000000 --- a/modules/mappers/mod_speling.mak +++ /dev/null @@ -1,325 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on mod_speling.dsp -!IF "$(CFG)" == "" -CFG=mod_speling - Win32 Release -!MESSAGE No configuration specified. Defaulting to mod_speling - Win32 Release. -!ENDIF - -!IF "$(CFG)" != "mod_speling - Win32 Release" && "$(CFG)" !=\ - "mod_speling - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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_speling.mak" CFG="mod_speling - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_speling - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_speling - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "mod_speling - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_speling.so" - -!ELSE - -ALL : "libhttpd - Win32 Release" "libapr - Win32 Release"\ - "$(OUTDIR)\mod_speling.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 ReleaseCLEAN" "libhttpd - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_speling.idb" - -@erase "$(INTDIR)\mod_speling.obj" - -@erase "$(OUTDIR)\mod_speling.exp" - -@erase "$(OUTDIR)\mod_speling.lib" - -@erase "$(OUTDIR)\mod_speling.map" - -@erase "$(OUTDIR)\mod_speling.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I\ - "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D\ - "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_speling" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_speling.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_speling.pdb" /map:"$(INTDIR)\mod_speling.map" /machine:I386\ - /out:"$(OUTDIR)\mod_speling.so" /implib:"$(OUTDIR)\mod_speling.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_speling -LINK32_OBJS= \ - "$(INTDIR)\mod_speling.obj" \ - "..\..\Release\libhttpd.lib" \ - "..\..\srclib\apr\Release\libapr.lib" - -"$(OUTDIR)\mod_speling.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "mod_speling - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_speling.so" - -!ELSE - -ALL : "libhttpd - Win32 Debug" "libapr - Win32 Debug"\ - "$(OUTDIR)\mod_speling.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 DebugCLEAN" "libhttpd - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_speling.idb" - -@erase "$(INTDIR)\mod_speling.obj" - -@erase "$(OUTDIR)\mod_speling.exp" - -@erase "$(OUTDIR)\mod_speling.lib" - -@erase "$(OUTDIR)\mod_speling.map" - -@erase "$(OUTDIR)\mod_speling.pdb" - -@erase "$(OUTDIR)\mod_speling.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_speling" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_speling.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_speling.pdb" /map:"$(INTDIR)\mod_speling.map" /debug\ - /machine:I386 /out:"$(OUTDIR)\mod_speling.so"\ - /implib:"$(OUTDIR)\mod_speling.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_speling -LINK32_OBJS= \ - "$(INTDIR)\mod_speling.obj" \ - "..\..\Debug\libhttpd.lib" \ - "..\..\srclib\apr\Debug\libapr.lib" - -"$(OUTDIR)\mod_speling.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "mod_speling - Win32 Release" || "$(CFG)" ==\ - "mod_speling - Win32 Debug" - -!IF "$(CFG)" == "mod_speling - Win32 Release" - -"libapr - Win32 Release" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Release" - cd "..\..\modules\mappers" - -"libapr - Win32 ReleaseCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\..\modules\mappers" - -!ELSEIF "$(CFG)" == "mod_speling - Win32 Debug" - -"libapr - Win32 Debug" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Debug" - cd "..\..\modules\mappers" - -"libapr - Win32 DebugCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\..\modules\mappers" - -!ENDIF - -!IF "$(CFG)" == "mod_speling - Win32 Release" - -"libhttpd - Win32 Release" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Release" - cd ".\modules\mappers" - -"libhttpd - Win32 ReleaseCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Release"\ - RECURSE=1 - cd ".\modules\mappers" - -!ELSEIF "$(CFG)" == "mod_speling - Win32 Debug" - -"libhttpd - Win32 Debug" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Debug" - cd ".\modules\mappers" - -"libhttpd - Win32 DebugCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Debug"\ - RECURSE=1 - cd ".\modules\mappers" - -!ENDIF - -SOURCE=.\mod_speling.c -DEP_CPP_MOD_S=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.h"\ - "..\..\include\ap_release.h"\ - "..\..\include\http_config.h"\ - "..\..\include\http_core.h"\ - "..\..\include\http_log.h"\ - "..\..\include\http_request.h"\ - "..\..\include\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\srclib\apr-util\include\apu.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_lib.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_strings.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\include\apr_user.h"\ - "..\..\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_S=\ - "..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_speling.obj" : $(SOURCE) $(DEP_CPP_MOD_S) "$(INTDIR)" - - - -!ENDIF - diff --git a/modules/mappers/mod_userdir.c b/modules/mappers/mod_userdir.c deleted file mode 100644 index baf8a51b12..0000000000 --- a/modules/mappers/mod_userdir.c +++ /dev/null @@ -1,399 +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. - */ - -/* - * 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 "apr_strings.h" -#include "apr_user.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if APR_HAVE_UNISTD_H -#include -#endif - -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_request.h" - -#if !defined(WIN32) && !defined(OS2) && !defined(BEOS) -#define HAVE_UNIX_SUEXEC -#endif - -#ifdef HAVE_UNIX_SUEXEC -#include "unixd.h" /* Contains the suexec_identity hook used on Unix */ -#endif - - -/* The default directory in user's home dir */ -#ifndef DEFAULT_USER_DIR -#define DEFAULT_USER_DIR "public_html" -#endif - -module userdir_module; - -typedef struct { - int globally_disabled; - char *userdir; - apr_table_t *enabled_users; - apr_table_t *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(apr_pool_t *p, server_rec *s) -{ - userdir_config *newcfg = apr_pcalloc(p, sizeof(*newcfg)); - - newcfg->globally_disabled = 0; - newcfg->userdir = DEFAULT_USER_DIR; - newcfg->enabled_users = apr_table_make(p, 4); - newcfg->disabled_users = apr_table_make(p, 4); - - return newcfg; -} - -#define O_DEFAULT 0 -#define O_ENABLE 1 -#define O_DISABLE 2 - -static const char *set_user_dir(cmd_parms *cmd, void *dummy, const char *arg) -{ - userdir_config *s_cfg = ap_get_module_config(cmd->server->module_config, - &userdir_module); - char *username; - const char *usernames = arg; - char *kw = ap_getword_conf(cmd->pool, &usernames); - apr_table_t *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 = apr_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); - apr_table_setn(usertable, username, kw); - } - return NULL; -} - -static const command_rec userdir_cmds[] = { - AP_INIT_RAW_ARGS("UserDir", set_user_dir, NULL, RSRC_CONF, - "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) -{ - ap_conf_vector_t *server_conf = r->server->module_config; - const userdir_config *s_cfg = 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; - apr_finfo_t 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 (apr_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 - && apr_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; - apr_status_t rv; - - if (ap_strchr_c(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, ignore - * a : as the first or second character, and assume a file - * was specified - * - * XXX: Still no good for NETWARE, since : is embedded (sys:/home) - */ - if (strchr(x + 2, ':')) -#else - if (strchr(x, ':')) -#endif /* HAVE_DRIVE_LETTERS */ - { - redirect = apr_pstrcat(r->pool, x, w, userdir, dname, NULL); - apr_table_setn(r->headers_out, "Location", redirect); - return HTTP_MOVED_TEMPORARILY; - } - else - filename = apr_pstrcat(r->pool, x, w, userdir, NULL); - } - else - filename = apr_pstrcat(r->pool, userdir, "/", w, NULL); - } - else if (ap_strchr_c(userdir, ':')) { - redirect = apr_pstrcat(r->pool, userdir, "/", w, dname, NULL); - apr_table_setn(r->headers_out, "Location", redirect); - return HTTP_MOVED_TEMPORARILY; - } - else { -#if APR_HAS_USER - char *homedir; - - if (apr_get_home_directory(&homedir, w, r->pool) == APR_SUCCESS) { - filename = apr_pstrcat(r->pool, homedir, "/", userdir, NULL); - } - else { - return DECLINED; - } -#else - return DECLINED; -#endif - } - - /* - * 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 - || ((rv = apr_stat(&statbuf, filename, APR_FINFO_MIN, - r->pool)) == APR_SUCCESS - || rv == APR_INCOMPLETE))) { - r->filename = apr_pstrcat(r->pool, filename, dname, NULL); - /* XXX: Does this walk us around FollowSymLink rules? - * 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; - - /* For use in the get_suexec_identity phase */ - apr_table_setn(r->notes, "mod_userdir_user", w); - - return OK; - } - } - - return DECLINED; -} - -#ifdef HAVE_UNIX_SUEXEC -static ap_unix_identity_t *get_suexec_id_doer(const request_rec *r) -{ - ap_unix_identity_t *ugid = NULL; -#if APR_HAS_USER - const char *username = apr_table_get(r->notes, "mod_userdir_user"); - - if (username == NULL) { - return NULL; - } - - if ((ugid = apr_palloc(r->pool, sizeof(ap_unix_identity_t *))) == NULL) { - return NULL; - } - - if (apr_get_userid(&ugid->uid, &ugid->gid, username, r->pool) != APR_SUCCESS) { - return NULL; - } - -#endif - return ugid; -} -#endif /* HAVE_UNIX_SUEXEC */ - -static void register_hooks(apr_pool_t *p) -{ - static const char * const aszSucc[]={ "mod_alias.c",NULL }; - - ap_hook_translate_name(translate_userdir,NULL,aszSucc,APR_HOOK_MIDDLE); -#ifdef HAVE_UNIX_SUEXEC - ap_hook_get_suexec_identity(get_suexec_id_doer,NULL,NULL,APR_HOOK_MIDDLE); -#endif -} - -module userdir_module = { - STANDARD20_MODULE_STUFF, - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - create_userdir_config, /* server config */ - NULL, /* merge server config */ - userdir_cmds, /* command apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/mappers/mod_userdir.exp b/modules/mappers/mod_userdir.exp deleted file mode 100644 index 6b8b81d5c3..0000000000 --- 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 09994fb7a4..0000000000 --- a/modules/mappers/mod_vhost_alias.c +++ /dev/null @@ -1,490 +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. - */ - -/* - * 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 Software Foundation - * 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 Software Foundation. - * - * 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 "apr.h" -#include "apr_strings.h" -#include "apr_hooks.h" -#include "apr_lib.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_request.h" /* for ap_hook_translate_name */ - - -module AP_MODULE_DECLARE_DATA 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 { - const char *doc_root; - const char *cgi_root; - mva_mode_e doc_root_mode; - mva_mode_e cgi_root_mode; -} mva_sconf_t; - -static void *mva_create_server_config(apr_pool_t *p, server_rec *s) -{ - mva_sconf_t *conf; - - conf = (mva_sconf_t *) apr_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(apr_pool_t *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 *) apr_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, const char *map) -{ - mva_sconf_t *conf; - mva_mode_e mode, *pmode; - const char **pmap; - const 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 (apr_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 (apr_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[] = -{ - AP_INIT_TAKE1("VirtualScriptAlias", vhost_alias_set, - &vhost_alias_set_cgi_root_name, RSRC_CONF, - "how to create a ScriptAlias based on the host"), - AP_INIT_TAKE1("VirtualDocumentRoot", vhost_alias_set, - &vhost_alias_set_doc_root_name, RSRC_CONF, - "how to create the DocumentRoot based on the host"), - AP_INIT_TAKE1("VirtualScriptAliasIP", vhost_alias_set, - &vhost_alias_set_cgi_root_ip, RSRC_CONF, - "how to create a ScriptAlias based on the host"), - AP_INIT_TAKE1("VirtualDocumentRootIP", vhost_alias_set, - &vhost_alias_set_doc_root_ip, RSRC_CONF, - "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 APR_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 = apr_pstrcat(r->pool, r->filename, buf, NULL); - } - else { - r->filename = apr_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 += apr_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++ = apr_tolower(*p); - } - } - *dest = '\0'; - /* no double slashes */ - if (last == '/') { - ++uri; - } - if (r->filename) { - r->filename = apr_pstrcat(r->pool, r->filename, buf, uri, NULL); - } - else { - r->filename = apr_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; - const char *cgi; - - conf = (mva_sconf_t *) ap_get_module_config(r->server->module_config, - &vhost_alias_module); - cgi = NULL; - if (conf->cgi_root) { - cgi = strstr(r->uri, "cgi-bin/"); - if (cgi && cgi - r->uri != strspn(r->uri, "/")) { - cgi = NULL; - } - } - if (cgi) { - mode = conf->cgi_root_mode; - map = conf->cgi_root; - uri = cgi + strlen("cgi-bin"); - } - else if (r->uri[0] == '/') { - mode = conf->doc_root_mode; - map = conf->doc_root; - uri = r->uri; - } - 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"; - apr_table_setn(r->notes, "alias-forced-type", r->handler); - } - - return OK; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_translate_name(mva_translate, NULL, NULL, APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA vhost_alias_module = -{ - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks /* register hooks */ -}; - diff --git a/modules/metadata/.cvsignore b/modules/metadata/.cvsignore deleted file mode 100644 index 65f0cc30cf..0000000000 --- a/modules/metadata/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -Debug -Release diff --git a/modules/metadata/.indent.pro b/modules/metadata/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- 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 167b343d0d..0000000000 --- a/modules/metadata/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ - -include $(top_srcdir)/build/special.mk - diff --git a/modules/metadata/config.m4 b/modules/metadata/config.m4 deleted file mode 100644 index d1bfb56d5b..0000000000 --- a/modules/metadata/config.m4 +++ /dev/null @@ -1,23 +0,0 @@ -dnl modules enabled in this directory by default - -dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]]) - -APACHE_MODPATH_INIT(metadata) - -APACHE_MODULE(env, clearing/setting of ENV vars, , , yes) -APACHE_MODULE(mime_magic, automagically determining MIME type) -APACHE_MODULE(cern_meta, CERN-type meta files) -APACHE_MODULE(expires, Expires header control, , , most) -APACHE_MODULE(headers, HTTP header control, , , most) - -APACHE_MODULE(usertrack, user-session tracking, , , , [ - AC_CHECK_HEADERS(sys/times.h) - AC_CHECK_FUNCS(times) -]) - -APACHE_MODULE(unique_id, per-request unique ids) -APACHE_MODULE(setenvif, basing ENV vars on headers, , , yes) - -APR_ADDTO(LTFLAGS,-export-dynamic) - -APACHE_MODPATH_FINISH diff --git a/modules/metadata/mod_cern_meta.c b/modules/metadata/mod_cern_meta.c deleted file mode 100644 index 44a1ebae3e..0000000000 --- a/modules/metadata/mod_cern_meta.c +++ /dev/null @@ -1,406 +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. - */ - -/* - * 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 "apr.h" -#include "apr_strings.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if APR_HAVE_SYS_TYPES_H -#include -#endif - -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "util_script.h" -#include "http_log.h" -#include "http_request.h" -#include "apr_lib.h" - -#define DIR_CMD_PERMS OR_INDEXES - -#define DEFAULT_METADIR ".web" -#define DEFAULT_METASUFFIX ".meta" -#define DEFAULT_METAFILES 0 - -module AP_MODULE_DECLARE_DATA cern_meta_module; - -typedef struct { - const char *metadir; - const char *metasuffix; - int metafiles; -} cern_meta_dir_config; - -static void *create_cern_meta_dir_config(apr_pool_t *p, char *dummy) -{ - cern_meta_dir_config *new = - (cern_meta_dir_config *) apr_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(apr_pool_t *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 *) apr_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, void *in_dconf, const char *arg) -{ - cern_meta_dir_config *dconf = in_dconf; - - dconf->metadir = arg; - return NULL; -} - -static const char *set_metasuffix(cmd_parms *parms, void *in_dconf, const char *arg) -{ - cern_meta_dir_config *dconf = in_dconf; - - dconf->metasuffix = arg; - return NULL; -} - -static const char *set_metafiles(cmd_parms *parms, void *in_dconf, int arg) -{ - cern_meta_dir_config *dconf = in_dconf; - - dconf->metafiles = arg; - return NULL; -} - - -static const command_rec cern_meta_cmds[] = -{ - AP_INIT_FLAG("MetaFiles", set_metafiles, NULL, DIR_CMD_PERMS, - "Limited to 'on' or 'off'"), - AP_INIT_TAKE1("MetaDir", set_metadir, NULL, DIR_CMD_PERMS, - "the name of the directory containing meta files"), - AP_INIT_TAKE1("MetaSuffix", set_metasuffix, NULL, DIR_CMD_PERMS, - "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, apr_file_t *f) -{ - char w[MAX_STRING_LEN]; - char *l; - int p; - apr_table_t *tmp_headers; - - tmp_headers = apr_table_make(r->pool, 5); - while (apr_file_gets(w, MAX_STRING_LEN - 1, f) == APR_SUCCESS) { - - /* 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, 0, r, - "malformed header in meta file: %s", r->filename); - return HTTP_INTERNAL_SERVER_ERROR; - } - - *l++ = '\0'; - while (*l && apr_isspace(*l)) - ++l; - - if (!strcasecmp(w, "Content-type")) { - char *tmp; - /* Nuke trailing whitespace */ - - char *endp = l + strlen(l) - 1; - while (endp > l && apr_isspace(*endp)) - *endp-- = '\0'; - - tmp = apr_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 = apr_pstrdup(r->pool, l); - } - else { - apr_table_set(tmp_headers, w, l); - } - } - apr_table_overlap(r->headers_out, tmp_headers, APR_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; - apr_file_t *f = NULL; - apr_status_t retcode; - 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.filetype == 0) { - return DECLINED; - }; - - /* is this a directory? */ - if (r->finfo.filetype == APR_DIR || r->uri[strlen(r->uri) - 1] == '/') { - return DECLINED; - }; - - /* what directory is this file in? */ - scrap_book = apr_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, 0, r, - "internal error in mod_cern_meta: %s", r->filename); - /* should really barf, but hey, let's be friends... */ - return DECLINED; - }; - - metafilename = apr_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, NULL); - if (rr->status != HTTP_OK) { - ap_destroy_sub_req(rr); - return DECLINED; - } - ap_destroy_sub_req(rr); - - retcode = apr_file_open(&f, metafilename, APR_READ | APR_CREATE, APR_OS_DEFAULT, r->pool); - if (retcode != APR_SUCCESS) { - if (APR_STATUS_IS_ENOENT(retcode)) { - return DECLINED; - } - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "meta file permissions deny server access: %s", metafilename); - return HTTP_FORBIDDEN; - }; - - /* read the headers in */ - rv = scan_meta_file(r, f); - apr_file_close(f); - - return rv; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_fixups(add_cern_meta_data,NULL,NULL,APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA cern_meta_module = -{ - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/metadata/mod_cern_meta.dsp b/modules/metadata/mod_cern_meta.dsp deleted file mode 100644 index 789970ced3..0000000000 --- a/modules/metadata/mod_cern_meta.dsp +++ /dev/null @@ -1,95 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_cern_meta" - 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_cern_meta - 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_cern_meta.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_cern_meta.mak" CFG="mod_cern_meta - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_cern_meta - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_cern_meta - 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_cern_meta - 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_cern_meta" /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_cern_meta.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_cern_meta -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_cern_meta.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_cern_meta - -!ELSEIF "$(CFG)" == "mod_cern_meta - 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_cern_meta" /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_cern_meta.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_cern_meta -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_cern_meta.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_cern_meta - -!ENDIF - -# Begin Target - -# Name "mod_cern_meta - Win32 Release" -# Name "mod_cern_meta - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_cern_meta.c -# End Source File -# 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 d36e2be6a8..0000000000 --- a/modules/metadata/mod_cern_meta.exp +++ /dev/null @@ -1 +0,0 @@ -cern_meta_module diff --git a/modules/metadata/mod_cern_meta.mak b/modules/metadata/mod_cern_meta.mak deleted file mode 100644 index c21fe9c48c..0000000000 --- a/modules/metadata/mod_cern_meta.mak +++ /dev/null @@ -1,327 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on mod_cern_meta.dsp -!IF "$(CFG)" == "" -CFG=mod_cern_meta - Win32 Release -!MESSAGE No configuration specified. Defaulting to mod_cern_meta - Win32\ - Release. -!ENDIF - -!IF "$(CFG)" != "mod_cern_meta - Win32 Release" && "$(CFG)" !=\ - "mod_cern_meta - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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_cern_meta.mak" CFG="mod_cern_meta - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_cern_meta - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_cern_meta - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "mod_cern_meta - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_cern_meta.so" - -!ELSE - -ALL : "libhttpd - Win32 Release" "libapr - Win32 Release"\ - "$(OUTDIR)\mod_cern_meta.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 ReleaseCLEAN" "libhttpd - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_cern_meta.idb" - -@erase "$(INTDIR)\mod_cern_meta.obj" - -@erase "$(OUTDIR)\mod_cern_meta.exp" - -@erase "$(OUTDIR)\mod_cern_meta.lib" - -@erase "$(OUTDIR)\mod_cern_meta.map" - -@erase "$(OUTDIR)\mod_cern_meta.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I\ - "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D\ - "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_cern_meta" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_cern_meta.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_cern_meta.pdb" /map:"$(INTDIR)\mod_cern_meta.map"\ - /machine:I386 /out:"$(OUTDIR)\mod_cern_meta.so"\ - /implib:"$(OUTDIR)\mod_cern_meta.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_cern_meta -LINK32_OBJS= \ - "$(INTDIR)\mod_cern_meta.obj" \ - "..\..\Release\libhttpd.lib" \ - "..\..\srclib\apr\Release\libapr.lib" - -"$(OUTDIR)\mod_cern_meta.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "mod_cern_meta - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_cern_meta.so" - -!ELSE - -ALL : "libhttpd - Win32 Debug" "libapr - Win32 Debug"\ - "$(OUTDIR)\mod_cern_meta.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 DebugCLEAN" "libhttpd - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_cern_meta.idb" - -@erase "$(INTDIR)\mod_cern_meta.obj" - -@erase "$(OUTDIR)\mod_cern_meta.exp" - -@erase "$(OUTDIR)\mod_cern_meta.lib" - -@erase "$(OUTDIR)\mod_cern_meta.map" - -@erase "$(OUTDIR)\mod_cern_meta.pdb" - -@erase "$(OUTDIR)\mod_cern_meta.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_cern_meta" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_cern_meta.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_cern_meta.pdb" /map:"$(INTDIR)\mod_cern_meta.map" /debug\ - /machine:I386 /out:"$(OUTDIR)\mod_cern_meta.so"\ - /implib:"$(OUTDIR)\mod_cern_meta.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_cern_meta -LINK32_OBJS= \ - "$(INTDIR)\mod_cern_meta.obj" \ - "..\..\Debug\libhttpd.lib" \ - "..\..\srclib\apr\Debug\libapr.lib" - -"$(OUTDIR)\mod_cern_meta.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "mod_cern_meta - Win32 Release" || "$(CFG)" ==\ - "mod_cern_meta - Win32 Debug" - -!IF "$(CFG)" == "mod_cern_meta - Win32 Release" - -"libapr - Win32 Release" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Release" - cd "..\..\modules\metadata" - -"libapr - Win32 ReleaseCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\..\modules\metadata" - -!ELSEIF "$(CFG)" == "mod_cern_meta - Win32 Debug" - -"libapr - Win32 Debug" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Debug" - cd "..\..\modules\metadata" - -"libapr - Win32 DebugCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\..\modules\metadata" - -!ENDIF - -!IF "$(CFG)" == "mod_cern_meta - Win32 Release" - -"libhttpd - Win32 Release" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Release" - cd ".\modules\metadata" - -"libhttpd - Win32 ReleaseCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Release"\ - RECURSE=1 - cd ".\modules\metadata" - -!ELSEIF "$(CFG)" == "mod_cern_meta - Win32 Debug" - -"libhttpd - Win32 Debug" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Debug" - cd ".\modules\metadata" - -"libhttpd - Win32 DebugCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Debug"\ - RECURSE=1 - cd ".\modules\metadata" - -!ENDIF - -SOURCE=.\mod_cern_meta.c -DEP_CPP_MOD_C=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.h"\ - "..\..\include\ap_release.h"\ - "..\..\include\http_config.h"\ - "..\..\include\http_log.h"\ - "..\..\include\http_request.h"\ - "..\..\include\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_script.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\srclib\apr-util\include\apu.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_lib.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_strings.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\include\apr_user.h"\ - "..\..\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_C=\ - "..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_cern_meta.obj" : $(SOURCE) $(DEP_CPP_MOD_C) "$(INTDIR)" - - - -!ENDIF - diff --git a/modules/metadata/mod_env.c b/modules/metadata/mod_env.c deleted file mode 100644 index ebe112b859..0000000000 --- a/modules/metadata/mod_env.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. - */ - -/* - * 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. apr_table_t 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 "apr.h" -#include "apr_strings.h" - -#if APR_HAVE_STDLIB_H -#include -#endif - -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_request.h" - - -typedef struct { - apr_table_t *vars; - const char *unsetenv; - int vars_present; -} env_dir_config_rec; - -module AP_MODULE_DECLARE_DATA env_module; - -static void *create_env_dir_config(apr_pool_t *p, char *dummy) -{ - env_dir_config_rec *conf = apr_palloc(p, sizeof(*conf)); - - conf->vars = apr_table_make(p, 50); - conf->unsetenv = ""; - conf->vars_present = 0; - - return conf; -} - -static void *merge_env_dir_configs(apr_pool_t *p, void *basev, void *addv) -{ - env_dir_config_rec *base = basev; - env_dir_config_rec *add = addv; - env_dir_config_rec *newconf = apr_palloc(p, sizeof(*newconf)); - - apr_table_t *new_table; - apr_table_entry_t *elts; - apr_array_header_t *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 = apr_table_copy(p, base->vars); - - arr = apr_table_elts(add->vars); - elts = (apr_table_entry_t *)arr->elts; - - for (i = 0; i < arr->nelts; ++i) { - apr_table_setn(new_table, elts[i].key, elts[i].val); - } - - unset = add->unsetenv; - uenv = ap_getword_conf(p, &unset); - while (uenv[0] != '\0') { - apr_table_unset(new_table, uenv); - uenv = ap_getword_conf(p, &unset); - } - - newconf->vars = new_table; - - newconf->vars_present = base->vars_present || add->vars_present; - - return newconf; -} - -static const char *add_env_module_vars_passed(cmd_parms *cmd, void *sconf_, - const char *arg) -{ - env_dir_config_rec *sconf = sconf_; - apr_table_t *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; - apr_table_setn(vars, name_ptr, apr_pstrdup(cmd->pool, env_var)); - } - } - return NULL; -} - -static const char *add_env_module_vars_set(cmd_parms *cmd, void *sconf_, - const char *arg) -{ - env_dir_config_rec *sconf = sconf_; - apr_table_t *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; - apr_table_setn(vars, name, value); - - return NULL; -} - -static const char *add_env_module_vars_unset(cmd_parms *cmd, void *sconf_, - const char *arg) -{ - env_dir_config_rec *sconf = sconf_; - - sconf->unsetenv = sconf->unsetenv - ? apr_pstrcat(cmd->pool, sconf->unsetenv, " ", arg, NULL) - : arg; - - return NULL; -} - -static const command_rec env_module_cmds[] = -{ -AP_INIT_RAW_ARGS("PassEnv", add_env_module_vars_passed, NULL, - OR_FILEINFO, "a list of environment variables to pass to CGI."), -AP_INIT_RAW_ARGS("SetEnv", add_env_module_vars_set, NULL, - OR_FILEINFO, "an environment variable name and a value to pass to CGI."), -AP_INIT_RAW_ARGS("UnsetEnv", add_env_module_vars_unset, NULL, - OR_FILEINFO, "a list of variables to remove from the CGI environment."), - {NULL}, -}; - -static int fixup_env_module(request_rec *r) -{ - apr_table_t *e = r->subprocess_env; - env_dir_config_rec *sconf = ap_get_module_config(r->per_dir_config, - &env_module); - apr_table_t *vars = sconf->vars; - - if (!sconf->vars_present) - return DECLINED; - - r->subprocess_env = apr_table_overlay(r->pool, e, vars); - - return OK; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_fixups(fixup_env_module, NULL, NULL, APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA env_module = -{ - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/metadata/mod_env.exp b/modules/metadata/mod_env.exp deleted file mode 100644 index b487bf09c8..0000000000 --- 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 068c03cf2e..0000000000 --- a/modules/metadata/mod_expires.c +++ /dev/null @@ -1,520 +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. - */ - -/* - * 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 "apr.h" -#include "apr_strings.h" -#include "apr_lib.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" -#include "http_request.h" - -typedef struct { - int active; - char *expiresdefault; - apr_table_t *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 AP_MODULE_DECLARE_DATA expires_module; - -static void *create_dir_expires_config(apr_pool_t *p, char *dummy) -{ - expires_dir_config *new = - (expires_dir_config *) apr_pcalloc(p, sizeof(expires_dir_config)); - new->active = ACTIVE_DONTCARE; - new->expiresdefault = ""; - new->expiresbytype = apr_table_make(p, 4); - return (void *) new; -} - -static const char *set_expiresactive(cmd_parms *cmd, void *in_dir_config, int arg) -{ - expires_dir_config *dir_config = in_dir_config; - - /* 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(apr_pool_t *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 apr_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 (apr_isdigit(word[0])) { - num = atoi(word); - } - else { - return apr_pstrcat(p, "bad expires code, numeric value expected '", - word, "'", NULL); - }; - - /* - */ - word = ap_getword_conf(p, &code); - if (word[0]) { - /* do nothing */ - } - else { - return apr_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 apr_pstrcat(p, "bad expires code, unrecognised ", - "'", word, "'", NULL); - }; - - modifier = modifier + factor * num; - - /* next - */ - word = ap_getword_conf(p, &code); - }; - - *real_code = apr_psprintf(p, "%c%d", base, modifier); - - return NULL; -} - -static const char *set_expiresbytype(cmd_parms *cmd, void *in_dir_config, - const char *mime, const char *code) -{ - expires_dir_config *dir_config = in_dir_config; - char *response, *real_code; - - if ((response = check_code(cmd->pool, code, &real_code)) == NULL) { - apr_table_setn(dir_config->expiresbytype, mime, real_code); - return NULL; - }; - return apr_pstrcat(cmd->pool, - "'ExpiresByType ", mime, " ", code, "': ", response, NULL); -} - -static const char *set_expiresdefault(cmd_parms *cmd, void *in_dir_config, - const char *code) -{ - expires_dir_config * dir_config = in_dir_config; - char *response, *real_code; - - if ((response = check_code(cmd->pool, code, &real_code)) == NULL) { - dir_config->expiresdefault = real_code; - return NULL; - }; - return apr_pstrcat(cmd->pool, - "'ExpiresDefault ", code, "': ", response, NULL); -} - -static const command_rec expires_cmds[] = -{ - AP_INIT_FLAG("ExpiresActive", set_expiresactive, NULL, DIR_CMD_PERMS, - "Limited to 'on' or 'off'"), - AP_INIT_TAKE2("ExpiresBytype", set_expiresbytype, NULL, DIR_CMD_PERMS, - "a MIME type followed by an expiry date code"), - AP_INIT_TAKE1("ExpiresDefault", set_expiresdefault, NULL, DIR_CMD_PERMS, - "an expiry date code"), - {NULL} -}; - -static void *merge_expires_dir_configs(apr_pool_t *p, void *basev, void *addv) -{ - expires_dir_config *new = (expires_dir_config *) apr_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 = apr_table_overlay(p, add->expiresbytype, - base->expiresbytype); - return new; -} - -static int add_expires(request_rec *r) -{ - expires_dir_config *conf; - char *code; - apr_time_t base; - apr_time_t additional; - apr_time_t expires; - char *timestr; - - 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, 0, r, - "internal error: %s", r->filename); - return HTTP_INTERNAL_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 *) apr_table_get(conf->expiresbytype, - ap_field_noparam(r->pool, 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.filetype == 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.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, 0, r, - "internal error: bad expires code: %s", r->filename); - return HTTP_INTERNAL_SERVER_ERROR; - }; - - expires = base + additional; - apr_table_mergen(r->headers_out, "Cache-Control", - apr_psprintf(r->pool, "max-age=%qd", - (expires - r->request_time) - / APR_USEC_PER_SEC)); - timestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN); - apr_rfc822_date(timestr, expires); - apr_table_setn(r->headers_out, "Expires", timestr); - return OK; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_fixups(add_expires,NULL,NULL,APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA expires_module = -{ - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/metadata/mod_expires.dsp b/modules/metadata/mod_expires.dsp deleted file mode 100644 index a0fac42270..0000000000 --- a/modules/metadata/mod_expires.dsp +++ /dev/null @@ -1,95 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_expires" - 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_expires - 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_expires.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_expires.mak" CFG="mod_expires - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_expires - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_expires - 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_expires - 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_expires" /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_expires.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_expires -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_expires.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_expires - -!ELSEIF "$(CFG)" == "mod_expires - 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_expires" /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_expires.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_expires -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_expires.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_expires - -!ENDIF - -# Begin Target - -# Name "mod_expires - Win32 Release" -# Name "mod_expires - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_expires.c -# End Source File -# End Target -# End Project diff --git a/modules/metadata/mod_expires.exp b/modules/metadata/mod_expires.exp deleted file mode 100644 index 863a96878e..0000000000 --- a/modules/metadata/mod_expires.exp +++ /dev/null @@ -1 +0,0 @@ -expires_module diff --git a/modules/metadata/mod_expires.mak b/modules/metadata/mod_expires.mak deleted file mode 100644 index 2dcc652d05..0000000000 --- a/modules/metadata/mod_expires.mak +++ /dev/null @@ -1,324 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on mod_expires.dsp -!IF "$(CFG)" == "" -CFG=mod_expires - Win32 Release -!MESSAGE No configuration specified. Defaulting to mod_expires - Win32 Release. -!ENDIF - -!IF "$(CFG)" != "mod_expires - Win32 Release" && "$(CFG)" !=\ - "mod_expires - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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_expires.mak" CFG="mod_expires - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_expires - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_expires - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "mod_expires - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_expires.so" - -!ELSE - -ALL : "libhttpd - Win32 Release" "libapr - Win32 Release"\ - "$(OUTDIR)\mod_expires.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 ReleaseCLEAN" "libhttpd - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_expires.idb" - -@erase "$(INTDIR)\mod_expires.obj" - -@erase "$(OUTDIR)\mod_expires.exp" - -@erase "$(OUTDIR)\mod_expires.lib" - -@erase "$(OUTDIR)\mod_expires.map" - -@erase "$(OUTDIR)\mod_expires.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I\ - "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D\ - "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_expires" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_expires.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_expires.pdb" /map:"$(INTDIR)\mod_expires.map" /machine:I386\ - /out:"$(OUTDIR)\mod_expires.so" /implib:"$(OUTDIR)\mod_expires.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_expires -LINK32_OBJS= \ - "$(INTDIR)\mod_expires.obj" \ - "..\..\Release\libhttpd.lib" \ - "..\..\srclib\apr\Release\libapr.lib" - -"$(OUTDIR)\mod_expires.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "mod_expires - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_expires.so" - -!ELSE - -ALL : "libhttpd - Win32 Debug" "libapr - Win32 Debug"\ - "$(OUTDIR)\mod_expires.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 DebugCLEAN" "libhttpd - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_expires.idb" - -@erase "$(INTDIR)\mod_expires.obj" - -@erase "$(OUTDIR)\mod_expires.exp" - -@erase "$(OUTDIR)\mod_expires.lib" - -@erase "$(OUTDIR)\mod_expires.map" - -@erase "$(OUTDIR)\mod_expires.pdb" - -@erase "$(OUTDIR)\mod_expires.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_expires" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_expires.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_expires.pdb" /map:"$(INTDIR)\mod_expires.map" /debug\ - /machine:I386 /out:"$(OUTDIR)\mod_expires.so"\ - /implib:"$(OUTDIR)\mod_expires.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_expires -LINK32_OBJS= \ - "$(INTDIR)\mod_expires.obj" \ - "..\..\Debug\libhttpd.lib" \ - "..\..\srclib\apr\Debug\libapr.lib" - -"$(OUTDIR)\mod_expires.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "mod_expires - Win32 Release" || "$(CFG)" ==\ - "mod_expires - Win32 Debug" - -!IF "$(CFG)" == "mod_expires - Win32 Release" - -"libapr - Win32 Release" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Release" - cd "..\..\modules\metadata" - -"libapr - Win32 ReleaseCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\..\modules\metadata" - -!ELSEIF "$(CFG)" == "mod_expires - Win32 Debug" - -"libapr - Win32 Debug" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Debug" - cd "..\..\modules\metadata" - -"libapr - Win32 DebugCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\..\modules\metadata" - -!ENDIF - -!IF "$(CFG)" == "mod_expires - Win32 Release" - -"libhttpd - Win32 Release" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Release" - cd ".\modules\metadata" - -"libhttpd - Win32 ReleaseCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Release"\ - RECURSE=1 - cd ".\modules\metadata" - -!ELSEIF "$(CFG)" == "mod_expires - Win32 Debug" - -"libhttpd - Win32 Debug" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Debug" - cd ".\modules\metadata" - -"libhttpd - Win32 DebugCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Debug"\ - RECURSE=1 - cd ".\modules\metadata" - -!ENDIF - -SOURCE=.\mod_expires.c -DEP_CPP_MOD_E=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.h"\ - "..\..\include\ap_release.h"\ - "..\..\include\http_config.h"\ - "..\..\include\http_log.h"\ - "..\..\include\http_request.h"\ - "..\..\include\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\srclib\apr-util\include\apu.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_lib.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_strings.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\include\apr_user.h"\ - "..\..\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_E=\ - "..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_expires.obj" : $(SOURCE) $(DEP_CPP_MOD_E) "$(INTDIR)" - - - -!ENDIF - diff --git a/modules/metadata/mod_headers.c b/modules/metadata/mod_headers.c deleted file mode 100644 index 20edf23ae1..0000000000 --- a/modules/metadata/mod_headers.c +++ /dev/null @@ -1,269 +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. - */ - -/* - * 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 "apr.h" -#include "apr_strings.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "httpd.h" -#include "http_config.h" -#include "http_request.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; - const 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 { - apr_array_header_t *headers; -} headers_conf; - -module AP_MODULE_DECLARE_DATA headers_module; - -static void *create_headers_config(apr_pool_t *p, server_rec *s) -{ - headers_conf *conf = apr_pcalloc(p, sizeof(*conf)); - - conf->headers = apr_array_make(p, 2, sizeof(header_entry)); - - return conf; -} - -static void *create_headers_dir_config(apr_pool_t *p, char *d) -{ - return create_headers_config(p, NULL); -} - -static void *merge_headers_config(apr_pool_t *p, void *basev, void *overridesv) -{ - headers_conf *newconf = apr_pcalloc(p, sizeof(*newconf)); - headers_conf *base = basev; - headers_conf *overrides = overridesv; - - newconf->headers = apr_array_append(p, base->headers, overrides->headers); - - return newconf; -} - - -static const char *header_cmd(cmd_parms *cmd, void *indirconf, - const char *action, const char *inhdr, - const char *value) -{ - headers_conf *dirconf = indirconf; - char *hdr = apr_pstrdup(cmd->pool, inhdr); - header_entry *new; - server_rec *s = cmd->server; - headers_conf *serverconf = ap_get_module_config(s->module_config, - &headers_module); - char *colon; - - if (cmd->path) { - new = (header_entry *) apr_array_push(dirconf->headers); - } - else { - new = (header_entry *) apr_array_push(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[] = -{ - AP_INIT_TAKE23("Header", header_cmd, NULL, OR_FILEINFO, - "an action, header and value"), - {NULL} -}; - -static void do_headers_fixup(request_rec *r, apr_array_header_t *headers) -{ - int i; - - for (i = 0; i < headers->nelts; ++i) { - header_entry *hdr = &((header_entry *) (headers->elts))[i]; - switch (hdr->action) { - case hdr_add: - apr_table_addn(r->headers_out, hdr->header, hdr->value); - break; - case hdr_append: - apr_table_mergen(r->headers_out, hdr->header, hdr->value); - break; - case hdr_set: - apr_table_setn(r->headers_out, hdr->header, hdr->value); - break; - case hdr_unset: - apr_table_unset(r->headers_out, hdr->header); - break; - } - } - -} - -static int fixup_headers(request_rec *r) -{ - headers_conf *serverconf = ap_get_module_config(r->server->module_config, - &headers_module); - headers_conf *dirconf = ap_get_module_config(r->per_dir_config, - &headers_module); - - do_headers_fixup(r, serverconf->headers); - do_headers_fixup(r, dirconf->headers); - - return DECLINED; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_fixups(fixup_headers, NULL, NULL, APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA headers_module = -{ - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/metadata/mod_headers.dsp b/modules/metadata/mod_headers.dsp deleted file mode 100644 index 0575868143..0000000000 --- a/modules/metadata/mod_headers.dsp +++ /dev/null @@ -1,95 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_headers" - 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_headers - 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_headers.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_headers.mak" CFG="mod_headers - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_headers - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_headers - 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_headers - 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_headers" /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_headers.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_headers -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_headers.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_headers - -!ELSEIF "$(CFG)" == "mod_headers - 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_headers" /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_headers.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_headers -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_headers.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_headers - -!ENDIF - -# Begin Target - -# Name "mod_headers - Win32 Release" -# Name "mod_headers - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_headers.c -# End Source File -# End Target -# End Project diff --git a/modules/metadata/mod_headers.exp b/modules/metadata/mod_headers.exp deleted file mode 100644 index 3f3063808a..0000000000 --- a/modules/metadata/mod_headers.exp +++ /dev/null @@ -1 +0,0 @@ -headers_module diff --git a/modules/metadata/mod_headers.mak b/modules/metadata/mod_headers.mak deleted file mode 100644 index 8544faa05c..0000000000 --- a/modules/metadata/mod_headers.mak +++ /dev/null @@ -1,321 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on mod_headers.dsp -!IF "$(CFG)" == "" -CFG=mod_headers - Win32 Release -!MESSAGE No configuration specified. Defaulting to mod_headers - Win32 Release. -!ENDIF - -!IF "$(CFG)" != "mod_headers - Win32 Release" && "$(CFG)" !=\ - "mod_headers - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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_headers.mak" CFG="mod_headers - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_headers - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_headers - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "mod_headers - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_headers.so" - -!ELSE - -ALL : "libhttpd - Win32 Release" "libapr - Win32 Release"\ - "$(OUTDIR)\mod_headers.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 ReleaseCLEAN" "libhttpd - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_headers.idb" - -@erase "$(INTDIR)\mod_headers.obj" - -@erase "$(OUTDIR)\mod_headers.exp" - -@erase "$(OUTDIR)\mod_headers.lib" - -@erase "$(OUTDIR)\mod_headers.map" - -@erase "$(OUTDIR)\mod_headers.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I\ - "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D\ - "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_headers" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_headers.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_headers.pdb" /map:"$(INTDIR)\mod_headers.map" /machine:I386\ - /out:"$(OUTDIR)\mod_headers.so" /implib:"$(OUTDIR)\mod_headers.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_headers -LINK32_OBJS= \ - "$(INTDIR)\mod_headers.obj" \ - "..\..\Release\libhttpd.lib" \ - "..\..\srclib\apr\Release\libapr.lib" - -"$(OUTDIR)\mod_headers.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "mod_headers - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_headers.so" - -!ELSE - -ALL : "libhttpd - Win32 Debug" "libapr - Win32 Debug"\ - "$(OUTDIR)\mod_headers.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 DebugCLEAN" "libhttpd - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_headers.idb" - -@erase "$(INTDIR)\mod_headers.obj" - -@erase "$(OUTDIR)\mod_headers.exp" - -@erase "$(OUTDIR)\mod_headers.lib" - -@erase "$(OUTDIR)\mod_headers.map" - -@erase "$(OUTDIR)\mod_headers.pdb" - -@erase "$(OUTDIR)\mod_headers.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_headers" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_headers.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_headers.pdb" /map:"$(INTDIR)\mod_headers.map" /debug\ - /machine:I386 /out:"$(OUTDIR)\mod_headers.so"\ - /implib:"$(OUTDIR)\mod_headers.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_headers -LINK32_OBJS= \ - "$(INTDIR)\mod_headers.obj" \ - "..\..\Debug\libhttpd.lib" \ - "..\..\srclib\apr\Debug\libapr.lib" - -"$(OUTDIR)\mod_headers.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "mod_headers - Win32 Release" || "$(CFG)" ==\ - "mod_headers - Win32 Debug" - -!IF "$(CFG)" == "mod_headers - Win32 Release" - -"libapr - Win32 Release" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Release" - cd "..\..\modules\metadata" - -"libapr - Win32 ReleaseCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\..\modules\metadata" - -!ELSEIF "$(CFG)" == "mod_headers - Win32 Debug" - -"libapr - Win32 Debug" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Debug" - cd "..\..\modules\metadata" - -"libapr - Win32 DebugCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\..\modules\metadata" - -!ENDIF - -!IF "$(CFG)" == "mod_headers - Win32 Release" - -"libhttpd - Win32 Release" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Release" - cd ".\modules\metadata" - -"libhttpd - Win32 ReleaseCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Release"\ - RECURSE=1 - cd ".\modules\metadata" - -!ELSEIF "$(CFG)" == "mod_headers - Win32 Debug" - -"libhttpd - Win32 Debug" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Debug" - cd ".\modules\metadata" - -"libhttpd - Win32 DebugCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Debug"\ - RECURSE=1 - cd ".\modules\metadata" - -!ENDIF - -SOURCE=.\mod_headers.c -DEP_CPP_MOD_H=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.h"\ - "..\..\include\ap_release.h"\ - "..\..\include\http_config.h"\ - "..\..\include\http_request.h"\ - "..\..\include\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\srclib\apr-util\include\apu.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_strings.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\include\apr_user.h"\ - "..\..\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_H=\ - "..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_headers.obj" : $(SOURCE) $(DEP_CPP_MOD_H) "$(INTDIR)" - - - -!ENDIF - diff --git a/modules/metadata/mod_mime_magic.c b/modules/metadata/mod_mime_magic.c deleted file mode 100644 index 36aa086918..0000000000 --- a/modules/metadata/mod_mime_magic.c +++ /dev/null @@ -1,2501 +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. - */ - -/* - * 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 Software Foundation 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 Software Foundation. - * - * 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 apr_pool_t 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 Software Foundation July 1997 - * - */ - -#include "apr.h" -#include "apr_strings.h" -#include "apr_lib.h" -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if APR_HAVE_UNISTD_H -#include -#endif - -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_request.h" -#include "http_core.h" -#include "http_log.h" -#include "http_protocol.h" -#include "util_script.h" - -/* ### this isn't set by configure? does anybody set this? */ -#ifdef HAVE_UTIME_H -#include -#endif - -/* - * 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 *, apr_size_t); -static int is_tar(unsigned char *, apr_size_t); -static int softmagic(request_rec *, unsigned char *, apr_size_t); -static void tryit(request_rec *, unsigned char *, apr_size_t, int); -static int zmagic(request_rec *, unsigned char *, apr_size_t); - -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 *, apr_pool_t *p, char *, int); - -static int match(request_rec *, unsigned char *, apr_size_t); -static int mget(request_rec *, union VALUETYPE *, unsigned char *, - struct magic *, apr_size_t); -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 **, apr_size_t); -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 apr_table_t '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 { - const 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(apr_pool_t *p, server_rec *d) -{ - /* allocate the config - use pcalloc because it needs to be zeroed */ - return apr_pcalloc(p, sizeof(magic_server_config_rec)); -} - -static void *merge_magic_server_config(apr_pool_t *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 *) - apr_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, void *dummy, const 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[] = -{ - AP_INIT_TAKE1("MimeMagicFile", set_magicfile, NULL, RSRC_CONF, - "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 *) apr_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, APR_EINVAL, 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 *) apr_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); - apr_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 *) apr_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, 0, 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 (apr_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, 0, 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, 0, 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) -{ - apr_file_t *fd = NULL; - unsigned char buf[HOWMANY + 1]; /* one extra for terminating '\0' */ - apr_size_t 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 (apr_file_open(&fd, r->filename, APR_READ, APR_OS_DEFAULT, r->pool) != APR_SUCCESS) { - /* We can't open it, but we were able to stat it. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, 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 - */ - nbytes = sizeof(buf) - 1; - if ((result = apr_file_read(fd, (char *) buf, &nbytes)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, result, 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) apr_file_close(fd); - (void) magic_rsl_putchar(r, '\n'); - - return OK; -} - - -static void tryit(request_rec *r, unsigned char *buf, apr_size_t 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 (apr_isspace((unsigned char) *l)) ++l;} - -/* - * apprentice - load configuration from the magic file r - * API request record - */ -static int apprentice(server_rec *s, apr_pool_t *p) -{ - apr_file_t *f = NULL; - apr_status_t result; - char line[BUFSIZ + 1]; - int errs = 0; - int lineno; -#if MIME_MAGIC_DEBUG - int rule = 0; - struct magic *m, *prevm; -#endif - magic_server_config_rec *conf = (magic_server_config_rec *) - ap_get_module_config(s->module_config, &mime_magic_module); - - const char *fname = ap_server_root_relative(p, conf->magicfile); - result = apr_file_open(&f, fname, APR_READ | APR_BUFFERED, APR_OS_DEFAULT, p); - if (result != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, result, 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; apr_file_gets(line, BUFSIZ, f) == APR_SUCCESS; lineno++) { - int ws_offset; - - /* delete newline */ - if (line[0]) { - line[strlen(line) - 1] = '\0'; - } - - /* skip leading whitespace */ - ws_offset = 0; - while (line[ws_offset] && apr_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) apr_file_close(f); - -#if MIME_MAGIC_DEBUG - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0, 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, 0, 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, 0, s, - MODNAME ": apprentice test"); - for (m = conf->magic; m; m = m->next) { - if (apr_isprint((((unsigned long) m) >> 24) & 255) && - apr_isprint((((unsigned long) m) >> 16) & 255) && - apr_isprint((((unsigned long) m) >> 8) & 255) && - apr_isprint(((unsigned long) m) & 255)) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0, 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, 0, 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, apr_pool_t *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 *) apr_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, 0, 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, 0, serv, - MODNAME ": indirect offset type %c invalid", *l); - break; - } - l++; - } - s = l; - if (*l == '+' || *l == '-') - l++; - if (apr_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, 0, serv, - MODNAME ": missing ')' in indirect offset"); - } - l = t; - } - - - while (apr_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, 0, 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' && apr_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, 0, 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 (apr_isspace((unsigned char) c)) - break; - if (p >= pmax) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, 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 (apr_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.filetype) { - case APR_DIR: - magic_rsl_puts(r, DIR_MAGIC_TYPE); - return DONE; - case APR_CHR: - /* - * (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; - case APR_BLK: - /* - * (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 */ - case APR_PIPE: - /* - * magic_rsl_puts(r,"fifo (named pipe)"); - */ - (void) magic_rsl_puts(r, MIME_BINARY_UNKNOWN); - return DONE; - case APR_LNK: - /* We used stat(), the only possible reason for this is that the - * symlink is broken. - */ - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r, - MODNAME ": broken symlink (%s)", fn); - return HTTP_INTERNAL_SERVER_ERROR; - case APR_SOCK: - magic_rsl_puts(r, MIME_BINARY_UNKNOWN); - return DONE; - case APR_REG: - break; - default: - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r, - MODNAME ": invalid file type %d.", r->finfo.filetype); - return HTTP_INTERNAL_SERVER_ERROR; - } - - /* - * regular file, check next possibility - */ - if (r->finfo.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, apr_size_t 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, apr_size_t 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, 0, 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 (apr_isprint((((unsigned long) m) >> 24) & 255) && - apr_isprint((((unsigned long) m) >> 16) & 255) && - apr_isprint((((unsigned long) m) >> 8) & 255) && - apr_isprint(((unsigned long) m) & 255)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0, 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, 0, 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, 0, 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, 0, 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, 0, 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, 0, 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, 0, 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, 0, 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, 0, 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, apr_size_t 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, 0, 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, 0, 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, 0, 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, 0, 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, 0, 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, 0, 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, 0, 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, 0, 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, 0, 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, 0, 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, 0, 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, 0, 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, apr_size_t 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 (apr_isspace(*tp)) - ++tp; /* skip leading whitespace */ - if ((apr_isalnum(*tp) || *tp == '\\') && - (apr_isalnum(*(tp + 1)) || *tp == '"')) { - magic_rsl_puts(r, "application/x-troff"); - return 1; - } - } - if ((*buf == 'c' || *buf == 'C') && apr_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, apr_size_t 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 create_uncompress_child(struct uncompress_parms *parm, apr_pool_t *cntxt, - apr_file_t **pipe_in) -{ - int rc = 1; - const char *new_argv[4]; - const char *const *env; - request_rec *r = parm->r; - apr_pool_t *child_context = cntxt; - apr_procattr_t *procattr; - apr_proc_t *procnew; - - /* XXX missing 1.3 logic: - * - * what happens when !compr[parm->method].silent? - * Should we create the err pipe, read it, and copy to the log? - */ - - env = (const char *const *)ap_create_environment(child_context, r->subprocess_env); - - if ((apr_procattr_create(&procattr, child_context) != APR_SUCCESS) || - (apr_procattr_io_set(procattr, APR_FULL_BLOCK, - APR_FULL_BLOCK, APR_NO_PIPE) != APR_SUCCESS) || - (apr_procattr_dir_set(procattr, r->filename) != APR_SUCCESS) || - (apr_procattr_cmdtype_set(procattr, APR_PROGRAM) != APR_SUCCESS)) { - /* Something bad happened, tell the world. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, APR_ENOPROC, r, - "couldn't setup child process: %s", r->filename); - } - else { - new_argv[0] = compr[parm->method].argv[0]; - new_argv[1] = compr[parm->method].argv[1]; - new_argv[2] = r->filename; - new_argv[3] = NULL; - - procnew = apr_pcalloc(child_context, sizeof(*procnew)); - rc = apr_proc_create(procnew, compr[parm->method].argv[0], - new_argv, env, procattr, child_context); - - if (rc != APR_SUCCESS) { - /* Bad things happened. Everyone should have cleaned up. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, APR_ENOPROC, r, - MODNAME ": could not execute `%s'.", - compr[parm->method].argv[0]); - } - else { - apr_pool_note_subprocess(child_context, procnew, kill_after_timeout); - *pipe_in = procnew->out; - } - } - - return (rc); -} - -static int uncompress(request_rec *r, int method, - unsigned char **newch, apr_size_t n) -{ - struct uncompress_parms parm; - apr_file_t *pipe_out = NULL; - apr_pool_t *sub_context; - apr_status_t rv; - - 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. - */ - if (apr_pool_create(&sub_context, r->pool) != APR_SUCCESS) - return -1; - - if ((rv = create_uncompress_child(&parm, sub_context, &pipe_out)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - MODNAME ": couldn't spawn uncompress process: %s", r->uri); - return -1; - } - - *newch = (unsigned char *) apr_palloc(r->pool, n); - rv = apr_file_read(pipe_out, *newch, &n); - if (n == 0) { - apr_pool_destroy(sub_context); - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - MODNAME ": read failed %s", r->filename); - return -1; - } - apr_pool_destroy(sub_context); - 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, apr_size_t 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 (apr_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 && !apr_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, 0, r, - MODNAME ": revision_suffix checking %s", r->filename); -#endif /* MIME_MAGIC_DEBUG */ - - /* check for recognized revision suffix */ - suffix_pos = strlen(r->filename) - 1; - if (!apr_isdigit(r->filename[suffix_pos])) { - return 0; - } - while (suffix_pos >= 0 && apr_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 = apr_pstrndup(r->pool, r->filename, suffix_pos); -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0, r, - MODNAME ": subrequest lookup for %s", sub_filename); -#endif /* MIME_MAGIC_DEBUG */ - sub = ap_sub_req_lookup_file(sub_filename, r, NULL); - - /* extract content type/encoding/language from sub-request */ - if (sub->content_type) { - r->content_type = apr_pstrdup(r->pool, sub->content_type); -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0, r, - MODNAME ": subrequest %s got %s", - sub_filename, r->content_type); -#endif /* MIME_MAGIC_DEBUG */ - if (sub->content_encoding) - r->content_encoding = - apr_pstrdup(r->pool, sub->content_encoding); - if (sub->content_language) - r->content_language = - apr_pstrdup(r->pool, sub->content_language); - result = 1; - } - - /* clean up */ - ap_destroy_sub_req(sub); - - return result; -} - -/* - * initialize the module - */ -static void magic_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *main_server) -{ - 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, 0, s, - MODNAME ": magic_init 1 test"); - for (m = conf->magic; m; m = m->next) { - if (apr_isprint((((unsigned long) m) >> 24) & 255) && - apr_isprint((((unsigned long) m) >> 16) & 255) && - apr_isprint((((unsigned long) m) >> 8) & 255) && - apr_isprint(((unsigned long) m) & 255)) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0, 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.filetype == 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); -} - -static void register_hooks(apr_pool_t *p) -{ - static const char * const aszPre[]={ "mod_mime.c", NULL }; - - /* mod_mime_magic should be run after mod_mime, if at all. */ - - ap_hook_type_checker(magic_find_ct, aszPre, NULL, APR_HOOK_MIDDLE); - ap_hook_post_config(magic_init, NULL, NULL, APR_HOOK_FIRST); -} - -/* - * Apache API module interface - */ - -module mime_magic_module = -{ - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks /* register hooks */ -}; - - diff --git a/modules/metadata/mod_mime_magic.exp b/modules/metadata/mod_mime_magic.exp deleted file mode 100644 index 42068a4342..0000000000 --- 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 386f3c8d74..0000000000 --- a/modules/metadata/mod_setenvif.c +++ /dev/null @@ -1,471 +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. - */ - -/* - * 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 "apr.h" -#include "apr_strings.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_log.h" -#include "http_protocol.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 */ - apr_table_t *features; /* env vars to set (or unset) */ - enum special special_type; /* is it a "special" header ? */ - int icase; /* ignoring case? */ -} sei_entry; - -typedef struct { - apr_array_header_t *conditionals; -} sei_cfg_rec; - -module AP_MODULE_DECLARE_DATA setenvif_module; - -/* - * These routines, the create- and merge-config functions, are called - * for both the server-wide and the per-directory contexts. This is - * because the different definitions are used at different times; the - * server-wide ones are used in the post-read-request phase, and the - * per-directory ones are used during the header-parse phase (after - * the URI has been mapped to a file and we have anything from the - * .htaccess file and <Directory> and <Files> containers). - */ -static void *create_setenvif_config(apr_pool_t *p) -{ - sei_cfg_rec *new = (sei_cfg_rec *) apr_palloc(p, sizeof(sei_cfg_rec)); - - new->conditionals = apr_array_make(p, 20, sizeof(sei_entry)); - return (void *) new; -} - -static void *create_setenvif_config_svr(apr_pool_t *p, server_rec *dummy) -{ - return create_setenvif_config(p); -} - -static void *create_setenvif_config_dir(apr_pool_t *p, char *dummy) -{ - return create_setenvif_config(p); -} - -static void *merge_setenvif_config(apr_pool_t *p, void *basev, void *overridesv) -{ - sei_cfg_rec *a = apr_pcalloc(p, sizeof(sei_cfg_rec)); - sei_cfg_rec *base = basev, *overrides = overridesv; - - a->conditionals = apr_array_append(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)) -#define SEI_MAGIC_HEIRLOOM "setenvif-phase-flag" - -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; - sei_entry *new; - sei_entry *entries; - char *var; - int i; - int beenhere = 0; - int icase; - - /* - * Determine from our context into which record to put the entry. - * cmd->path == NULL means we're in server-wide context; otherwise, - * we're dealing with a per-directory setting. - */ - sconf = (cmd->path != NULL) - ? (sei_cfg_rec *) mconfig - : (sei_cfg_rec *) ap_get_module_config(cmd->server->module_config, - &setenvif_module); - entries = (sei_entry *) sconf->conditionals->elts; - /* get regex */ - regex = ap_getword_conf(cmd->pool, &args); - if (!*regex) { - return apr_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 identical 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 = apr_array_push(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 apr_pstrcat(cmd->pool, cmd->cmd->name, - " regex could not be compiled.", NULL); - } - new->features = apr_table_make(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) { - apr_table_setn(new->features, var, feature); - } - else if (*var == '!') { - apr_table_setn(new->features, var + 1, "!"); - } - else { - apr_table_setn(new->features, var, "1"); - } - } - - if (!beenhere) { - return apr_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 apr_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[] = -{ - AP_INIT_RAW_ARGS("SetEnvIf", add_setenvif, NULL, - OR_FILEINFO, "A header-name, regex and a list of variables."), - AP_INIT_RAW_ARGS("SetEnvIfNoCase", add_setenvif, ICASE_MAGIC, - OR_FILEINFO, "a header-name, regex and a list of variables."), - AP_INIT_RAW_ARGS("BrowserMatch", add_browser, NULL, - OR_FILEINFO, "A browser regex and a list of variables."), - AP_INIT_RAW_ARGS("BrowserMatchNoCase", add_browser, ICASE_MAGIC, - OR_FILEINFO, "A browser regex and a list of variables."), - { NULL }, -}; - -/* - * This routine gets called at two different points in request processing: - * once before the URI has been translated (during the post-read-request - * phase) and once after (during the header-parse phase). We use different - * config records for the two different calls to reduce overhead (by not - * re-doing the server-wide settings during directory processing), and - * signal which call it is by having the earlier one pass a flag to the - * later one. - */ -static int match_headers(request_rec *r) -{ - sei_cfg_rec *sconf; - sei_entry *entries; - apr_table_entry_t *elts; - const char *val; - int i, j; - char *last_name; - - if (apr_table_get(r->notes, SEI_MAGIC_HEIRLOOM) == NULL) { - apr_table_set(r->notes, SEI_MAGIC_HEIRLOOM, "post-read done"); - sconf = (sei_cfg_rec *) ap_get_module_config(r->server->module_config, - &setenvif_module); - } - else { - sconf = (sei_cfg_rec *) ap_get_module_config(r->per_dir_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, NULL); - break; - case SPECIAL_REMOTE_USER: - val = r->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 = apr_table_get(r->headers_in, b->name); - if (val == NULL) { - val = apr_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)) { - apr_array_header_t *arr = apr_table_elts(b->features); - elts = (apr_table_entry_t *) arr->elts; - - for (j = 0; j < arr->nelts; ++j) { - if (!strcmp(elts[j].val, "!")) { - apr_table_unset(r->subprocess_env, elts[j].key); - } - else { - apr_table_setn(r->subprocess_env, elts[j].key, elts[j].val); - } - } - } - } - - return DECLINED; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_header_parser(match_headers, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_post_read_request(match_headers, NULL, NULL, APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA setenvif_module = -{ - STANDARD20_MODULE_STUFF, - create_setenvif_config_dir, /* dir config creater */ - merge_setenvif_config, /* dir merger --- default is to override */ - create_setenvif_config_svr, /* server config */ - merge_setenvif_config, /* merge server configs */ - setenvif_module_cmds, /* command apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/metadata/mod_setenvif.exp b/modules/metadata/mod_setenvif.exp deleted file mode 100644 index 4f3800e3a8..0000000000 --- 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 69a54174b4..0000000000 --- a/modules/metadata/mod_unique_id.c +++ /dev/null @@ -1,402 +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. - */ - -/* - * 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 "apr_general.h" /* for XtOffsetOf */ - -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" -#include "http_protocol.h" /* for ap_hook_post_read_request */ - -#if APR_HAVE_NETDB_H -#include <netdb.h> -#endif -#if APR_HAVE_ARPA_INET_H -#include <arpa/inet.h> -#endif -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#endif - -typedef struct { - unsigned int stamp; - unsigned int in_addr; - unsigned int pid; - unsigned short counter; - unsigned int thread_index; -} unique_id_rec; - -/* We are using thread_index (the index into the scoreboard), because we - * cannont garauntee the thread_id will be an integer. - * - * This code looks like it won't give a unique ID with the new thread logic. - * It will. The reason is, we don't increment the counter in a thread_safe - * manner. Because the thread_index is also in the unique ID now, this does - * not matter. In order for the id to not be unique, the same thread would - * have to get the same counter twice in the same second. - */ - -/* 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 unique_id_rec cur_unique_id; - -/* - * Number of elements in the structure unique_id_rec. - */ -#define UNIQUE_ID_REC_MAX 5 - -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(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *main_server) -{ -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 256 -#endif - char str[MAXHOSTNAMELEN + 1]; - struct hostent *hent; - apr_short_interval_time_t pause; - - /* - * 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_offset[4] = XtOffsetOf(unique_id_rec, thread_index); - unique_id_rec_size[4] = sizeof(cur_unique_id.thread_index); - 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] + - unique_id_rec_size[4]; - - /* - * 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, errno, main_server, - "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, h_errno, main_server, - "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, 0, main_server, - "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. - */ - pause = (apr_short_interval_time_t)(1000000 - (apr_time_now() % APR_USEC_PER_SEC)); - apr_sleep(pause); -} - -static void unique_id_child_init(apr_pool_t *p, server_rec *s) -{ - pid_t pid; - apr_time_t tv; - - /* - * 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, 0, 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. - */ - tv = apr_time_now(); - /* Some systems have very low variance on the low end of their system - * counter, defend against that. - */ - cur_unique_id.counter = tv % APR_USEC_PER_SEC / 10; - - /* - * 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. - */ - unique_id_rec new_unique_id; - 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 = apr_table_get(r->subprocess_env, "REDIRECT_UNIQUE_ID"))) { - apr_table_setn(r->subprocess_env, "UNIQUE_ID", e); - return DECLINED; - } - - new_unique_id.in_addr = cur_unique_id.in_addr; - new_unique_id.pid = cur_unique_id.pid; - new_unique_id.counter = cur_unique_id.counter; - - new_unique_id.stamp = htonl((unsigned int)r->request_time); - new_unique_id.thread_index = htonl((unsigned int)r->connection->id); - - /* we'll use a temporal buffer to avoid uuencoding the possible internal - * paddings of the original structure */ - x = (unsigned char *) &paddedbuf; - y = (unsigned char *) &new_unique_id; - k = 0; - for (i = 0; i < UNIQUE_ID_REC_MAX; i++) { - y = ((unsigned char *) &new_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 *)apr_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 */ - apr_table_setn(r->subprocess_env, "UNIQUE_ID", str); - - /* and increment the identifier for the next call */ - - counter = ntohs(new_unique_id.counter) + 1; - cur_unique_id.counter = htons(counter); - - return DECLINED; -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_post_config(unique_id_global_init, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_child_init(unique_id_child_init, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_post_read_request(gen_unique_id, NULL, NULL, APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA unique_id_module = { - STANDARD20_MODULE_STUFF, - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server configs */ - NULL, /* command apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/metadata/mod_unique_id.exp b/modules/metadata/mod_unique_id.exp deleted file mode 100644 index 93000f1ee6..0000000000 --- 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 dfe39f0875..0000000000 --- a/modules/metadata/mod_usertrack.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. - * ==================================================================== - * - * 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. - */ - -/* 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 "apr.h" -#include "apr_lib.h" -#include "apr_strings.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_request.h" - - -module AP_MODULE_DECLARE_DATA usertrack_module; - -typedef struct { - int always; - int expires; -} cookie_log_state; - -typedef struct { - int enabled; - char *cookie_name; -} cookie_dir_rec; - -/* 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); - /* 1024 == hardcoded constant */ - char cookiebuf[1024]; - char *new_cookie; - const char *rname = ap_get_remote_host(r->connection, r->per_dir_config, - REMOTE_NAME, NULL); - cookie_dir_rec *dcfg; - - dcfg = ap_get_module_config(r->per_dir_config, &usertrack_module); - - /* XXX: hmm, this should really tie in with mod_unique_id */ - apr_snprintf(cookiebuf, sizeof(cookiebuf), "%s.%qd", rname, apr_time_now()); - - if (cls->expires) { - apr_exploded_time_t tms; - - apr_explode_gmt(&tms, r->request_time + cls->expires * APR_USEC_PER_SEC); - - /* Cookie with date; as strftime '%a, %d-%h-%y %H:%M:%S GMT' */ - new_cookie = apr_psprintf(r->pool, - "%s=%s; path=/; expires=%s, %.2d-%s-%.2d %.2d:%.2d:%.2d GMT", - dcfg->cookie_name, cookiebuf, apr_day_snames[tms.tm_wday], - tms.tm_mday, apr_month_snames[tms.tm_mon], - tms.tm_year % 100, - tms.tm_hour, tms.tm_min, tms.tm_sec); - } - else { - new_cookie = apr_psprintf(r->pool, "%s=%s; path=/", - dcfg->cookie_name, cookiebuf); - } - - apr_table_setn(r->headers_out, "Set-Cookie", new_cookie); - apr_table_setn(r->notes, "cookie", apr_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; - const char *value; - - if (!dcfg->enabled) { - return DECLINED; - } - - if ((cookie = apr_table_get(r->headers_in, "Cookie"))) - if ((value = ap_strstr_c(cookie, dcfg->cookie_name))) { - char *cookiebuf, *cookieend; - - value += strlen(dcfg->cookie_name) + 1; /* Skip over the '=' */ - cookiebuf = apr_pstrdup(r->pool, value); - cookieend = strchr(cookiebuf, ';'); - if (cookieend) - *cookieend = '\0'; /* Ignore anything after a ; */ - - /* Set the cookie in a note, for logging */ - apr_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(apr_pool_t *p, server_rec *s) -{ - cookie_log_state *cls = - (cookie_log_state *) apr_palloc(p, sizeof(cookie_log_state)); - - cls->expires = 0; - - return (void *) cls; -} - -static void *make_cookie_dir(apr_pool_t *p, char *d) -{ - cookie_dir_rec *dcfg; - - dcfg = (cookie_dir_rec *) apr_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 (apr_isdigit(arg[0]) && apr_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 (apr_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, const char *name) -{ - cookie_dir_rec *dcfg = (cookie_dir_rec *) mconfig; - - dcfg->cookie_name = apr_pstrdup(cmd->pool, name); - return NULL; -} - -static const command_rec cookie_log_cmds[] = { - AP_INIT_TAKE1("CookieExpires", set_cookie_exp, NULL, RSRC_CONF, - "an expiry date code"), - AP_INIT_FLAG("CookieTracking", set_cookie_enable, NULL, OR_FILEINFO, - "whether or not to enable cookies"), - AP_INIT_TAKE1("CookieName", set_cookie_name, NULL, OR_FILEINFO, - "name of the tracking cookie"), - {NULL} -}; - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_fixups(spot_cookie,NULL,NULL,APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA usertrack_module = { - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/metadata/mod_usertrack.dsp b/modules/metadata/mod_usertrack.dsp deleted file mode 100644 index 47a70f1645..0000000000 --- a/modules/metadata/mod_usertrack.dsp +++ /dev/null @@ -1,95 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_usertrack" - 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_usertrack - 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_usertrack.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_usertrack.mak" CFG="mod_usertrack - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_usertrack - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_usertrack - 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_usertrack - 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_usertrack" /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_usertrack.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_usertrack -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_usertrack.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_usertrack - -!ELSEIF "$(CFG)" == "mod_usertrack - 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_usertrack" /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_usertrack.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_usertrack -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_usertrack.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_usertrack - -!ENDIF - -# Begin Target - -# Name "mod_usertrack - Win32 Release" -# Name "mod_usertrack - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_usertrack.c -# End Source File -# End Target -# End Project diff --git a/modules/metadata/mod_usertrack.exp b/modules/metadata/mod_usertrack.exp deleted file mode 100644 index 234a5f759d..0000000000 --- a/modules/metadata/mod_usertrack.exp +++ /dev/null @@ -1 +0,0 @@ -usertrack_module diff --git a/modules/metadata/mod_usertrack.mak b/modules/metadata/mod_usertrack.mak deleted file mode 100644 index 342ea22ce1..0000000000 --- a/modules/metadata/mod_usertrack.mak +++ /dev/null @@ -1,325 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on mod_usertrack.dsp -!IF "$(CFG)" == "" -CFG=mod_usertrack - Win32 Release -!MESSAGE No configuration specified. Defaulting to mod_usertrack - Win32\ - Release. -!ENDIF - -!IF "$(CFG)" != "mod_usertrack - Win32 Release" && "$(CFG)" !=\ - "mod_usertrack - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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_usertrack.mak" CFG="mod_usertrack - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_usertrack - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_usertrack - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "mod_usertrack - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_usertrack.so" - -!ELSE - -ALL : "libhttpd - Win32 Release" "libapr - Win32 Release"\ - "$(OUTDIR)\mod_usertrack.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 ReleaseCLEAN" "libhttpd - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_usertrack.idb" - -@erase "$(INTDIR)\mod_usertrack.obj" - -@erase "$(OUTDIR)\mod_usertrack.exp" - -@erase "$(OUTDIR)\mod_usertrack.lib" - -@erase "$(OUTDIR)\mod_usertrack.map" - -@erase "$(OUTDIR)\mod_usertrack.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I\ - "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D\ - "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_usertrack" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_usertrack.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_usertrack.pdb" /map:"$(INTDIR)\mod_usertrack.map"\ - /machine:I386 /out:"$(OUTDIR)\mod_usertrack.so"\ - /implib:"$(OUTDIR)\mod_usertrack.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_usertrack -LINK32_OBJS= \ - "$(INTDIR)\mod_usertrack.obj" \ - "..\..\Release\libhttpd.lib" \ - "..\..\srclib\apr\Release\libapr.lib" - -"$(OUTDIR)\mod_usertrack.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "mod_usertrack - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_usertrack.so" - -!ELSE - -ALL : "libhttpd - Win32 Debug" "libapr - Win32 Debug"\ - "$(OUTDIR)\mod_usertrack.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 DebugCLEAN" "libhttpd - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_usertrack.idb" - -@erase "$(INTDIR)\mod_usertrack.obj" - -@erase "$(OUTDIR)\mod_usertrack.exp" - -@erase "$(OUTDIR)\mod_usertrack.lib" - -@erase "$(OUTDIR)\mod_usertrack.map" - -@erase "$(OUTDIR)\mod_usertrack.pdb" - -@erase "$(OUTDIR)\mod_usertrack.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_usertrack" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_usertrack.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)\mod_usertrack.pdb" /map:"$(INTDIR)\mod_usertrack.map" /debug\ - /machine:I386 /out:"$(OUTDIR)\mod_usertrack.so"\ - /implib:"$(OUTDIR)\mod_usertrack.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_usertrack -LINK32_OBJS= \ - "$(INTDIR)\mod_usertrack.obj" \ - "..\..\Debug\libhttpd.lib" \ - "..\..\srclib\apr\Debug\libapr.lib" - -"$(OUTDIR)\mod_usertrack.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "mod_usertrack - Win32 Release" || "$(CFG)" ==\ - "mod_usertrack - Win32 Debug" - -!IF "$(CFG)" == "mod_usertrack - Win32 Release" - -"libapr - Win32 Release" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Release" - cd "..\..\modules\metadata" - -"libapr - Win32 ReleaseCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\..\modules\metadata" - -!ELSEIF "$(CFG)" == "mod_usertrack - Win32 Debug" - -"libapr - Win32 Debug" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\libapr.mak CFG="libapr - Win32 Debug" - cd "..\..\modules\metadata" - -"libapr - Win32 DebugCLEAN" : - cd "..\..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libapr.mak CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\..\modules\metadata" - -!ENDIF - -!IF "$(CFG)" == "mod_usertrack - Win32 Release" - -"libhttpd - Win32 Release" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Release" - cd ".\modules\metadata" - -"libhttpd - Win32 ReleaseCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Release"\ - RECURSE=1 - cd ".\modules\metadata" - -!ELSEIF "$(CFG)" == "mod_usertrack - Win32 Debug" - -"libhttpd - Win32 Debug" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) /F .\libhttpd.mak CFG="libhttpd - Win32 Debug" - cd ".\modules\metadata" - -"libhttpd - Win32 DebugCLEAN" : - cd "..\.." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\libhttpd.mak CFG="libhttpd - Win32 Debug"\ - RECURSE=1 - cd ".\modules\metadata" - -!ENDIF - -SOURCE=.\mod_usertrack.c -DEP_CPP_MOD_U=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.h"\ - "..\..\include\ap_release.h"\ - "..\..\include\http_config.h"\ - "..\..\include\http_core.h"\ - "..\..\include\http_request.h"\ - "..\..\include\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\srclib\apr-util\include\apr_buckets.h"\ - "..\..\srclib\apr-util\include\apr_hooks.h"\ - "..\..\srclib\apr-util\include\apr_ring.h"\ - "..\..\srclib\apr-util\include\apu.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_info.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_lib.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_strings.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\include\apr_user.h"\ - "..\..\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_MOD_U=\ - "..\..\include\ap_config_auto.h"\ - - -"$(INTDIR)\mod_usertrack.obj" : $(SOURCE) $(DEP_CPP_MOD_U) "$(INTDIR)" - - - -!ENDIF - diff --git a/modules/proxy/.cvsignore b/modules/proxy/.cvsignore deleted file mode 100644 index efec0263f6..0000000000 --- a/modules/proxy/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -Debug -Release -Makefile -*.lo -*.slo -*.la -*.so -modules.mk -.deps -.libs diff --git a/modules/proxy/.indent.pro b/modules/proxy/.indent.pro deleted file mode 100644 index 20c2d83371..0000000000 --- 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/Makefile.in b/modules/proxy/Makefile.in deleted file mode 100644 index 7c5c149d85..0000000000 --- a/modules/proxy/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/proxy/config.m4 b/modules/proxy/config.m4 deleted file mode 100644 index 325fca910f..0000000000 --- a/modules/proxy/config.m4 +++ /dev/null @@ -1,24 +0,0 @@ -dnl modules enabled in this directory by default - -APACHE_MODPATH_INIT(proxy) - -if test "$enable_proxy" = "shared"; then - proxy_mods_enable=shared -elif test "$enable_proxy" = "yes"; then - proxy_mods_enable=yes -else - proxy_mods_enable=no -fi - -proxy_objs="mod_proxy.lo proxy_util.lo" -APACHE_MODULE(proxy, Apache proxy module, $proxy_objs, , $proxy_mods_enable) - -proxy_connect_objs="proxy_connect.lo proxy_util.lo" -APACHE_MODULE(proxy_connect, Apache proxy CONNECT module, $proxy_connect_objs, , $proxy_mods_enable) -proxy_ftp_objs="proxy_ftp.lo proxy_util.lo" -APACHE_MODULE(proxy_ftp, Apache proxy FTP module, $proxy_ftp_objs, , $proxy_mods_enable) -proxy_http_objs="proxy_http.lo proxy_util.lo" -APACHE_MODULE(proxy_http, Apache proxy HTTP module, $proxy_http_objs, , $proxy_mods_enable) - - -APACHE_MODPATH_FINISH diff --git a/modules/proxy/libproxy.exp b/modules/proxy/libproxy.exp deleted file mode 100644 index a20f2378f5..0000000000 --- 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 0d6b28977f..0000000000 --- a/modules/proxy/mod_proxy.c +++ /dev/null @@ -1,768 +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. - */ - -#define CORE_PRIVATE - -#include "mod_proxy.h" - -extern module AP_MODULE_DECLARE_DATA proxy_module; - - -/* - * 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 = PROXYREQ_PROXY; - r->uri = r->unparsed_uri; - r->filename = apr_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 = PROXYREQ_PROXY; - r->uri = r->unparsed_uri; - r->filename = apr_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 = apr_pstrcat(r->pool, "proxy:", ent[i].real, - r->uri + len, NULL); - r->handler = "proxy-server"; - r->proxyreq = PROXYREQ_REVERSE; - return OK; - } - } - return DECLINED; -} - -/* -------------------------------------------------------------- */ -/* Fixup the filename */ - -/* - * Canonicalise the URL - */ -static int proxy_fixup(request_rec *r) -{ - char *url, *p; - int access_status; - - if (!r->proxyreq || strncmp(r->filename, "proxy:", 6) != 0) - return DECLINED; - - url = &r->filename[6]; - - /* canonicalise each specific scheme */ - if ((access_status = proxy_run_canon_handler(r, url))) { - return access_status; - } - - p = strchr(url, ':'); - if (p == NULL || p == url) - return HTTP_BAD_REQUEST; - - return OK; /* otherwise; we've done the best we can */ -} - -/* 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 = apr_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 = apr_pstrcat(r->pool, r->parsed_uri.hostname, - domain, NULL); - nuri = ap_unparse_uri_components(r->pool, - &r->parsed_uri, - UNP_REVEALPASSWORD); - - apr_table_set(r->headers_out, "Location", nuri); - ap_log_rerror(APLOG_MARK, APLOG_INFO|APLOG_NOERRNO, 0, 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; - const char *p2; - void *sconf = r->server->module_config; - proxy_server_conf *conf = (proxy_server_conf *) - ap_get_module_config(sconf, &proxy_module); - apr_array_header_t *proxies = conf->proxies; - struct proxy_remote *ents = (struct proxy_remote *) proxies->elts; - int i, rc, access_status; - int direct_connect = 0; - const char *str; - long maxfwd; - - /* is this for us? */ - if (!r->proxyreq || strncmp(r->filename, "proxy:", 6) != 0) - return DECLINED; - - /* handle max-forwards / OPTIONS / TRACE */ - if ((str = apr_table_get(r->headers_in, "Max-Forwards"))) { - maxfwd = strtol(str, NULL, 10); - if (maxfwd < 1) { - switch (r->method_number) { - case M_TRACE: { - int access_status; - r->proxyreq = PROXYREQ_NONE; - if ((access_status = ap_send_http_trace(r))) - ap_die(access_status, r); - else - ap_finalize_request_protocol(r); - return OK; - } - case M_OPTIONS: { - int access_status; - r->proxyreq = PROXYREQ_NONE; - if ((access_status = ap_send_http_options(r))) - ap_die(access_status, r); - else - ap_finalize_request_protocol(r); - return OK; - } - default: { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Max-Forwards has reached zero - proxy loop?"); - } - } - } - maxfwd = (maxfwd > 0) ? maxfwd - 1 : 0; - } - else { - /* set configured max-forwards */ - maxfwd = conf->maxfwd; - } - apr_table_setn(r->headers_in, "Max-Forwards", - apr_psprintf(r->pool, "%ld", (maxfwd > 0) ? maxfwd : 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; - - /* 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 = apr_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++) { - p2 = ap_strchr_c(ents[i].scheme, ':'); /* is it a partial URL? */ - if (strcmp(ents[i].scheme, "*") == 0 || - (p2 == NULL && strcasecmp(scheme, ents[i].scheme) == 0) || - (p2 != NULL && - strncasecmp(url, ents[i].scheme, strlen(ents[i].scheme)) == 0)) { - - /* handle the scheme */ - ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server, - "Trying to run scheme_handler against proxy"); - access_status = proxy_run_scheme_handler(r, conf, url, ents[i].hostname, ents[i].port); - - /* an error or success */ - if (access_status != DECLINED && access_status != HTTP_BAD_GATEWAY) { - return access_status; - } - /* 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 */ - ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server, - "Trying to run scheme_handler"); - access_status = proxy_run_scheme_handler(r, conf, url, NULL, 0); - if (DECLINED == access_status) { - ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server, - "Neither CONNECT, HTTP or FTP for %s", - r->uri); - return HTTP_FORBIDDEN; - } - return access_status; -} - -/* -------------------------------------------------------------- */ -/* Setup configurable data */ - -static void * create_proxy_config(apr_pool_t *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->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->viaopt_set = 0; /* 0 means default */ - ps->req = 0; - ps->req_set = 0; - ps->recv_buffer_size = 0; /* this default was left unset for some reason */ - ps->recv_buffer_size_set = 0; - ps->maxfwd = DEFAULT_MAX_FORWARDS; - ps->maxfwd_set = 0; - - return ps; -} - -static void * merge_proxy_config(apr_pool_t *p, void *basev, void *overridesv) -{ - proxy_server_conf *ps = ap_pcalloc(p, sizeof(proxy_server_conf)); - proxy_server_conf *base = (proxy_server_conf *) basev; - proxy_server_conf *overrides = (proxy_server_conf *) overridesv; - - ps->proxies = ap_append_arrays(p, base->proxies, overrides->proxies); - ps->aliases = ap_append_arrays(p, base->aliases, overrides->aliases); - ps->raliases = ap_append_arrays(p, base->raliases, overrides->raliases); - ps->noproxies = ap_append_arrays(p, base->noproxies, overrides->noproxies); - ps->dirconn = ap_append_arrays(p, base->dirconn, overrides->dirconn); - ps->allowed_connect_ports = ap_append_arrays(p, base->allowed_connect_ports, overrides->allowed_connect_ports); - - ps->domain = (overrides->domain == NULL) ? base->domain : overrides->domain; - ps->viaopt = (overrides->viaopt_set == 0) ? base->viaopt : overrides->viaopt; - ps->req = (overrides->req_set == 0) ? base->req : overrides->req; - ps->recv_buffer_size = (overrides->recv_buffer_size_set == 0) ? base->recv_buffer_size : overrides->recv_buffer_size; - ps->maxfwd = (overrides->maxfwd_set == 0) ? base->maxfwd : overrides->maxfwd; - - return ps; -} - -static const char * - add_proxy(cmd_parms *cmd, void *dummy, const char *f1, const char *r1) -{ - 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; - char *r, *f, *scheme; - int port; - - r = apr_pstrdup(cmd->pool, r1); - scheme = apr_pstrdup(cmd->pool, r1); - f = apr_pstrdup(cmd->pool, f1); - p = strchr(r, ':'); - if (p == NULL || p[1] != '/' || p[2] != '/' || p[3] == '\0') { - return "ProxyRemote: Bad syntax for a remote proxy server"; - } - else { - scheme[p-r] = 0; - } - 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) { - port = ap_default_port_for_scheme(scheme); - } - - new = apr_array_push(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, const char *f, const 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 = apr_array_push(conf->aliases); - new->fake = f; - new->real = r; - return NULL; -} - -static const char * - add_pass_reverse(cmd_parms *cmd, void *dummy, const char *f, const 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 = apr_array_push(conf->raliases); - new->fake = f; - new->real = r; - return NULL; -} - -static const char * - set_proxy_exclude(cmd_parms *parms, void *dummy, const 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 apr_sockaddr_t *addr; - int found = 0; - int i; - - /* Don't duplicate entries */ - for (i = 0; i < conf->noproxies->nelts; i++) { - if (apr_strnatcasecmp(arg, list[i].name) == 0) { /* ignore case for host names */ - found = 1; - } - } - - if (!found) { - new = apr_array_push(conf->noproxies); - new->name = arg; - if (APR_SUCCESS == apr_sockaddr_info_get(&addr, new->name, APR_UNSPEC, 0, 0, parms->pool)) { - new->addr = addr; - } - else { - new->addr = NULL; - } - } - return NULL; -} - -/* - * Set the ports CONNECT can use - */ -static const char * - set_allowed_ports(cmd_parms *parms, void *dummy, const char *arg) -{ - server_rec *s = parms->server; - proxy_server_conf *conf = - ap_get_module_config(s->module_config, &proxy_module); - int *New; - - if (!apr_isdigit(arg[0])) - return "AllowCONNECT: port number must be numeric"; - - New = apr_array_push(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, const 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 = apr_array_push(conf->dirconn); - New->name = apr_pstrdup(parms->pool, arg); - New->hostentry = NULL; - - if (ap_proxy_is_ipaddr(New, parms->pool)) { -#if DEBUGGING - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Parsed addr %s", inet_ntoa(New->addr)); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Parsed mask %s", inet_ntoa(New->mask)); -#endif - } - else if (ap_proxy_is_domainname(New, parms->pool)) { - ap_str_tolower(New->name); -#if DEBUGGING - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Parsed domain %s", New->name); -#endif - } - else if (ap_proxy_is_hostname(New, parms->pool)) { - ap_str_tolower(New->name); -#if DEBUGGING - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Parsed host %s", 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, const 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; - psf->req_set = 1; - return NULL; -} - -static const char * - set_recv_buffer_size(cmd_parms *parms, void *dummy, const 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; - psf->recv_buffer_size_set = 1; - return NULL; -} - -static const char * - set_max_forwards(cmd_parms *parms, void *dummy, const char *arg) -{ - proxy_server_conf *psf = - ap_get_module_config(parms->server->module_config, &proxy_module); - long s = atol(arg); - if (s < 0) { - return "ProxyMaxForwards must be greater or equal to zero.."; - } - - psf->maxfwd = s; - psf->maxfwd_set = 1; - return NULL; -} - -static const char* - set_via_opt(cmd_parms *parms, void *dummy, const 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"; - } - - psf->viaopt_set = 1; - return NULL; -} - -static const command_rec proxy_cmds[] = -{ - AP_INIT_FLAG("ProxyRequests", set_proxy_req, NULL, RSRC_CONF, - "on if the true proxy requests should be accepted"), - AP_INIT_TAKE2("ProxyRemote", add_proxy, NULL, RSRC_CONF, - "a scheme, partial URL or '*' and a proxy server"), - AP_INIT_TAKE2("ProxyPass", add_pass, NULL, RSRC_CONF, - "a virtual path and a URL"), - AP_INIT_TAKE2("ProxyPassReverse", add_pass_reverse, NULL, RSRC_CONF, - "a virtual path and a URL for reverse proxy behaviour"), - AP_INIT_ITERATE("ProxyBlock", set_proxy_exclude, NULL, RSRC_CONF, - "A list of names, hosts or domains to which the proxy will not connect"), - AP_INIT_TAKE1("ProxyReceiveBufferSize", set_recv_buffer_size, NULL, RSRC_CONF, - "Receive buffer size for outgoing HTTP and FTP connections in bytes"), - AP_INIT_TAKE1("ProxyMaxForwards", set_max_forwards, NULL, RSRC_CONF, - "The maximum number of proxies a request may be forwarded through."), - AP_INIT_ITERATE("NoProxy", set_proxy_dirconn, NULL, RSRC_CONF, - "A list of domains, hosts, or subnets to which the proxy will connect directly"), - AP_INIT_TAKE1("ProxyDomain", set_proxy_domain, NULL, RSRC_CONF, - "The default intranet domain name (in absence of a domain in the URL)"), - AP_INIT_ITERATE("AllowCONNECT", set_allowed_ports, NULL, RSRC_CONF, - "A list of ports which CONNECT may connect to"), - AP_INIT_TAKE1("ProxyVia", set_via_opt, NULL, RSRC_CONF, - "Configure Via: proxy header header to one of: on | off | block | full"), - {NULL} -}; - -static void register_hooks(apr_pool_t *p) -{ - /* handler */ - ap_hook_handler(proxy_handler, NULL, NULL, APR_HOOK_FIRST); - /* filename-to-URI translation */ - ap_hook_translate_name(proxy_trans, NULL, NULL, APR_HOOK_FIRST); - /* fixups */ - ap_hook_fixups(proxy_fixup, NULL, NULL, APR_HOOK_FIRST); - /* post read_request handling */ - ap_hook_post_read_request(proxy_detect, NULL, NULL, APR_HOOK_FIRST); -} - -module AP_MODULE_DECLARE_DATA proxy_module = -{ - STANDARD20_MODULE_STUFF, - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - create_proxy_config, /* create per-server config structure */ - merge_proxy_config, /* merge per-server config structures */ - proxy_cmds, /* command table */ - register_hooks -}; - -APR_HOOK_STRUCT( - APR_HOOK_LINK(scheme_handler) - APR_HOOK_LINK(canon_handler) -) - -APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(proxy, PROXY, int, scheme_handler, - (request_rec *r, proxy_server_conf *conf, - char *url, const char *proxyhost, - apr_port_t proxyport),(r,conf,url, - proxyhost,proxyport),DECLINED) -APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(proxy, PROXY, int, canon_handler, - (request_rec *r, char *url),(r, - url),DECLINED) diff --git a/modules/proxy/mod_proxy.dsp b/modules/proxy/mod_proxy.dsp deleted file mode 100644 index d57baaa0e5..0000000000 --- a/modules/proxy/mod_proxy.dsp +++ /dev/null @@ -1,123 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_proxy" - 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 - 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.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.mak" CFG="mod_proxy - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_proxy - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_proxy - 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 - 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 "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /I "..\..\include" /I "..\..\os\win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_proxy" /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 /incremental:no /map /out:"Release/mod_proxy.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_proxy -# ADD LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_proxy.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_proxy - -!ELSEIF "$(CFG)" == "mod_proxy - 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 "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /I "..\..\include" /I "..\..\os\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_proxy" /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 /out:"Debug/mod_proxy.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_proxy -# ADD LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_proxy.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_proxy - -!ENDIF - -# Begin Target - -# Name "mod_proxy - Win32 Release" -# Name "mod_proxy - 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_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 -# End Target -# End Project diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h deleted file mode 100644 index c614605a36..0000000000 --- a/modules/proxy/mod_proxy.h +++ /dev/null @@ -1,259 +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_PROXY_H -#define MOD_PROXY_H - -/* - * Main include file for the Apache proxy - */ - -/* - - Also note numerous FIXMEs and CHECKMEs which should be eliminated. - - This code is once again experimental! - - Things to do: - - 1. Make it completely work (for FTP too) - - 2. HTTP/1.1 - - Chuck Murcko <chuck@topsail.org> 02-06-01 - - */ - -#define CORE_PRIVATE - -#include "apr_hooks.h" -#include "apr.h" -#include "apr_compat.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_buckets.h" -#include "apr_md5.h" -#include "apr_pools.h" -#include "apr_strings.h" - -#include "httpd.h" -#include "http_config.h" -#include "ap_config.h" -#include "http_core.h" -#include "http_protocol.h" -#include "http_request.h" -#include "http_vhost.h" -#include "http_main.h" -#include "http_log.h" -#include "http_connection.h" -#include "util_filter.h" -#include "util_date.h" -#include "util_uri.h" -#include "mod_core.h" - - -#if APR_HAVE_NETDB_H -#include <netdb.h> -#endif -#if APR_HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif -#if APR_HAVE_NETINET_IN_H -#include <netinet/in.h> -#endif -#if APR_HAVE_ARPA_INET_H -#include <arpa/inet.h> -#endif - -/* for proxy_canonenc() */ -enum enctype { - enc_path, enc_search, enc_user, enc_fpath, enc_parm -}; - -#if APR_CHARSET_EBCDIC -#define CRLF "\r\n" -#else /*APR_CHARSET_EBCDIC*/ -#define CRLF "\015\012" -#endif /*APR_CHARSET_EBCDIC*/ - -/* default Max-Forwards header setting */ -#define DEFAULT_MAX_FORWARDS 10 - -/* 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 { - const char *real; - const 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 { - const char *name; - struct apr_sockaddr_t *addr; -}; - -typedef struct { - apr_array_header_t *proxies; - apr_array_header_t *aliases; - apr_array_header_t *raliases; - apr_array_header_t *noproxies; - apr_array_header_t *dirconn; - apr_array_header_t *allowed_connect_ports; - const char *domain; /* domain name to use in absence of a domain name in the request */ - int req; /* true if proxy requests are enabled */ - char req_set; - enum { - via_off, - via_on, - via_block, - via_full - } viaopt; /* how to deal with proxy Via: headers */ - char viaopt_set; - size_t recv_buffer_size; - char recv_buffer_size_set; - long maxfwd; - char maxfwd_set; -} proxy_server_conf; - -struct per_thread_data { - struct hostent hpbuf; - u_long ipaddr; - char *charpbuf[2]; -}; - -typedef struct { - conn_rec *connection; - char *hostname; - apr_port_t port; -} proxy_conn_rec; - -typedef struct { - float cache_completion; /* completion percentage */ - int content_length; /* length of the content */ -} proxy_completion; - - -/* hooks */ - -/* Create a set of PROXY_DECLARE(type), PROXY_DECLARE_NONSTD(type) and - * PROXY_DECLARE_DATA with appropriate export and import tags for the platform - */ -#if !defined(WIN32) -#define PROXY_DECLARE(type) type -#define PROXY_DECLARE_NONSTD(type) type -#define PROXY_DECLARE_DATA -#elif defined(PROXY_DECLARE_STATIC) -#define PROXY_DECLARE(type) type __stdcall -#define PROXY_DECLARE_NONSTD(type) type -#define PROXY_DECLARE_DATA -#elif defined(PROXY_DECLARE_EXPORT) -#define PROXY_DECLARE(type) __declspec(dllexport) type __stdcall -#define PROXY_DECLARE_NONSTD(type) __declspec(dllexport) type -#define PROXY_DECLARE_DATA __declspec(dllexport) -#else -#define PROXY_DECLARE(type) __declspec(dllimport) type __stdcall -#define PROXY_DECLARE_NONSTD(type) __declspec(dllimport) type -#define PROXY_DECLARE_DATA __declspec(dllimport) -#endif - -APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, scheme_handler, (request_rec *r, - proxy_server_conf *conf, char *url, - const char *proxyhost, apr_port_t proxyport)) -APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, canon_handler, (request_rec *r, - char *url)) - -/* proxy_util.c */ - -request_rec *make_fake_req(conn_rec *c, request_rec *r); -int ap_proxy_hex2c(const char *x); -void ap_proxy_c2hex(int ch, char *x); -char *ap_proxy_canonenc(apr_pool_t *p, const char *x, int len, enum enctype t, - int isenc); -char *ap_proxy_canon_netloc(apr_pool_t *p, char **const urlp, char **userp, - char **passwordp, char **hostp, apr_port_t *port); -const char *ap_proxy_date_canon(apr_pool_t *p, const char *x); -apr_table_t *ap_proxy_read_headers(request_rec *r, request_rec *rp, char *buffer, int size, conn_rec *c); -int ap_proxy_liststr(const char *list, const char *val); -char *ap_proxy_removestr(apr_pool_t *pool, const char *list, const char *val); -int ap_proxy_hex2sec(const char *x); -void ap_proxy_sec2hex(int t, char *y); -const char *ap_proxy_host2addr(const char *host, struct hostent *reqhp); -int ap_proxyerror(request_rec *r, int statuscode, const char *message); -int ap_proxy_is_ipaddr(struct dirconn_entry *This, apr_pool_t *p); -int ap_proxy_is_domainname(struct dirconn_entry *This, apr_pool_t *p); -int ap_proxy_is_hostname(struct dirconn_entry *This, apr_pool_t *p); -int ap_proxy_is_word(struct dirconn_entry *This, apr_pool_t *p); -int ap_proxy_checkproxyblock(request_rec *r, proxy_server_conf *conf, apr_sockaddr_t *uri_addr); -int ap_proxy_pre_http_connection(conn_rec *c, request_rec *r); -apr_status_t ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb, char *buff, size_t bufflen, int *eos); -void ap_proxy_reset_output_filters(conn_rec *c); - - -#endif /*MOD_PROXY_H*/ diff --git a/modules/proxy/mod_proxy.mak b/modules/proxy/mod_proxy.mak deleted file mode 100644 index 3d13f3d1ac..0000000000 --- a/modules/proxy/mod_proxy.mak +++ /dev/null @@ -1,573 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on mod_proxy.dsp -!IF "$(CFG)" == "" -CFG=mod_proxy - Win32 Release -!MESSAGE No configuration specified. Defaulting to mod_proxy - Win32 Release. -!ENDIF - -!IF "$(CFG)" != "mod_proxy - Win32 Release" && "$(CFG)" !=\ - "mod_proxy - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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.mak" CFG="mod_proxy - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_proxy - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_proxy - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "mod_proxy - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_proxy.so" - -!ELSE - -ALL : "libaprutil - Win32 Release" "libhttpd - Win32 Release"\ - "libapr - Win32 Release" "$(OUTDIR)\mod_proxy.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 ReleaseCLEAN" "libhttpd - Win32 ReleaseCLEAN"\ - "libaprutil - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_proxy.idb" - -@erase "$(INTDIR)\mod_proxy.obj" - -@erase "$(INTDIR)\proxy_connect.obj" - -@erase "$(INTDIR)\proxy_ftp.obj" - -@erase "$(INTDIR)\proxy_http.obj" - -@erase "$(INTDIR)\proxy_util.obj" - -@erase "$(OUTDIR)\mod_proxy.exp" - -@erase "$(OUTDIR)\mod_proxy.lib" - -@erase "$(OUTDIR)\mod_proxy.map" - -@erase "$(OUTDIR)\mod_proxy.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "..\..\srclib\apr\include" /I\ - "../../srclib/apr-util/include" /I "..\..\include" /I "..\..\os\win32" /D\ - "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_proxy" /FD\ - /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_proxy.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows\ - /dll /incremental:no /pdb:"$(OUTDIR)\mod_proxy.pdb"\ - /map:"$(INTDIR)\mod_proxy.map" /machine:I386 /out:"$(OUTDIR)\mod_proxy.so"\ - /implib:"$(OUTDIR)\mod_proxy.lib" /base:@..\..\os\win32\BaseAddr.ref,mod_proxy -LINK32_OBJS= \ - "$(INTDIR)\mod_proxy.obj" \ - "$(INTDIR)\proxy_connect.obj" \ - "$(INTDIR)\proxy_ftp.obj" \ - "$(INTDIR)\proxy_http.obj" \ - "$(INTDIR)\proxy_util.obj" \ - "..\..\Release\libhttpd.lib" \ - "..\..\srclib\apr-util\Release\libaprutil.lib" \ - "..\..\srclib\apr\Release\libapr.lib" - -"$(OUTDIR)\mod_proxy.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "mod_proxy - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\mod_proxy.so" - -!ELSE - -ALL : "libaprutil - Win32 Debug" "libhttpd - Win32 Debug"\ - "libapr - Win32 Debug" "$(OUTDIR)\mod_proxy.so" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"libapr - Win32 DebugCLEAN" "libhttpd - Win32 DebugCLEAN"\ - "libaprutil - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\mod_proxy.idb" - -@erase "$(INTDIR)\mod_proxy.obj" - -@erase "$(INTDIR)\proxy_connect.obj" - -@erase "$(INTDIR)\proxy_ftp.obj" - -@erase "$(INTDIR)\proxy_http.obj" - -@erase "$(INTDIR)\proxy_util.obj" - -@erase "$(OUTDIR)\mod_proxy.exp" - -@erase "$(OUTDIR)\mod_proxy.lib" - -@erase "$(OUTDIR)\mod_proxy.map" - -@erase "$(OUTDIR)\mod_proxy.pdb" - -@erase "$(OUTDIR)\mod_proxy.so" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Zi /Od /I "..\..\srclib\apr\include" /I\ - "../../srclib/apr-util/include" /I "..\..\include" /I "..\..\os\win32" /D\ - "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\mod_proxy" /FD\ - /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\mod_proxy.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows\ - /dll /incremental:no /pdb:"$(OUTDIR)\mod_proxy.pdb"\ - /map:"$(INTDIR)\mod_proxy.map" /debug /machine:I386\ - /out:"$(OUTDIR)\mod_proxy.so" /implib:"$(OUTDIR)\mod_proxy.lib"\ - /base:@..\..\os\win32\BaseAddr.ref,mod_proxy -LINK32_OBJS= \ - "$(INTDIR)\mod_proxy.obj" \ - "$(INTDIR)\proxy_connect.obj" \ - "$(INTDIR)\proxy_ftp.obj" \ - "$(INTDIR)\proxy_http.obj" \ - "$(INTDIR)\proxy_util.obj" \ - "..\..\Debug\libhttpd.lib" \ - "..\..\srclib\apr-util\Debug\libaprutil.lib" \ - "..\..\srclib\apr\Debug\libapr.lib" - -"$(OUTDIR)\mod_proxy.so" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "mod_proxy - Win32 Release" || "$(CFG)" ==\ - "mod_proxy - Win32 Debug" -SOURCE=.\mod_proxy.c -DEP_CPP_MOD_P=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.h"\ - "..\..\include\http_config.h"\ - "..\..\include\http_log.h"\ - "..\..\include\http_protocol.h"\ - "..\..\include\http_request.h"\ - "..\..\include\http_vhost.h"\ - "..\..\include\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_date.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\srclib\apr-util\include\ap_buckets.h"\ - "..\..\srclib\apr-util\include\ap_hooks.h"\ - "..\..\srclib\apr-util\include\ap_ring.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_compat.h"\ - "..\..\srclib\apr\include\apr_dso.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_lib.h"\ - "..\..\srclib\apr\include\apr_lock.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_portable.h"\ - "..\..\srclib\apr\include\apr_strings.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\network_io\os2\os2nerrno.h"\ - ".\mod_proxy.h"\ - -NODEP_CPP_MOD_P=\ - "..\..\include\ap_config_auto.h"\ - "..\..\include\ap_config_path.h"\ - ".\ap_cache.h"\ - ".\buff.h"\ - - -"$(INTDIR)\mod_proxy.obj" : $(SOURCE) $(DEP_CPP_MOD_P) "$(INTDIR)" - - -SOURCE=.\proxy_connect.c -DEP_CPP_PROXY=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.h"\ - "..\..\include\http_config.h"\ - "..\..\include\http_log.h"\ - "..\..\include\http_main.h"\ - "..\..\include\http_protocol.h"\ - "..\..\include\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\srclib\apr-util\include\ap_buckets.h"\ - "..\..\srclib\apr-util\include\ap_hooks.h"\ - "..\..\srclib\apr-util\include\ap_ring.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_compat.h"\ - "..\..\srclib\apr\include\apr_dso.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_lib.h"\ - "..\..\srclib\apr\include\apr_lock.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_portable.h"\ - "..\..\srclib\apr\include\apr_strings.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\network_io\os2\os2nerrno.h"\ - ".\mod_proxy.h"\ - -NODEP_CPP_PROXY=\ - "..\..\include\ap_config_auto.h"\ - "..\..\include\ap_config_path.h"\ - ".\ap_cache.h"\ - ".\buff.h"\ - - -"$(INTDIR)\proxy_connect.obj" : $(SOURCE) $(DEP_CPP_PROXY) "$(INTDIR)" - - -SOURCE=.\proxy_ftp.c -DEP_CPP_PROXY_=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.h"\ - "..\..\include\http_config.h"\ - "..\..\include\http_core.h"\ - "..\..\include\http_log.h"\ - "..\..\include\http_main.h"\ - "..\..\include\http_protocol.h"\ - "..\..\include\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\srclib\apr-util\include\ap_buckets.h"\ - "..\..\srclib\apr-util\include\ap_hooks.h"\ - "..\..\srclib\apr-util\include\ap_ring.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_compat.h"\ - "..\..\srclib\apr\include\apr_dso.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_lib.h"\ - "..\..\srclib\apr\include\apr_lock.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_portable.h"\ - "..\..\srclib\apr\include\apr_strings.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\network_io\os2\os2nerrno.h"\ - ".\mod_proxy.h"\ - -NODEP_CPP_PROXY_=\ - "..\..\include\ap_config_auto.h"\ - "..\..\include\ap_config_path.h"\ - ".\ap_cache.h"\ - ".\buff.h"\ - - -"$(INTDIR)\proxy_ftp.obj" : $(SOURCE) $(DEP_CPP_PROXY_) "$(INTDIR)" - - -SOURCE=.\proxy_http.c -DEP_CPP_PROXY_H=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.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\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_date.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\srclib\apr-util\include\ap_buckets.h"\ - "..\..\srclib\apr-util\include\ap_hooks.h"\ - "..\..\srclib\apr-util\include\ap_ring.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_compat.h"\ - "..\..\srclib\apr\include\apr_dso.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_lib.h"\ - "..\..\srclib\apr\include\apr_lock.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_portable.h"\ - "..\..\srclib\apr\include\apr_strings.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\network_io\os2\os2nerrno.h"\ - ".\mod_proxy.h"\ - -NODEP_CPP_PROXY_H=\ - "..\..\include\ap_config_auto.h"\ - "..\..\include\ap_config_path.h"\ - ".\ap_cache.h"\ - ".\buff.h"\ - - -"$(INTDIR)\proxy_http.obj" : $(SOURCE) $(DEP_CPP_PROXY_H) "$(INTDIR)" - - -SOURCE=.\proxy_util.c -DEP_CPP_PROXY_U=\ - "..\..\include\ap_config.h"\ - "..\..\include\ap_mmn.h"\ - "..\..\include\http_config.h"\ - "..\..\include\http_core.h"\ - "..\..\include\http_log.h"\ - "..\..\include\http_main.h"\ - "..\..\include\http_protocol.h"\ - "..\..\include\httpd.h"\ - "..\..\include\pcreposix.h"\ - "..\..\include\util_cfgtree.h"\ - "..\..\include\util_date.h"\ - "..\..\include\util_filter.h"\ - "..\..\include\util_uri.h"\ - "..\..\os\win32\os.h"\ - "..\..\srclib\apr-util\include\ap_buckets.h"\ - "..\..\srclib\apr-util\include\ap_hooks.h"\ - "..\..\srclib\apr-util\include\ap_ring.h"\ - "..\..\srclib\apr\include\apr.h"\ - "..\..\srclib\apr\include\apr_compat.h"\ - "..\..\srclib\apr\include\apr_dso.h"\ - "..\..\srclib\apr\include\apr_errno.h"\ - "..\..\srclib\apr\include\apr_file_io.h"\ - "..\..\srclib\apr\include\apr_general.h"\ - "..\..\srclib\apr\include\apr_lib.h"\ - "..\..\srclib\apr\include\apr_lock.h"\ - "..\..\srclib\apr\include\apr_md5.h"\ - "..\..\srclib\apr\include\apr_mmap.h"\ - "..\..\srclib\apr\include\apr_network_io.h"\ - "..\..\srclib\apr\include\apr_pools.h"\ - "..\..\srclib\apr\include\apr_portable.h"\ - "..\..\srclib\apr\include\apr_strings.h"\ - "..\..\srclib\apr\include\apr_tables.h"\ - "..\..\srclib\apr\include\apr_thread_proc.h"\ - "..\..\srclib\apr\include\apr_time.h"\ - "..\..\srclib\apr\include\apr_xlate.h"\ - "..\..\srclib\apr\network_io\os2\os2nerrno.h"\ - ".\mod_proxy.h"\ - -NODEP_CPP_PROXY_U=\ - "..\..\include\ap_config_auto.h"\ - "..\..\include\ap_config_path.h"\ - ".\ap_cache.h"\ - ".\buff.h"\ - - -"$(INTDIR)\proxy_util.obj" : $(SOURCE) $(DEP_CPP_PROXY_U) "$(INTDIR)" - - -!IF "$(CFG)" == "mod_proxy - Win32 Release" - -"libapr - Win32 Release" : - cd "\test\httpd-2.0\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F ".\libapr.mak" CFG="libapr - Win32 Release" - cd "..\..\modules\proxy" - -"libapr - Win32 ReleaseCLEAN" : - cd "\test\httpd-2.0\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libapr.mak" CFG="libapr - Win32 Release"\ - RECURSE=1 - cd "..\..\modules\proxy" - -!ELSEIF "$(CFG)" == "mod_proxy - Win32 Debug" - -"libapr - Win32 Debug" : - cd "\test\httpd-2.0\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F ".\libapr.mak" CFG="libapr - Win32 Debug" - cd "..\..\modules\proxy" - -"libapr - Win32 DebugCLEAN" : - cd "\test\httpd-2.0\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libapr.mak" CFG="libapr - Win32 Debug"\ - RECURSE=1 - cd "..\..\modules\proxy" - -!ENDIF - -!IF "$(CFG)" == "mod_proxy - Win32 Release" - -"libhttpd - Win32 Release" : - cd "\test\httpd-2.0" - $(MAKE) /$(MAKEFLAGS) /F ".\libhttpd.mak" CFG="libhttpd - Win32 Release" - cd ".\modules\proxy" - -"libhttpd - Win32 ReleaseCLEAN" : - cd "\test\httpd-2.0" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libhttpd.mak"\ - CFG="libhttpd - Win32 Release" RECURSE=1 - cd ".\modules\proxy" - -!ELSEIF "$(CFG)" == "mod_proxy - Win32 Debug" - -"libhttpd - Win32 Debug" : - cd "\test\httpd-2.0" - $(MAKE) /$(MAKEFLAGS) /F ".\libhttpd.mak" CFG="libhttpd - Win32 Debug" - cd ".\modules\proxy" - -"libhttpd - Win32 DebugCLEAN" : - cd "\test\httpd-2.0" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libhttpd.mak" CFG="libhttpd - Win32 Debug"\ - RECURSE=1 - cd ".\modules\proxy" - -!ENDIF - -!IF "$(CFG)" == "mod_proxy - Win32 Release" - -"libaprutil - Win32 Release" : - cd "\test\httpd-2.0\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\libaprutil.mak" CFG="libaprutil - Win32 Release"\ - - cd "..\..\modules\proxy" - -"libaprutil - Win32 ReleaseCLEAN" : - cd "\test\httpd-2.0\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libaprutil.mak"\ - CFG="libaprutil - Win32 Release" RECURSE=1 - cd "..\..\modules\proxy" - -!ELSEIF "$(CFG)" == "mod_proxy - Win32 Debug" - -"libaprutil - Win32 Debug" : - cd "\test\httpd-2.0\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\libaprutil.mak" CFG="libaprutil - Win32 Debug" - cd "..\..\modules\proxy" - -"libaprutil - Win32 DebugCLEAN" : - cd "\test\httpd-2.0\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\libaprutil.mak"\ - CFG="libaprutil - Win32 Debug" RECURSE=1 - cd "..\..\modules\proxy" - -!ENDIF - - -!ENDIF - diff --git a/modules/proxy/proxy_connect.c b/modules/proxy/proxy_connect.c deleted file mode 100644 index c83e2accf6..0000000000 --- a/modules/proxy/proxy_connect.c +++ /dev/null @@ -1,427 +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. - */ - -/* CONNECT method for Apache proxy */ - -#define CORE_PRIVATE - -#include "mod_proxy.h" - -module AP_MODULE_DECLARE_DATA proxy_connect_module; - -PROXY_DECLARE (int) ap_proxy_connect_canon(request_rec *r, char *url); -PROXY_DECLARE (int) ap_proxy_connect_handler(request_rec *r, proxy_server_conf *conf, - char *url, const char *proxyname, - apr_port_t proxyport); - -/* - * 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 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; -} - -/* canonicalise CONNECT URLs. */ -PROXY_DECLARE (int) ap_proxy_connect_canon(request_rec *r, char *url) -{ - - if (r->method_number != M_CONNECT) { - return DECLINED; - } - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: CONNECT: canonicalising URL %s", url); - - return OK; -} - -/* CONNECT handler */ -PROXY_DECLARE (int) ap_proxy_connect_handler(request_rec *r, proxy_server_conf *conf, - char *url, const char *proxyname, - apr_port_t proxyport) -{ - apr_pool_t *p = r->pool; - apr_socket_t *sock; - apr_status_t err, rv; - apr_size_t i, o, nbytes; - char buffer[HUGE_STRING_LEN]; - - apr_pollfd_t *pollfd; - apr_int32_t pollcnt; - apr_int16_t pollevent; - apr_sockaddr_t *uri_addr, *connect_addr; - - uri_components uri; - const char *connectname; - int connectport = 0; - - /* is this for us? */ - if (r->method_number != M_CONNECT) { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: CONNECT: rejecting URL %s", url); - return DECLINED; - } - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: CONNECT: serving URL %s", url); - - - /* - * Step One: Determine Who To Connect To - * - * Break up the URL to determine the host to connect to - */ - - /* we break the URL into host, port, uri */ - if (HTTP_OK != ap_parse_hostinfo_components(p, url, &uri)) { - return ap_proxyerror(r, HTTP_BAD_REQUEST, - apr_pstrcat(p, "URI cannot be parsed: ", url, NULL)); - } - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: CONNECT: connecting %s to %s:%d", url, uri.hostname, uri.port); - - /* do a DNS lookup for the destination host */ - err = apr_sockaddr_info_get(&uri_addr, uri.hostname, APR_UNSPEC, uri.port, 0, p); - - /* are we connecting directly, or via a proxy? */ - if (proxyname) { - connectname = proxyname; - connectport = proxyport; - err = apr_sockaddr_info_get(&connect_addr, proxyname, APR_UNSPEC, proxyport, 0, p); - } - else { - connectname = uri.hostname; - connectport = uri.port; - connect_addr = uri_addr; - } - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL, - "proxy: CONNECT: connecting to remote proxy %s on port %d", connectname, connectport); - - /* check if ProxyBlock directive on this host */ - if (OK != ap_proxy_checkproxyblock(r, conf, uri_addr)) { - 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 (uri.port) { - case DEFAULT_HTTPS_PORT: - case DEFAULT_SNEWS_PORT: - break; - default: - return HTTP_FORBIDDEN; - } - } else if(!allowed_port(conf, uri.port)) - return HTTP_FORBIDDEN; - - - /* - * Step Two: Make the Connection - * - * We have determined who to connect to. Now make the connection. - */ - - /* get all the possible IP addresses for the destname and loop through them - * until we get a successful connection - */ - if (APR_SUCCESS != err) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_pstrcat(p, - "DNS lookup failure for: ", - connectname, NULL)); - } - - /* create a new socket */ - if ((rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: error creating socket"); - return HTTP_INTERNAL_SERVER_ERROR; - } - - /* - * At this point we have a list of one or more IP addresses of - * the machine to connect to. If configured, reorder this - * list so that the "best candidate" is first try. "best - * candidate" could mean the least loaded server, the fastest - * responding server, whatever. - * - * For now we do nothing, ie we get DNS round robin. - * XXX FIXME - */ - - - /* try each IP address until we connect successfully */ - { - int failed = 1; - while (connect_addr) { - - /* make the connection out of the socket */ - rv = apr_connect(sock, connect_addr); - - /* if an error occurred, loop round and try again */ - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: CONNECT: attempt to connect to %pI (%s) failed", connect_addr, connectname); - connect_addr = connect_addr->next; - continue; - } - - /* if we get here, all is well */ - failed = 0; - break; - } - - /* handle a permanent error from the above loop */ - if (failed) { - apr_socket_close(sock); - if (proxyname) { - return DECLINED; - } - else { - return HTTP_BAD_GATEWAY; - } - } - } - - - /* - * Step Three: Send the Request - * - * Send the HTTP/1.1 CONNECT request to the remote server - */ - - /* we are acting as a tunnel - the output filter stack should - * be completely empty, because when we are done here we are done completely. - * We add the NULL filter to the stack to do this... - */ - r->output_filters = NULL; - r->connection->output_filters = NULL; - - - /* If we are connecting through a remote proxy, we need to pass - * the CONNECT request on to it. - */ - if (proxyport) { - /* FIXME: Error checking ignored. - */ - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: CONNECT: sending the CONNECT request to the remote proxy"); - nbytes = apr_snprintf(buffer, sizeof(buffer), - "CONNECT %s HTTP/1.0" CRLF, r->uri); - apr_send(sock, buffer, &nbytes); - nbytes = apr_snprintf(buffer, sizeof(buffer), - "Proxy-agent: %s" CRLF CRLF, ap_get_server_version()); - apr_send(sock, buffer, &nbytes); - } - else { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: CONNECT: Returning 200 OK Status"); - nbytes = apr_snprintf(buffer, sizeof(buffer), - "HTTP/1.0 200 Connection Established" CRLF); - apr_send(r->connection->client_socket, buffer, &nbytes); - nbytes = apr_snprintf(buffer, sizeof(buffer), - "Proxy-agent: %s" CRLF CRLF, ap_get_server_version()); - apr_send(r->connection->client_socket, buffer, &nbytes); - } - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: CONNECT: setting up poll()"); - - /* - * Step Four: Handle Data Transfer - * - * Handle two way transfer of data over the socket (this is a tunnel). - */ - -/* r->sent_bodyct = 1;*/ - - if((rv = apr_poll_setup(&pollfd, 2, r->pool)) != APR_SUCCESS) - { - apr_socket_close(sock); - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: CONNECT: error apr_poll_setup()"); - return HTTP_INTERNAL_SERVER_ERROR; - } - - /* Add client side to the poll */ - apr_poll_socket_add(pollfd, r->connection->client_socket, APR_POLLIN); - - /* Add the server side to the poll */ - apr_poll_socket_add(pollfd, sock, APR_POLLIN); - - while (1) { /* Infinite loop until error (one side closes the connection) */ -/* ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, "proxy: CONNECT: going to sleep (poll)");*/ - if ((rv = apr_poll(pollfd, &pollcnt, -1)) != APR_SUCCESS) - { - apr_socket_close(sock); - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: CONNECT: error apr_poll()"); - return HTTP_INTERNAL_SERVER_ERROR; - } -/* ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: CONNECT: woke from select(), i=%d", pollcnt);*/ - - if (pollcnt) { - apr_poll_revents_get(&pollevent, sock, pollfd); - if (pollevent & APR_POLLIN) { -/* ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: CONNECT: sock was set");*/ - nbytes = sizeof(buffer); - if (apr_recv(sock, buffer, &nbytes) == APR_SUCCESS) { - o = 0; - i = nbytes; - while(i > 0) - { - nbytes = i; - if (apr_send(r->connection->client_socket, buffer + o, &nbytes) != APR_SUCCESS) - break; - o += nbytes; - i -= nbytes; - } - } - else - break; - } - else if ((pollevent & APR_POLLERR) || (pollevent & APR_POLLHUP)) - break; - - - apr_poll_revents_get(&pollevent, r->connection->client_socket, pollfd); - if (pollevent & APR_POLLIN) { -/* ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: CONNECT: client was set");*/ - nbytes = sizeof(buffer); - if (apr_recv(r->connection->client_socket, buffer, &nbytes) == APR_SUCCESS) { - o = 0; - i = nbytes; - while(i > 0) - { - nbytes = i; - if (apr_send(sock, buffer + o, &nbytes) != APR_SUCCESS) - break; - o += nbytes; - i -= nbytes; - } - } - else - break; - } - else if ((pollevent & APR_POLLERR) || (pollevent & APR_POLLHUP)) - break; - } - else - break; - } - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: CONNECT: finished with poll() - cleaning up"); - - /* - * Step Five: Clean Up - * - * Close the socket and clean up - */ - - apr_socket_close(sock); - - return OK; -} - -static void ap_proxy_connect_register_hook(apr_pool_t *p) -{ - proxy_hook_scheme_handler(ap_proxy_connect_handler, NULL, NULL, APR_HOOK_MIDDLE); - proxy_hook_canon_handler(ap_proxy_connect_canon, NULL, NULL, APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA proxy_connect_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 */ - ap_proxy_connect_register_hook /* register hooks */ -}; diff --git a/modules/proxy/proxy_ftp.c b/modules/proxy/proxy_ftp.c deleted file mode 100644 index a6661db7a9..0000000000 --- a/modules/proxy/proxy_ftp.c +++ /dev/null @@ -1,1666 +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. - */ - -/* FTP routines for Apache proxy */ - -#include "mod_proxy.h" - -#define AUTODETECT_PWD - -module AP_MODULE_DECLARE_DATA proxy_ftp_module; - -PROXY_DECLARE (int) ap_proxy_ftp_canon(request_rec *r, char *url); -PROXY_DECLARE (int) ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf, - char *url, const char *proxyhost, - apr_port_t proxyport); -apr_status_t ap_proxy_send_dir_filter(ap_filter_t *f, - apr_bucket_brigade *bb); - - -/* - * 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 = 0; - - 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; - } -#if !APR_CHARSET_EBCDIC - if (ch == '\015' || ch == '\012' || (ch & 0x80)) -#else /*APR_CHARSET_EBCDIC*/ - if (ch == '\r' || ch == '\n' || (os_toascii[ch] & 0x80)) -#endif /*APR_CHARSET_EBCDIC*/ - return 0; - } - return 1; -} - -/* - * Canonicalise ftp URLs. - */ -PROXY_DECLARE (int) ap_proxy_ftp_canon(request_rec *r, char *url) -{ - char *user, *password, *host, *path, *parms, *strp, sport[7]; - apr_pool_t *p = r->pool; - const char *err; - apr_port_t port, def_port; - - /* */ - if (strncasecmp(url, "ftp:", 4) == 0) { - url += 4; - } - else { - return DECLINED; - } - def_port = ap_default_port_for_scheme("ftp"); - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: canonicalising URL %s", url); - - port = def_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 = apr_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 = apr_pstrcat(p, path, "?", strp, NULL); - } - r->args = NULL; - } - -/* now, rebuild URL */ - - if (port != def_port) - apr_snprintf(sport, sizeof(sport), ":%d", port); - else - sport[0] = '\0'; - - r->filename = apr_pstrcat(p, "proxy:ftp://", (user != NULL) ? user : "", - (password != NULL) ? ":" : "", - (password != NULL) ? password : "", - (user != NULL) ? "@" : "", host, sport, "/", path, - (parms[0] != '\0') ? ";" : "", parms, NULL); - - return OK; -} - -/* we chop lines longer than 80 characters */ -#define MAX_LINE_LEN 80 - -/* - * Reads response lines, returns both the ftp status code and - * remembers the response message in the supplied buffer - */ -static int ftp_getrc_msg(conn_rec *c, apr_bucket_brigade *bb, char *msgbuf, int msglen) -{ - int status; - char response[MAX_LINE_LEN]; - char buff[5]; - char *mb = msgbuf, - *me = &msgbuf[msglen]; - apr_status_t rv; - int eos; - - if (APR_SUCCESS != (rv = ap_proxy_string_read(c, bb, response, sizeof(response), &eos))) { - return -1; - } - if (!apr_isdigit(response[0]) || !apr_isdigit(response[1]) || - !apr_isdigit(response[2]) || (response[3] != ' ' && response[3] != '-')) - status = 0; - else - status = 100 * response[0] + 10 * response[1] + response[2] - 111 * '0'; - - mb = apr_cpystrn(mb, response+4, me - mb); - - if (response[3] == '-') { - memcpy(buff, response, 3); - buff[3] = ' '; - do { - if (APR_SUCCESS != (rv = ap_proxy_string_read(c, bb, response, sizeof(response), &eos))) { - return -1; - } - mb = apr_cpystrn(mb, response + (' ' == response[0] ? 1 : 4), me - mb); - } while (memcmp(response, buff, 4) != 0); - } - - return status; -} - -/* this is a filter that turns a raw ASCII directory listing into pretty HTML */ - -/* ideally, mod_proxy should simply send the raw directory list up the filter - * stack to mod_autoindex, which in theory should turn the raw ascii into - * pretty html along with all the bells and whistles it provides... - * - * all in good time...! :) - */ - -typedef struct { - apr_bucket_brigade *in; - char buffer[MAX_STRING_LEN]; - enum {HEADER, BODY, FOOTER} state; -} proxy_dir_ctx_t; - -apr_status_t ap_proxy_send_dir_filter(ap_filter_t *f, apr_bucket_brigade *in) -{ - request_rec *r = f->r; - apr_pool_t *p = r->pool; - apr_bucket *e; - apr_bucket_brigade *out = apr_brigade_create(p); - apr_status_t rv; - - register int n; - char *dir, *path, *reldir, *site, *str; - - const char *pwd = apr_table_get(r->notes, "Directory-PWD"); - const char *readme = apr_table_get(r->notes, "Directory-README"); - - proxy_dir_ctx_t *ctx = f->ctx; - if (!ctx) { - f->ctx = ctx = apr_pcalloc(p, sizeof(*ctx)); - ctx->in = apr_brigade_create(p); - ctx->buffer[0] = 0; - ctx->state = HEADER; - } - - /* combine the stored and the new */ - APR_BRIGADE_CONCAT(ctx->in, in); - - if (HEADER == ctx->state) { - - /* Save "scheme://site" prefix without password */ - site = ap_unparse_uri_components(p, &f->r->parsed_uri, UNP_OMITPASSWORD|UNP_OMITPATHINFO); - /* ... and path without query args */ - path = ap_unparse_uri_components(p, &f->r->parsed_uri, UNP_OMITSITEPART|UNP_OMITQUERY); - (void)decodeenc(path); - - /* Copy path, strip (all except the last) trailing slashes */ - path = dir = apr_pstrcat(p, path, "/", NULL); - while ((n = strlen(path)) > 1 && path[n-1] == '/' && path[n-2] == '/') - path[n-1] = '\0'; - - /* print "ftp://host/" */ - str = apr_psprintf(p, DOCTYPE_HTML_3_2 - "\n\n<HTML>\n<HEAD>\n<TITLE>%s%s\n" - "\n\n\n" - "\n\n

    Directory of " - "%s/", - site, path, site, path, site); - - e = apr_bucket_pool_create(str, strlen(str), p); - APR_BRIGADE_INSERT_TAIL(out, e); - - while ((dir = strchr(dir+1, '/')) != NULL) - { - *dir = '\0'; - if ((reldir = strrchr(path+1, '/'))==NULL) - reldir = path+1; - else - ++reldir; - /* print "path/" component */ - str = apr_psprintf(p, "%s/", path+1, reldir); - e = apr_bucket_pool_create(str, strlen(str), p); - APR_BRIGADE_INSERT_TAIL(out, e); - *dir = '/'; - } - /* If the caller has determined the current directory, and it differs */ - /* from what the client requested, then show the real name */ - if (pwd == NULL || strncmp (pwd, path, strlen(pwd)) == 0) { - str = apr_psprintf(p, "

    \n\n
    \n\n
    ");
    -	} else {
    -	    str = apr_psprintf(p, "\n\n(%s)\n\n
    \n\n
    ", pwd);
    -	}
    -	e = apr_bucket_pool_create(str, strlen(str), p);
    -	APR_BRIGADE_INSERT_TAIL(out, e);
    -
    -	/* print README */
    -	if (readme) {
    -	    str = apr_psprintf(p, "%s\n
    \n\n
    \n\n
    \n",
    -			     readme);
    -
    -	    e = apr_bucket_pool_create(str, strlen(str), p);
    -	    APR_BRIGADE_INSERT_TAIL(out, e);
    -	}
    -
    -	/* make sure page intro gets sent out */
    -	e = apr_bucket_flush_create();
    -	APR_BRIGADE_INSERT_TAIL(out, e);
    -	if (APR_SUCCESS != (rv = ap_pass_brigade(f->next, out))) {
    -	    return rv;
    -	}
    -	apr_brigade_cleanup(out);
    -
    -	ctx->state = BODY;
    -    }
    -
    -    /* loop through each line of directory */
    -    while (BODY == ctx->state) {
    -	char *filename;
    -	int found = 0;
    -	int eos = 0;
    -
    -	/* get a complete line */
    -	/* if the buffer overruns - throw data away */
    -	while (!found && !APR_BRIGADE_EMPTY(ctx->in)) {
    -	    char *pos, *response;
    -	    apr_size_t len, max;
    -	    e = APR_BRIGADE_FIRST(ctx->in);
    -	    if (APR_BUCKET_IS_EOS(e)) {
    -		eos = 1;
    -		break;
    -	    }
    -	    if (APR_SUCCESS != (rv = apr_bucket_read(e, (const char **)&response, &len, APR_BLOCK_READ))) {
    -		return rv;
    -	    }
    -	    pos = memchr(response, APR_ASCII_LF, len);
    -	    if (pos != NULL) {
    -		if ((pos - response + 1) != len) {
    -		    len = pos - response + 1;
    -		    apr_bucket_split(e, pos - response + 1);
    -		    
    -		}
    -		found = 1;
    -	    }
    -	    max = sizeof(ctx->buffer)-strlen(ctx->buffer)-1;
    -	    if (len > max) {
    -		len = max;
    -	    }
    -/* strncat works here, but apr_cpystrn does not - the last char gets chopped, dunno why */
    -/*	    apr_cpystrn(ctx->buffer+strlen(ctx->buffer), response, len);*/
    -	    strncat(ctx->buffer, response, len);
    -	    APR_BUCKET_REMOVE(e);
    -	    apr_bucket_destroy(e);
    -	}
    -
    -	/* EOS? jump to footer */
    -	if (eos) {
    -	    ctx->state = FOOTER;
    -	    break;
    -	}
    -
    -	/* not complete? leave and try get some more */
    -	if (!found) {
    -	    return APR_SUCCESS;
    -	}
    -
    -	/* a symlink? */
    -	if (ctx->buffer[0] == 'l' && (filename=strstr(ctx->buffer, " -> ")) != 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';
    -	    str = apr_psprintf(p, "%s %s %s\n", ctx->buffer, filename, filename, link_ptr);
    -	}
    -
    -	/* a directory/file? */
    -	else if (ctx->buffer[0] == 'd' || ctx->buffer[0] == '-' || ctx->buffer[0] == 'l' || apr_isdigit(ctx->buffer[0])) {
    -	    int searchidx = 0;
    -	    char *searchptr = NULL;
    -	    int firstfile = 1;
    -	    if (apr_isdigit(ctx->buffer[0])) {	/* handle DOS dir */
    -		searchptr = strchr(ctx->buffer, '<');
    -		if (searchptr != NULL)
    -		    *searchptr = '[';
    -		searchptr = strchr(ctx->buffer, '>');
    -		if (searchptr != NULL)
    -		    *searchptr = ']';
    -	    }
    -
    -	    filename = strrchr(ctx->buffer, ' ');
    -	    *(filename++) = 0;
    -	    filename[strlen(filename) - 1] = 0;
    -
    -	    /* handle filenames with spaces in 'em */
    -	    if (!strcmp(filename, ".") || !strcmp(filename, "..") || firstfile) {
    -		firstfile = 0;
    -		searchidx = filename - ctx->buffer;
    -	    }
    -	    else if (searchidx != 0 && ctx->buffer[searchidx] != 0) {
    -		*(--filename) = ' ';
    -		ctx->buffer[searchidx - 1] = 0;
    -		filename = &ctx->buffer[searchidx];
    -	    }
    -
    -	    /* Special handling for '.' and '..' */
    -	    if (!strcmp(filename, ".") || !strcmp(filename, "..") || ctx->buffer[0] == 'd') {
    -		str = apr_psprintf(p, "%s %s\n",
    -		    ctx->buffer, filename, filename);
    -	    }
    -	    else {
    -		str = apr_psprintf(p, "%s %s\n",
    -		    ctx->buffer, filename, filename);
    -	    }
    -	}
    -	else {
    -	    str = apr_pstrdup(p, ctx->buffer);
    -	}
    -
    -	/* erase buffer for next time around */
    -	ctx->buffer[0] = 0;
    -
    -	e = apr_bucket_pool_create(str, strlen(str), p);
    -	APR_BRIGADE_INSERT_TAIL(out, e);
    -	e = apr_bucket_flush_create();
    -	APR_BRIGADE_INSERT_TAIL(out, e);
    -	if (APR_SUCCESS != (rv = ap_pass_brigade(f->next, out))) {
    -	    return rv;
    -	}
    -	apr_brigade_cleanup(out);
    -
    -    }
    -
    -    if (FOOTER == ctx->state) {
    -	str = apr_psprintf(p, "
    \n\n
    \n\n%s\n\n\n\n", ap_psignature("", r)); - e = apr_bucket_pool_create(str, strlen(str), p); - APR_BRIGADE_INSERT_TAIL(out, e); - - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(out, e); - - e = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(out, e); - - if (APR_SUCCESS != (rv = ap_pass_brigade(f->next, out))) { - return rv; - } - apr_brigade_destroy(out); - } - - return APR_SUCCESS; -} - -/* 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 = PROXYREQ_NONE; - /* 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, 0, r, - "proxy: missing or failed auth to %s", - ap_unparse_uri_components(r->pool, - &r->parsed_uri, UNP_OMITPATHINFO)); - - apr_table_setn(r->err_headers_out, "WWW-Authenticate", - apr_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 - * Filters by [Graham Leggett ] - */ -PROXY_DECLARE (int) ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf, - char *url, const char *proxyhost, - apr_port_t proxyport) -{ - apr_pool_t *p = r->pool; - conn_rec *c = r->connection; - proxy_conn_rec *backend; - apr_socket_t *sock, *local_sock, *remote_sock; - apr_sockaddr_t *connect_addr; - apr_status_t rv; - conn_rec *origin, *remote; - int err; - apr_bucket *e; - apr_bucket_brigade *bb = apr_brigade_create(p); - apr_bucket_brigade *cbb = apr_brigade_create(p); - char *buf, *connectname; - apr_port_t connectport; - char buffer[MAX_STRING_LEN]; - char *path, *strp, *parms; - char *user = NULL; -/* char *account = NULL; how to supply an account in a URL? */ - const char *password = NULL; - int i, j, len, rc; - int one = 1; - char *size = NULL; - apr_size_t readbytes = -1; - - /* stuff for PASV mode */ - int connect = 0, use_port = 0; - char dates[AP_RFC822_DATE_LEN]; - - /* is this for us? */ - if (proxyhost) { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: rejecting URL %s - proxyhost %s specified:", url, proxyhost); - return DECLINED; /* proxy connections are via HTTP */ - } - if (strncasecmp(url, "ftp:", 4)) { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: rejecting URL %s - not ftp:", url); - return DECLINED; /* only interested in FTP */ - } - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: serving URL %s", url); - - /* create space for state information */ - backend = (proxy_conn_rec *) ap_get_module_config(c->conn_config, &proxy_ftp_module); - if (!backend) { - backend = ap_pcalloc(c->pool, sizeof(proxy_conn_rec)); - backend->connection = NULL; - backend->hostname = NULL; - backend->port = 0; - ap_set_module_config(c->conn_config, &proxy_ftp_module, backend); - } - - - /* - * I: Who Do I Connect To? - * ----------------------- - * - * Break up the URL to determine the host to connect to - */ - - /* 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 */ - connectname = r->parsed_uri.hostname; - connectport = (r->parsed_uri.port != 0) - ? r->parsed_uri.port - : ap_default_port_for_request(r); - path = apr_pstrdup(p, r->parsed_uri.path); - path = (path != NULL && path[0] != '\0') ? &path[1] : ""; - - parms = strchr(path, ';'); - if (parms != NULL) - *(parms++) = '\0'; - - /* 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 = apr_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->ap_auth_type = "Basic"; - r->user = r->parsed_uri.user = user; - } - else if ((user = r->parsed_uri.user) != NULL) { - user = apr_pstrdup(p, user); - decodeenc(user); - if ((password = r->parsed_uri.password) != NULL) { - char *tmp = apr_pstrdup(p, password); - decodeenc(tmp); - password = tmp; - } - } - else { - user = "anonymous"; - password = "apache-proxy@"; - } - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: connecting %s to %s:%d", url, connectname, connectport); - - /* do a DNS lookup for the destination host */ - err = apr_sockaddr_info_get(&connect_addr, connectname, APR_UNSPEC, connectport, 0, p); - - /* check if ProxyBlock directive on this host */ - if (OK != ap_proxy_checkproxyblock(r, conf, connect_addr)) { - return ap_proxyerror(r, HTTP_FORBIDDEN, - "Connect to remote machine blocked"); - } - - - /* - * II: Make the Connection - * ----------------------- - * - * We have determined who to connect to. Now make the connection. - */ - - /* get all the possible IP addresses for the destname and loop through them - * until we get a successful connection - */ - if (APR_SUCCESS != err) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_pstrcat(p, - "DNS lookup failure for: ", - connectname, NULL)); - } - - - if ((rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: FTP: error creating socket"); - return HTTP_INTERNAL_SERVER_ERROR; - } - -#if !defined(TPF) && !defined(BEOS) - if (conf->recv_buffer_size > 0 - && (rv = apr_setsocketopt(sock, APR_SO_RCVBUF, - conf->recv_buffer_size))) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); - } -#endif - - if (APR_SUCCESS != (rv = apr_setsocketopt(sock, APR_SO_REUSEADDR, one))) { -#ifndef _OSD_POSIX /* BS2000 has this option "always on" */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: FTP: error setting reuseaddr option: setsockopt(SO_REUSEADDR)"); - return HTTP_INTERNAL_SERVER_ERROR; -#endif /*_OSD_POSIX*/ - } - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: socket has been created"); - - - /* - * At this point we have a list of one or more IP addresses of - * the machine to connect to. If configured, reorder this - * list so that the "best candidate" is first try. "best - * candidate" could mean the least loaded server, the fastest - * responding server, whatever. - * - * For now we do nothing, ie we get DNS round robin. - * XXX FIXME - */ - - - /* try each IP address until we connect successfully */ - { - int failed = 1; - while (connect_addr) { - - /* make the connection out of the socket */ - rv = apr_connect(sock, connect_addr); - - /* if an error occurred, loop round and try again */ - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: FTP: attempt to connect to %pI (%s) failed", connect_addr, connectname); - connect_addr = connect_addr->next; - continue; - } - - /* if we get here, all is well */ - failed = 0; - break; - } - - /* handle a permanent error from the above loop */ - if (failed) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_psprintf(r->pool, - "Could not connect to remote machine: %s port %d", - connectname, connectport)); - } - } - - /* the socket is now open, create a new connection */ - origin = ap_new_connection(p, r->server, sock, r->connection->id); - if (!origin) { - /* the peer reset the connection already; ap_new_connection() - * closed the socket */ - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: an error occurred creating a new connection to %pI (%s)", connect_addr, connectname); - return HTTP_INTERNAL_SERVER_ERROR; - } - - /* if a keepalive connection is floating around, close it first! */ - /* we might support ftp keepalives later, but not now... */ - if (backend->connection) { - apr_socket_close(backend->connection->client_socket); - backend->connection = NULL; - } - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: control connection complete"); - - - /* - * III: Send Control Request - * ------------------------- - * - * Log into the ftp server, send the username & password, change to the correct - * directory... - */ - - /* set up the connection filters */ - ap_proxy_pre_http_connection(origin, NULL); - - /* possible results: */ - /* 120 Service ready in nnn minutes. */ - /* 220 Service ready for new user. */ - /* 421 Service not available, closing control connection. */ - i = ftp_getrc_msg(origin, cbb, buffer, sizeof(buffer)); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: %d %s", i, buffer); - if (i == -1) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, "Error reading from remote server"); - } - if (i == 120) { - /* RFC2616 states: - * 14.37 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 ) - */ - for (i=0 ; buffer[i] && !isdigit(buffer[i]); i++); - if (buffer[i]) { - ap_table_add(r->headers_out, "Retry-After", apr_psprintf(p, "%lu", 60*atol(buffer+i))); - } - return ap_proxyerror(r, HTTP_SERVICE_UNAVAILABLE, buffer); - } - if (i != 220) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer); - } - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: connected."); - - buf = apr_pstrcat(p, "USER ", user, CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: 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_msg(origin, cbb, buffer, sizeof(buffer)); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: %d %s", i, buffer); - if (i == -1) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, "Error reading from remote server"); - } - if (i == 530) { - return ftp_unauthorized (r, 1); /* log it: user name guessing attempt? */ - } - if (i != 230 && i != 331) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer); - } - - if (i == 331) { /* send password */ - if (password == NULL) { - return ftp_unauthorized (r, 0); - } - buf = apr_pstrcat(p, "PASS ", password, CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: 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_msg(origin, cbb, buffer, sizeof(buffer)); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: %d %s", i, buffer); - if (i == -1) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (i == 332) { - return ap_proxyerror(r, HTTP_UNAUTHORIZED, - apr_pstrcat(p, "Need account for login: ", buffer, NULL)); - } - /* @@@ questionable -- we might as well return a 403 Forbidden here */ - if (i == 530) { - return ftp_unauthorized (r, 1); /* log it: passwd guessing attempt? */ - } - if (i != 230 && i != 202) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer); - } - } - apr_table_set(r->notes, "Directory-README", buffer); - - /* 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); - buf = apr_pstrcat(p, "CWD ", path, CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: 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_msg(origin, cbb, buffer, sizeof(buffer)); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: %d %s", i, buffer); - if (i == -1) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (i == 550) { - return ap_proxyerror(r, HTTP_NOT_FOUND, buffer); - } - if (i != 250) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer); - } - - path = strp + 1; - } - - if (parms != NULL && strncasecmp(parms, "type=a", 6) == 0) { - parms = "A"; - } - else { - parms = "I"; - } - - /* changed to make binary transfers the default */ - /* set type to binary */ - buf = apr_pstrcat(p, "TYPE ", parms, CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: 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_msg(origin, cbb, buffer, sizeof(buffer)); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: %d %s", i, buffer); - if (i == -1) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (i != 200 && i != 504) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer); - } - /* Allow not implemented */ - if (i == 504) { - parms[0] = '\0'; - } - - - /* - * IV: Make Data Connection? - * ------------------------- - * - * Try EPSV, if that fails... - * try PASV, if that fails... - * try PORT. - */ -/* this temporarily switches off EPSV/PASV */ -/*goto bypass;*/ - - /* set up data connection - EPSV */ - { - apr_sockaddr_t *remote_addr; - char *remote_ip; - apr_port_t remote_port; - - /* The EPSV command replaces PASV where both IPV4 and IPV6 is supported. Only - * the port is returned, the IP address is always the same as that on the - * control connection. Example: - * Entering Extended Passive Mode (|||6446|) - */ - buf = apr_pstrcat(p, "EPSV", CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: EPSV"); - /* 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 = ftp_getrc_msg(origin, cbb, buffer, sizeof(buffer)); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: %d %s", i, buffer); - if (i == -1) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (i != 229 && i != 500 && i != 501 && i != 502) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer); - } - else if (i == 229) { - char *pstr; - - pstr = apr_pstrdup(p, buffer); - pstr = strtok(pstr, " "); /* separate result code */ - if (pstr != NULL) { - if (*(pstr + strlen(pstr) + 1) == '=') { - pstr += strlen(pstr) + 2; - } - else { - pstr = strtok(NULL, "("); /* separate address & port params */ - if (pstr != NULL) - pstr = strtok(NULL, ")"); - } - } - - if (pstr) { - apr_sockaddr_t *epsv_addr; - remote_port = atoi(pstr+3); - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: EPSV contacting remote host on port %d", - remote_port); - - if ((rv = apr_socket_create(&remote_sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: FTP: error creating EPSV socket"); - return HTTP_INTERNAL_SERVER_ERROR; - } - -#if !defined (TPF) && !defined(BEOS) - if (conf->recv_buffer_size > 0 && (rv = apr_setsocketopt(remote_sock, APR_SO_RCVBUF, - conf->recv_buffer_size))) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: FTP: setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); - } -#endif - - /* make the connection */ - apr_socket_addr_get(&remote_addr, APR_REMOTE, sock); - apr_sockaddr_ip_get(&remote_ip, remote_addr); - apr_sockaddr_info_get(&epsv_addr, remote_ip, APR_INET, remote_port, 0, p); - rv = apr_connect(remote_sock, epsv_addr); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: FTP: EPSV attempt to connect to %pI failed - Firewall/NAT?", epsv_addr); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_psprintf(r->pool, - "EPSV attempt to connect to %pI failed - firewall/NAT?", epsv_addr)); - } - else { - connect = 1; - } - } - else { - /* and try the regular way */ - apr_socket_close(remote_sock); - } - } - } - - /* set up data connection - PASV */ - if (!connect) { - buf = apr_pstrcat(p, "PASV", CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: PASV"); - /* 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 = ftp_getrc_msg(origin, cbb, buffer, sizeof(buffer)); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: %d %s", i, buffer); - if (i == -1) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (i != 227 && i != 502) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer); - } - else if (i == 227) { - unsigned int h0, h1, h2, h3, p0, p1; - char *pstr; - -/* FIXME: Check PASV against RFC1123 */ - - pstr = apr_pstrdup(p, buffer); - pstr = strtok(pstr, " "); /* separate result code */ - if (pstr != NULL) { - if (*(pstr + strlen(pstr) + 1) == '=') { - pstr += strlen(pstr) + 2; - } - else { - pstr = strtok(NULL, "("); /* separate address & port params */ - if (pstr != NULL) - pstr = strtok(NULL, ")"); - } - } - -/* FIXME: Only supports IPV4 - fix in RFC2428 */ - - if (pstr != NULL && (sscanf(pstr, - "%d,%d,%d,%d,%d,%d", &h3, &h2, &h1, &h0, &p1, &p0) == 6)) { - - apr_sockaddr_t *pasv_addr; - int pasvport = (p1 << 8) + p0; - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: PASV contacting host %d.%d.%d.%d:%d", - h3, h2, h1, h0, pasvport); - - if ((rv = apr_socket_create(&remote_sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: error creating PASV socket"); - return HTTP_INTERNAL_SERVER_ERROR; - } - -#if !defined (TPF) && !defined(BEOS) - if (conf->recv_buffer_size > 0 && (rv = apr_setsocketopt(remote_sock, APR_SO_RCVBUF, - conf->recv_buffer_size))) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: FTP: setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); - } -#endif - - /* make the connection */ - apr_sockaddr_info_get(&pasv_addr, apr_psprintf(p, "%d.%d.%d.%d", h3, h2, h1, h0), APR_INET, pasvport, 0, p); - rv = apr_connect(remote_sock, pasv_addr); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: FTP: PASV attempt to connect to %pI failed - Firewall/NAT?", pasv_addr); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_psprintf(r->pool, - "PASV attempt to connect to %pI failed - firewall/NAT?", pasv_addr)); - } - else { - connect = 1; - } - } - else { - /* and try the regular way */ - apr_socket_close(remote_sock); - } - } - } -/*bypass:*/ - - /* set up data connection - PORT */ - if (!connect) { - apr_sockaddr_t *local_addr; - char *local_ip; - apr_port_t local_port; - unsigned int h0, h1, h2, h3, p0, p1; - - if ((rv = apr_socket_create(&local_sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: FTP: error creating local socket"); - return HTTP_INTERNAL_SERVER_ERROR; - } - apr_socket_addr_get(&local_addr, APR_LOCAL, sock); - apr_sockaddr_port_get(&local_port, local_addr); - apr_sockaddr_ip_get(&local_ip, local_addr); - - if ((rv = apr_setsocketopt(local_sock, APR_SO_REUSEADDR, one)) != APR_SUCCESS) { -#ifndef _OSD_POSIX /* BS2000 has this option "always on" */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: FTP: error setting reuseaddr option"); - return HTTP_INTERNAL_SERVER_ERROR; -#endif /*_OSD_POSIX*/ - } - - apr_sockaddr_info_get(&local_addr, local_ip, APR_UNSPEC, local_port, 0, r->pool); - - if ((rv = apr_bind(local_sock, local_addr)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: FTP: error binding to ftp data socket %pI", local_addr); - return HTTP_INTERNAL_SERVER_ERROR; - } - - /* only need a short queue */ - if ((rv = apr_listen(local_sock, 2)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: FTP: error listening to ftp data socket %pI", local_addr); - return HTTP_INTERNAL_SERVER_ERROR; - } - -/* FIXME: Sent PORT here */ - - if (local_ip && (sscanf(local_ip, - "%d.%d.%d.%d", &h3, &h2, &h1, &h0) == 4)) { - p1 = (local_port >> 8); - p0 = (local_port & 0xFF); - - buf = apr_psprintf(p, "PORT %d,%d,%d,%d,%d,%d" CRLF, h3, h2, h1, h0, p1, p0); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: PORT %d,%d,%d,%d,%d,%d", h3, h2, h1, h0, p1, p0); - /* possible results: 200, 421, 500, 501, 502, 530 */ - /* 200 Command okay. */ - /* 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. */ - rc = ftp_getrc_msg(origin, cbb, buffer, sizeof(buffer)); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: %d %s", rc, buffer); - if (rc == -1) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (rc != 200) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer); - } - - /* signal that we must use the EPRT/PORT loop */ - use_port = 1; - } - else { -/* IPV6 FIXME: - * The EPRT command replaces PORT where both IPV4 and IPV6 is supported. The first - * number (1,2) indicates the protocol type. Examples: - * EPRT |1|132.235.1.2|6275| - * EPRT |2|1080::8:800:200C:417A|5282| - */ - return ap_proxyerror(r, HTTP_NOT_IMPLEMENTED, "Connect to IPV6 ftp server using EPRT not supported. Enable EPSV."); - } - } - - - /* - * V: Set The Headers - * ------------------- - * - * Get the size of the request, set up the environment for HTTP. - */ - - /* 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 { - buf = apr_pstrcat(p, "SIZE ", path, CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: SIZE %s", path); - i = ftp_getrc_msg(origin, cbb, buffer, sizeof buffer); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: returned status %d with response %s", i, buffer); - if (i != 500) { /* Size command not recognized */ - if (i == 550) { /* Not a regular file */ - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: SIZE shows this is a directory"); - parms = "d"; - buf = apr_pstrcat(p, "CWD ", path, CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: CWD %s", path); - i = ftp_getrc_msg(origin, cbb, buffer, sizeof(buffer)); - /* 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. */ - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: %d %s", i, buffer); - if (i == -1) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (i == 550) { - return ap_proxyerror(r, HTTP_NOT_FOUND, buffer); - } - if (i != 250) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer); - } - path = ""; - len = 0; - } - else if (i == 213) { /* Size command ok */ - for (j = 0; j < sizeof(buffer) && apr_isdigit(buffer[j]); j++); - buffer[j] = '\0'; - if (buffer[0] != '\0') - size = apr_pstrdup(p, buffer); - } - } - } - - - -#ifdef AUTODETECT_PWD - buf = apr_pstrcat(p, "PWD", CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: 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(origin, cbb, buffer, sizeof(buffer)); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: %d %s", i, buffer); - if (i == -1 || i == 421) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (i == 550) { - return ap_proxyerror(r, HTTP_NOT_FOUND, buffer); - } - if (i == 257) { - const char *dirp = buffer; - apr_table_set(r->notes, "Directory-PWD", ap_getword_conf(r->pool, &dirp)); - } -#endif /*AUTODETECT_PWD*/ - - if (parms[0] == 'd') { - if (len != 0) - buf = apr_pstrcat(p, "LIST ", path, CRLF, NULL); - else - buf = apr_pstrcat(p, "LIST -lag", CRLF, NULL); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: LIST %s", (len == 0 ? "-lag" : path)); - } - else { -/* FIXME: Handle range requests - send REST */ - buf = apr_pstrcat(p, "RETR ", path, CRLF, NULL); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: RETR %s", path); - } - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - /* 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_msg(origin, cbb, buffer, sizeof(buffer)); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: %d %s", rc, buffer); - if (rc == -1) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (rc == 550) { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: RETR failed, trying LIST instead"); - parms = "d"; - buf = apr_pstrcat(p, "CWD ", path, CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: 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_msg(origin, cbb, buffer, sizeof(buffer)); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: %d %s", rc, buffer); - if (rc == -1) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (rc == 550) { - return ap_proxyerror(r, HTTP_NOT_FOUND, buffer); - } - if (rc != 250) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer); - } - -#ifdef AUTODETECT_PWD - buf = apr_pstrcat(p, "PWD ", CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: 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(origin, cbb, buffer, sizeof(buffer)); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: %d %s", i, buffer); - if (i == -1 || i == 421) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (i == 550) { - return ap_proxyerror(r, HTTP_NOT_FOUND, buffer); - } - if (i == 257) { - const char *dirp = buffer; - apr_table_set(r->notes, "Directory-PWD", ap_getword_conf(r->pool, &dirp)); - } -#endif /*AUTODETECT_PWD*/ - - buf = apr_pstrcat(p, "LIST -lag", CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: LIST -lag"); - rc = ftp_getrc_msg(origin, cbb, buffer, sizeof(buffer)); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: %d %s", rc, buffer); - if (rc == -1) - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (rc != 125 && rc != 150 && rc != 226 && rc != 250) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer); - } - - r->status = HTTP_OK; - r->status_line = "200 OK"; - - apr_rfc822_date(dates, r->request_time); - apr_table_setn(r->headers_out, "Date", dates); - apr_table_setn(r->headers_out, "Server", ap_get_server_version()); - - /* set content-type */ - if (parms[0] == 'd') { - r->content_type = "text/html"; - } - else { - if (r->content_type) { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: Content-Type set to %s", r->content_type); - } - else { - r->content_type = ap_default_type(r); - } - if (parms[0] != 'a' && size != NULL) { - /* We "trust" the ftp server to really serve (size) bytes... */ - apr_table_setn(r->headers_out, "Content-Length", size); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: Content-Length set to %s", size); - } - } - apr_table_setn(r->headers_out, "Content-Type", r->content_type); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: Content-Type set to %s", r->content_type); - - /* set content-encoding */ - if (r->content_encoding != NULL && r->content_encoding[0] != '\0') { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: Content-Encoding set to %s", r->content_encoding); - apr_table_setn(r->headers_out, "Content-Encoding", r->content_encoding); - } - - /* wait for connection */ - if (use_port) { - for(;;) - { -/* FIXME: this does not return, despite the incoming connection being accepted */ - switch(rv = apr_accept(&remote_sock, local_sock, r->pool)) - { - case APR_EINTR: - continue; - case APR_SUCCESS: - break; - default: - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: FTP: failed to accept data connection"); - return HTTP_BAD_GATEWAY; - } - } - } - - /* the transfer socket is now open, create a new connection */ - remote = ap_new_connection(p, r->server, remote_sock, r->connection->id); - if (!remote) { - /* the peer reset the connection already; ap_new_connection() - * closed the socket */ - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: an error occurred creating the transfer connection"); - return HTTP_INTERNAL_SERVER_ERROR; - } - - /* set up the connection filters */ - ap_proxy_pre_http_connection(remote, NULL); - - - /* - * VI: Receive the Response - * ------------------------ - * - * Get response from the remote ftp socket, and pass it up the - * filter chain. - */ - - /* send response */ - r->sent_bodyct = 1; - - if (parms[0] == 'd') { - /* insert directory filter */ - ap_add_output_filter("PROXY_SEND_DIR", NULL, r, r->connection); - } - - /* send body */ - if (!r->header_only) { - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: start body send"); - - /* read the body, pass it to the output filters */ - while (ap_get_brigade(remote->input_filters, bb, AP_MODE_BLOCKING, &readbytes) == APR_SUCCESS) { - if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) { - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(r->output_filters, bb); - break; - } - ap_pass_brigade(r->output_filters, bb); - apr_brigade_cleanup(bb); - } - apr_brigade_cleanup(bb); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: end body send"); - - } - else { - - /* abort the transfer */ - buf = apr_pstrcat(p, "ABOR", CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: 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_msg(origin, cbb, buffer, sizeof(buffer)); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: %d %s", i, buffer); - } - - - /* - * VII: Clean Up - * ------------- - * - * If there are no KeepAlives, or if the connection has been signalled - * to close, close the socket and clean up - */ - - /* finish */ - buf = apr_pstrcat(p, "QUIT", CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: QUIT"); - /* responses: 221, 500 */ - /* 221 Service closing control connection. */ - /* 500 Syntax error, command unrecognized. */ - i = ftp_getrc_msg(origin, cbb, buffer, sizeof(buffer)); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: FTP: %d %s", i, buffer); - - apr_brigade_destroy(bb); - return OK; -} - -static void ap_proxy_ftp_register_hook(apr_pool_t *p) -{ - /* hooks */ - proxy_hook_scheme_handler(ap_proxy_ftp_handler, NULL, NULL, APR_HOOK_MIDDLE); - proxy_hook_canon_handler(ap_proxy_ftp_canon, NULL, NULL, APR_HOOK_MIDDLE); - /* filters */ - ap_register_output_filter("PROXY_SEND_DIR", ap_proxy_send_dir_filter, AP_FTYPE_CONTENT); -} - -module AP_MODULE_DECLARE_DATA proxy_ftp_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 */ - ap_proxy_ftp_register_hook /* register hooks */ -}; diff --git a/modules/proxy/proxy_http.c b/modules/proxy/proxy_http.c deleted file mode 100644 index f6d3213a28..0000000000 --- a/modules/proxy/proxy_http.c +++ /dev/null @@ -1,835 +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 routines for Apache proxy */ - -#include "mod_proxy.h" - -module AP_MODULE_DECLARE_DATA proxy_http_module; - -PROXY_DECLARE (int) ap_proxy_http_canon(request_rec *r, char *url); -PROXY_DECLARE (int) ap_proxy_http_handler(request_rec *r, proxy_server_conf *conf, - char *url, const char *proxyname, - apr_port_t proxyport); - - -/* - * 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. - */ -PROXY_DECLARE (int) ap_proxy_http_canon(request_rec *r, char *url) -{ - char *host, *path, *search, sport[7]; - const char *err; - const char *scheme; - apr_port_t port, def_port; - - /* ap_default_port_for_scheme() */ - if (strncasecmp(url, "http:", 5) == 0) { - url += 5; - scheme = "http"; - } - else if (strncasecmp(url, "https:", 6) == 0) { - url += 6; - scheme = "https:"; - } - else { - return DECLINED; - } - def_port = ap_default_port_for_scheme(scheme); - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: HTTP: canonicalising URL %s", url); - - /* 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) - apr_snprintf(sport, sizeof(sport), ":%d", port); - else - sport[0] = '\0'; - - r->filename = apr_pstrcat(r->pool, "proxy:", scheme, "://", host, sport, "/", - path, (search) ? "?" : "", (search) ? search : "", NULL); - return OK; -} - -static const char *ap_proxy_location_reverse_map(request_rec *r, proxy_server_conf *conf, const char *url) -{ - struct proxy_alias *ent; - int i, l1, l2; - char *u; - - /* XXX FIXME: Make sure this handled the ambiguous case of the :80 - * after the hostname */ - - 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 = apr_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 ap_proxy_clear_connection(apr_pool_t *p, apr_table_t *headers) -{ - const char *name; - char *next = apr_pstrdup(p, apr_table_get(headers, "Connection")); - - apr_table_unset(headers, "Proxy-Connection"); - if (!next) - return; - - while (*next) { - name = next; - while (*next && !apr_isspace(*next) && (*next != ',')) - ++next; - while (*next && (apr_isspace(*next) || (*next == ','))) { - *next = '\0'; - ++next; - } - apr_table_unset(headers, name); - } - apr_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.) - */ -PROXY_DECLARE (int) ap_proxy_http_handler(request_rec *r, proxy_server_conf *conf, - char *url, const char *proxyname, - apr_port_t proxyport) -{ - request_rec *rp; - const char *connectname; - int connectport = 0; - apr_sockaddr_t *uri_addr; - apr_sockaddr_t *connect_addr; - char server_portstr[32]; - apr_socket_t *sock; - int i, len, backasswards, eos, close=0, failed=0, new=0; - apr_status_t err, rv; - apr_array_header_t *headers_in_array; - apr_table_entry_t *headers_in; - char buffer[HUGE_STRING_LEN]; - char *buf; - conn_rec *origin; - uri_components uri; - proxy_conn_rec *backend; - - /* Note: Memory pool allocation. - * A downstream keepalive connection is always connected to the existence - * (or not) of an upstream keepalive connection. If this is not done then - * load balancing against multiple backend servers breaks (one backend - * server ends up taking 100% of the load), and the risk is run of - * downstream keepalive connections being kept open unnecessarily. This - * keeps webservers busy and ties up resources. - * - * As a result, we allocate all sockets out of the upstream connection - * pool, and when we want to reuse a socket, we check first whether the - * connection ID of the current upstream connection is the same as that - * of the connection when the socket was opened. - */ - apr_pool_t *p = r->connection->pool; - conn_rec *c = r->connection; - apr_bucket *e; - apr_bucket_brigade *bb = apr_brigade_create(p); - - /* is it for us? */ - if (strncasecmp(url, "http:", 5)) { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: HTTP: rejecting URL %s", url); - return DECLINED; /* only interested in HTTP */ - } - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: HTTP: serving URL %s", url); - - /* create space for state information */ - backend = (proxy_conn_rec *) ap_get_module_config(c->conn_config, &proxy_http_module); - if (!backend) { - backend = ap_pcalloc(c->pool, sizeof(proxy_conn_rec)); - backend->connection = NULL; - backend->hostname = NULL; - backend->port = 0; - ap_set_module_config(c->conn_config, &proxy_http_module, backend); - } - - /* - * Step One: Determine Who To Connect To - * - * Break up the URL to determine the host to connect to - */ - - /* we break the URL into host, port, uri */ - if (HTTP_OK != ap_parse_uri_components(p, url, &uri)) { - return ap_proxyerror(r, HTTP_BAD_REQUEST, - apr_pstrcat(p,"URI cannot be parsed: ", url, NULL)); - } - if (!uri.port) { - uri.port = ap_default_port_for_scheme(uri.scheme); - } - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: HTTP connecting %s to %s:%d", url, uri.hostname, uri.port); - - /* do a DNS lookup for the destination host */ - /* see memory note above */ - err = apr_sockaddr_info_get(&uri_addr, apr_pstrdup(c->pool, uri.hostname), APR_UNSPEC, uri.port, 0, c->pool); - - /* allocate these out of the connection pool - the check on r->connection->id makes - * sure that this string does not get accessed past the connection lifetime */ - /* are we connecting directly, or via a proxy? */ - if (proxyname) { - connectname = apr_pstrdup(c->pool,proxyname); - connectport = proxyport; - /* see memory note above */ - err = apr_sockaddr_info_get(&connect_addr, connectname, APR_UNSPEC, connectport, 0, c->pool); - } - else { - connectname = apr_pstrdup(c->pool, uri.hostname); - connectport = uri.port; - connect_addr = uri_addr; - url = apr_pstrcat(p, uri.path, uri.query ? "?" : "", - uri.query ? uri.query : "", uri.fragment ? "#" : "", - uri.fragment ? uri.fragment : "", NULL); - } - - - /* Get the server port for the Via headers */ - { - i = ap_get_server_port(r); - if (ap_is_default_port(i,r)) { - strcpy(server_portstr,""); - } else { - apr_snprintf(server_portstr, sizeof server_portstr, ":%d", i); - } - } - - /* check if ProxyBlock directive on this host */ - if (OK != ap_proxy_checkproxyblock(r, conf, uri_addr)) { - return ap_proxyerror(r, HTTP_FORBIDDEN, - "Connect to remote machine blocked"); - } - - - /* - * Step Two: Make the Connection - * - * We have determined who to connect to. Now make the connection, supporting - * a KeepAlive connection. - */ - - /* get all the possible IP addresses for the destname and loop through them - * until we get a successful connection - */ - if (APR_SUCCESS != err) { - return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_pstrcat(p, - "DNS lookup failure for: ", - connectname, NULL)); - } - - /* if a keepalive socket is already open, check whether it must stay - * open, or whether it should be closed and a new socket created. - */ - /* see memory note above */ - if (backend->connection) { - if ((backend->connection->id == c->id) && - (backend->port == connectport) && - (backend->hostname) && - (!apr_strnatcasecmp(backend->hostname,connectname))) { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: keepalive address match (keep original socket)"); - } - else { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: keepalive address mismatch / connection has" - " changed (close old socket (%s/%s, %d/%d))", - connectname, backend->hostname, - connectport, backend->port); - apr_socket_close(backend->connection->client_socket); - backend->connection = NULL; - } - } - - /* get a socket - either a keepalive one, or a new one */ - new = 1; - if ((backend->connection) && (backend->connection->id == c->id)) { - - /* use previous keepalive socket */ - origin = backend->connection; - sock = origin->client_socket; - new = 0; - - /* reset the connection filters */ - ap_proxy_reset_output_filters(origin); - - /* XXX FIXME: If the socket has since closed, change new to 1 so - * a new socket is opened */ - } - if (new) { - - /* create a new socket */ - backend->connection = NULL; - - /* see memory note above */ - if ((rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, c->pool)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: error creating socket"); - return HTTP_INTERNAL_SERVER_ERROR; - } - -#if !defined(TPF) && !defined(BEOS) - if (conf->recv_buffer_size > 0 && (rv = apr_setsocketopt(sock, APR_SO_RCVBUF, - conf->recv_buffer_size))) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); - } -#endif - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: socket has been created"); - - /* - * At this point we have a list of one or more IP addresses of - * the machine to connect to. If configured, reorder this - * list so that the "best candidate" is first try. "best - * candidate" could mean the least loaded server, the fastest - * responding server, whatever. - * - * For now we do nothing, ie we get DNS round robin. - * XXX FIXME - */ - - - /* try each IP address until we connect successfully */ - failed = 1; - while (connect_addr) { - - /* make the connection out of the socket */ - rv = apr_connect(sock, connect_addr); - - /* if an error occurred, loop round and try again */ - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: attempt to connect to %pI (%s) failed", - connect_addr, connectname); - connect_addr = connect_addr->next; - continue; - } - - /* if we get here, all is well */ - failed = 0; - break; - } - - /* handle a permanent error from the above loop */ - if (failed) { - apr_socket_close(sock); - if (proxyname) { - return DECLINED; - } - else { - return HTTP_BAD_GATEWAY; - } - } - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: socket is connected"); - - /* the socket is now open, create a new backend server connection */ - origin = ap_new_connection(c->pool, r->server, sock, r->connection->id); - if (!origin) { - /* the peer reset the connection already; ap_new_connection() - * closed the socket */ - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: an error occurred creating a new connection to %pI (%s)", connect_addr, connectname); - apr_socket_close(sock); - return HTTP_INTERNAL_SERVER_ERROR; - } - backend->connection = origin; - backend->hostname = apr_pstrdup(c->pool, connectname); - backend->port = connectport; - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: connection complete"); - - /* set up the connection filters */ - ap_proxy_pre_http_connection(origin, NULL); - - } - - - /* - * Step Three: Send the Request - * - * Send the HTTP/1.1 request to the remote server - */ - - - /* strip connection listed hop-by-hop headers from the request */ - /* even though in theory a connection: close coming from the client - * should not affect the connection to the server, it's unlikely - * that subsequent client requests will hit this thread/process, so - * we cancel server keepalive if the client does. - */ - close += ap_proxy_liststr(apr_table_get(r->headers_in, "Connection"), "close"); - ap_proxy_clear_connection(p, r->headers_in); - if (close) { - apr_table_mergen(r->headers_in, "Connection", "close"); - origin->keepalive = 0; - } - - buf = apr_pstrcat(p, r->method, " ", url, " HTTP/1.1" CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - if (uri.port_str && uri.port != DEFAULT_HTTP_PORT) { - buf = apr_pstrcat(p, "Host: ", uri.hostname, ":", uri.port_str, CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - } - else { - buf = apr_pstrcat(p, "Host: ", uri.hostname, CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - } - - /* handle Via */ - if (conf->viaopt == via_block) { - /* Block all outgoing Via: headers */ - apr_table_unset(r->headers_in, "Via"); - } else if (conf->viaopt != via_off) { - /* Create a "Via:" request header entry and merge it */ - /* Generate outgoing Via: header with/without server comment: */ - apr_table_mergen(r->headers_in, "Via", - (conf->viaopt == via_full) - ? apr_psprintf(p, "%d.%d %s%s (%s)", - HTTP_VERSION_MAJOR(r->proto_num), - HTTP_VERSION_MINOR(r->proto_num), - ap_get_server_name(r), server_portstr, - AP_SERVER_BASEVERSION) - : apr_psprintf(p, "%d.%d %s%s", - HTTP_VERSION_MAJOR(r->proto_num), - HTTP_VERSION_MINOR(r->proto_num), - ap_get_server_name(r), server_portstr) - ); - } - - /* X-Forwarded-*: handling - * - * XXX Privacy Note: - * ----------------- - * - * These request headers are only really useful when the mod_proxy - * is used in a reverse proxy configuration, so that useful info - * about the client can be passed through the reverse proxy and on - * to the backend server, which may require the information to - * function properly. - * - * In a forward proxy situation, these options are a potential - * privacy violation, as information about clients behind the proxy - * are revealed to arbitrary servers out there on the internet. - * - * The HTTP/1.1 Via: header is designed for passing client - * information through proxies to a server, and should be used in - * a forward proxy configuation instead of X-Forwarded-*. See the - * ProxyVia option for details. - */ - - if (PROXYREQ_REVERSE == r->proxyreq) { - const char *buf; - - /* Add X-Forwarded-For: so that the upstream has a chance to - * determine, where the original request came from. - */ - apr_table_mergen(r->headers_in, "X-Forwarded-For", r->connection->remote_ip); - - /* Add X-Forwarded-Host: so that upstream knows what the - * original request hostname was. - */ - if ((buf = apr_table_get(r->headers_in, "Host"))) { - apr_table_mergen(r->headers_in, "X-Forwarded-Host", buf); - } - - /* Add X-Forwarded-Server: so that upstream knows what the - * name of this proxy server is (if there are more than one) - * XXX: This duplicates Via: - do we strictly need it? - */ - apr_table_mergen(r->headers_in, "X-Forwarded-Server", - r->server->server_hostname); - } - - /* send request headers */ - headers_in_array = apr_table_elts(r->headers_in); - headers_in = (apr_table_entry_t *) headers_in_array->elts; - for (i = 0; i < headers_in_array->nelts; i++) { - if (headers_in[i].key == NULL || headers_in[i].val == NULL - - /* Clear out hop-by-hop request headers not to send - * RFC2616 13.5.1 says we should strip these headers - */ - || !apr_strnatcasecmp(headers_in[i].key, "Host") /* Already sent */ - || !apr_strnatcasecmp(headers_in[i].key, "Keep-Alive") - || !apr_strnatcasecmp(headers_in[i].key, "TE") - || !apr_strnatcasecmp(headers_in[i].key, "Trailer") - || !apr_strnatcasecmp(headers_in[i].key, "Transfer-Encoding") - || !apr_strnatcasecmp(headers_in[i].key, "Upgrade") - - /* XXX: @@@ FIXME: "Proxy-Authorization" should *only* be - * suppressed if THIS server requested the authentication, - * not when a frontend proxy requested it! - * - * The solution to this problem is probably to strip out - * the Proxy-Authorisation header in the authorisation - * code itself, not here. This saves us having to signal - * somehow whether this request was authenticated or not. - */ - || !apr_strnatcasecmp(headers_in[i].key, "Proxy-Authorization") - || !apr_strnatcasecmp(headers_in[i].key, "Proxy-Authenticate")) - continue; - - buf = apr_pstrcat(p, headers_in[i].key, ": ", headers_in[i].val, CRLF, NULL); - e = apr_bucket_pool_create(buf, strlen(buf), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - - } - - /* add empty line at the end of the headers */ - e = apr_bucket_pool_create(CRLF, strlen(CRLF), p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - - ap_pass_brigade(origin->output_filters, bb); - - /* send the request data, if any. */ - if (ap_should_client_block(r)) { - while ((i = ap_get_client_block(r, buffer, sizeof buffer)) > 0) { - e = apr_bucket_pool_create(buffer, i, p); - APR_BRIGADE_INSERT_TAIL(bb, e); - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(origin->output_filters, bb); - apr_brigade_cleanup(bb); - } - } - - - /* - * Step Four: Receive the Response - * - * Get response from the remote server, and pass it up the - * filter chain - */ - - rp = make_fake_req(origin, r); - - apr_brigade_cleanup(bb); - - if (APR_SUCCESS != (rv = ap_proxy_string_read(origin, bb, buffer, sizeof(buffer), &eos))) { - apr_socket_close(sock); - backend->connection = NULL; - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: error reading status line from remote server %s", - connectname); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - len = strlen(buffer); - - /* 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 = 1; - } - - /* If not an HTTP/1 message or if the status line was > 8192 bytes */ - else if ((buffer[5] != '1') || (len >= sizeof(buffer)-1)) { - apr_socket_close(sock); - backend->connection = NULL; - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - apr_pstrcat(p, "Corrupt status line returned by remote server: ", buffer, NULL)); - } - backasswards = 0; - buffer[--len] = '\0'; - - buffer[12] = '\0'; - r->status = atoi(&buffer[9]); - - buffer[12] = ' '; - r->status_line = apr_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. */ - - r->headers_out = ap_proxy_read_headers(r, rp, buffer, sizeof(buffer), origin); - if (r->headers_out == NULL) { - ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, r->server, - "proxy: bad HTTP/%d.%d header returned by %s (%s)", - major, minor, r->uri, r->method); - close += 1; - } - else - { - /* strip connection listed hop-by-hop headers from response */ - const char *buf; - close += ap_proxy_liststr(apr_table_get(r->headers_out, "Connection"), "close"); - ap_proxy_clear_connection(p, r->headers_out); - if ((buf = apr_table_get(r->headers_out, "Content-Type"))) { - r->content_type = apr_pstrdup(p, buf); - } - } - - /* handle Via header in response */ - if (conf->viaopt != via_off && conf->viaopt != via_block) { - /* create a "Via:" response header entry and merge it */ - ap_table_mergen(r->headers_out, "Via", - (conf->viaopt == via_full) - ? apr_psprintf(p, "%d.%d %s%s (%s)", - HTTP_VERSION_MAJOR(r->proto_num), - HTTP_VERSION_MINOR(r->proto_num), - ap_get_server_name(r), server_portstr, - AP_SERVER_BASEVERSION) - : apr_psprintf(p, "%d.%d %s%s", - HTTP_VERSION_MAJOR(r->proto_num), - HTTP_VERSION_MINOR(r->proto_num), - ap_get_server_name(r), server_portstr) - ); - } - - /* cancel keepalive if HTTP/1.0 or less */ - if ((major < 1) || (minor < 1)) { - close += 1; - origin->keepalive = 0; - } - } - else { - /* an http/0.9 response */ - backasswards = 1; - r->status = 200; - r->status_line = "200 OK"; - close += 1; - } - - /* we must accept 3 kinds of date, but generate only 1 kind of date */ - { - const char *buf; - if ((buf = apr_table_get(r->headers_out, "Date")) != NULL) { - apr_table_set(r->headers_out, "Date", ap_proxy_date_canon(p, buf)); - } - if ((buf = apr_table_get(r->headers_out, "Expires")) != NULL) { - apr_table_set(r->headers_out, "Expires", ap_proxy_date_canon(p, buf)); - } - if ((buf = apr_table_get(r->headers_out, "Last-Modified")) != NULL) { - apr_table_set(r->headers_out, "Last-Modified", ap_proxy_date_canon(p, buf)); - } - } - - /* munge the Location and URI response headers according to ProxyPassReverse */ - { - const char *buf; - if ((buf = apr_table_get(r->headers_out, "Location")) != NULL) { - apr_table_set(r->headers_out, "Location", ap_proxy_location_reverse_map(r, conf, buf)); - } - if ((buf = apr_table_get(r->headers_out, "Content-Location")) != NULL) { - apr_table_set(r->headers_out, "Content-Location", ap_proxy_location_reverse_map(r, conf, buf)); - } - if ((buf = apr_table_get(r->headers_out, "URI")) != NULL) { - apr_table_set(r->headers_out, "URI", ap_proxy_location_reverse_map(r, conf, buf)); - } - } - - r->sent_bodyct = 1; - /* Is it an HTTP/0.9 response? If so, send the extra data */ - if (backasswards) { - apr_ssize_t cntr = len; - e = apr_bucket_heap_create(buffer, cntr, 0, NULL); - APR_BRIGADE_INSERT_TAIL(bb, e); - } - - /* send body - but only if a body is expected */ - if ((!r->header_only) && /* not HEAD request */ - (r->status > 199) && /* not any 1xx response */ - (r->status != HTTP_NO_CONTENT) && /* not 204 */ - (r->status != HTTP_RESET_CONTENT) && /* not 205 */ - (r->status != HTTP_NOT_MODIFIED)) { /* not 304 */ - - const char *buf; - apr_size_t readbytes; - - /* if chunked - insert DECHUNK filter */ - if (ap_proxy_liststr((buf = apr_table_get(r->headers_out, "Transfer-Encoding")), "chunked")) { - rp->read_chunked = 1; - apr_table_unset(r->headers_out, "Transfer-Encoding"); - if ((buf = ap_proxy_removestr(r->pool, buf, "chunked"))) { - apr_table_set(r->headers_out, "Transfer-Encoding", buf); - } - ap_add_input_filter("DECHUNK", NULL, rp, origin); - readbytes = -1; - } - - /* if content length - set the length to read */ - else if ((buf = apr_table_get(r->headers_out, "Content-Length"))) { - readbytes = atol(buf); - } - - /* no chunked / no length therefore read till EOF and cancel keepalive */ - else { - close += 1; - } - - /* if keepalive cancelled, read to EOF */ - if (close) { - readbytes = -1; - } - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: start body send"); - - /* read the body, pass it to the output filters */ - while (ap_get_brigade(rp->input_filters, bb, AP_MODE_BLOCKING, &readbytes) == APR_SUCCESS) { - if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) { - e = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - ap_pass_brigade(r->output_filters, bb); - break; - } - ap_pass_brigade(r->output_filters, bb); - apr_brigade_cleanup(bb); - } - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: end body send"); - } - else { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: header only"); - } - - - /* - * Step Five: Clean Up - * - * If there are no KeepAlives, or if the connection has been signalled - * to close, close the socket and clean up - */ - - /* if the connection is < HTTP/1.1, or Connection: close, - * we close the socket, otherwise we leave it open for KeepAlive support - */ - if (close || (r->proto_num < HTTP_VERSION(1,1))) { - apr_socket_close(sock); - backend->connection = NULL; - } - - return OK; -} - -static void ap_proxy_http_register_hook(apr_pool_t *p) -{ - proxy_hook_scheme_handler(ap_proxy_http_handler, NULL, NULL, APR_HOOK_FIRST); - proxy_hook_canon_handler(ap_proxy_http_canon, NULL, NULL, APR_HOOK_FIRST); -} - -module AP_MODULE_DECLARE_DATA proxy_http_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 */ - ap_proxy_http_register_hook /* register hooks */ -}; diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c deleted file mode 100644 index b51feb1a11..0000000000 --- a/modules/proxy/proxy_util.c +++ /dev/null @@ -1,1187 +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. - */ - -/* Utility routines for Apache proxy */ -#include "mod_proxy.h" - - -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); -static struct per_thread_data *get_per_thread_data(void); - -/* already called in the knowledge that the characters are hex digits */ -int ap_proxy_hex2c(const char *x) -{ - int i, ch; - -#if !APR_CHARSET_EBCDIC - ch = x[0]; - if (apr_isdigit(ch)) - i = ch - '0'; - else if (apr_isupper(ch)) - i = ch - ('A' - 10); - else - i = ch - ('a' - 10); - i <<= 4; - - ch = x[1]; - if (apr_isdigit(ch)) - i += ch - '0'; - else if (apr_isupper(ch)) - i += ch - ('A' - 10); - else - i += ch - ('a' - 10); - return i; -#else /*APR_CHARSET_EBCDIC*/ - return (1 == sscanf(x, "%2x", &i)) ? os_toebcdic[i&0xFF] : 0; -#endif /*APR_CHARSET_EBCDIC*/ -} - -void ap_proxy_c2hex(int ch, char *x) -{ -#if !APR_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 /*APR_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 /*APR_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(apr_pool_t *p, const char *x, int len, enum enctype t, - int isenc) -{ - int i, j, ch; - char *y; - char *allowed; /* characters which should not be encoded */ - 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 = apr_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 (!apr_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(apr_pool_t *p, char **const urlp, char **userp, - char **passwordp, char **hostp, apr_port_t *port) -{ - apr_port_t 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 (!apr_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 (!apr_isdigit(host[i]) && host[i] != '.') - break; - /* must be an IP address */ -#if defined(WIN32) || defined(NETWARE) || defined(TPF) || defined(BEOS) - 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(apr_pool_t *p, const char *x1) -{ - char *x = apr_pstrdup(p, x1); - 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 = apr_palloc(p, 30); - apr_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; -} - -request_rec *make_fake_req(conn_rec *c, request_rec *r) -{ - request_rec *rp = apr_pcalloc(c->pool, sizeof(*r)); - core_request_config *req_cfg; - - rp->pool = c->pool; - rp->status = HTTP_OK; - - rp->headers_in = apr_table_make(c->pool, 50); - rp->subprocess_env = apr_table_make(c->pool, 50); - rp->headers_out = apr_table_make(c->pool, 12); - rp->err_headers_out = apr_table_make(c->pool, 5); - rp->notes = apr_table_make(c->pool, 5); - - rp->server = r->server; - rp->request_time = r->request_time; - rp->connection = c; - rp->output_filters = c->output_filters; - rp->input_filters = c->input_filters; - - rp->request_config = ap_create_request_config(c->pool); - req_cfg = apr_pcalloc(rp->pool, sizeof(core_request_config)); - req_cfg->bb = apr_brigade_create(c->pool); - ap_set_module_config(rp->request_config, &core_module, req_cfg); - - return rp; -} - -/* - * 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? - */ -apr_table_t *ap_proxy_read_headers(request_rec *r, request_rec *rr, char *buffer, int size, conn_rec *c) -{ - apr_table_t *headers_out; - int len; - char *value, *end; - char field[MAX_STRING_LEN]; - - headers_out = 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 = ap_getline(buffer, size, rr, 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, 0, 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 (apr_isspace(*value)) - ++value; /* Skip to start of value */ - - /* should strip trailing whitespace as well */ - for (end = &value[strlen(value)-1]; end > value && apr_isspace(*end); --end) - *end = '\0'; - - apr_table_add(headers_out, buffer, value); - - /* the header was too long; at the least we should skip extra data */ - if (len >= size - 1) { - while ((len = ap_getline(field, MAX_STRING_LEN, rr, 1)) - >= MAX_STRING_LEN - 1) { - /* soak up the extra data */ - } - if (len == 0) /* time to exit the larger loop as well */ - break; - } - } - return headers_out; -} - - -/* - * 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 = ap_strchr_c(list, ','); - if (p != NULL) { - i = p - list; - do - p++; - while (apr_isspace(*p)); - } - else - i = strlen(list); - - while (i > 0 && apr_isspace(list[i - 1])) - i--; - if (i == len && strncasecmp(list, val, len) == 0) - return 1; - list = p; - } - return 0; -} - -/* - * 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. - */ -char *ap_proxy_removestr(apr_pool_t *pool, const char *list, const char *val) -{ - int len, i; - const char *p; - char *new = NULL; - - len = strlen(val); - - while (list != NULL) { - p = ap_strchr_c(list, ','); - if (p != NULL) { - i = p - list; - do - p++; - while (apr_isspace(*p)); - } - else - i = strlen(list); - - while (i > 0 && apr_isspace(list[i - 1])) - i--; - if (i == len && strncasecmp(list, val, len) == 0) { - /* do nothing */ - } - else { - if (new) - new = apr_pstrcat(pool, new, ",", apr_pstrndup(pool, list, i), NULL); - else - new = apr_pstrndup(pool, list, i); - } - list = p; - } - return new; -} - -/* - * 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 (apr_isdigit(ch)) - j |= ch - '0'; - else if (apr_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'; -} - -int ap_proxyerror(request_rec *r, int statuscode, const char *message) -{ - apr_table_setn(r->notes, "error-notes", - apr_pstrcat(r->pool, - "The proxy server could not handle the request " - "pool, r->uri), - "\">", ap_escape_html(r->pool, r->method), - " ", - ap_escape_html(r->pool, r->uri), ".

    \n" - "Reason: ", - ap_escape_html(r->pool, message), - "", NULL)); - - /* Allow "error-notes" string to be printed by ap_send_error_response() */ - apr_table_setn(r->notes, "verbose-error-to", apr_pstrdup(r->pool, "*")); - - r->status_line = apr_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; - struct per_thread_data *ptd = get_per_thread_data(); - - for (i = 0; host[i] != '\0'; i++) - if (!apr_isdigit(host[i]) && host[i] != '.') - break; - - if (host[i] != '\0') { - hp = gethostbyname(host); - if (hp == NULL) - return "Host not found"; - } - else { - ptd->ipaddr = ap_inet_addr(host); - hp = gethostbyaddr((char *) &ptd->ipaddr, sizeof(ptd->ipaddr), AF_INET); - if (hp == NULL) { - memset(&ptd->hpbuf, 0, sizeof(ptd->hpbuf)); - ptd->hpbuf.h_name = 0; - ptd->hpbuf.h_addrtype = AF_INET; - ptd->hpbuf.h_length = sizeof(ptd->ipaddr); - ptd->hpbuf.h_addr_list = ptd->charpbuf; - ptd->hpbuf.h_addr_list[0] = (char *) &ptd->ipaddr; - ptd->hpbuf.h_addr_list[1] = 0; - hp = &ptd->hpbuf; - } - } - *reqhp = *hp; - return NULL; -} - -static const char * - proxy_get_host_of_request(request_rec *r) -{ - char *url, *user = NULL, *password = NULL, *err, *host; - apr_port_t 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 = apr_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, 0, 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, apr_pool_t *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 (!apr_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] == '/' && apr_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 */ - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Warning: NetMask not supplied with IP-Addr; guessing: %s/%ld\n", - inet_ntoa(This->addr), bits); - } - - This->mask.s_addr = htonl(APR_INADDR_NONE << (32 - bits)); - - if (*addr == '\0' && (This->addr.s_addr & ~This->mask.s_addr) != 0) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Warning: NetMask and IP-Addr disagree in %s/%ld\n", - inet_ntoa(This->addr), bits); - This->addr.s_addr &= This->mask.s_addr; - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - " 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 - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "1)IP-Match: %s[%s] <-> ", host, inet_ntoa(addr)); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "%s/", inet_ntoa(This->addr)); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "%s", inet_ntoa(This->mask)); -#endif - return 1; - } -#if DEBUGGING - else { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "1)IP-NoMatch: %s[%s] <-> ", host, inet_ntoa(addr)); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "%s/", inet_ntoa(This->addr)); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "%s", 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 - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "2)IP-NoMatch: hostname=%s msg=%s", 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 - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "3)IP-Match: %s[%s] <-> ", found, inet_ntoa(*ip_list)); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "%s/", inet_ntoa(This->addr)); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "%s", inet_ntoa(This->mask)); -#endif - return 1; - } -#if DEBUGGING - else { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "3)IP-NoMatch: %s[%s] <-> ", found, inet_ntoa(*ip_list)); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "%s/", inet_ntoa(This->addr)); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "%s", inet_ntoa(This->mask)); - } -#endif - } - } - - return 0; -} - -/* Return TRUE if addr represents a domain name */ -int ap_proxy_is_domainname(struct dirconn_entry *This, apr_pool_t *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; apr_isalnum(addr[i]) || addr[i] == '-' || addr[i] == '.'; ++i) - continue; - -#if 0 - if (addr[i] == ':') { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "@@@@ handle optional port in proxy_is_domainname()"); - /* @@@@ 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; -} - -/* Create a copy of a "struct hostent" record; it was presumably returned - * from a call to gethostbyname() and lives in static storage. - * By creating a copy we can tuck it away for later use. - */ -static struct hostent * pduphostent(apr_pool_t *p, const struct hostent *hp) -{ - struct hostent *newent; - char **ptrs; - char **aliases; - struct in_addr *addrs; - int i = 0, j = 0; - - if (hp == NULL) - return NULL; - - /* Count number of alias entries */ - if (hp->h_aliases != NULL) - for (; hp->h_aliases[j] != NULL; ++j) - continue; - - /* Count number of in_addr entries */ - if (hp->h_addr_list != NULL) - for (; hp->h_addr_list[i] != NULL; ++i) - continue; - - /* Allocate hostent structure, alias ptrs, addr ptrs, addrs */ - newent = (struct hostent *) apr_palloc(p, sizeof(*hp)); - aliases = (char **) apr_palloc(p, (j+1) * sizeof(char*)); - ptrs = (char **) apr_palloc(p, (i+1) * sizeof(char*)); - addrs = (struct in_addr *) apr_palloc(p, (i+1) * sizeof(struct in_addr)); - - *newent = *hp; - newent->h_name = apr_pstrdup(p, hp->h_name); - newent->h_aliases = aliases; - newent->h_addr_list = (char**) ptrs; - - /* Copy Alias Names: */ - for (j = 0; hp->h_aliases[j] != NULL; ++j) { - aliases[j] = apr_pstrdup(p, hp->h_aliases[j]); - } - aliases[j] = NULL; - - /* Copy address entries */ - for (i = 0; hp->h_addr_list[i] != NULL; ++i) { - ptrs[i] = (char*) &addrs[i]; - addrs[i] = *(struct in_addr *) hp->h_addr_list[i]; - } - ptrs[i] = NULL; - - return newent; -} - -/* Return TRUE if addr represents a host name */ -int ap_proxy_is_hostname(struct dirconn_entry *This, apr_pool_t *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; apr_isalnum(addr[i]) || addr[i] == '-' || addr[i] == '.'; ++i); - - if (addr[i] != '\0' || ap_proxy_host2addr(addr, &host) != NULL) - return 0; - - This->hostentry = 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, apr_pool_t *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 && ap_strstr_c(host, This->name) != NULL; -} - -/* checks whether a host in uri_addr matches proxyblock */ -int ap_proxy_checkproxyblock(request_rec *r, proxy_server_conf *conf, - apr_sockaddr_t *uri_addr) -{ - int j; - /* XXX FIXME: conf->noproxies->elts is part of an opaque structure */ - for (j = 0; j < conf->noproxies->nelts; j++) { - struct noproxy_entry *npent = (struct noproxy_entry *) conf->noproxies->elts; - struct apr_sockaddr_t *conf_addr = npent[j].addr; - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: checking remote machine [%s] against [%s]", uri_addr->hostname, npent[j].name); - if ((npent[j].name && ap_strstr_c(uri_addr->hostname, npent[j].name)) - || npent[j].name[0] == '*') { - ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, r->server, - "proxy: connect to remote machine %s blocked: name %s matched", uri_addr->hostname, npent[j].name); - return HTTP_FORBIDDEN; - } - while (conf_addr) { - while (uri_addr) { - char *conf_ip; - char *uri_ip; - apr_sockaddr_ip_get(&conf_ip, conf_addr); - apr_sockaddr_ip_get(&uri_ip, uri_addr); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: ProxyBlock comparing %s and %s", conf_ip, uri_ip); - if (!apr_strnatcasecmp(conf_ip, uri_ip)) { - ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, r->server, - "proxy: connect to remote machine %s blocked: IP %s matched", uri_addr->hostname, conf_ip); - return HTTP_FORBIDDEN; - } - uri_addr = uri_addr->next; - } - conf_addr = conf_addr->next; - } - } - return OK; -} - -/* set up the minimal filter set */ -int ap_proxy_pre_http_connection(conn_rec *c, request_rec *r) -{ - ap_add_input_filter("HTTP_IN", NULL, r, c); - ap_add_input_filter("CORE_IN", NULL, r, c); - ap_add_output_filter("CORE", NULL, r, c); - return OK; -} - -/* converts a series of buckets into a string */ -apr_status_t ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb, - char *buff, size_t bufflen, int *eos) -{ - apr_bucket *e; - apr_status_t rv; - apr_size_t readbytes = 0; /* line-at-a-time */ - char *pos = buff; - char *response; - int found = 0; - apr_size_t len; - - /* start with an empty string */ - buff[0] = 0; - *eos = 0; - - /* loop through each brigade */ - while (!found) { - - /* get brigade from network one line at a time */ - if (APR_SUCCESS != (rv = ap_get_brigade(c->input_filters, bb, AP_MODE_BLOCKING, &readbytes))) { - return rv; - } - - /* loop through each bucket */ - while (!found && !APR_BRIGADE_EMPTY(bb)) { - e = APR_BRIGADE_FIRST(bb); - if (APR_BUCKET_IS_EOS(e)) { - *eos = 1; - } - if (APR_SUCCESS != apr_bucket_read(e, (const char **)&response, &len, APR_BLOCK_READ)) { - return rv; - } - /* is string LF terminated? */ - if (memchr(response, APR_ASCII_LF, len)) { - found = 1; - } - /* concat strings until buff is full - then throw the data away */ - if (len > ((bufflen-1)-(pos-buff))) { - len = (bufflen-1)-(pos-buff); - } - if (len > 0) { - pos = apr_cpystrn(pos, response, len); - } - APR_BUCKET_REMOVE(e); - apr_bucket_destroy(e); - } - } - - return APR_SUCCESS; - -} - -/* remove other filters (like DECHUNK) from filter stack */ -void ap_proxy_reset_output_filters(conn_rec *c) -{ - ap_filter_t *f = c->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; - } - } -} - -#if defined WIN32 - -static DWORD tls_index; - -BOOL WINAPI DllMain (HINSTANCE dllhandle, DWORD reason, LPVOID reserved) -{ - LPVOID memptr; - - switch (reason) { - case DLL_PROCESS_ATTACH: - tls_index = TlsAlloc(); - case DLL_THREAD_ATTACH: /* intentional no break */ - TlsSetValue (tls_index, malloc (sizeof (struct per_thread_data))); - break; - case DLL_THREAD_DETACH: - memptr = TlsGetValue (tls_index); - if (memptr) { - free (memptr); - TlsSetValue (tls_index, 0); - } - break; - } - - return TRUE; -} - -#endif - -static struct per_thread_data *get_per_thread_data(void) -{ - return NULL; -} diff --git a/modules/ssl/.cvsignore b/modules/ssl/.cvsignore deleted file mode 100644 index 65f0cc30cf..0000000000 --- a/modules/ssl/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -Debug -Release diff --git a/modules/ssl/README b/modules/ssl/README deleted file mode 100644 index ca9e225bf8..0000000000 --- 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 d8d03db247..0000000000 --- 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 def19dbecf..0000000000 --- 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/mod_ssl.c b/modules/ssl/mod_ssl.c deleted file mode 100644 index 2d1b5e1b0a..0000000000 --- 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.h b/modules/ssl/mod_ssl.h deleted file mode 100644 index 8731ef9de4..0000000000 --- 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 c47340b223..0000000000 --- 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 84f49e6657..0000000000 --- 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 6a27c4af4d..0000000000 --- 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 4ba1574ca8..0000000000 --- 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 ca1b3f0a55..0000000000 --- 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 0e1c53a852..0000000000 --- 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 146f9ce4d9..0000000000 --- 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 2cef4e309e..0000000000 --- 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 afb49b4f5c..0000000000 --- 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 c0755a5ec8..0000000000 --- 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 49ab873ded..0000000000 --- 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 419bb02192..0000000000 --- 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 d8c5ea5f9e..0000000000 --- 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 8e35553a4e..0000000000 --- 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 618cacbe3b..0000000000 --- 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 1e3ad6e513..0000000000 --- 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 f3e9f9d1f5..0000000000 --- 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 a0db7cccde..0000000000 --- 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 139c7865fe..0000000000 --- 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 323c612991..0000000000 --- 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 e588f0a5d1..0000000000 --- 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 af4a9672f2..0000000000 --- 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 19f6bd3629..0000000000 --- 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 23aaaaa40d..0000000000 --- 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 02736007bd..0000000000 --- a/modules/test/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -Makefile -*.lo -*.so -modules.mk -Debug -Release diff --git a/modules/test/.indent.pro b/modules/test/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- 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/README b/modules/test/README deleted file mode 100644 index c61763c1dd..0000000000 --- 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/mod_autoindex.c b/modules/test/mod_autoindex.c deleted file mode 100644 index d875082a85..0000000000 --- a/modules/test/mod_autoindex.c +++ /dev/null @@ -1,1711 +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. - */ - -/* - * mod_autoindex.c: Handles the on-the-fly html index generation - * - * Rob McCool - * 3/23/93 - * - * Adapted to Apache by rst. - * - * Version sort added by Martin Pool . */ - -#include "apr_strings.h" -#include "ap_config.h" -#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 "apr_fnmatch.h" -#include "apr_strings.h" -#ifdef HAVE_STRING_H -#include -#endif -#ifdef HAVE_STRINGS_H -#include -#endif - -module AP_MODULE_DECLARE_DATA 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 VERSION_SORT 512 - -#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; - - apr_array_header_t *icon_list; - apr_array_header_t *alt_list; - apr_array_header_t *desc_list; - apr_array_header_t *ign_list; - apr_array_header_t *hdr_list; - apr_array_header_t *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 apr_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(apr_array_header_t *arr, char *type, const char *to, - const char *path, const char *data) -{ - struct item *p = (struct item *) apr_array_push(arr); - - if (!to) { - to = ""; - } - if (!path) { - path = ""; - } - - p->type = type; - p->data = data ? apr_pstrdup(arr->cont, data) : NULL; - p->apply_path = apr_pstrcat(arr->cont, path, "*", NULL); - - if ((type == BY_PATH) && (!ap_is_matchexp(to))) { - p->apply_to = apr_pstrcat(arr->cont, "*", to, NULL); - } - else if (to) { - p->apply_to = apr_pstrdup(arr->cont, to); - } - else { - p->apply_to = NULL; - } -} - -static const char *add_alt(cmd_parms *cmd, void *d, const char *alt, - const char *to) -{ - if (cmd->info == BY_PATH) { - if (!strcmp(to, "**DIRECTORY**")) { - to = "^^DIRECTORY^^"; - } - } - if (cmd->info == BY_ENCODING) { - char *tmp = apr_pstrdup(cmd->pool, to); - ap_str_tolower(tmp); - to = tmp; - } - - 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, const char *icon, - const char *to) -{ - char *iconbak = apr_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) { - char *tmp = apr_pstrdup(cmd->pool, to); - ap_str_tolower(tmp); - to = tmp; - } - - 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, const char *desc, - const char *to) -{ - autoindex_config_rec *dcfg = (autoindex_config_rec *) d; - ai_desc_t *desc_entry; - char *prefix = ""; - - desc_entry = (ai_desc_t *) apr_array_push(dcfg->desc_list); - desc_entry->full_path = (ap_strchr_c(to, '/') == NULL) ? 0 : 1; - desc_entry->wildcards = (WILDCARDS_REQUIRED - || desc_entry->full_path - || apr_is_fnmatch(to)); - if (desc_entry->wildcards) { - prefix = desc_entry->full_path ? "*/" : "*"; - desc_entry->pattern = apr_pstrcat(dcfg->desc_list->cont, - prefix, to, "*", NULL); - } - else { - desc_entry->pattern = apr_pstrdup(dcfg->desc_list->cont, to); - } - desc_entry->description = apr_pstrdup(dcfg->desc_list->cont, desc); - return NULL; -} - -static const char *add_ignore(cmd_parms *cmd, void *d, const 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, const 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, const 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, "VersionSort")) { - option = VERSION_SORT; - } - 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, const char *direction, - const char *key) -{ - char temp[4]; - autoindex_config_rec *d_cfg = (autoindex_config_rec *) m; - - apr_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 = apr_palloc(cmd->pool, 4); - d_cfg->default_order[3] = '\0'; - } - apr_cpystrn(d_cfg->default_order, temp, sizeof(temp)); - return NULL; -} - -#define DIR_CMD_PERMS OR_INDEXES - -static const command_rec autoindex_cmds[] = -{ - AP_INIT_ITERATE2("AddIcon", add_icon, BY_PATH, DIR_CMD_PERMS, - "an icon URL followed by one or more filenames"), - AP_INIT_ITERATE2("AddIconByType", add_icon, BY_TYPE, DIR_CMD_PERMS, - "an icon URL followed by one or more MIME types"), - AP_INIT_ITERATE2("AddIconByEncoding", add_icon, BY_ENCODING, DIR_CMD_PERMS, - "an icon URL followed by one or more content encodings"), - AP_INIT_ITERATE2("AddAlt", add_alt, BY_PATH, DIR_CMD_PERMS, - "alternate descriptive text followed by one or more filenames"), - AP_INIT_ITERATE2("AddAltByType", add_alt, BY_TYPE, DIR_CMD_PERMS, - "alternate descriptive text followed by one or more MIME types"), - AP_INIT_ITERATE2("AddAltByEncoding", add_alt, BY_ENCODING, DIR_CMD_PERMS, - "alternate descriptive text followed by one or more content encodings"), - AP_INIT_RAW_ARGS("IndexOptions", add_opts, NULL, DIR_CMD_PERMS, - "one or more index options"), - AP_INIT_TAKE2("IndexOrderDefault", set_default_order, NULL, DIR_CMD_PERMS, - "{Ascending,Descending} {Name,Size,Description,Date}"), - AP_INIT_ITERATE("IndexIgnore", add_ignore, NULL, DIR_CMD_PERMS, - "one or more file extensions"), - AP_INIT_ITERATE2("AddDescription", add_desc, BY_PATH, DIR_CMD_PERMS, - "Descriptive text followed by one or more filenames"), - AP_INIT_TAKE1("HeaderName", add_header, NULL, DIR_CMD_PERMS, - "a filename"), - AP_INIT_TAKE1("ReadmeName", add_readme, NULL, DIR_CMD_PERMS, - "a filename"), - AP_INIT_FLAG("FancyIndexing", fancy_indexing, NULL, DIR_CMD_PERMS, - "Limited to 'on' or 'off' (superseded by IndexOptions FancyIndexing)"), - AP_INIT_TAKE1("DefaultIcon", ap_set_string_slot, - (void *) XtOffsetOf(autoindex_config_rec, default_icon), - DIR_CMD_PERMS, "an icon URL"), - {NULL} -}; - -static void *create_autoindex_config(apr_pool_t *p, char *dummy) -{ - autoindex_config_rec *new = - (autoindex_config_rec *) apr_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 = apr_array_make(p, 4, sizeof(struct item)); - new->alt_list = apr_array_make(p, 4, sizeof(struct item)); - new->desc_list = apr_array_make(p, 4, sizeof(ai_desc_t)); - new->ign_list = apr_array_make(p, 4, sizeof(struct item)); - new->hdr_list = apr_array_make(p, 4, sizeof(struct item)); - new->rdme_list = apr_array_make(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(apr_pool_t *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 *) apr_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 = apr_array_append(p, add->alt_list, base->alt_list); - new->ign_list = apr_array_append(p, add->ign_list, base->ign_list); - new->hdr_list = apr_array_append(p, add->hdr_list, base->hdr_list); - new->desc_list = apr_array_append(p, add->desc_list, base->desc_list); - new->icon_list = apr_array_append(p, add->icon_list, base->icon_list); - new->rdme_list = apr_array_append(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 nonincremental 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 nonincremental 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; - apr_time_t lm; - struct ent *next; - int ascending, version_sort; - char key; -}; - -static char *find_item(request_rec *r, apr_array_header_t *list, int path_only) -{ - const char *content_type = ap_field_noparam(r->pool, 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 = ap_strrchr_c(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 = (apr_fnmatch(tuple->pattern, filename, MATCH_FLAGS) == 0); - } - else { - found = (ap_strstr_c(filename, tuple->pattern) != NULL); - } - if (found) { - return tuple->description; - } - } - return NULL; -} - -static int ignore_entry(autoindex_config_rec *d, char *path) -{ - apr_array_header_t *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, apr_file_t *f) -{ - char buf[AP_IOBUFSIZE + 1]; - int i, c, ch; - apr_size_t n; - apr_status_t stat; - - ap_rputs("
    \n", r);
    -    while (!apr_file_eof(f)) {
    -	do {
    -            n = sizeof(char) * AP_IOBUFSIZE;
    -	    stat = apr_file_read(f, buf, &n);
    -	}
    -	while (stat != APR_SUCCESS && APR_STATUS_IS_EINTR(stat));
    -	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) -{ - apr_file_t *f = NULL; - 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, NULL)) - && (rr->status == HTTP_OK) - && (rr->filename != NULL) - && rr->finfo.filetype == APR_REG) { - /* - * 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 (apr_file_open(&f, rr->filename, APR_READ,
    -                            APR_OS_DEFAULT, r->pool) == APR_SUCCESS) {
    -		    emit_preamble(r, title);
    -		    emit_amble = 0;
    -		    do_emit_plain(r, f);
    -		    apr_file_close(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) -{ - apr_file_t *f = NULL; - 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, NULL)) - && (rr->status == HTTP_OK) - && (rr->filename != NULL) - && rr->finfo.filetype == APR_REG) { - /* - * 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 (apr_file_open(&f, rr->filename, APR_READ, - APR_OS_DEFAULT, r->pool) == APR_SUCCESS) { - do_emit_plain(r, f); - apr_file_close(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 = ""; - apr_file_t *thefile = NULL; - int x, y, p; - apr_size_t n; - - 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 (apr_file_open(&thefile, r->filename, APR_READ, - APR_OS_DEFAULT, r->pool) != APR_SUCCESS) { - return NULL; - } - n = sizeof(char) * (MAX_STRING_LEN - 1); - apr_file_read(thefile, titlebuf, &n); - if (n <= 0) { - apr_file_close(thefile); - return NULL; - } - titlebuf[n] = '\0'; - for (x = 0, p = 0; titlebuf[x]; x++) { - if (apr_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] = ' '; - } - } - } - apr_file_close(thefile); - return apr_pstrdup(r->pool, &titlebuf[x]); - } - } - else { - p = 0; - } - } - apr_file_close(thefile); - } - return NULL; -} - -static struct ent *make_autoindex_entry(const 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 *) apr_pcalloc(r->pool, sizeof(struct ent)); - p->name = apr_pstrdup(r->pool, name); - p->size = -1; - p->icon = NULL; - p->alt = NULL; - p->desc = NULL; - p->lm = -1; - p->key = apr_toupper(keyid); - p->ascending = (apr_toupper(direction) == D_ASCENDING); - p->version_sort = autoindex_opts & VERSION_SORT; - - if (autoindex_opts & FANCY_INDEXING) { - request_rec *rr = ap_sub_req_lookup_file(name, r, NULL); - - if (rr->finfo.filetype != 0) { - p->lm = rr->finfo.mtime; - if (rr->finfo.filetype == APR_DIR) { - 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 = apr_pstrcat(r->pool, name, "/", NULL); - } - else { - p->icon = find_icon(d, rr, 0); - p->alt = find_alt(d, rr, 0); - p->size = rr->finfo.size; - } - } - - p->desc = find_desc(d, rr); - - if ((!p->desc) && (autoindex_opts & SCAN_HTML_TITLES)) { - p->desc = apr_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; - apr_size_t rv; - char *name = r->uri; - char *tp; - int static_columns = (autoindex_opts & SUPPRESS_COLSORT); - apr_pool_t *scratch; - int name_width; - char *name_scratch; - char *pad_scratch; - - apr_pool_create(&scratch, r->pool); - 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 = apr_palloc(r->pool, name_width + 1); - pad_scratch = apr_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; - - apr_pool_clear(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]; - apr_exploded_time_t ts; - apr_explode_localtime(&ts, ar[x]->lm); - apr_strftime(time_str, &rv, 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: - if (c1->version_sort) - result = apr_strnatcmp(c1->desc ? c1->desc : "", c2->desc ? c2->desc : ""); - else - result = strcmp(c1->desc ? c1->desc : "", c2->desc ? c2->desc : ""); - if (result) { - return result; - } - break; - } - if (c1->version_sort) - return apr_strnatcmp(c1->name, c2->name); - else - 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; - apr_finfo_t dirent; - apr_dir_t *thedir; - apr_status_t status; - 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 ((status = apr_dir_open(&thedir, name, r->pool)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, - "Can't open directory for index: %s", r->filename); - return HTTP_FORBIDDEN; - } - -#if APR_HAS_UNICODE_FS - r->content_type = "text/html;charset=utf-8"; -#else - r->content_type = "text/html"; -#endif - ap_update_mtime(r, r->finfo.mtime); - ap_set_last_modified(r); - ap_set_etag(r); - - if (r->header_only) { - apr_dir_close(thedir); - return 0; - } - - /* 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 (apr_dir_read(&dirent, APR_FINFO_DIRENT, thedir) == APR_SUCCESS) { - p = make_autoindex_entry(dirent.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 **) apr_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); - apr_dir_close(thedir); - - if (autoindex_opts & FANCY_INDEXING) { - ap_rputs("<HR>\n", r); - } - emit_tail(r, find_readme(autoindex_conf, r), - autoindex_opts & SUPPRESS_PREAMBLE); - - return 0; -} - -/* The formal handler... */ - -static int handle_autoindex(request_rec *r) -{ - autoindex_config_rec *d; - int allow_opts; - - if(strcmp(r->handler,DIR_MAGIC_TYPE)) - return DECLINED; - - 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 = apr_pstrcat(r->pool, r->filename, "/", NULL); - } - return index_directory(r, d); - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Directory index forbidden by rule: %s", r->filename); - return HTTP_FORBIDDEN; - } -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_handler(handle_autoindex,NULL,NULL,APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA autoindex_module = -{ - STANDARD20_MODULE_STUFF, - 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 apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/test/mod_autoindex.exp b/modules/test/mod_autoindex.exp deleted file mode 100644 index 90f4057e9c..0000000000 --- a/modules/test/mod_autoindex.exp +++ /dev/null @@ -1 +0,0 @@ -autoindex_module diff --git a/modules/test/mod_optional_fn_export.c b/modules/test/mod_optional_fn_export.c deleted file mode 100644 index b214a36621..0000000000 --- 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 - * <http://www.apache.org/>. - */ - -#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 a1950f373b..0000000000 --- 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 3be3b6be6d..0000000000 --- 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 - * <http://www.apache.org/>. - */ - -#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; -} - -static 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_rndchunk.c b/modules/test/mod_rndchunk.c deleted file mode 100644 index 6eeae175ac..0000000000 --- a/modules/test/mod_rndchunk.c +++ /dev/null @@ -1,179 +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. - */ - -/* - * This module is intended to be used for testing chunked encoding. It - * generates a whole whack of output using ap_bputc() and ap_bputs(). It - * also exercises start_chunk() and end_chunk() in buff.c. To use it - * you should use a tool like netcat and the src/test/check_chunked - * tool. Add something like this to your access.conf file: - * - * <Location /rndchunk> - * SetHandler rndchunk - * </Location> - * - * Then fake requests such as: - * - * GET /rndchunk?0,1000000 HTTP/1.1 - * Host: localhost - * - * The first arg is the random seed, the second is the number of - * "things" to do. You should try a few seeds. - * - * You should also edit main/buff.c and change DEFAULT_BUFSIZE (and - * CHUNK_HEADER_SIZE). Small values are particularly useful for - * finding bugs. Try a few different values. - * - * -djg - */ - -#include "httpd.h" -#include "http_protocol.h" -#include "http_config.h" -#include "http_main.h" - -#define MAX_SEGMENT 32 -#define ONE_WEIGHT (256-32) - -static int send_rndchunk(request_rec *r) -{ - const char *args; - char *endptr; - unsigned int seed; - unsigned int count; - int i; - char buf[MAX_SEGMENT + 1]; - unsigned int len; - - r->allowed |= (1 << M_GET); - if (r->method_number != M_GET) - return DECLINED; - - r->content_type = "text/html"; - if(r->header_only) { - return 0; - } - ap_hard_timeout("send_rndchunk", r); - - if (!r->chunked) { - ap_rputs("Not chunked!", r); - ap_kill_timeout(r); - return 0; - } - - args = r->args; - if (!args) { -error: - ap_rputs("Must include args! ... of the form <code>?seed,count</code>", r); - ap_kill_timeout(r); - return 0; - } - seed = strtol(args, &endptr, 0); - if (!endptr || *endptr != ',') { - goto error; - } - ++endptr; - count = strtol(endptr, &endptr, 0); - - srandom(seed); - for (i = 0; i < count; ++i) { - len = random() % (MAX_SEGMENT + ONE_WEIGHT); - if (len >= MAX_SEGMENT) { - ap_rputc((i & 1) ? '0' : '1', r); - } - else if (len == 0) { - /* not a really nice thing to do, but we need to test - * beginning/ending chunks as well - */ - ap_bsetflag(r->connection->client, B_CHUNK, 0); - ap_bsetflag(r->connection->client, B_CHUNK, 1); - } - else { - memset(buf, '2' + len, len); - buf[len] = 0; - ap_rputs(buf, r); - } - } - ap_kill_timeout(r); - return 0; -} - -static const handler_rec rndchunk_handlers[] = -{ - {"rndchunk", send_rndchunk}, - {NULL} -}; - -module rndchunk_module = { - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - NULL, /* command apr_table_t */ - rndchunk_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 */ -}; diff --git a/modules/test/mod_test_util_uri.c b/modules/test/mod_test_util_uri.c deleted file mode 100644 index 5472243568..0000000000 --- a/modules/test/mod_test_util_uri.c +++ /dev/null @@ -1,354 +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. - */ - -/* - * This module is intended to test the util_uri routines by parsing a - * bunch of urls and comparing the results with what we expect to - * see. - * - * Usage: - * - * <Location /test-util-uri> - * SetHandler test-util-uri - * </Location> - * - * Then make a request to /test-util-uri. An html apr_table_t of errors will - * be output... and a total count of errors. - */ - -#include "httpd.h" -#include "http_protocol.h" -#include "http_config.h" -#include "http_main.h" - -typedef struct { - const char *scheme; - const char *user; - const char *password; - const char *hostname; - const char *port_str; - const char *path; - const char *query; - const char *fragment; -} test_uri_t; - -#define T_scheme 0x01 -#define T_user 0x02 -#define T_password 0x04 -#define T_hostname 0x08 -#define T_port_str 0x10 -#define T_path 0x20 -#define T_query 0x40 -#define T_fragment 0x80 -#define T_MAX 0x100 - -/* The idea is that we list here a bunch of url pieces that we want - * stitched together in every way that's valid. - */ -static const test_uri_t uri_tests[] = { - { "http", "userid", "passwd", "hostname.goes.here", "80", "/path/goes/here", "query-here", "frag-here" }, - { "http", "", "passwd", "hostname.goes.here", "80", "/path/goes/here", "query-here", "frag-here" }, - { "http", "userid", "", "hostname.goes.here", "80", "/path/goes/here", "query-here", "frag-here" }, - { "http", "userid", "passwd", "", "80", "/path/goes/here", "query-here", "frag-here" }, - { "http", "userid", "passwd", "hostname.goes.here", "", "/path/goes/here", "query-here", "frag-here" }, -#if 0 - /* An empty path means two different things depending on whether this is a - * relative or an absolute uri... consider <a href="#frag"> versus "GET - * http://hostname HTTP/1.1". So this is why parse_uri_components returns - * a NULL for path when it doesn't find one, instead of returning an empty - * string. - * - * We don't really need to test it explicitly since path has no explicit - * character that indicates its precense, and so we test empty paths all - * the time by varying T_path in the loop. It would just cost us extra - * code to special case the empty path string... - */ - { "http", "userid", "passwd", "hostname.goes.here", "80", "", "query-here", "frag-here" }, -#endif - { "http", "userid", "passwd", "hostname.goes.here", "80", "/path/goes/here", "", "frag-here" }, - { "http", "userid", "passwd", "hostname.goes.here", "80", "/path/goes/here", "query-here", "" }, - { "https", "user@d", "pa:swd", "hostname.goes.here.", "", "/~path/goes/here", "query&query?crud", "frag-here?baby" } - -}; - -static char *my_stpcpy(char *d, const char *s) -{ - while((*d = *s)) { - ++d; - ++s; - } - return d; -} - -/* return the number of failures */ -static unsigned iterate_pieces(request_rec *r, const test_uri_t *pieces, int row) -{ - unsigned u; - apr_pool_t *sub; - char *input_uri; - char *strp; - uri_components result; - unsigned expect; - int status; - unsigned failures; - - failures = 0; - - input_uri = apr_palloc(r->pool, - strlen(pieces->scheme) + 3 - + strlen(pieces->user) + 1 - + strlen(pieces->password) + 1 - + strlen(pieces->hostname) + 1 - + strlen(pieces->port_str) + 1 - + strlen(pieces->path) + - + strlen(pieces->query) + 1 - + strlen(pieces->fragment) + 1 - + 1); - - for (u = 0; u < T_MAX; ++u) { - strp = input_uri; - expect = 0; - - /* a scheme requires a hostinfo and vice versa */ - /* a hostinfo requires a hostname */ - if (u & (T_scheme|T_user|T_password|T_hostname|T_port_str)) { - expect |= T_scheme; - strp = my_stpcpy(strp, pieces->scheme); - *strp++ = ':'; - *strp++ = '/'; - *strp++ = '/'; - /* can't have password without user */ - if (u & (T_user|T_password)) { - expect |= T_user; - strp = my_stpcpy(strp, pieces->user); - if (u & T_password) { - expect |= T_password; - *strp++ = ':'; - strp = my_stpcpy(strp, pieces->password); - } - *strp++ = '@'; - } - expect |= T_hostname; - strp = my_stpcpy(strp, pieces->hostname); - if (u & T_port_str) { - expect |= T_port_str; - *strp++ = ':'; - strp = my_stpcpy(strp, pieces->port_str); - } - } - if (u & T_path) { - expect |= T_path; - strp = my_stpcpy(strp, pieces->path); - } - if (u & T_query) { - expect |= T_query; - *strp++ = '?'; - strp = my_stpcpy(strp, pieces->query); - } - if (u & T_fragment) { - expect |= T_fragment; - *strp++ = '#'; - strp = my_stpcpy(strp, pieces->fragment); - } - *strp = 0; - - sub = apr_pool_sub_make(r->pool); - status = ap_parse_uri_components(sub, input_uri, &result); - if (status == HTTP_OK) { -#define CHECK(f) \ - if ((expect & T_##f) \ - && (result.f == NULL || strcmp(result.f, pieces->f))) { \ - status = HTTP_INTERNAL_SERVER_ERROR; \ - } \ - else if (!(expect & T_##f) && result.f != NULL) { \ - status = HTTP_INTERNAL_SERVER_ERROR; \ - } - CHECK(scheme) - CHECK(user) - CHECK(password) - CHECK(hostname) - CHECK(port_str) - CHECK(path) - CHECK(query) - CHECK(fragment) -#undef CHECK - } - if (status != HTTP_OK) { - ap_rprintf(r, "<tr><td>%d</td><td>0x%02x</td><td>0x%02x</td><td>%d</td><td>\"%s\"</td>", row, u, expect, status, input_uri); -#define DUMP(f) \ - if (result.f) { \ - ap_rvputs(r, "<td>\"", result.f, "\"<br>", NULL); \ - } \ - else { \ - ap_rputs("<td>NULL<br>", r); \ - } \ - if (expect & T_##f) { \ - ap_rvputs(r, "\"", pieces->f, "\"</td>", NULL); \ - } \ - else { \ - ap_rputs("NULL</td>", r); \ - } - DUMP(scheme); - DUMP(user); - DUMP(password); - DUMP(hostname); - DUMP(port_str); - DUMP(path); - DUMP(query); - DUMP(fragment); -#undef DUMP - ap_rputs("</tr>\n", r); - ++failures; - } - apr_pool_destroy(sub); - } - return failures; -} - -static int test_util_uri(request_rec *r) -{ - unsigned total_failures; - int i; - - r->allowed |= (1 << M_GET); - if (r->method_number != M_GET) - return DECLINED; - - r->content_type = "text/html"; - if(r->header_only) { - return 0; - } - ap_hard_timeout("test_util_uri", r); - - ap_rputs( -DOCTYPE_HTML_2_0 " -<html><body> -<p>Key: -<dl> -<dt>row -<dd>entry number in the uri_tests array -<dt>u -<dd>fields under test -<dt>expected -<dd>fields expected in the result -<dt>status -<dd>response from parse_uri_components, or 500 if unexpected results -<dt>input uri -<dd>the uri given to parse_uri_components -</dl> -<p>The remaining fields are the pieces returned from parse_uri_components, and -the values we expected for each piece (resp.). -<p>Only failures are displayed. -<p> -<table><tr><th>row</th><th>u</th><th>expect</th><th>status</th><th>input uri</th>", r); -#define HEADER(f) ap_rprintf(r, "<th>" #f "<br>0x%02x</th>", T_##f) - HEADER(scheme); - HEADER(user); - HEADER(password); - HEADER(hostname); - HEADER(port_str); - HEADER(path); - HEADER(query); - HEADER(fragment); -#undef HEADER - - if (r->args) { - i = atoi(r->args); - total_failures = iterate_pieces(r, &uri_tests[i], i); - } - else { - total_failures = 0; - for (i = 0; i < sizeof(uri_tests) / sizeof(uri_tests[0]); ++i) { - total_failures += iterate_pieces(r, &uri_tests[i], i); - if (total_failures > 256) { - ap_rprintf(r, "</table>\n<b>Stopped early to save your browser " - "from certain death!</b>\nTOTAL FAILURES = %u\n", - total_failures); - return OK; - } - } - } - ap_rprintf(r, "</table>\nTOTAL FAILURES = %u\n", total_failures); - - return OK; -} - -static const handler_rec test_util_uri_handlers[] = -{ - {"test-util-uri", test_util_uri}, - {NULL} -}; - -module test_util_uri_module = { - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - NULL, /* command apr_table_t */ - test_util_uri_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 */ -}; diff --git a/modules/tls/.cvsignore b/modules/tls/.cvsignore deleted file mode 100644 index 239bc29765..0000000000 --- a/modules/tls/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.libs -.deps -Makefile -modules.mk -*.lo -*.la diff --git a/modules/tls/Makefile.in b/modules/tls/Makefile.in deleted file mode 100644 index d8187ddf06..0000000000 --- a/modules/tls/Makefile.in +++ /dev/null @@ -1,2 +0,0 @@ -include $(top_srcdir)/build/special.mk - diff --git a/modules/tls/README b/modules/tls/README deleted file mode 100644 index 064ce839fe..0000000000 --- a/modules/tls/README +++ /dev/null @@ -1,20 +0,0 @@ -This currently won't work with Apache unaided. The manual things I -have to do to make it work are: - -To configure this module you must use: - ---enable-tls ---with-ssl=/path/to/ssl/library - -For example: - ---enable-tls ---with-ssl=/home/rbb/openssl-0.9.6 - -NOTE: You must be using OpenSSL 0.9.6 or later in order for this to work. - -Then all you need is "TLSFilter on" and "TLSCertificateFile <file>" in -your config, and you are away (note that the cert file must also -contain the private key at present). - -Ben Laurie, 11 Feb 2001. diff --git a/modules/tls/config.m4 b/modules/tls/config.m4 deleted file mode 100644 index 2ecee966e0..0000000000 --- a/modules/tls/config.m4 +++ /dev/null @@ -1,43 +0,0 @@ -AC_MSG_CHECKING(for SSL library) -APACHE_MODPATH_INIT(tls) - -tls_objs="mod_tls.lo openssl_state_machine.lo" - -APACHE_MODULE(tls, TLS/SSL support, $tls_objs, , no, [ - AC_ARG_WITH(ssl, [ --with-ssl use a specific SSL library installation ], - [ - searchfile="$withval/inc/ssl.h" - if test -f $searchfile ; then - APR_ADDTO(INCLUDES, [-I$withval/inc]) - APR_ADDTO(LIBS, [-L$withval -lsslc]) - ssl_lib="SSLC" - else - searchfile="$withval/ssl/ssl.h" - if test -f $searchfile ; then - APR_ADDTO(INCLUDES, [-I$withval/include]) - APR_ADDTO(LIBS, [-L$withval -lssl -lcrypto]) - ssl_lib="OpenSSL" - else - searchfile="$withval/openssl/ssl.h" - if test -f $searchfile ; then - APR_ADDTO(INCLUDES, [-I$withval/openssl]) - APR_ADDTO(LIBS, [-L$withval -lssl -lcrypto]) - ssl_lib="OpenSSL" - else - searchfile="$withval/include/openssl/ssl.h" - if test -f $searchfile ; then - APR_ADDTO(INCLUDES, [-I$withval/include]) - APR_ADDTO(LIBS, [-L$withval/lib -lssl -lcrypto]) - ssl_lib="OpenSSL" - else - AC_MSG_ERROR(no - Unable to locate $withval/inc/ssl.h) - fi - fi - fi - fi - AC_MSG_RESULT(found $ssl_lib) - ],[ - AC_MSG_ERROR(--with-ssl not given) - ] ) ] ) - -APACHE_MODPATH_FINISH diff --git a/modules/tls/mod_tls.c b/modules/tls/mod_tls.c deleted file mode 100644 index 2fd8cc75d3..0000000000 --- a/modules/tls/mod_tls.c +++ /dev/null @@ -1,417 +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 - * <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. - */ - -#include "httpd.h" -#include "http_config.h" -#include "util_filter.h" -#include "http_connection.h" -#include "openssl_state_machine.h" -#include "apr_strings.h" -#include "http_protocol.h" -#include "http_log.h" - -/* temp */ -#include <assert.h> - -module AP_MODULE_DECLARE_DATA tls_module; -static const char s_szTLSFilterName[]="TLSFilter"; -typedef struct -{ - int bEnabled; - const char *szCertificateFile; - const char *szKeyFile; -} TLSServerConfig; - -typedef struct -{ - SSLStateMachine *pStateMachine; - ap_filter_t *pInputFilter; - ap_filter_t *pOutputFilter; - apr_bucket_brigade *pbbInput; /* encrypted input */ - apr_bucket_brigade *pbbPendingInput; /* decrypted input */ -} TLSFilterCtx; - -static void *create_tls_server_config(apr_pool_t *p, server_rec *s) -{ - TLSServerConfig *pConfig = apr_pcalloc(p, sizeof *pConfig); - - pConfig->bEnabled = 0; - pConfig->szCertificateFile = pConfig->szKeyFile = NULL; - - return pConfig; -} - -static const char *tls_on(cmd_parms *cmd, void *dummy, int arg) -{ - TLSServerConfig *pConfig = ap_get_module_config(cmd->server->module_config, - &tls_module); - pConfig->bEnabled = arg; - - return NULL; -} - -static const char *tls_cert_file(cmd_parms *cmd, void *dummy, const char *arg) -{ - TLSServerConfig *pConfig = ap_get_module_config(cmd->server->module_config, - &tls_module); - pConfig->szCertificateFile = ap_server_root_relative(cmd->pool, arg); - - /* temp */ - pConfig->szKeyFile=pConfig->szCertificateFile; - - return NULL; -} - -static int tls_filter_inserter(conn_rec *c) -{ - TLSServerConfig *pConfig = - ap_get_module_config(c->base_server->module_config, - &tls_module); - TLSFilterCtx *pCtx; - - if (!pConfig->bEnabled) - return DECLINED; - - pCtx=apr_pcalloc(c->pool,sizeof *pCtx); - pCtx->pStateMachine=SSLStateMachine_new(pConfig->szCertificateFile, - pConfig->szKeyFile); - - pCtx->pInputFilter=ap_add_input_filter(s_szTLSFilterName,pCtx,NULL,c); - pCtx->pOutputFilter=ap_add_output_filter(s_szTLSFilterName,pCtx,NULL,c); - pCtx->pbbInput=apr_brigade_create(c->pool); - pCtx->pbbPendingInput=apr_brigade_create(c->pool); - - return OK; -} - -static apr_status_t churn_output(TLSFilterCtx *pCtx) -{ - apr_bucket_brigade *pbbOutput=NULL; - int done; - - do { - char buf[1024]; - int n; - apr_bucket *pbkt; - - done=0; - - if(SSLStateMachine_write_can_extract(pCtx->pStateMachine)) { - n=SSLStateMachine_write_extract(pCtx->pStateMachine,buf, - sizeof buf); - if(n > 0) { - char *pbuf; - - if(!pbbOutput) - pbbOutput=apr_brigade_create(pCtx->pOutputFilter->c->pool); - - pbuf=apr_pmemdup(pCtx->pOutputFilter->c->pool,buf,n); - pbkt=apr_bucket_pool_create(pbuf,n, - pCtx->pOutputFilter->c->pool); - APR_BRIGADE_INSERT_TAIL(pbbOutput,pbkt); - done=1; - /* } else if(n == 0) { - apr_bucket *pbktEOS=apr_bucket_create_eos(); - APR_BRIGADE_INSERT_TAIL(pbbOutput,pbktEOS);*/ - } - assert(n > 0); - } - } while(done); - - /* XXX: check for errors */ - if(pbbOutput) { - apr_bucket *pbkt; - - /* XXX: it may be possible to not always flush */ - pbkt=apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(pbbOutput,pbkt); - ap_pass_brigade(pCtx->pOutputFilter->next,pbbOutput); - } - - return APR_SUCCESS; -} - -static apr_status_t churn(TLSFilterCtx *pCtx,apr_read_type_e eReadType,apr_size_t *readbytes) -{ - ap_input_mode_t eMode=eReadType == APR_BLOCK_READ ? AP_MODE_BLOCKING - : AP_MODE_NONBLOCKING; - apr_bucket *pbktIn; - - if(APR_BRIGADE_EMPTY(pCtx->pbbInput)) { - ap_get_brigade(pCtx->pInputFilter->next,pCtx->pbbInput,eMode,readbytes); - if(APR_BRIGADE_EMPTY(pCtx->pbbInput)) - return APR_EOF; - } - - APR_BRIGADE_FOREACH(pbktIn,pCtx->pbbInput) { - const char *data; - apr_size_t len; - int n; - char buf[1024]; - apr_status_t ret; - - if(APR_BUCKET_IS_EOS(pbktIn)) { - /* XXX: why can't I reuse pbktIn??? */ - /* Write eof! */ - break; - } - - /* read filter */ - ret=apr_bucket_read(pbktIn,&data,&len,eReadType); - - APR_BUCKET_REMOVE(pbktIn); - - if(ret == APR_SUCCESS && len == 0 && eReadType == APR_BLOCK_READ) - ret=APR_EOF; - - if(len == 0) { - /* Lazy frickin browsers just reset instead of shutting down. */ - if(ret == APR_EOF || ret == APR_ECONNRESET) { - if(APR_BRIGADE_EMPTY(pCtx->pbbPendingInput)) - return APR_EOF; - else - /* Next time around, the incoming brigade will be empty, - * so we'll return EOF then - */ - return APR_SUCCESS; - } - - if(eReadType != APR_NONBLOCK_READ) - ap_log_error(APLOG_MARK,APLOG_ERR,ret,NULL, - "Read failed in tls_in_filter"); - assert(eReadType == APR_NONBLOCK_READ); - assert(ret == APR_SUCCESS || APR_STATUS_IS_EAGAIN(ret)); - /* In this case, we have data in the output bucket, or we were - * non-blocking, so returning nothing is fine. - */ - return APR_SUCCESS; - } - - assert(len > 0); - - /* write SSL */ - SSLStateMachine_read_inject(pCtx->pStateMachine,data,len); - - n=SSLStateMachine_read_extract(pCtx->pStateMachine,buf,sizeof buf); - if(n > 0) { - apr_bucket *pbktOut; - char *pbuf; - - pbuf=apr_pmemdup(pCtx->pInputFilter->c->pool,buf,n); - /* XXX: should we use a heap bucket instead? Or a transient (in - * which case we need a separate brigade for each bucket)? - */ - pbktOut=apr_bucket_pool_create(pbuf,n,pCtx->pInputFilter->c->pool); - APR_BRIGADE_INSERT_TAIL(pCtx->pbbPendingInput,pbktOut); - - /* Once we've read something, we can move to non-blocking mode (if - * we weren't already). - */ - eReadType=APR_NONBLOCK_READ; - - /* XXX: deal with EOF! */ - /* } else if(n == 0) { - apr_bucket *pbktEOS=apr_bucket_create_eos(); - APR_BRIGADE_INSERT_TAIL(pbbInput,pbktEOS);*/ - } - assert(n >= 0); - - ret=churn_output(pCtx); - if(ret != APR_SUCCESS) - return ret; - } - - return churn_output(pCtx); -} - -static apr_status_t tls_out_filter(ap_filter_t *f,apr_bucket_brigade *pbbIn) -{ - TLSFilterCtx *pCtx=f->ctx; - apr_bucket *pbktIn; - apr_size_t zero = 0; - - APR_BRIGADE_FOREACH(pbktIn,pbbIn) { - const char *data; - apr_size_t len; - apr_status_t ret; - - if(APR_BUCKET_IS_EOS(pbktIn)) { - /* XXX: demote to debug */ - ap_log_error(APLOG_MARK,APLOG_ERR,0,NULL,"Got EOS on output"); - SSLStateMachine_write_close(pCtx->pStateMachine); - /* XXX: dubious - does this always terminate? Does it return the right thing? */ - for( ; ; ) { - ret=churn_output(pCtx); - if(ret != APR_SUCCESS) - return ret; - ret=churn(pCtx,APR_NONBLOCK_READ,&zero); - if(ret != APR_SUCCESS) { - if(ret == APR_EOF) - return APR_SUCCESS; - else - return ret; - } - } - break; - } - - if(APR_BUCKET_IS_FLUSH(pbktIn)) { - /* assume that churn will flush (or already has) if there's output */ - ret=churn(pCtx,APR_NONBLOCK_READ,&zero); - if(ret != APR_SUCCESS) - return ret; - continue; - } - - /* read filter */ - apr_bucket_read(pbktIn,&data,&len,APR_BLOCK_READ); - - /* write SSL */ - SSLStateMachine_write_inject(pCtx->pStateMachine,data,len); - - /* churn the state machine */ - ret=churn_output(pCtx); - if(ret != APR_SUCCESS) - return ret; - } - - return APR_SUCCESS; -} - -static apr_status_t tls_in_filter(ap_filter_t *f,apr_bucket_brigade *pbbOut, - ap_input_mode_t eMode, apr_size_t *readbytes) -{ - TLSFilterCtx *pCtx=f->ctx; - apr_read_type_e eReadType=eMode == AP_MODE_BLOCKING ? APR_BLOCK_READ : - APR_NONBLOCK_READ; - apr_status_t ret; - - /* XXX: we don't currently support peek */ - assert(eMode != AP_MODE_PEEK); - - /* churn the state machine */ - ret=churn(pCtx,eReadType,readbytes); - if(ret != APR_SUCCESS) - return ret; - - /* XXX: shame that APR_BRIGADE_FOREACH doesn't work here */ - while(!APR_BRIGADE_EMPTY(pCtx->pbbPendingInput)) { - apr_bucket *pbktIn=APR_BRIGADE_FIRST(pCtx->pbbPendingInput); - APR_BUCKET_REMOVE(pbktIn); - APR_BRIGADE_INSERT_TAIL(pbbOut,pbktIn); - } - - return APR_SUCCESS; -} - -static const char *tls_method(const request_rec *r) -{ - TLSServerConfig *pConfig = - ap_get_module_config(r->connection->base_server->module_config, - &tls_module); - - if (!pConfig->bEnabled) - return NULL; - - return "https"; -} - -static unsigned short tls_port(const request_rec *r) -{ - TLSServerConfig *pConfig = - ap_get_module_config(r->connection->base_server->module_config, - &tls_module); - - if (!pConfig->bEnabled) - return 0; - - return 443; -} - -static const command_rec tls_cmds[] = -{ - /* XXX: We should be able to add the filter using AddOutputFilter */ - AP_INIT_FLAG("TLSFilter", tls_on, NULL, RSRC_CONF, - "Run TLS/SSL on this host"), - AP_INIT_TAKE1("TLSCertificateFile", tls_cert_file, NULL, RSRC_CONF, - "Set the certificate file for this host"), - { NULL } -}; - -static void register_hooks(apr_pool_t *p) -{ - SSLStateMachine_init(); - - ap_register_output_filter(s_szTLSFilterName,tls_out_filter, - AP_FTYPE_NETWORK); - ap_register_input_filter(s_szTLSFilterName,tls_in_filter, - AP_FTYPE_NETWORK); - ap_hook_pre_connection(tls_filter_inserter,NULL,NULL,APR_HOOK_MIDDLE); - ap_hook_default_port(tls_port,NULL,NULL,APR_HOOK_MIDDLE); - ap_hook_http_method(tls_method,NULL,NULL,APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA tls_module = { - STANDARD20_MODULE_STUFF, - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - create_tls_server_config, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - tls_cmds, /* command apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/modules/tls/openssl_state_machine.c b/modules/tls/openssl_state_machine.c deleted file mode 100644 index 171a1aa23d..0000000000 --- a/modules/tls/openssl_state_machine.c +++ /dev/null @@ -1,268 +0,0 @@ -/* This is adapted from the OpenSSL state_machine demo */ - -/* ==================================================================== - * Copyright (c) 2000 The OpenSSL Project. 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 OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * openssl-core@openssl.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.openssl.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``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 OpenSSL PROJECT 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 product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -/* - * Nuron, a leader in hardware encryption technology, generously - * sponsored the development of this demo by Ben Laurie. - * - * See http://www.nuron.com/. - */ - -/* - * the aim of this demo is to provide a fully working state-machine - * style SSL implementation, i.e. one where the main loop acquires - * some data, then converts it from or to SSL by feeding it into the - * SSL state machine. It then does any I/O required by the state machine - * and loops. - * - * In order to keep things as simple as possible, this implementation - * listens on a TCP socket, which it expects to get an SSL connection - * on (for example, from s_client) and from then on writes decrypted - * data to stdout and encrypts anything arriving on stdin. Verbose - * commentary is written to stderr. - * - * This implementation acts as a server, but it can also be done for a client. */ - -#include "apr.h" - -#include <openssl/ssl.h> -#include <assert.h> -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#endif -#include <string.h> -#include <openssl/err.h> -#include "openssl_state_machine.h" - -/* die_unless is intended to work like assert, except that it happens - always, even if NDEBUG is defined. Use assert as a stopgap. */ - -#define die_unless(x) assert(x) - -struct SSLStateMachine - { - SSL_CTX *pCtx; - BIO *pbioRead; - BIO *pbioWrite; - SSL *pSSL; - }; - -void SSLStateMachine_init(void) -{ - static int s_bInitDone; - - if(s_bInitDone) - return; - - SSL_library_init(); - OpenSSL_add_ssl_algorithms(); - SSL_load_error_strings(); - ERR_load_crypto_strings(); - - s_bInitDone=1; -} - -static void SSLStateMachine_print_error(SSLStateMachine *pMachine, - const char *szErr) - { - unsigned long l; - - fprintf(stderr,"%s\n",szErr); - while((l=ERR_get_error())) - { - char buf[1024]; - - ERR_error_string_n(l,buf,sizeof buf); - fprintf(stderr,"Error %lx: %s\n",l,buf); - } - } - -SSLStateMachine *SSLStateMachine_new(const char *szCertificateFile, - const char *szKeyFile) - { - SSLStateMachine *pMachine=malloc(sizeof *pMachine); - int n; - - die_unless(pMachine); - - pMachine->pCtx=SSL_CTX_new(SSLv23_server_method()); - die_unless(pMachine->pCtx); - - n=SSL_CTX_use_certificate_file(pMachine->pCtx,szCertificateFile, - SSL_FILETYPE_PEM); - die_unless(n > 0); - - n=SSL_CTX_use_PrivateKey_file(pMachine->pCtx,szKeyFile,SSL_FILETYPE_PEM); - die_unless(n > 0); - - pMachine->pSSL=SSL_new(pMachine->pCtx); - die_unless(pMachine->pSSL); - - pMachine->pbioRead=BIO_new(BIO_s_mem()); - - pMachine->pbioWrite=BIO_new(BIO_s_mem()); - - SSL_set_bio(pMachine->pSSL,pMachine->pbioRead,pMachine->pbioWrite); - - SSL_set_accept_state(pMachine->pSSL); - - return pMachine; - } - -void SSLStateMachine_read_inject(SSLStateMachine *pMachine, - const unsigned char *aucBuf,int nBuf) - { - int n=BIO_write(pMachine->pbioRead,aucBuf,nBuf); - /* If it turns out this assert fails, then buffer the data here - * and just feed it in in churn instead. Seems to me that it - * should be guaranteed to succeed, though. - */ - assert(n == nBuf); - fprintf(stderr,"%d bytes of encrypted data fed to state machine\n",n); - } - -int SSLStateMachine_read_extract(SSLStateMachine *pMachine, - unsigned char *aucBuf,int nBuf) - { - int n; - - if(!SSL_is_init_finished(pMachine->pSSL)) - { - fprintf(stderr,"Doing SSL_accept\n"); - n=SSL_accept(pMachine->pSSL); - if(n == 0) - fprintf(stderr,"SSL_accept returned zero\n"); - if(n < 0) - { - int err; - - if((err=SSL_get_error(pMachine->pSSL,n)) == SSL_ERROR_WANT_READ) - { - fprintf(stderr,"SSL_accept wants more data\n"); - return 0; - } - - SSLStateMachine_print_error(pMachine,"SSL_accept error"); - exit(7); - } - return 0; - } - - n=SSL_read(pMachine->pSSL,aucBuf,nBuf); - if(n < 0) - { - int err=SSL_get_error(pMachine->pSSL,n); - - if(err == SSL_ERROR_WANT_READ) - { - fprintf(stderr,"SSL_read wants more data\n"); - return 0; - } - SSLStateMachine_print_error(pMachine,"SSL_read error"); - exit(8); - } - - fprintf(stderr,"%d bytes of decrypted data read from state machine\n",n); - return n; - } - -int SSLStateMachine_write_can_extract(SSLStateMachine *pMachine) - { - int n=BIO_pending(pMachine->pbioWrite); - if(n) - fprintf(stderr,"There is encrypted data available to write\n"); - else - fprintf(stderr,"There is no encrypted data available to write\n"); - - return n; - } - -int SSLStateMachine_write_extract(SSLStateMachine *pMachine, - unsigned char *aucBuf,int nBuf) - { - int n; - - n=BIO_read(pMachine->pbioWrite,aucBuf,nBuf); - fprintf(stderr,"%d bytes of encrypted data read from state machine\n",n); - return n; - } - -void SSLStateMachine_write_inject(SSLStateMachine *pMachine, - const unsigned char *aucBuf,int nBuf) - { - int n=SSL_write(pMachine->pSSL,aucBuf,nBuf); - if(n < 0) - { - if(ERR_peek_error() == ERR_PACK(ERR_LIB_SSL,SSL_F_SSL_WRITE, - SSL_R_PROTOCOL_IS_SHUTDOWN)) - { - SSLStateMachine_print_error(pMachine,"SSL_write error (someone wrote after shutdown)"); - return; - } - SSLStateMachine_print_error(pMachine,"SSL_write error"); - } - /* If it turns out this assert fails, then buffer the data here - * and just feed it in in churn instead. Seems to me that it - * should be guaranteed to succeed, though. - */ - assert(n == nBuf); - fprintf(stderr,"%d bytes of unencrypted data fed to state machine\n",n); - } - -void SSLStateMachine_write_close(SSLStateMachine *pMachine) - { - SSL_shutdown(pMachine->pSSL); - } diff --git a/modules/tls/openssl_state_machine.h b/modules/tls/openssl_state_machine.h deleted file mode 100644 index 10be69a3b0..0000000000 --- a/modules/tls/openssl_state_machine.h +++ /dev/null @@ -1,15 +0,0 @@ -typedef struct SSLStateMachine SSLStateMachine; - -void SSLStateMachine_init(void); -SSLStateMachine *SSLStateMachine_new(const char *szCertificateFile, - const char *szKeyFile); -void SSLStateMachine_read_inject(SSLStateMachine *pMachine, - const unsigned char *aucBuf,int nBuf); -int SSLStateMachine_read_extract(SSLStateMachine *pMachine, - unsigned char *aucBuf,int nBuf); -int SSLStateMachine_write_can_extract(SSLStateMachine *pMachine); -int SSLStateMachine_write_extract(SSLStateMachine *pMachine, - unsigned char *aucBuf,int nBuf); -void SSLStateMachine_write_inject(SSLStateMachine *pMachine, - const unsigned char *aucBuf,int nBuf); -void SSLStateMachine_write_close(SSLStateMachine *pMachine); diff --git a/os/.cvsignore b/os/.cvsignore deleted file mode 100644 index bd5fe06963..0000000000 --- a/os/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -.deps diff --git a/os/.indent.pro b/os/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- 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 6850624f70..0000000000 --- a/os/Makefile.in +++ /dev/null @@ -1,4 +0,0 @@ - -SUBDIRS = $(OS_DIR) - -include $(top_srcdir)/build/rules.mk diff --git a/os/beos/.cvsignore b/os/beos/.cvsignore deleted file mode 100644 index bbc8ba00d1..0000000000 --- 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 66272ecc46..0000000000 --- a/os/beos/Makefile.in +++ /dev/null @@ -1,5 +0,0 @@ - -LTLIBRARY_NAME = libos.la -LTLIBRARY_SOURCES = os.c beosd.c - -include $(top_srcdir)/build/ltlib.mk diff --git a/os/beos/beosd.c b/os/beos/beosd.c deleted file mode 100644 index c29be7f1a3..0000000000 --- a/os/beos/beosd.c +++ /dev/null @@ -1,163 +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. - */ - -#include <unistd.h> -#include "httpd.h" -#include "http_config.h" -#include "http_main.h" -#include "http_log.h" -#include "beosd.h" - -beosd_config_rec beosd_config; - -/* 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. - */ - -#if B_BEOS_VERSION < 0x0460 -static int set_group_privs(void) -{ - - if (!geteuid()) { - char *name; - - /* Get username if passed as a uid */ - - if (beosd_config.user_name[0] == '#') { - struct passwd *ent; - uid_t uid = atoi(&beosd_config.user_name[1]); - - if ((ent = getpwuid(uid)) == NULL) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, 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 = beosd_config.user_name; - - if (setgid(beosd_config.group_id) == -1) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, - "setgid: unable to set group id to Group %u", - (unsigned)beosd_config.group_id); - return -1; - } - - /* Reset `groups' attributes. */ - -#ifdef HAVE_INITGROUPS - if (initgroups(name, beosd_config.group_id) == -1) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, - "initgroups: unable to set groups for User %s " - "and Group %u", name, (unsigned)beosd_config.group_id); - return -1; - } -#endif - } - return 0; -} -#endif - - -int beosd_setup_child(void) -{ - /* TODO: revisit the whole issue of users/groups for BeOS as - * R5 and below doesn't really have much concept of them. - */ - - return 0; -} - - -const char *beosd_set_user(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - beosd_config.user_name = arg; - beosd_config.user_id = ap_uname2id(arg); - return NULL; -} - -const char *beosd_set_group(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - beosd_config.group_id = ap_gname2id(arg); - - return NULL; -} - -void beosd_pre_config(void) -{ - beosd_config.user_name = DEFAULT_USER; - beosd_config.user_id = ap_uname2id(DEFAULT_USER); - beosd_config.group_id = ap_gname2id(DEFAULT_GROUP); -} diff --git a/os/beos/beosd.h b/os/beos/beosd.h deleted file mode 100644 index 31b055bd7f..0000000000 --- a/os/beos/beosd.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 - * <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 BEOSD_H -#define BEOSD_H - -/* common stuff that beos MPMs will want */ - -/* Default user name and group name. 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 "#" -#endif - -typedef struct { - char *user_name; - uid_t user_id; - gid_t group_id; -} beosd_config_rec; -extern beosd_config_rec beosd_config; - -void beosd_detach(void); -int beosd_setup_child(void); -void beosd_pre_config(void); -const char *beosd_set_user(cmd_parms *cmd, void *dummy, char *arg); -const char *beosd_set_group(cmd_parms *cmd, void *dummy, char *arg); - -#define beosd_killpg(x, y) (kill (-(x), (y))) - -#define UNIX_DAEMON_COMMANDS \ -{ "User", beosd_set_user, NULL, RSRC_CONF, TAKE1, \ - "Effective user id for this server"}, \ -{ "Group", beosd_set_group, NULL, RSRC_CONF, TAKE1, \ - "Effective group id for this server"}, \ - -#endif /* BEOSD_H */ diff --git a/os/beos/config.m4 b/os/beos/config.m4 deleted file mode 100644 index 4fe95b7509..0000000000 --- a/os/beos/config.m4 +++ /dev/null @@ -1,3 +0,0 @@ -if test "$OS" = "beos" ; then - APR_ADDTO(CFLAGS,-DBEOS) -fi diff --git a/os/beos/os.c b/os/beos/os.c deleted file mode 100644 index 13bcfd8a3c..0000000000 --- a/os/beos/os.c +++ /dev/null @@ -1,84 +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. - */ - -/* - * 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" -#include "httpd.h" -#include "apr_thread_proc.h" -#include "ap_mpm.h" /* needed for definition of - * ap_os_create_privileged_process */ - -int ap_os_is_path_absolute(const char *file) -{ - return file[0] == '/'; -} - -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_proc_create(newproc, progname, args, env, attr, p); -} diff --git a/os/beos/os.h b/os/beos/os.h deleted file mode 100644 index b7dcd1cdd3..0000000000 --- a/os/beos/os.h +++ /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 - * <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 APACHE_OS_H -#define APACHE_OS_H - -#include "ap_config.h" - -#ifndef PLATFORM - #ifdef BONE_VERSION - #define PLATFORM "BeOS BONE" - #else - #define PLATFORM "BeOS R5" - #endif -#endif - -/* - * This file is 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); -#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) - -#endif /* !APACHE_OS_H */ diff --git a/os/bs2000/.cvsignore b/os/bs2000/.cvsignore deleted file mode 100644 index bd5fe06963..0000000000 --- a/os/bs2000/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -.deps diff --git a/os/bs2000/bs2login.c b/os/bs2000/bs2login.c deleted file mode 100644 index 2320e3f73f..0000000000 --- a/os/bs2000/bs2login.c +++ /dev/null @@ -1,308 +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. - */ - -#ifdef _OSD_POSIX -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" -#include <ctype.h> -#include <sys/utsname.h> - -#define ACCT_LEN 8 -#define USER_LEN 8 - -static const char *bs2000_account = NULL; -typedef enum -{ - bs2_unknown, /* not initialized yet. */ - bs2_noFORK, /* no fork() because -X flag was specified */ - bs2_FORK, /* only fork() because uid != 0 */ - bs2_FORK_RINI, /* prior to A17, regular fork() and _rini() was used. */ - bs2_RFORK_RINI, /* for A17, use of _rfork() and _rini() was required */ - bs2_UFORK /* As of A18, the new ufork() is used. */ -} bs2_ForkType; - -static bs2_ForkType forktype = bs2_unknown; - -#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) */ - - -static void ap_pad(char *dest, size_t size, char ch) -{ - int i = strlen(dest); /* Leave space for trailing '\0' */ - - while (i < size-1) - dest[i++] = ch; - - dest[size-1] = '\0'; /* Guarantee for trailing '\0' */ -} - -static void ap_str_toupper(char *str) -{ - while (*str) { - *str = apr_toupper(*str); - ++str; - } -} - -/* Determine the method for forking off a child in such a way as to - * set both the POSIX and BS2000 user id's to the unprivileged user. - */ -static bs2_ForkType os_forktype(void) -{ - struct utsname os_version; - - /* have we checked the OS version before? If yes return the previous - * result - the OS release isn't going to change suddenly! - */ - if (forktype != bs2_unknown) { - return forktype; - } - - /* If the user is unprivileged, use the normal fork() only. */ - if (getuid() != 0) { - return forktype = bs2_FORK; - } - - if (uname(&os_version) < 0) - { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, - "uname() failed - aborting."); - exit(APEXIT_CHILDFATAL); - } - - /* - * Old BS2000/OSD versions (before XPG4 SPEC1170) don't work with Apache. - * Anyway, simply return a fork(). - */ - if (strcmp(os_version.release, "01.0A") == 0 || - strcmp(os_version.release, "02.0A") == 0 || - strcmp(os_version.release, "02.1A") == 0) - { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL, - "Error: unsupported OS version. " - "You may encounter problems."); - forktype = bs2_FORK; - } - - /* The following versions are special: - * OS versions before A17 needs regular fork() and _rini(). - * A17 requires _rfork() and _rini(), - * and later versions need ufork(). - */ - else if (strcmp(os_version.release, "01.1A") == 0 || - strcmp(os_version.release, "03.0A") == 0 || - strcmp(os_version.release, "03.1A") == 0 || - strcmp(os_version.release, "04.0A") == 0) - { - if (strcmp (os_version.version, "A18") >= 0) - forktype = bs2_UFORK; - - else if (strcmp (os_version.version, "A17") < 0) - forktype = bs2_FORK_RINI; - - else - forktype = bs2_RFORK_RINI; - } - - /* All later OS versions will hopefully use ufork() only ;-) */ - else - forktype = bs2_UFORK; - - return forktype; -} - - - -/* This routine is called by http_core for the BS2000Account directive */ -/* It stores the account name for later use */ -const char *os_set_account(apr_pool_t *p, const char *account) -{ - char account_temp[ACCT_LEN+1]; - - apr_cpystrn(account_temp, account, sizeof account_temp); - - /* Make account all upper case */ - ap_str_toupper(account_temp); - - /* Pad to length 8 */ - ap_pad(account_temp, sizeof account_temp, ' '); - - bs2000_account = apr_pstrdup(p, account_temp); - return NULL; -} - -/* This routine complements the setuid() call: it causes the BS2000 job - * environment to be switched to the target user's user id. - * That is important if CGI scripts try to execute native BS2000 commands. - */ -int os_init_job_environment(server_rec *server, const char *user_name, int one_process) -{ - _rini_struct inittask; - char username[USER_LEN+1]; - int save_errno; - bs2_ForkType type = os_forktype(); - - /* We can be sure that no change to uid==0 is possible because of - * the checks in http_core.c:set_user() - */ - - /* The _rini() function works only after a prior _rfork(). - * In the case of one_process, it would fail. - */ - if (one_process) { - - type = forktype = bs2_noFORK; - - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, server, - "The debug mode of Apache should only " - "be started by an unprivileged user!"); - return 0; - } - - /* If no _rini() is required, then return quickly. */ - if (type != bs2_RFORK_RINI && type != bs2_FORK_RINI) - return 0; - - /* An Account is required for _rini() */ - if (bs2000_account == NULL) - { - ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, server, - "No BS2000Account configured - cannot switch to User %s", - user_name); - exit(APEXIT_CHILDFATAL); - } - - apr_cpystrn(username, user_name, sizeof username); - - /* Make user name all upper case */ - ap_str_toupper(username); - - /* Pad to length 8 */ - ap_pad(username, sizeof username, ' '); - - inittask.username = username; - inittask.account = bs2000_account; - inittask.processor_name = " "; - - /* Switch to the new logon user (setuid() and setgid() are done later) */ - /* Only the super user can switch identities. */ - if (_rini(&inittask) != 0) { - - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server, - "_rini: BS2000 auth failed for user \"%s\" acct \"%s\"", - inittask.username, inittask.account); - - exit(APEXIT_CHILDFATAL); - } - - return 0; -} - -/* BS2000 requires a "special" version of fork() before a setuid()/_rini() call */ -pid_t os_fork(const char *user) -{ - pid_t pid; - char username[USER_LEN+1]; - - switch (os_forktype()) { - case bs2_FORK: - case bs2_FORK_RINI: - pid = fork(); - break; - - case bs2_RFORK_RINI: - pid = _rfork(); - break; - - case bs2_UFORK: - apr_cpystrn(username, user, sizeof username); - - /* Make user name all upper case - for some versions of ufork() */ - ap_str_toupper(username); - - pid = ufork(username); - if (pid == -1 && errno == EPERM) { - ap_log_error(APLOG_MARK, APLOG_EMERG, errno, - NULL, "ufork: Possible mis-configuration " - "for user %s - Aborting.", user); - exit(1); - } - break; - - default: - pid = 0; - break; - } - - return pid; -} - -#else /* _OSD_POSIX */ -void bs2login_is_not_here() -{ -} -#endif /* _OSD_POSIX */ diff --git a/os/bs2000/ebcdic.c b/os/bs2000/ebcdic.c deleted file mode 100644 index a6914e9e57..0000000000 --- a/os/bs2000/ebcdic.c +++ /dev/null @@ -1,252 +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. - */ - -#include "ap_config.h" -#if APR_CHARSET_EBCDIC -#include "ebcdic.h" -/* - Initial Port for Apache-1.3 by <Martin.Kraemer@Mch.SNI.De> - -"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 apr_table_t 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 apr_table_t 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 apr_table_t 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 apr_table_t 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 apr_table_t 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 /*APR_CHARSET_EBCDIC*/ diff --git a/os/bs2000/ebcdic.h b/os/bs2000/ebcdic.h deleted file mode 100644 index 63821f73ec..0000000000 --- a/os/bs2000/ebcdic.h +++ /dev/null @@ -1,66 +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. - */ - -#include <sys/types.h> - -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-inline.c b/os/bs2000/os-inline.c deleted file mode 100644 index c8299b58ac..0000000000 --- a/os/bs2000/os-inline.c +++ /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 - * <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. - */ - -/* - * This file contains functions which can be inlined if the compiler - * has an "inline" modifier. Because of this, this file is both a - * header file and a compilable module. - * - * Only inlineable functions should be defined in here. They must all - * include the APR_INLINE modifier. - * - * If the compiler supports inline, this file will be #included as a - * header file from os.h to create all the inline function - * definitions. APR_INLINE will be defined to whatever is required on - * function definitions to make them inline declarations. - * - * If the compiler does not support inline, this file will be compiled - * as a normal C file into libos.a (along with os.c). In this case - * APR_HAS_INLINE will be zero so we can use this to test if we are - * compiling this source file. - */ - -#include "apr.h" - -#if APR_HAS_INLINE -/* keep inlined functions private to the including file */ -static -#endif -APR_INLINE int ap_os_is_path_absolute(const char *file) -{ - return file[0] == '/'; -} diff --git a/os/bs2000/os.c b/os/bs2000/os.c deleted file mode 100644 index 63907a4393..0000000000 --- a/os/bs2000/os.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 - * <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. - */ - -/* - * 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 "os.h" - -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_proc_create(newproc, progname, args, env, attr, p); -} - diff --git a/os/bs2000/os.h b/os/bs2000/os.h deleted file mode 100644 index 4b7fd4c893..0000000000 --- a/os/bs2000/os.h +++ /dev/null @@ -1,91 +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 APACHE_OS_H -#define APACHE_OS_H - -#define PLATFORM "BS2000" - -#include "apr.h" - -/* - * 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 APR_HAS_INLINE -/* Compiler supports inline, so include the inlineable functions as - * part of the header - */ - -#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 */ - - -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 7442325d73..0000000000 --- a/os/config.m4 +++ /dev/null @@ -1,25 +0,0 @@ -AC_MSG_CHECKING(for target platform) - -#PLATFORM=`${CONFIG_SHELL-/bin/sh} $ac_config_guess` -PLATFORM=$host - -case "$PLATFORM" in -*beos*) - OS="beos" - OS_DIR=$OS - ;; -*pc-os2_emx*) - OS="os2" - OS_DIR=$OS - ;; -bs2000*) - OS="unix" - OS_DIR=bs2000 # only the OS_DIR is platform specific. - ;; -*) - OS="unix" - OS_DIR=$OS;; -esac - -AC_MSG_RESULT($OS) -APACHE_FAST_OUTPUT(os/$OS_DIR/Makefile) diff --git a/os/os2/.cvsignore b/os/os2/.cvsignore deleted file mode 100644 index a00af59e15..0000000000 --- a/os/os2/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -Makefile -.deps -*.lo -*.la -.libs diff --git a/os/os2/Makefile.in b/os/os2/Makefile.in deleted file mode 100644 index 5796f5c57c..0000000000 --- a/os/os2/Makefile.in +++ /dev/null @@ -1,5 +0,0 @@ - -LTLIBRARY_NAME = libos.la -LTLIBRARY_SOURCES = os-inline.c util_os2.c - -include $(top_srcdir)/build/ltlib.mk diff --git a/os/os2/config.m4 b/os/os2/config.m4 deleted file mode 100644 index b62d214e1d..0000000000 --- a/os/os2/config.m4 +++ /dev/null @@ -1,3 +0,0 @@ -if test "$OS" = "os2" ; then - APR_ADDTO(CFLAGS, [-DOS2 -O2]) -fi diff --git a/os/os2/core.mk b/os/os2/core.mk deleted file mode 100644 index aac4356532..0000000000 --- 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 9764c4a484..0000000000 --- a/os/os2/core_header.def +++ /dev/null @@ -1,29 +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" - -; Some globals from apr & apr-util - "apr_day_snames" - "apr_month_snames" - "apr_global_hook_pool" - "apr_debug_module_hooks" - "apr_current_hooking_module" - -; One for mod_dav from socket library - "_swaps" - -; And some more for mod_unique_id - "gethostname" - "gethostbyname" - "_swapl" - "h_errno" - "inet_ntoa" - diff --git a/os/os2/os-inline.c b/os/os2/os-inline.c deleted file mode 100644 index dfcf05cc00..0000000000 --- a/os/os2/os-inline.c +++ /dev/null @@ -1,93 +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. - */ - -/* - * This file contains functions which can be inlined if the compiler - * has an "inline" modifier. Because of this, this file is both a - * header file and a compilable module. - * - * Only inlineable functions should be defined in here. They must all - * include the APR_INLINE modifier. - * - * If the compiler supports inline, this file will be #included as a - * header file from os.h to create all the inline function - * definitions. APR_INLINE will be defined to whatever is required on - * function definitions to make them inline declarations. - * - * If the compiler does not support inline, this file will be compiled - * as a normal C file into libos.a (along with os.c). In this case - * APR_HAS_INLINE will be zero so we can use this to test if we are - * compiling this source file. - */ - -#include "apr.h" - -#if APR_HAS_INLINE -/* keep inlined functions private to the including file */ -static -#endif -APR_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. - * XXX: Accept /bleh still? Or do we concur that d:/bleh is a minimum - * requirement? If so, canonical name needs to convert to drive/path - * syntax, and the test is (file[0] == '/' && file[1] == '/') ||... - */ - return (file[0] == '/' - || (file[0] != '\0' && file[1] == ':' && file[2] == '/')); -} diff --git a/os/os2/os.h b/os/os2/os.h deleted file mode 100644 index 1f8f44dce3..0000000000 --- a/os/os2/os.h +++ /dev/null @@ -1,96 +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 APACHE_OS_H -#define APACHE_OS_H - -#define PLATFORM "OS/2" -#define HAVE_CANONICAL_FILENAME -#define HAVE_DRIVE_LETTERS -#define HAVE_UNC_PATHS - -#include <apr.h> -#include <apr_pools.h> - -/* - * 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 APR_HAS_INLINE -/* Compiler supports inline, so include the inlineable functions as - * part of the header - */ - -#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 - -char *ap_os_canonical_filename(apr_pool_t *p, const char *file); -char *ap_os_case_canonical_filename(apr_pool_t *p, const char *szFile); - -/* OS/2 doesn't have symlinks so S_ISLNK is always false */ -#define S_ISLNK(m) 0 - -#endif /* ! APACHE_OS_H */ diff --git a/os/os2/util_os2.c b/os/os2/util_os2.c deleted file mode 100644 index 0ecb9dc4fd..0000000000 --- a/os/os2/util_os2.c +++ /dev/null @@ -1,183 +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. - */ - -#define INCL_DOS -#define INCL_DOSERRORS -#include <os2.h> -#include "ap_config.h" -#include "httpd.h" -#include "http_log.h" -#include "os.h" -#include <sys/time.h> -#include <sys/signal.h> -#include <ctype.h> -#include <string.h> -#include "apr_strings.h" - - -AP_DECLARE(char *)ap_os_case_canonical_filename(apr_pool_t *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, APR_OS2_STATUS(rc), NULL, "for file [%s]", szFile); - } - apr_cpystrn(buf2, buf, sizeof(buf2)); - } - -/* Switch backslashes to forward */ - for (pos=buf2; *pos; pos++) - if (*pos == '\\') - *pos = '/'; - - return apr_pstrdup(pPool, buf2); -} - - - -static void fix_component(char *path, char *lastcomp) -{ - FILEFINDBUF3 fb3; - HDIR hDir = HDIR_CREATE; - ULONG numNames = 1; - ULONG rc = DosFindFirst( (UCHAR *)path, &hDir, FILE_NORMAL|FILE_DIRECTORY, &fb3, sizeof(fb3), &numNames, FIL_STANDARD ); - - if (rc == 0) - strcpy(lastcomp, fb3.achName); - - DosFindClose(hDir); -} - - - -char *ap_os_systemcase_canonical_filename(apr_pool_t *pPool, const char *szFile) -{ - char *szCanonicalFile = ap_os_case_canonical_filename(pPool, szFile); - int startslash = 2, slashnum=0; - char *pos, *prevslash = NULL; - - if (szCanonicalFile[0] == '/' && szCanonicalFile[1] == '/') /* a UNC name */ - startslash = 5; - - for (pos = szCanonicalFile; *pos; pos++) { - if (*pos == '/') { - slashnum++; - if (slashnum >= startslash) { - *pos = 0; - fix_component(szCanonicalFile, prevslash+1); - *pos = '/'; - } - prevslash = pos; - } - } - - if (slashnum >= startslash) { - fix_component(szCanonicalFile, prevslash+1); - } - - return szCanonicalFile; -} - - - -char *ap_os_canonical_filename(apr_pool_t *pPool, const char *szFile) -{ - char *szCanonicalFile; - const unsigned char *pos = szFile; - - /* Find any 8 bit characters */ - while (*pos && *pos < 128) { - pos++; - } - - /* Only use the very expensive ap_os_systemcase_canonical_filename() if - * the file name contains non-english characters as they are the only type - * that can't be made canonical with a simple strlwr() - */ - if (*pos < 128) { - szCanonicalFile = ap_os_case_canonical_filename(pPool, szFile); - } else { - szCanonicalFile = ap_os_systemcase_canonical_filename(pPool, szFile); - } - - strlwr(szCanonicalFile); - return szCanonicalFile; -} - -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_proc_create(newproc, progname, args, env, attr, p); -} diff --git a/os/tpf/.cvsignore b/os/tpf/.cvsignore deleted file mode 100644 index bd5fe06963..0000000000 --- a/os/tpf/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -.deps diff --git a/os/tpf/TPFExport b/os/tpf/TPFExport deleted file mode 100644 index 449ebf2f93..0000000000 --- a/os/tpf/TPFExport +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -echo " Setting TPF/c89 environment variables" -export _C89_CCMODE=1 -# replace the following with the location of your TPF include files -export _C89_INCDIRS="/u/tpf41/currentmaint/include /u/tpf41/currentmaint/include/oco" -export TPF=YES -echo "Done" diff --git a/os/tpf/ebcdic.c b/os/tpf/ebcdic.c deleted file mode 100644 index dc838004e5..0000000000 --- a/os/tpf/ebcdic.c +++ /dev/null @@ -1,221 +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. - */ - -#include "ap_config.h" -#if APR_CHARSET_EBCDIC -#include "ebcdic.h" -/* -This code does basic character mapping for IBM's TPF operating system. -It is a modified version of <Martin.Kraemer@Mch.SNI.De>'s code for -the BS2000 (apache/src/os/bs2000/ebcdic.c). -*/ - -/* -Bijective EBCDIC (character set IBM-1047) to US-ASCII table: -This apr_table_t 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 apr_table_t is a copy of the os_toascii_strictly bijective apr_table_t 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 apr_table_t 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 /*APR_CHARSET_EBCDIC*/ - diff --git a/os/tpf/ebcdic.h b/os/tpf/ebcdic.h deleted file mode 100644 index 026a888740..0000000000 --- a/os/tpf/ebcdic.h +++ /dev/null @@ -1,66 +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. - */ - -#include <sys/types.h> - -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-inline.c b/os/tpf/os-inline.c deleted file mode 100644 index c8299b58ac..0000000000 --- a/os/tpf/os-inline.c +++ /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 - * <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. - */ - -/* - * This file contains functions which can be inlined if the compiler - * has an "inline" modifier. Because of this, this file is both a - * header file and a compilable module. - * - * Only inlineable functions should be defined in here. They must all - * include the APR_INLINE modifier. - * - * If the compiler supports inline, this file will be #included as a - * header file from os.h to create all the inline function - * definitions. APR_INLINE will be defined to whatever is required on - * function definitions to make them inline declarations. - * - * If the compiler does not support inline, this file will be compiled - * as a normal C file into libos.a (along with os.c). In this case - * APR_HAS_INLINE will be zero so we can use this to test if we are - * compiling this source file. - */ - -#include "apr.h" - -#if APR_HAS_INLINE -/* keep inlined functions private to the including file */ -static -#endif -APR_INLINE int ap_os_is_path_absolute(const char *file) -{ - return file[0] == '/'; -} diff --git a/os/tpf/os.c b/os/tpf/os.c deleted file mode 100644 index 5424f992b3..0000000000 --- a/os/tpf/os.c +++ /dev/null @@ -1,178 +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. - */ - -/* - * 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" - -static FILE *sock_fp; - -#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); -} - - -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, errno, 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, errno, 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; -} - -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_proc_create(newproc, progname, args, env, attr, p); -} diff --git a/os/tpf/os.h b/os/tpf/os.h deleted file mode 100644 index c50fdc5451..0000000000 --- a/os/tpf/os.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 - * <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 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 "apr.h" -#include "ap_config.h" - -#if APR_HAS_INLINE -/* Compiler supports inline, so include the inlineable functions as - * part of the header - */ - -#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 *f); -#endif - - -#include <strings.h> -#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 - -#include <i$netd.h> -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; - -extern int tpf_child; - -struct server_rec; -pid_t os_fork(struct server_rec *s, int slot); -int os_check_server(char *server); - -extern char *ap_server_argv0; -extern int scoreboard_fd; -#include <signal.h> -#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 16524bf3c9..0000000000 --- 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 405af82847..0000000000 --- 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 bbc8ba00d1..0000000000 --- a/os/unix/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -Makefile -.deps -.libs -*.lo -*.la diff --git a/os/unix/Makefile.in b/os/unix/Makefile.in deleted file mode 100644 index 63596967db..0000000000 --- a/os/unix/Makefile.in +++ /dev/null @@ -1,5 +0,0 @@ - -LTLIBRARY_NAME = libos.la -LTLIBRARY_SOURCES = os-inline.c unixd.c - -include $(top_srcdir)/build/ltlib.mk diff --git a/os/unix/config.m4 b/os/unix/config.m4 deleted file mode 100644 index 688312c4a6..0000000000 --- a/os/unix/config.m4 +++ /dev/null @@ -1,7 +0,0 @@ -if test "$OS" = "unix" ; then - APACHE_TYPE_RLIM_T - - AC_CHECK_HEADERS(sys/time.h sys/resource.h) - - AC_CHECK_FUNCS(setsid killpg) -fi diff --git a/os/unix/os-inline.c b/os/unix/os-inline.c deleted file mode 100644 index c8299b58ac..0000000000 --- a/os/unix/os-inline.c +++ /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 - * <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. - */ - -/* - * This file contains functions which can be inlined if the compiler - * has an "inline" modifier. Because of this, this file is both a - * header file and a compilable module. - * - * Only inlineable functions should be defined in here. They must all - * include the APR_INLINE modifier. - * - * If the compiler supports inline, this file will be #included as a - * header file from os.h to create all the inline function - * definitions. APR_INLINE will be defined to whatever is required on - * function definitions to make them inline declarations. - * - * If the compiler does not support inline, this file will be compiled - * as a normal C file into libos.a (along with os.c). In this case - * APR_HAS_INLINE will be zero so we can use this to test if we are - * compiling this source file. - */ - -#include "apr.h" - -#if APR_HAS_INLINE -/* keep inlined functions private to the including file */ -static -#endif -APR_INLINE int ap_os_is_path_absolute(const char *file) -{ - return file[0] == '/'; -} diff --git a/os/unix/os.h b/os/unix/os.h deleted file mode 100644 index 267210d064..0000000000 --- a/os/unix/os.h +++ /dev/null @@ -1,136 +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 APACHE_OS_H -#define APACHE_OS_H - -#include "apr.h" -#include "ap_config.h" - -#ifndef PLATFORM -#define PLATFORM "Unix" -#endif - -/** - * @package OS Specific Functions - */ - -/* - * 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 APR_HAS_INLINE -/* Compiler supports inline, so include the inlineable functions as - * part of the header - */ - -#include "os-inline.c" - -#else - -/* Compiler does not support inline, so prototype the inlineable functions - * as normal - */ - -/** - * Is the path an absolute or relative path - * @param file The path to the file - * @return 1 if absolute, 0 otherwise - * @deffunc int ap_os_is_path_absolute(const char *file) - */ -extern int ap_os_is_path_absolute(const char *file); - -#endif - -/* Other ap_os_ routines not used by this platform */ - -/** - * Perform canonicalization on a given filename. This means that files on - * all platforms have the same format - * @param p The pool to allocate the canonical filename out of - * @param f The filename to canonicalize - * @return The new filename - * @deffunc char *ap_os_canonical_filename(apr_pool_t *p, const char *f) - */ -#define ap_os_canonical_filename(p,f) (f) - -/** - * Perform canonicalization on a given filename, except that the input case - * is preserved. - * @param p The pool to allocate the canonical filename out of - * @param f The filename to canonicalize - * @return The new filename - * @deffunc char *ap_os_case_canonical_filename(apr_pool_t *p, const char *f) - */ -#define ap_os_case_canonical_filename(p,f) (f) - -/** - * Tries to match a filename to the existing patch, and returns the pathname - * in the case that is present on the existing path. This routine also - * converts alias names to long names. - * @param p The pool to allocate out of - * @param f The file to match - * @return The matched file name with the correct case - * @deffunc char *ap_os_systemcase_filename(apr_pool_t *p, const char *f) - */ -#define ap_os_systemcase_filename(p,f) (f) - -#endif /* !APACHE_OS_H */ diff --git a/os/unix/unixd.c b/os/unix/unixd.c deleted file mode 100644 index 9cdbd7384f..0000000000 --- a/os/unix/unixd.c +++ /dev/null @@ -1,372 +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. - */ - -#include "ap_config.h" -#define CORE_PRIVATE -#include "httpd.h" -#include "http_config.h" -#include "http_main.h" -#include "http_log.h" -#include "unixd.h" -#include "mpm_common.h" -#include "os.h" -#include "ap_mpm.h" -#include "apr_thread_proc.h" -#include "apr_strings.h" -#ifdef HAVE_PWD_H -#include <pwd.h> -#endif -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif -/* XXX */ -#include <sys/stat.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_GRP_H -#include <grp.h> -#endif -#ifdef HAVE_STRINGS_H -#include <strings.h> -#endif - -unixd_config_rec unixd_config; - -/* 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()) { - const 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, errno, 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, errno, 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, errno, 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, errno, NULL, - "setuid: unable to change to uid: %ld", - (long) unixd_config.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, unixd_config.user_name, one_process) != 0 || -#endif - setuid(unixd_config.user_id) == -1)) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, - "setuid: unable to change to uid: %ld", - (long) unixd_config.user_id); - return -1; - } -#endif - return 0; -} - - -const char *unixd_set_user(cmd_parms *cmd, void *dummy, const 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, const 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(apr_pool_t *ptemp) -{ - apr_finfo_t wrapper; - - unixd_config.user_name = DEFAULT_USER; - unixd_config.user_id = ap_uname2id(DEFAULT_USER); - unixd_config.group_id = ap_gname2id(DEFAULT_GROUP); - - /* Check for suexec */ - unixd_config.suexec_enabled = 0; - if ((apr_stat(&wrapper, SUEXEC_BIN, - APR_FINFO_NORM, ptemp)) != APR_SUCCESS) { - return; - } - - /* XXX - apr_stat is incapable of checking suid bits (grumble) */ - /* if ((wrapper.filetype & S_ISUID) && wrapper.user == 0) { */ - unixd_config.suexec_enabled = 1; - /* } */ -} - - -AP_DECLARE(void) unixd_set_rlimit(cmd_parms *cmd, struct rlimit **plimit, - const char *arg, const char * arg2, int type) -{ -#if (defined(RLIMIT_CPU) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_NPROC) || defined(RLIMIT_AS)) && APR_HAVE_STRUCT_RLIMIT && APR_HAVE_GETRLIMIT - 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 *)apr_pcalloc(cmd->pool, sizeof(**plimit)); - limit = *plimit; - if ((getrlimit(type, limit)) != 0) { - *plimit = NULL; - ap_log_error(APLOG_MARK, APLOG_ERR, errno, 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, 0, 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, 0, 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; - } - } -#else - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, cmd->server, - "Platform does not support rlimit for %s", cmd->cmd->name); -#endif -} - -APR_HOOK_STRUCT( - APR_HOOK_LINK(get_suexec_identity) -) - -AP_IMPLEMENT_HOOK_RUN_FIRST(ap_unix_identity_t *, get_suexec_identity, - (const request_rec *r), (r), NULL) - -static apr_status_t ap_unix_create_privileged_process( - apr_proc_t *newproc, const char *progname, - const char * const *args, - const char * const *env, - apr_procattr_t *attr, ap_unix_identity_t *ugid, - apr_pool_t *p) -{ - int i = 0; - const char **newargs; - char *newprogname; - char *execuser, *execgroup; - - if (!unixd_config.suexec_enabled) { - return apr_proc_create(newproc, progname, args, env, attr, p); - } - - execuser = apr_psprintf(p, "%ld", (long) ugid->uid); - execgroup = apr_psprintf(p, "%ld", (long) ugid->gid); - - if (!execuser || !execgroup) { - return APR_ENOMEM; - } - - i = 0; - if (args) { - while (args[i]) { - i++; - } - } - newargs = apr_palloc(p, sizeof(char *) * (i + 4)); - newprogname = SUEXEC_BIN; - newargs[0] = SUEXEC_BIN; - newargs[1] = execuser; - newargs[2] = execgroup; - newargs[3] = apr_pstrdup(p, progname); - - i = 0; - do { - newargs[i + 4] = args[i]; - } while (args[i++]); - - return apr_proc_create(newproc, newprogname, newargs, env, attr, p); -} - -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) -{ - ap_unix_identity_t *ugid = ap_run_get_suexec_identity(r); - - if (ugid == NULL) { - return apr_proc_create(newproc, progname, args, env, attr, p); - } - - return ap_unix_create_privileged_process(newproc, progname, args, env, - attr, ugid, p); -} - diff --git a/os/unix/unixd.h b/os/unix/unixd.h deleted file mode 100644 index e943b38912..0000000000 --- a/os/unix/unixd.h +++ /dev/null @@ -1,127 +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 UNIXD_H -#define UNIXD_H - -#include "httpd.h" -#include "http_config.h" -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif -#include "apr_hooks.h" -#include "apr_thread_proc.h" - -#include <pwd.h> -#include <grp.h> -#include <sys/types.h> - -typedef struct { - uid_t uid; - gid_t gid; -} ap_unix_identity_t; - -AP_DECLARE_HOOK(ap_unix_identity_t *, get_suexec_identity,(const request_rec *r) -) - -/* common stuff that unix MPMs will want */ - -/* Default user name and group name. 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 - -typedef struct { - const char *user_name; - uid_t user_id; - gid_t group_id; - int suexec_enabled; -} unixd_config_rec; -extern unixd_config_rec unixd_config; - -int unixd_setup_child(void); -void unixd_pre_config(apr_pool_t *ptemp); -const char *unixd_set_user(cmd_parms *cmd, void *dummy, const char *arg); -const char *unixd_set_group(cmd_parms *cmd, void *dummy, const char *arg); -#if defined(RLIMIT_CPU) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_NPROC) || defined(RLIMIT_AS) -AP_DECLARE(void) unixd_set_rlimit(cmd_parms *cmd, struct rlimit **plimit, - const char *arg, const char * arg2, int type); -#endif - - -#ifdef HAVE_KILLPG -#define unixd_killpg(x, y) (killpg ((x), (y))) -#else /* HAVE_KILLPG */ -#define unixd_killpg(x, y) (kill (-(x), (y))) -#endif /* HAVE_KILLPG */ - -#define UNIX_DAEMON_COMMANDS \ -AP_INIT_TAKE1("User", unixd_set_user, NULL, RSRC_CONF, \ - "Effective user id for this server"), \ -AP_INIT_TAKE1("Group", unixd_set_group, NULL, RSRC_CONF, \ - "Effective group id for this server"), - -#endif diff --git a/os/win32/.cvsignore b/os/win32/.cvsignore deleted file mode 100644 index 97bcd09a59..0000000000 --- a/os/win32/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -*.mdp -*.ncb -*.opt -*.plg -*.dsw -*.mak -mod_*D -mod_*R diff --git a/os/win32/BaseAddr.ref b/os/win32/BaseAddr.ref deleted file mode 100644 index 83b556a10a..0000000000 --- a/os/win32/BaseAddr.ref +++ /dev/null @@ -1,26 +0,0 @@ -; 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 - -libhttpd 0x6FF00000 0x000A0000 -mod_auth_anon 0x6FEF0000 0x00010000 -mod_auth_digest 0x6FED0000 0x00020000 -mod_cern_meta 0x6FEC0000 0x00010000 -mod_expires 0x6FEB0000 0x00010000 -mod_headers 0x6FEA0000 0x00010000 -mod_info 0x6FE90000 0x00010000 -mod_rewrite 0x6FE70000 0x00020000 -mod_speling 0x6FE60000 0x00010000 -mod_status 0x6FE50000 0x00010000 -mod_usertrack 0x6FE40000 0x00010000 -mod_proxy 0x6FE20000 0x00020000 -mod_file_cache 0x6FE00000 0x00020000 -mod_auth_dbm 0x6FDF0000 0x00010000 -mod_dav_fs 0x6FDE0000 0x00010000 -mod_dav 0x6FDC0000 0x00020000 diff --git a/os/win32/apache.ico b/os/win32/apache.ico deleted file mode 100644 index 5e8adcbfc5d201d6e667decdb04c71ea26f9ee89..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1078 zcmcIju};G<5PhLV#RH@}Lo=cN14BDxjl_ZkU(+B4M!I^)mt+ZIV9k)FgQX4(jFnh2 zR5kD7v`$c^ih)a??_S>dQtQq@fHOqV7-C;%zzzL)?D#YQt_HxA?;>JO1Q>D!Qsy4F zlp>Whb&e}T6h%QVf^B}VRw9CryprYLO!q5mvn)Grls478!*yoj4i`CId0lAYxng#* zS{`)DiSb-zRotP_lI{P`DOq#3_Qh4!+bz|MF9udijL(MZ%g|NQ$p&<9H-f5jE*>bT zj6Wy&ZGZPg{%|<81i$$p@5v_#XW)o^e^~oAur|Hsh%D?5GrJ{f#v5WCSX+oZq8w75 zv?<oslxj+w&|y8ZR#5OO&n;f*_a<{bCL&@#=LO^AmU70aaHbo_mEqs#T)B3s?2g6Q zkunyi%rFr_mrY05_GY4Vb=mZ<rK)rdQA0OxS=*nb>)QFftDQeeNg#KhaQE$#ckYSc f{oe7OZ|Un1unCC?u$~bMo`=`+op>QaVnX}?2rvI@ diff --git a/os/win32/apache.rc b/os/win32/apache.rc deleted file mode 100644 index d1105fe554..0000000000 --- a/os/win32/apache.rc +++ /dev/null @@ -1,78 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winresrc.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Neutral resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) -#ifdef _WIN32 -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -101 ICON DISCARDABLE "apache.ico" -#endif // Neutral resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.K.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winresrc.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // English (U.K.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/os/win32/modules.c b/os/win32/modules.c deleted file mode 100644 index f37583dea2..0000000000 --- a/os/win32/modules.c +++ /dev/null @@ -1,79 +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 - */ - -#define CORE_PRIVATE -#include "httpd.h" -#include "http_config.h" - -extern module core_module; -extern module mpm_winnt_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; -extern module isapi_module; - -AP_DECLARE_DATA module *ap_prelinked_modules[] = { - &core_module, - &mpm_winnt_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, - &isapi_module, - NULL -}; -AP_DECLARE_DATA module *ap_preloaded_modules[] = { - &core_module, - &mpm_winnt_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, - &isapi_module, - NULL -}; diff --git a/os/win32/os.h b/os/win32/os.h deleted file mode 100644 index 560c5963f2..0000000000 --- a/os/win32/os.h +++ /dev/null @@ -1,129 +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 APACHE_OS_H -#define APACHE_OS_H -/* - * Compile the server including all the Windows NT 4.0 header files by - * default. We still want the server to run on Win95/98 so use - * runtime checks before calling NT specific functions to verify we are - * really running on an NT system. - * - * Delegate windows include to the apr.h header, if USER or GDI declarations - * are required (for a window rather than console application), include - * windows.h prior to any other Apache header files. - */ - -#ifndef _WIN32 -#define _WIN32 -#endif - -#include "apr_general.h" -#include <process.h> -#include <malloc.h> -#include <io.h> -#include <fcntl.h> - -#define PLATFORM "Win32" - -#define APACHE_MPM_DIR "modules/mpm/winnt" /* generated on unix */ - -/* Although DIR_TYPE is dirent (see nt/readdir.h) we need direct.h for - chdir() */ -#include <direct.h> - -#define CASE_BLIND_FILESYSTEM -#define NO_WRITEV -#define HAVE_CANONICAL_FILENAME -#define HAVE_DRIVE_LETTERS -#define HAVE_UNC_PATHS - -typedef int uid_t; -typedef int gid_t; -typedef int pid_t; -typedef int mode_t; -typedef char * caddr_t; - -#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 - -#define JMP_BUF jmp_buf -#define O_CREAT _O_CREAT -#define O_RDWR _O_RDWR - -#include <stddef.h> - -__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. - * XXX: Accept /bleh still? Or do we concur that d:/bleh is a minimum - * requirement? If so, canonical name needs to convert to drive/path - * syntax, and the test becomes (file[0] == '/' && file[1] == '/') ||... - */ - return file && (file[0] == '/' || (file[1] == ':' && file[2] == '/')); -} - -/* OS-dependent filename routines in util_win32.c */ -AP_DECLARE(char *) ap_os_canonical_filename(apr_pool_t *p, const char *file); -AP_DECLARE(char *) ap_os_case_canonical_filename(apr_pool_t *pPool, const char *szFile); -AP_DECLARE(char *) ap_os_systemcase_filename(apr_pool_t *pPool, const char *szFile); - -#endif /* ! APACHE_OS_H */ diff --git a/os/win32/util_win32.c b/os/win32/util_win32.c deleted file mode 100644 index 8923db001b..0000000000 --- a/os/win32/util_win32.c +++ /dev/null @@ -1,514 +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. - */ - -#include "httpd.h" -#include "http_log.h" -#include "apr_strings.h" - -#include <stdarg.h> -#include <time.h> -#include <stdlib.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. - */ -AP_DECLARE(char *) ap_os_systemcase_filename(apr_pool_t *pPool, - const char *szFile) -{ - char buf[HUGE_STRING_LEN]; - char *pInputName; - char *p, *q, *t; - BOOL bDone = FALSE; - BOOL bFileExists = TRUE; - - if (!szFile || strlen(szFile) == 0 || strlen(szFile) >= sizeof(buf)) - return apr_pstrdup(pPool, ""); - - t = buf; - pInputName = apr_pstrdup(pPool, szFile); - - /* First convert all slashes to \ so Win32 calls work OK */ - for (p = pInputName; *p; p++) { - if (*p == '/') - *p = '\\'; - } - - q = p = pInputName; - /* If there is drive information, copy it over. */ - if (pInputName[1] == ':') { - /* This is correct - if systemcase is used for - * comparison, d: designations will match - */ - *(t++) = tolower(*p++); - *(t++) = *p++; - q = p; - - /* If all we have is a drive letter, then we are done */ - if (!*p) - bDone = TRUE; - - q = p; - } - - if (*p == '\\') { - ++p; - if (*p == '\\') /* UNC name */ - { - p++; - /* Get past the machine name. FindFirstFile - * will not find a machine name only - */ - *(t++) = '\\'; - ++q; - p = strchr(p + 1, '\\'); - if (p) - { - p++; - /* Get past the share name. FindFirstFile */ - /* will not find a \\machine\share name only */ - p = strchr(p, '\\'); - if (p) { - /* This was faulty - as of 1.3.13 \\machine\share - * name is now always lowercased - */ - strncpy(t,q,p-q); - strlwr(t); - t += p - q; - q = p; - p++; - } - } - - if (!p) { - bFileExists = FALSE; - 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))) { - apr_finfo_t fs; - if (apr_stat(&fs, pInputName, APR_FINFO_NAME, pPool) != APR_SUCCESS) { - bFileExists = FALSE; - } - else { - if (*q == '\\') - *(t++) = '\\'; - t = strchr(strcpy(t, fs.name), '\0'); - } - } - - if (!bFileExists || OnlyDots((*q == '.' ? q : q+1))) { - /* XXX: Comparison could be faulty ...\unknown - * names may not be tested (if they reside outside - * of the file system)! - */ - strcpy(t, q); - t = strchr(t, '\0'); - } - - if (p) { - q = p; - *p++ = '\\'; - p = strchr(p, '\\'); - } - else { - bDone = TRUE; - } - } - *t = '\0'; - - /* Finally, convert all slashes to / so server code handles it ok */ - - for (p = buf; *p; p++) { - if (*p == '\\') - *p = '/'; - } - - return apr_pstrdup(pPool, buf); -} - - -/* Perform canonicalization with the exception that the - * input case is preserved. - */ -AP_DECLARE(char *) ap_os_case_canonical_filename(apr_pool_t *pPool, - const char *szFile) -{ - char *pNewStr; - char *s; - char *p; - char *q; - - if (szFile == NULL || strlen(szFile) == 0) - return apr_pstrdup(pPool, ""); - - pNewStr = apr_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. - * - * XXX: Netware network clients may have alternate short names, - * simply truncated, with no embedded '~'. Further, this behavior - * can be modified on WinNT volumes. This was not a safe test, - * therefore exclude the '~' pretest. - */ -#ifdef WIN32_SHORT_FILENAME_INSECURE_BEHAVIOR - p = strchr(pNewStr, '~'); - if (p != NULL) -#endif - { - 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 = apr_pstrdup(pPool, buf); - } - } - - return pNewStr; -} - -/* Perform complete canonicalization. - */ -AP_DECLARE(char *) ap_os_canonical_filename(apr_pool_t *pPool, const char *szFile) -{ - char *pNewName; - pNewName = ap_os_case_canonical_filename(pPool, szFile); - strlwr(pNewName); - return pNewName; -} - -#ifdef NEVER_SINCE_THESE_TESTS_ARE_MOVING -/* - * XXX we will no longer use this redunant parsing function, it's - * logic moves off into the canonical filename processing and the - * apr file handling functions. Left for today till it's finished. - * - * 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 additional - * names such as "COM5" are also special devices). - * - * If the path fails ANY of these tests, the result must be to deny access. - */ - -AP_DECLARE(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; -} -#endif - -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_proc_create(newproc, progname, args, env, attr, p); -} - diff --git a/server/.cvsignore b/server/.cvsignore deleted file mode 100644 index 88ac171b53..0000000000 --- a/server/.cvsignore +++ /dev/null @@ -1,14 +0,0 @@ -Makefile -.deps -.libs -*.lo -*.la -uri_delims.h -gen_uri_delims -test_char.h -gen_test_char -*.mak -exports.c -Debug -Release -apache.exports diff --git a/server/.indent.pro b/server/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- 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 24aef10277..0000000000 --- a/server/Makefile.in +++ /dev/null @@ -1,69 +0,0 @@ - -TARGET_EXPORTS = apache.exports -CLEAN_TARGETS = gen_test_char gen_uri_delims test_char.h uri_delims.h \ - $(TARGET_EXPORTS) ApacheCoreOS2.def -EXTRACLEAN_TARGETS = exports.c - -SUBDIRS = mpm - -LTLIBRARY_NAME = libmain.la -LTLIBRARY_SOURCES = \ - uri_delims.h test_char.h \ - config.c log.c main.c vhost.c util.c util_date.c \ - util_script.c util_uri.c util_md5.c util_cfgtree.c util_ebcdic.c \ - rfc1413.c connection.c listen.c \ - mpm_common.c util_charset.c util_debug.c util_xml.c \ - util_filter.c exports.c buildmark.c scoreboard.c \ - error_bucket.c protocol.c core.c request.c - -targets = delete-exports $(LTLIBRARY_NAME) $(CORE_IMPLIB_FILE) - -include $(top_srcdir)/build/rules.mk -include $(top_srcdir)/build/library.mk - -gen_uri_delims_OBJECTS = gen_uri_delims.lo -gen_uri_delims: $(gen_uri_delims_OBJECTS) - $(LINK) $(EXTRA_LDFLAGS) $(gen_uri_delims_OBJECTS) $(EXTRA_LIBS) - -gen_test_char_OBJECTS = gen_test_char.lo util_debug.lo -gen_test_char: $(gen_test_char_OBJECTS) - $(LINK) $(EXTRA_LDFLAGS) $(gen_test_char_OBJECTS) $(EXTRA_LIBS) - -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.lo: uri_delims.h -util.lo: test_char.h - -EXPORT_FILES = ../srclib/apr/apr.exports ../srclib/apr-util/aprutil.exports \ - $(TARGET_EXPORTS) - -delete-exports: - @if test -f $(TARGET_EXPORTS); then \ - headers="`find ../include/*.h -newer $(TARGET_EXPORTS)`" ; \ - if test -n "$$headers"; then \ - echo Found newer headers. Will rebuild $(TARGET_EXPORTS). ; \ - echo rm -f $(TARGET_EXPORTS) ; \ - rm -f $(TARGET_EXPORTS) ; \ - fi \ - fi - - -$(TARGET_EXPORTS): - $(AWK) -f $(top_srcdir)/srclib/apr/build/make_export.awk \ - $(top_srcdir)/include/*.h \ - $(top_srcdir)/os/$(OS_DIR)/*.h > $@ - -exports.c: $(EXPORT_FILES) - (cat $(EXPORT_FILES) | ../build/buildexports.sh ..) > $@ - -# wtf does this have to be explicit???? -exports.lo: exports.c - -# Rule to make def file for OS/2 core dll -ApacheCoreOS2.def: exports.c $(top_srcdir)/os/$(OS_DIR)/core_header.def - cat $(top_srcdir)/os/$(OS_DIR)/core_header.def > $@ - $(CPP) $< $(ALL_CPPFLAGS) $(ALL_INCLUDES) | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$$/ "\1"/' >> $@ diff --git a/server/buildmark.c b/server/buildmark.c deleted file mode 100644 index b25783d097..0000000000 --- a/server/buildmark.c +++ /dev/null @@ -1,67 +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/>. - */ - -#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 - -AP_DECLARE(const char *) ap_get_server_built() -{ - return server_built; -} diff --git a/server/config.c b/server/config.c deleted file mode 100644 index 689b347777..0000000000 --- a/server/config.c +++ /dev/null @@ -1,1763 +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. - */ - -/* - * 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 - * - */ - -#include "apr.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_file_io.h" - -#define APR_WANT_STDIO -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#define CORE_PRIVATE - -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_protocol.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_main.h" -#include "http_vhost.h" -#include "util_cfgtree.h" -#include "mpm.h" - - -AP_DECLARE_DATA const char *ap_server_argv0; - -AP_DECLARE_DATA const char *ap_server_root; - -AP_DECLARE_DATA apr_array_header_t *ap_server_pre_read_config; -AP_DECLARE_DATA apr_array_header_t *ap_server_post_read_config; -AP_DECLARE_DATA apr_array_header_t *ap_server_config_defines; - -AP_DECLARE_DATA ap_directive_t *ap_conftree; - -APR_HOOK_STRUCT( - APR_HOOK_LINK(header_parser) - APR_HOOK_LINK(pre_config) - APR_HOOK_LINK(post_config) - APR_HOOK_LINK(open_logs) - APR_HOOK_LINK(child_init) - APR_HOOK_LINK(handler) - APR_HOOK_LINK(quick_handler) - APR_HOOK_LINK(optional_fn_retrieve) -) - -AP_IMPLEMENT_HOOK_RUN_ALL(int,header_parser, - (request_rec *r),(r),OK,DECLINED) -AP_IMPLEMENT_HOOK_VOID(pre_config, - (apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp), - (pconf,plog,ptemp)) -AP_IMPLEMENT_HOOK_VOID(post_config, - (apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, - server_rec *s),(pconf,plog,ptemp,s)) -AP_IMPLEMENT_HOOK_VOID(open_logs, - (apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, - server_rec *s),(pconf,plog,ptemp,s)) -AP_IMPLEMENT_HOOK_VOID(child_init, - (apr_pool_t *pchild, server_rec *s),(pchild,s)) - -AP_IMPLEMENT_HOOK_RUN_FIRST(int,handler,(request_rec *r), - (r),DECLINED) -AP_IMPLEMENT_HOOK_RUN_FIRST(int,quick_handler,(request_rec *r), - (r),DECLINED) - -AP_IMPLEMENT_HOOK_VOID(optional_fn_retrieve,(void),()) - -/**************************************************************** - * - * 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; -AP_DECLARE_DATA module *ap_top_module = NULL; -AP_DECLARE_DATA module **ap_loaded_modules=NULL; - -typedef int (*handler_func) (request_rec *); -typedef void *(*dir_maker_func) (apr_pool_t *, char *); -typedef void *(*merger_func) (apr_pool_t *, 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). - */ - -static ap_conf_vector_t *create_empty_config(apr_pool_t *p) -{ - void *conf_vector = apr_pcalloc(p, sizeof(void *) * - (total_modules + DYNAMIC_MODULE_LIMIT)); - return conf_vector; -} - -static ap_conf_vector_t *create_default_per_dir_config(apr_pool_t *p) -{ - void **conf_vector = apr_pcalloc(p, sizeof(void *) * - (total_modules + DYNAMIC_MODULE_LIMIT)); - module *modp; - - for (modp = ap_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 (ap_conf_vector_t *) conf_vector; -} - -ap_conf_vector_t *ap_merge_per_dir_configs(apr_pool_t *p, - ap_conf_vector_t *base, - ap_conf_vector_t *new_conf) -{ - void **conf_vector = apr_palloc(p, sizeof(void *) * total_modules); - void **base_vector = (void **) base; - void **new_vector = (void **) new_conf; - module *modp; - - for (modp = ap_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 (ap_conf_vector_t *) conf_vector; -} - -static ap_conf_vector_t *create_server_config(apr_pool_t *p, server_rec *s) -{ - void **conf_vector = apr_pcalloc(p, sizeof(void *) * - (total_modules + DYNAMIC_MODULE_LIMIT)); - module *modp; - - for (modp = ap_top_module; modp; modp = modp->next) { - if (modp->create_server_config) - conf_vector[modp->module_index] = (*modp->create_server_config) (p, s); - } - - return (ap_conf_vector_t *) conf_vector; -} - -static void merge_server_configs(apr_pool_t *p, ap_conf_vector_t *base, - ap_conf_vector_t *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 = ap_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]); - } -} - -ap_conf_vector_t *ap_create_request_config(apr_pool_t *p) -{ - return create_empty_config(p); -} - -ap_conf_vector_t *ap_create_conn_config(apr_pool_t *p) -{ - return create_empty_config(p); -} - -AP_CORE_DECLARE(ap_conf_vector_t *) ap_create_per_dir_config(apr_pool_t *p) -{ - return create_empty_config(p); -} - -int ap_invoke_handler(request_rec *r) -{ - const char *handler; - const char *p; - char *p2; - int result; - char hbuf[MAX_STRING_LEN]; - const char *old_handler = r->handler; - - if (!r->handler) { - handler = r->content_type ? r->content_type : ap_default_type(r); - if ((p=ap_strchr_c(handler, ';')) != NULL) { - apr_cpystrn(hbuf, handler, sizeof hbuf); - p2 = hbuf+(handler-p); - handler = hbuf; - /* MIME type arguments */ - while (p2 > handler && p2[-1] == ' ') - --p2; /* strip trailing spaces */ - *p2='\0'; - } - r->handler = handler; - } - - result = ap_run_handler(r); - - r->handler = old_handler; - - if (result == DECLINED && r->handler && r->filename) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r, - "handler \"%s\" not found for: %s", r->handler, r->filename); - } - return result == DECLINED ? HTTP_INTERNAL_SERVER_ERROR : result; -} - -AP_DECLARE(int) ap_method_is_limited(cmd_parms *cmd, const char *method) { - int methnum; - int i; - char **xmethod; - - methnum = ap_method_number_of(method); - /* - * The simple case: a method hard-coded into Apache. - */ - if (methnum != M_INVALID) { - return (methnum & cmd->limited); - } - /* - * Some extension method we don't know implicitly. - */ - if ((cmd->limited_xmethods == NULL) - || (cmd->limited_xmethods->nelts == 0)) { - return 0; - } - xmethod = (char **) cmd->limited_xmethods->elts; - for (i = 0; i < cmd->limited_xmethods->nelts; ++i) { - if (strcmp(method, xmethod[i]) == 0) { - return 1; - } - } - return 0; -} - -AP_DECLARE(void) ap_register_hooks(module *m, apr_pool_t *p) -{ - if(m->register_hooks) - { - if(getenv("SHOW_HOOKS")) - { - printf("Registering hooks for %s\n",m->name); - apr_debug_module_hooks=1; - } - apr_current_hooking_module=m->name; - m->register_hooks(p); - } -} - -/* One-time setup for precompiled modules --- NOT to be done on restart */ - -AP_DECLARE(void) ap_add_module(module *m, apr_pool_t *p) -{ - /* 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) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "%s: module \"%s\" is not compatible with this " - "version of Apache.", ap_server_argv0, m->name); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Please contact the vendor for the correct version."); - exit(1); - } - - if (m->next == NULL) { - m->next = ap_top_module; - ap_top_module = m; - } - if (m->module_index == -1) { - m->module_index = total_modules++; - dynamic_modules++; - - if (dynamic_modules > DYNAMIC_MODULE_LIMIT) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "%s: module \"%s\" could not be loaded, because" - " the dynamic", ap_server_argv0, m->name); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "module limit was reached. Please increase " - "DYNAMIC_MODULE_LIMIT and recompile."); - 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 (ap_strrchr_c(m->name, '/')) - m->name = 1 + ap_strrchr_c(m->name, '/'); - if (ap_strrchr_c(m->name, '\\')) - m->name = 1 + ap_strrchr_c(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*/ - - /* FIXME: is this the right place to call this? - * It doesn't appear to be - */ - ap_register_hooks(m, p); -} - -/* - * 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. - */ - -AP_DECLARE(void) ap_remove_module(module *m) -{ - module *modp; - - modp = ap_top_module; - if (modp == m) { - /* We are the top module, special case */ - ap_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, 0, 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--; -} - -AP_DECLARE(void) ap_add_loaded_module(module *mod, apr_pool_t *p) -{ - module **m; - - /* - * Add module pointer to top of chained module list - */ - ap_add_module(mod, p); - - /* - * 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; -} - -AP_DECLARE(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; -} - -AP_DECLARE(void) ap_setup_prelinked_modules(process_rec *process) -{ - module **m; - module **m2; - - apr_global_hook_pool=process->pconf; - - /* - * 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 **)apr_palloc(process->pool, - sizeof(module *)*(total_modules+DYNAMIC_MODULE_LIMIT+1)); - if (ap_loaded_modules == NULL) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Ouch! Out of memory in ap_setup_prelinked_modules()!"); - } - 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, process->pconf); - - apr_sort_hooks(); -} - -AP_DECLARE(const char *) ap_find_module_name(module *m) -{ - return m->name; -} - -AP_DECLARE(module *) ap_find_linked_module(const char *name) -{ - module *modp; - - for (modp = ap_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. */ -AP_DECLARE(int) ap_add_named_module(const char *name, apr_pool_t *p) -{ - 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, p); - } - return 1; - } - } - - return 0; -} - -/***************************************************************** - * - * 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 apr_pstrcat(parms->pool, cmd->name, " not allowed here", NULL); - - parms->info = cmd->cmd_data; - parms->cmd = cmd; - - switch (cmd->args_how) { - case RAW_ARGS: -#ifdef RESOLVE_ENV_PER_TOKEN - args = ap_resolve_env(parms->pool,args); -#endif - return cmd->AP_RAW_ARGS(parms, mconfig, args); - - case NO_ARGS: - if (*args != 0) - return apr_pstrcat(parms->pool, cmd->name, " takes no arguments", - NULL); - - return cmd->AP_NO_ARGS(parms, mconfig); - - case TAKE1: - w = ap_getword_conf(parms->pool, &args); - - if (*w == '\0' || *args != 0) - return apr_pstrcat(parms->pool, cmd->name, " takes one argument", - cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); - - return cmd->AP_TAKE1(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 apr_pstrcat(parms->pool, cmd->name, " takes two arguments", - cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); - - return cmd->AP_TAKE2(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 apr_pstrcat(parms->pool, cmd->name, " takes 1-2 arguments", - cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); - - return cmd->AP_TAKE2(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 apr_pstrcat(parms->pool, cmd->name, " takes three arguments", - cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); - - return cmd->AP_TAKE3(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 apr_pstrcat(parms->pool, cmd->name, - " takes two or three arguments", - cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); - - return cmd->AP_TAKE3(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 apr_pstrcat(parms->pool, cmd->name, - " takes one, two or three arguments", - cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); - - return cmd->AP_TAKE3(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 && *w2 && !w3) || *args != 0) - return apr_pstrcat(parms->pool, cmd->name, - " takes one or three arguments", - cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); - - return cmd->AP_TAKE3(parms, mconfig, w, w2, w3); - - case ITERATE: - - while (*(w = ap_getword_conf(parms->pool, &args)) != '\0') - { - if ((errmsg = cmd->AP_TAKE1(parms, mconfig, w))) - return errmsg; - } - - return NULL; - - case ITERATE2: - - w = ap_getword_conf(parms->pool, &args); - - if (*w == '\0' || *args == 0) - return apr_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 = cmd->AP_TAKE2(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 apr_pstrcat(parms->pool, cmd->name, " must be On or Off", - NULL); - - return cmd->AP_FLAG(parms, mconfig, strcasecmp(w, "off") != 0); - - default: - - return apr_pstrcat(parms->pool, cmd->name, - " is improperly configured internally (server bug)", - NULL); - } -} - -AP_CORE_DECLARE(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; -} - -AP_CORE_DECLARE(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; -} - -AP_CORE_DECLARE(void *) ap_set_config_vectors(server_rec *server, - ap_conf_vector_t *section_vector, - const char *section, - module *mod, apr_pool_t *pconf) -{ - void *section_config = ap_get_module_config(section_vector, mod); - void *server_config = ap_get_module_config(server->module_config, mod); - - if (!section_config && mod->create_dir_config) { - /* ### need to fix the create_dir_config functions' prototype... */ - section_config = (*mod->create_dir_config) (pconf, (char *)section); - ap_set_module_config(section_vector, mod, section_config); - } - - if (!server_config && mod->create_server_config) { - server_config = (*mod->create_server_config) (pconf, server); - ap_set_module_config(server->module_config, mod, server_config); - } - - return section_config; -} - -static const char *execute_now(char *cmd_line, const char *args, cmd_parms *parms, - apr_pool_t *p, apr_pool_t *ptemp, - ap_directive_t **sub_tree, ap_directive_t *parent); - -static const char * ap_build_config_sub(apr_pool_t *p, apr_pool_t *temp_pool, - const char *l, cmd_parms *parms, - ap_directive_t **current, - ap_directive_t **curr_parent, - ap_directive_t **conftree) -{ - const char *args; - char *cmd_name; - ap_directive_t *newdir; - module *mod = ap_top_module; - const command_rec *cmd; - - if (*l == '#' || *l == '\0') - return NULL; - -#if RESOLVE_ENV_PER_TOKEN - args = l; -#else - args = ap_resolve_env(temp_pool, l); -#endif - cmd_name = ap_getword_conf(p, &args); - if (*cmd_name == '\0') { - /* Note: this branch should not occur. An empty line should have - * triggered the exit further above. - */ - return NULL; - } - - newdir = apr_pcalloc(p, sizeof(ap_directive_t)); - newdir->filename = parms->config_file->name; - newdir->line_num = parms->config_file->line_number; - newdir->directive = cmd_name; - newdir->args = apr_pstrdup(p, args); - - if ((cmd = ap_find_command_in_modules(cmd_name, &mod)) != NULL) { - if (cmd->req_override & EXEC_ON_READ) { - const char *retval; - ap_directive_t *sub_tree = NULL; - - parms->err_directive = newdir; - retval = execute_now(cmd_name, args, parms, p, temp_pool, - &sub_tree, *curr_parent); - if (*current) { - (*current)->next = sub_tree; - } - else { - (*current) = sub_tree; - if (*curr_parent) { - (*curr_parent)->first_child = (*current); - } - if (*current) { - (*current)->parent = (*curr_parent); - } - } - if (*current) { - if (!*conftree) { - /* Before walking *current to the end of the list, - * set the head to *current. - */ - *conftree = *current; - } - while ((*current)->next != NULL) { - (*current) = (*current)->next; - (*current)->parent = (*curr_parent); - } - } - return retval; - } - } - - if (cmd_name[0] == '<') { - if (cmd_name[1] != '/') { - (*current) = ap_add_node(curr_parent, *current, newdir, 1); - } - else if (*curr_parent == NULL) { - parms->err_directive = newdir; - return apr_pstrcat(p, cmd_name, - " without matching <", cmd_name + 2, - " section", NULL); - } - else { - char *bracket = cmd_name + strlen(cmd_name) - 1; - - if (*bracket != '>') { - parms->err_directive = newdir; - return apr_pstrcat(p, cmd_name, - "> directive missing closing '>'", NULL); - } - *bracket = '\0'; - if (strcasecmp(cmd_name + 2, - (*curr_parent)->directive + 1) != 0) { - parms->err_directive = newdir; - return apr_pstrcat(p, "Expected </", - (*curr_parent)->directive + 1, "> but saw ", - cmd_name, ">", NULL); - } - *bracket = '>'; - - /* done with this section; move up a level */ - *current = *curr_parent; - *curr_parent = (*current)->parent; - } - } - else { - *current = ap_add_node(curr_parent, *current, newdir, 0); - } - - return NULL; -} - -const char *ap_build_cont_config(apr_pool_t *p, apr_pool_t *temp_pool, - cmd_parms *parms, - ap_directive_t **current, - ap_directive_t **curr_parent, - char *orig_directive) -{ - char l[MAX_STRING_LEN]; - char *bracket; - const char *retval; - ap_directive_t *sub_tree = NULL; - - bracket = apr_pstrcat(p, orig_directive + 1, ">", NULL); - while (!(ap_cfg_getline(l, MAX_STRING_LEN, parms->config_file))) { - if (!memcmp(l, "</", 2) && - (strcasecmp(l + 2, bracket) == 0) && - (*curr_parent == NULL)) { - break; - } - retval = ap_build_config_sub(p, temp_pool, l, parms, current, - curr_parent, &sub_tree); - if (retval != NULL) - return retval; - if (sub_tree == NULL && curr_parent != NULL) { - sub_tree = *curr_parent; - } - if (sub_tree == NULL && current != NULL) { - sub_tree = *current; - } - } - *current = sub_tree; - return NULL; -} - -static const char *ap_walk_config_sub(const ap_directive_t *current, - cmd_parms *parms, - ap_conf_vector_t *section_vector) -{ - module *mod = ap_top_module; - - while (1) { - const command_rec *cmd; - - if (!(cmd = ap_find_command_in_modules(current->directive, &mod))) { - parms->err_directive = current; - return apr_pstrcat(parms->pool, "Invalid command '", - current->directive, - "', perhaps mis-spelled or defined by a module " - "not included in the server configuration", - NULL); - } - else { - void *dir_config = ap_set_config_vectors(parms->server, - section_vector, - parms->path, - mod, - parms->pool); - const char *retval; - - retval = invoke_cmd(cmd, parms, dir_config, current->args); - if (retval == NULL) { - return NULL; - } - if (strcmp(retval, DECLINE_CMD) != 0) { - /* If the directive in error has already been set, don't - * replace it. Otherwise, an error inside a container - * will be reported as occuring on the first line of the - * container. - */ - if (!parms->err_directive) { - parms->err_directive = current; - } - return retval; - } - - mod = mod->next; /* Next time around, skip this one */ - } - } - /* NOTREACHED */ -} - -AP_DECLARE(const char *) ap_walk_config(ap_directive_t *current, - cmd_parms *parms, - ap_conf_vector_t *section_vector) -{ - ap_conf_vector_t *oldconfig = parms->context; - - parms->context = section_vector; - - /* scan through all directives, executing each one */ - for (; current != NULL; current = current->next) { - const char *errmsg; - - parms->directive = current; - - /* actually parse the command and execute the correct function */ - errmsg = ap_walk_config_sub(current, parms, section_vector); - if (errmsg != NULL) { - /* restore the context (just in case) */ - parms->context = oldconfig; - return errmsg; - } - } - - parms->context = oldconfig; - return NULL; -} - - -AP_DECLARE(const char *) ap_build_config(cmd_parms *parms, - apr_pool_t *p, apr_pool_t *temp_pool, - ap_directive_t **conftree) -{ - ap_directive_t *current = *conftree; - ap_directive_t *curr_parent = NULL; - char l[MAX_STRING_LEN]; - const char *errmsg; - - if (current != NULL) { - while (current->next) { - current = current->next; - } - } - - while (!(ap_cfg_getline(l, MAX_STRING_LEN, parms->config_file))) { - - errmsg = ap_build_config_sub(p, temp_pool, l, parms, - ¤t, &curr_parent, conftree); - if (errmsg != NULL) - return errmsg; - - if (*conftree == NULL && curr_parent != NULL) { - *conftree = curr_parent; - } - if (*conftree == NULL && current != NULL) { - *conftree = current; - } - } - - if (curr_parent != NULL) { - errmsg = ""; - while (curr_parent != NULL) { - errmsg = apr_psprintf(p, "%s%s%s:%u: %s> was not closed.", - errmsg, - *errmsg == '\0' ? "" : APR_EOL_STR, - curr_parent->filename, - curr_parent->line_num, - curr_parent->directive); - curr_parent = curr_parent->parent; - } - return errmsg; - } - - return NULL; -} - -/* - * Generic command functions... - */ - -AP_DECLARE_NONSTD(const char *) ap_set_string_slot(cmd_parms *cmd, - void *struct_ptr, - const char *arg) -{ - /* This one's pretty generic... */ - - int offset = (int) (long) cmd->info; - *(const char **) ((char *)struct_ptr + offset) = arg; - return NULL; -} - -AP_DECLARE_NONSTD(const char *) ap_set_int_slot(cmd_parms *cmd, - void *struct_ptr, - const char *arg) -{ - char *endptr; - char *error_str = NULL; - int offset = (int) (long) cmd->info; - - *(int *) ((char*)struct_ptr + offset) = strtol(arg, &endptr, 10); - - if ((*arg == '\0') || (*endptr != '\0')) { - error_str = apr_psprintf(cmd->pool, - "Invalid value for directive %s, expected integer", - cmd->directive->directive); - } - - return error_str; -} - -AP_DECLARE_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *cmd, - void *struct_ptr, - const char *arg_) -{ - /* This one's pretty generic... */ - char *arg=apr_pstrdup(cmd->pool,arg_); - - int offset = (int) (long) cmd->info; - ap_str_tolower(arg); - *(char **) ((char *)struct_ptr + offset) = arg; - return NULL; -} - -AP_DECLARE_NONSTD(const char *) ap_set_flag_slot(cmd_parms *cmd, - void *struct_ptr_v, int arg) -{ - /* This one's pretty generic too... */ - - int offset = (int) (long) cmd->info; - char *struct_ptr = (char *)struct_ptr_v; - *(int *) (struct_ptr + offset) = arg ? 1 : 0; - return NULL; -} - -AP_DECLARE_NONSTD(const char *) ap_set_file_slot(cmd_parms *cmd, void *struct_ptr, - const 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; -#ifndef OS2 - arg = ap_os_canonical_filename(cmd->pool, arg); -#endif - if (ap_os_is_path_absolute(arg)) - p = apr_pstrdup(cmd->pool, arg); - else - p = ap_make_full_path(cmd->pool, ap_server_root, arg); - *(char **) ((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, NULL, NULL}; - -AP_DECLARE(const char *) ap_server_root_relative(apr_pool_t *p, const char *file) -{ -#ifndef OS2 - file = ap_os_canonical_filename(p, file); -#endif - if(ap_os_is_path_absolute(file)) - return file; - return ap_make_full_path(p, ap_server_root, file); -} - -AP_DECLARE(const char *) ap_soak_end_container(cmd_parms *cmd, char *directive) -{ - char l[MAX_STRING_LEN]; - const char *args; - char *cmd_name; - - while(!(ap_cfg_getline(l, MAX_STRING_LEN, cmd->config_file))) { -#if RESOLVE_ENV_PER_TOKEN - args = l; -#else - args = ap_resolve_env(cmd->temp_pool, l); -#endif - cmd_name = ap_getword_conf(cmd->pool, &args); - if (cmd_name[0] == '<') { - if (cmd_name[1] == '/') { - cmd_name[strlen(cmd_name) - 1] = '\0'; - if (strcasecmp(cmd_name + 2, directive + 1) != 0) { - return apr_pstrcat(cmd->pool, "Expected </", - directive + 1, "> but saw ", - cmd_name, ">", NULL); - } - return NULL; /* found end of container */ - } - else { - const char *msg; - - if ((msg = ap_soak_end_container(cmd, cmd_name)) != NULL) { - return msg; - } - } - } - } - return apr_pstrcat(cmd->pool, "Expected </", - directive + 1, "> before end of configuration", - NULL); -} - -static const char *execute_now(char *cmd_line, const char *args, cmd_parms *parms, - apr_pool_t *p, apr_pool_t *ptemp, - ap_directive_t **sub_tree, ap_directive_t *parent) -{ - module *mod = ap_top_module; - const command_rec *cmd; - - if (!(cmd = ap_find_command_in_modules(cmd_line, &mod))) { - return apr_pstrcat(parms->pool, "Invalid command '", - cmd_line, - "', perhaps mis-spelled or defined by a module " - "not included in the server configuration", - NULL); - } - else { - return invoke_cmd(cmd, parms, sub_tree, args); - } -} - -/* 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 apr_array_header_t pointer for the string array. - */ -typedef struct { - apr_array_header_t *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 */ - apr_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, apr_array_header_t *arr, - ap_directive_t **conftree, apr_pool_t *p, - apr_pool_t *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_build_config(&parms, p, ptemp, conftree); - if (errmsg) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Syntax error in -C/-c directive:" APR_EOL_STR "%s", - errmsg); - exit(1); - } - - ap_cfg_closefile(parms.config_file); -} - -typedef struct { - char *fname; -} fnames; - -static int fname_alphasort(const void *fn1, const void *fn2) -{ - const fnames *f1 = fn1; - const fnames *f2 = fn2; - - return strcmp(f1->fname,f2->fname); -} - -void ap_process_resource_config(server_rec *s, const char *fname, - ap_directive_t **conftree, apr_pool_t *p, - apr_pool_t *ptemp) -{ - cmd_parms parms; - apr_finfo_t finfo; - const char *errmsg; - ap_configfile_t *cfp; - - fname = ap_server_root_relative(p, fname); - - /* 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 (apr_lstat(&finfo, fname, APR_FINFO_TYPE, p) != APR_SUCCESS) - return; - } - - /* - * here we want to check if the candidate file is really a - * directory, and most definitely NOT a symlink (to prevent - * horrible loops). If so, let's recurse and toss it back - * into the function. - */ - if (ap_is_rdirectory(ptemp, fname)) { - apr_dir_t *dirp; - apr_finfo_t dirent; - int current; - apr_array_header_t *candidates = NULL; - fnames *fnew; - apr_status_t rv; - char errmsg[120]; - - /* - * first course of business is to grok all the directory - * entries here and store 'em away. Recall we need full pathnames - * for this. - */ - fprintf(stderr, "Processing config directory: %s\n", fname); - rv = apr_dir_open(&dirp, fname, p); - if (rv != APR_SUCCESS) { - fprintf(stderr, "%s: could not open config directory %s: %s\n", - ap_server_argv0, fname, - apr_strerror(rv, errmsg, sizeof errmsg)); - exit(1); - } - candidates = apr_array_make(p, 1, sizeof(fnames)); - while (apr_dir_read(&dirent, APR_FINFO_DIRENT, dirp) == APR_SUCCESS) { - /* strip out '.' and '..' */ - if (strcmp(dirent.name, ".") && - strcmp(dirent.name, "..")) { - fnew = (fnames *) apr_array_push(candidates); - fnew->fname = ap_make_full_path(p, fname, dirent.name); - } - } - apr_dir_close(dirp); - if (candidates->nelts != 0) { - qsort((void *) candidates->elts, candidates->nelts, - sizeof(fnames), fname_alphasort); - /* - * Now recurse these... we handle errors and subdirectories - * via the recursion, which is nice - */ - for (current = 0; current < candidates->nelts; ++current) { - fnew = &((fnames *) candidates->elts)[current]; - fprintf(stderr, " Processing config file: %s\n", fnew->fname); - ap_process_resource_config(s, fnew->fname, conftree, p, ptemp); - } - } - 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 (ap_pcfg_openfile(&cfp, p, fname) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "%s: could not open document config file %s", - ap_server_argv0, fname); - exit(1); - } - - parms.config_file = cfp; - - errmsg = ap_build_config(&parms, p, ptemp, conftree); - - if (errmsg != NULL) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Syntax error on line %d of %s:", - parms.err_directive->line_num, - parms.err_directive->filename); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "%s", errmsg); - exit(1); - } - - ap_cfg_closefile(cfp); -} - -AP_DECLARE(void) ap_process_config_tree(server_rec *s, - ap_directive_t *conftree, - apr_pool_t *p, apr_pool_t *ptemp) -{ - const char *errmsg; - cmd_parms parms; - - parms = default_parms; - parms.pool = p; - parms.temp_pool = ptemp; - parms.server = s; - parms.override = (RSRC_CONF | OR_ALL) & ~(OR_AUTHCFG | OR_LIMIT); - parms.limited = -1; - - errmsg = ap_walk_config(conftree, &parms, s->lookup_defaults); - if (errmsg) { - ap_log_perror(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, p, - "Syntax error on line %d of %s:", - parms.err_directive->line_num, - parms.err_directive->filename); - ap_log_perror(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, p, - "%s", errmsg); - exit(1); - } -} - -int ap_parse_htaccess(ap_conf_vector_t **result, request_rec *r, int override, - const char *d, const char *access_name) -{ - ap_configfile_t *f = NULL; - cmd_parms parms; - char *filename = NULL; - const struct htaccess_result *cache; - struct htaccess_result *new; - ap_conf_vector_t *dc = NULL; - apr_status_t status; - - /* 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 = apr_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)); - status = ap_pcfg_openfile(&f, r->pool, filename); - - if (status == APR_SUCCESS) { - const char *errmsg; - ap_directive_t *temptree = NULL; - - dc = ap_create_per_dir_config(r->pool); - - parms.config_file = f; - errmsg = ap_build_config(&parms, r->pool, r->pool, &temptree); - if (errmsg == NULL) - errmsg = ap_walk_config(temptree, &parms, dc); - - ap_cfg_closefile(f); - - if (errmsg) { - ap_log_rerror(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, r, - "%s: %s", filename, errmsg); - return HTTP_INTERNAL_SERVER_ERROR; - } - *result = dc; - break; - } else { - if (!APR_STATUS_IS_ENOENT(status) - && !APR_STATUS_IS_ENOTDIR(status)) { - ap_log_rerror(APLOG_MARK, APLOG_CRIT, status, r, - "%s pcfg_openfile: unable to check htaccess file, " - "ensure it is readable", - filename); - apr_table_setn(r->notes, "error-notes", - "Server unable to read htaccess file, denying " - "access to be safe"); - return HTTP_FORBIDDEN; - } - } - } - - /* cache it */ - new = apr_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; -} - -AP_CORE_DECLARE(const char *) ap_init_virtual_host(apr_pool_t *p, - const char *hostname, - server_rec *main_server, - server_rec **ps) -{ - server_rec *s = (server_rec *) apr_pcalloc(p, sizeof(server_rec)); - - /* TODO: this crap belongs in http_core */ - s->process = main_server->process; - s->server_admin = NULL; - s->server_hostname = NULL; - s->error_fname = 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 = apr_array_make(p, 4, sizeof(char **)); - s->wild_names = apr_array_make(p, 4, sizeof(char **)); - - s->module_config = create_empty_config(p); - s->lookup_defaults = ap_create_per_dir_config(p); - - 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); -} - - -AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *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->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; - - /* 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(apr_pool_t *p) -{ - /* Global virtual host hash bucket pointers. Init to null. */ - ap_init_vhost_config(p); -} - -static server_rec *init_server_config(process_rec *process, apr_pool_t *p) -{ - apr_status_t rv; - server_rec *s = (server_rec *) apr_pcalloc(p, sizeof(server_rec)); - - apr_file_open_stderr(&s->error_log, p); - s->process = process; - s->port = 0; - s->server_admin = DEFAULT_ADMIN; - s->server_hostname = NULL; - s->error_fname = DEFAULT_ERRORLOG; - s->loglevel = DEFAULT_LOGLEVEL; - 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 = apr_pcalloc(p, sizeof(server_addr_rec)); - /* NOT virtual host; don't match any real network interface */ - rv = apr_sockaddr_info_get(&s->addrs->host_addr, - NULL, APR_INET, 0, 0, p); - ap_assert(rv == APR_SUCCESS); /* otherwise: bug or no storage */ - 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; -} - - -AP_DECLARE(server_rec*) ap_read_config(process_rec *process, apr_pool_t *ptemp, - const char *confname, - ap_directive_t **conftree) -{ - apr_pool_t *p = process->pconf; - server_rec *s = init_server_config(process, p); - - init_config_globals(p); - - /* All server-wide config files now have the SAME syntax... */ - - process_command_config(s, ap_server_pre_read_config, conftree, - p, ptemp); - - ap_process_resource_config(s, confname, conftree, p, ptemp); - - process_command_config(s, ap_server_post_read_config, conftree, - p, ptemp); - - return s; -} - -AP_DECLARE(void) ap_single_module_configure(apr_pool_t *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)); -} - -AP_DECLARE(void) ap_run_rewrite_args(process_rec *process) -{ - module *m; - - for (m = ap_top_module; m; m = m->next) - if (m->rewrite_args) - (*m->rewrite_args) (process); -} - -/******************************************************************** - * 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 <Directory> or <Location> --> 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 <Directory>, <Files> or <Location>"); - else - printf("only inside <Directory>, <Files> or <Location>"); - - /* Warn if the directive is allowed inside <Directory> 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 -L. - */ -AP_DECLARE(void) ap_show_directives(void) -{ - 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. */ -AP_DECLARE(void) ap_show_modules(void) -{ - int n; - - printf("Compiled in modules:\n"); - for (n = 0; ap_loaded_modules[n]; ++n) - printf(" %s\n", ap_loaded_modules[n]->name); -} - -AP_DECLARE(const char *) ap_show_mpm(void) -{ - return MPM_NAME; -} diff --git a/server/config.m4 b/server/config.m4 deleted file mode 100644 index 761be95a53..0000000000 --- a/server/config.m4 +++ /dev/null @@ -1,29 +0,0 @@ -dnl ## Check for libraries - -AC_CHECK_LIB(nsl, gethostname, APR_ADDTO(LIBS,-lnsl)) -AC_CHECK_LIB(socket, socket, APR_ADDTO(LIBS,-lsocket)) -AC_CHECK_LIB(nsl, gethostbyaddr, APR_ADDTO(LIBS,-lnsl)) - -dnl ## Check for header files - -AC_CHECK_HEADERS(bstring.h unistd.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 <sys/types.h> -#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,, - [Define if struct tm has a tm_gmtoff member]) -fi - -dnl ## Check for library functions - -AC_CHECK_FUNCS(syslog) - -dnl Obsolete scoreboard code uses this. - AC_CHECK_HEADERS(sys/times.h) - AC_CHECK_FUNCS(times) diff --git a/server/connection.c b/server/connection.c deleted file mode 100644 index 297d4eef8e..0000000000 --- a/server/connection.c +++ /dev/null @@ -1,263 +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. - */ - -#include "apr.h" -#include "apr_strings.h" - -#define CORE_PRIVATE -#include "ap_config.h" -#include "httpd.h" -#include "http_connection.h" -#include "http_request.h" -#include "http_protocol.h" -#include "ap_mpm.h" -#include "mpm_default.h" -#include "http_config.h" -#include "http_vhost.h" -#include "scoreboard.h" -#include "http_log.h" -#include "util_filter.h" - -APR_HOOK_STRUCT( - APR_HOOK_LINK(pre_connection) - APR_HOOK_LINK(process_connection) -) - -AP_IMPLEMENT_HOOK_RUN_ALL(int,pre_connection,(conn_rec *c),(c),OK,DECLINED) -AP_IMPLEMENT_HOOK_RUN_FIRST(int,process_connection,(conn_rec *c),(c),DECLINED) - -/* - * 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, errno, server_conf, - "setsockopt: (SO_LINGER)"); - /* not a fatal error */ - } -} - -#else -#define sock_enable_linger(s) /* NOOP */ -#endif /* USE_SO_LINGER */ - -AP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c) -{ - apr_bucket_brigade *bb; - apr_bucket *b; - - bb = apr_brigade_create(c->pool); - b = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, b); - ap_pass_brigade(c->output_filters, bb); -} - -/* we now proceed to read from the client until we get EOF, or until - * MAX_SECS_TO_LINGER has passed. the reasons for doing this are - * documented in a draft: - * - * http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-connection-00.txt - * - * in a nutshell -- if we don't make this effort we risk causing - * TCP RST packets to be sent which can tear down a connection before - * all the response data has been sent to the client. - */ -#define SECONDS_TO_LINGER 2 -void ap_lingering_close(conn_rec *c) -{ - char dummybuf[512]; - apr_size_t nbytes = sizeof(dummybuf); - apr_status_t rc; - apr_int32_t timeout; - apr_int32_t total_linger_time = 0; - -#ifdef NO_LINGCLOSE - ap_flush_conn(c); /* just close it */ - apr_socket_close(c->client_socket); - return; -#endif - - /* 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. - */ - - /* Send any leftover data to the client, but never try to again */ - ap_flush_conn(c); - - if (c->aborted) { - apr_socket_close(c->client_socket); - return; - } - - /* Shut down the socket for write, which will send a FIN - * to the peer. - */ - - if (apr_shutdown(c->client_socket, APR_SHUTDOWN_WRITE) != APR_SUCCESS || - c->aborted) { - apr_socket_close(c->client_socket); - return; - } - - /* Read all data from the peer until we reach "end-of-file" (FIN - * from peer) or we've exceeded our overall timeout. If the client does - * not send us bytes within 2 seconds (a value pulled from Apache 1.3 - * which seems to work well), close the connection. - */ - timeout = SECONDS_TO_LINGER * APR_USEC_PER_SEC; - apr_setsocketopt(c->client_socket, APR_SO_TIMEOUT, timeout); - for (;;) { - nbytes = sizeof(dummybuf); - rc = apr_recv(c->client_socket, dummybuf, &nbytes); - if (rc != APR_SUCCESS || nbytes == 0) break; - - total_linger_time += SECONDS_TO_LINGER; - if (total_linger_time >= MAX_SECS_TO_LINGER) { - break; - } - } - - apr_socket_close(c->client_socket); -} - -AP_CORE_DECLARE(void) ap_process_connection(conn_rec *c) -{ - ap_update_vhost_given_ip(c); - - ap_run_pre_connection(c); - - ap_run_process_connection(c); - -} - -/* Clearly some of this stuff doesn't belong in a generalised connection - structure, but for now... -*/ - -conn_rec *ap_new_connection(apr_pool_t *p, server_rec *server, - apr_socket_t *inout, long id) -{ - conn_rec *conn = (conn_rec *) apr_pcalloc(p, sizeof(conn_rec)); - apr_status_t rv; - - (void) ap_update_child_status(AP_CHILD_THREAD_FROM_ID(id), - SERVER_BUSY_READ, (request_rec *) NULL); - - /* Got a connection structure, so initialize what fields we can - * (the rest are zeroed out by pcalloc). - */ - - conn->conn_config=ap_create_conn_config(p); - conn->notes = apr_table_make(p, 5); - - conn->pool = p; - if ((rv = apr_socket_addr_get(&conn->local_addr, APR_LOCAL, inout)) - != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_INFO, rv, server, - "apr_socket_addr_get(APR_LOCAL)"); - apr_socket_close(inout); - return NULL; - } - apr_sockaddr_ip_get(&conn->local_ip, conn->local_addr); - if ((rv = apr_socket_addr_get(&conn->remote_addr, APR_REMOTE, inout)) - != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_INFO, rv, server, - "apr_socket_addr_get(APR_REMOTE)"); - apr_socket_close(inout); - return NULL; - } - apr_sockaddr_ip_get(&conn->remote_ip, conn->remote_addr); - conn->base_server = server; - conn->client_socket = inout; - - conn->id = id; - - return conn; -} diff --git a/server/core.c b/server/core.c deleted file mode 100644 index 092eb62f09..0000000000 --- a/server/core.c +++ /dev/null @@ -1,3336 +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. - */ - -#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 <directory> 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 <hanche@imf.unit.no> */ -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; - } -#if APR_HAVE_IPV6 - /* match IPv4-mapped IPv6 addresses with IPv4 A record */ - if (conn->remote_addr->sa.sin.sin_family == APR_INET6 && - sa->sa.sin.sin_family == APR_INET && - IN6_IS_ADDR_V4MAPPED((struct in6_addr *)conn->remote_addr->ipaddr_ptr) && - !memcmp(&((struct in6_addr *)conn->remote_addr->ipaddr_ptr)->s6_addr[12], - sa->ipaddr_ptr, - sizeof (((struct in_addr *)0)->s_addr))) { - conn->double_reverse = 1; - return; - } -#endif - sa = sa->next; - } - } - conn->double_reverse = -1; -} - -AP_DECLARE(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, - int type, int *str_is_ip) -{ - int hostname_lookups; - - if (str_is_ip) { /* if caller wants to know */ - *str_is_ip = 0; - } - - /* 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 { - if (str_is_ip) { /* if caller wants to know */ - *str_is_ip = 1; - } - 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 <VirtualHost> section", NULL); - } - - if ((forbidden & NOT_IN_LIMIT) && cmd->limited != -1) { - return apr_pstrcat(cmd->pool, cmd->cmd->name, gt, - " cannot occur within <Limit> 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 <Directory/Location/Files> " - "section", NULL); - } - - if (((forbidden & NOT_IN_DIRECTORY) - && ((found = find_parent(cmd->directive, "<Directory")) - || (found = find_parent(cmd->directive, "<DirectoryMatch")))) - || ((forbidden & NOT_IN_LOCATION) - && ((found = find_parent(cmd->directive, "<Location")) - || (found = find_parent(cmd->directive, "<LocationMatch")))) - || ((forbidden & NOT_IN_FILES) - && ((found = find_parent(cmd->directive, "<Files")) - || (found = find_parent(cmd->directive, "<FilesMatch"))))) { - return apr_pstrcat(cmd->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 <Limit>"; - } - else if (methnum == M_INVALID) { - char **xmethod; - register int i, j, k; - - /* - * Deal with <Limit> 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); - } - /* - * <LimitExcept>, 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) <Limit>, else <LimitExcept> - */ - 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 <DirectoryMatch> and <FilesMatch>, 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) { /* <DirectoryMatch> */ - 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) { /* <LocationMatch> */ - 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) { /* <FilesMatch> */ - 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, "<IfModule"); - *(ap_directive_t **)mconfig = current; - return retval; - } - else { - *(ap_directive_t **)mconfig = NULL; - return ap_soak_end_container(cmd, "<IfModule"); - } -} - -AP_DECLARE(int) ap_exists_config_define(const 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 *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, "<IfDefine"); - *(ap_directive_t **)dummy = current; - return retval; - } - else { - *(ap_directive_t **)dummy = NULL; - return ap_soak_end_container(cmd, "<IfDefine"); - } -} - -/* httpd.conf commands... beginning with the <VirtualHost> 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 <VirtualHost> - 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 "<VirtualHost> 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 <VirtualHost>"; - } - 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, "<ADDRESS>" AP_SERVER_BASEVERSION - " Server at <A HREF=\"mailto:", - r->server->server_admin, "\">", - ap_get_server_name(r), "</A> Port ", sport, - "</ADDRESS>\n", NULL); - } - return apr_pstrcat(r->pool, prefix, "<ADDRESS>" AP_SERVER_BASEVERSION - " Server at ", ap_get_server_name(r), " Port ", sport, - "</ADDRESS>\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("<Directory", dirsection, NULL, RSRC_CONF, - "Container for directives affecting resources located in the specified " - "directories"), -AP_INIT_RAW_ARGS("<Location", urlsection, NULL, RSRC_CONF, - "Container for directives affecting resources accessed through the " - "specified URL paths"), -AP_INIT_RAW_ARGS("<VirtualHost", virtualhost_section, NULL, RSRC_CONF, - "Container to map directives to a particular virtual host, takes one or " - "more host addresses"), -AP_INIT_RAW_ARGS("<Files", filesection, NULL, OR_ALL, - "Container for directives affecting files matching specified patterns"), -AP_INIT_RAW_ARGS("<Limit", ap_limit_section, NULL, OR_ALL, - "Container for authentication directives when accessed using specified HTTP " - "methods"), -AP_INIT_RAW_ARGS("<LimitExcept", ap_limit_section, (void*)1, OR_ALL, - "Container for authentication directives to be applied when any HTTP " - "method other than those specified is used to access the resource"), -AP_INIT_TAKE1("<IfModule", start_ifmod, NULL, EXEC_ON_READ | OR_ALL, - "Container for directives based on existance of specified modules"), -AP_INIT_TAKE1("<IfDefine", start_ifdefine, NULL, EXEC_ON_READ | OR_ALL, - "Container for directives based on existance of command line defines"), -AP_INIT_RAW_ARGS("<DirectoryMatch", dirsection, (void*)1, RSRC_CONF, - "Container for directives affecting resources located in the " - "specified directories"), -AP_INIT_RAW_ARGS("<LocationMatch", urlsection, (void*)1, RSRC_CONF, - "Container for directives affecting resources accessed through the " - "specified URL paths"), -AP_INIT_RAW_ARGS("<FilesMatch", filesection, (void*)1, OR_ALL, - "Container for directives affecting files matching specified patterns"), -AP_INIT_TAKE1("AuthType", ap_set_string_slot, - (void*)XtOffsetOf(core_dir_config, ap_auth_type), OR_AUTHCFG, - "An HTTP authorization type (e.g., \"Basic\")"), -AP_INIT_TAKE1("AuthName", set_authname, NULL, OR_AUTHCFG, - "The authentication realm (e.g. \"Members Only\")"), -AP_INIT_RAW_ARGS("Require", require, NULL, OR_AUTHCFG, - "Selects which authenticated users or groups may access a protected space"), -AP_INIT_TAKE1("Satisfy", satisfy, NULL, OR_AUTHCFG, - "access policy if both allow and require used ('all' or 'any')"), -#ifdef GPROF -AP_INIT_TAKE1("GprofDir", set_gprof_dir, NULL, RSRC_CONF, - "Directory to plop gmon.out files"), -#endif -AP_INIT_TAKE1("AddDefaultCharset", set_add_default_charset, NULL, OR_FILEINFO, - "The name of the default charset to add to any Content-Type without one or 'Off' to disable"), - -/* Old resource config file commands */ - -AP_INIT_RAW_ARGS("AccessFileName", set_access_name, NULL, RSRC_CONF, - "Name(s) of per-directory config files (default: .htaccess)"), -AP_INIT_TAKE1("DocumentRoot", set_document_root, NULL, RSRC_CONF, - "Root directory of the document tree"), -AP_INIT_TAKE2("ErrorDocument", set_error_document, NULL, OR_FILEINFO, - "Change responses for HTTP errors"), -AP_INIT_RAW_ARGS("AllowOverride", set_override, NULL, ACCESS_CONF, - "Controls what groups of directives can be configured by per-directory " - "config files"), -AP_INIT_RAW_ARGS("Options", set_options, NULL, OR_OPTIONS, - "Set a number of attributes for a given directory"), -AP_INIT_TAKE1("DefaultType", ap_set_string_slot, - (void*)XtOffsetOf (core_dir_config, ap_default_type), - OR_FILEINFO, "the default MIME type for untypable files"), - -/* Old server config file commands */ - -AP_INIT_TAKE1("Port", server_port, NULL, RSRC_CONF, "A TCP port number"), -AP_INIT_TAKE1("HostnameLookups", set_hostname_lookups, NULL, - ACCESS_CONF|RSRC_CONF, - "\"on\" to enable, \"off\" to disable reverse DNS lookups, or \"double\" to " - "enable double-reverse DNS lookups"), -AP_INIT_TAKE1("ServerAdmin", set_server_string_slot, - (void *)XtOffsetOf (server_rec, server_admin), RSRC_CONF, - "The email address of the server administrator"), -AP_INIT_TAKE1("ServerName", set_server_string_slot, - (void *)XtOffsetOf (server_rec, server_hostname), RSRC_CONF, - "The hostname of the server"), -AP_INIT_TAKE1("ServerSignature", set_signature_flag, NULL, OR_ALL, - "En-/disable server signature (on|off|email)"), -AP_INIT_TAKE1("ServerRoot", set_server_root, NULL, RSRC_CONF, - "Common directory of server-related files (logs, confs, etc.)"), -AP_INIT_TAKE1("ErrorLog", set_server_string_slot, - (void *)XtOffsetOf (server_rec, error_fname), RSRC_CONF, - "The filename of the error log"), -AP_INIT_RAW_ARGS("ServerAlias", set_server_alias, NULL, RSRC_CONF, - "A name or names alternately used to access the server"), -AP_INIT_TAKE1("ServerPath", set_serverpath, NULL, RSRC_CONF, - "The pathname the server can be reached at"), -AP_INIT_TAKE1("Timeout", set_timeout, NULL, RSRC_CONF, - "Timeout duration (sec)"), -AP_INIT_FLAG("IdentityCheck", set_idcheck, NULL, RSRC_CONF|ACCESS_CONF, - "Enable identd (RFC 1413) user lookups - SLOW"), -AP_INIT_FLAG("ContentDigest", set_content_md5, NULL, OR_OPTIONS, - "whether or not to send a Content-MD5 header with each request"), -AP_INIT_TAKE1("UseCanonicalName", set_use_canonical_name, NULL, - RSRC_CONF|ACCESS_CONF, - "How to work out the ServerName : Port when constructing URLs"), -/* TODO: RlimitFoo should all be part of mod_cgi, not in the core */ -/* TODO: ListenBacklog in MPM */ -AP_INIT_TAKE1("Include", include_config, NULL, - (RSRC_CONF | ACCESS_CONF | EXEC_ON_READ), - "Name of the config file to be included"), -AP_INIT_TAKE1("LogLevel", set_loglevel, NULL, RSRC_CONF, - "Level of verbosity in error logging"), -AP_INIT_TAKE1("NameVirtualHost", ap_set_name_virtual_host, NULL, RSRC_CONF, - "A numeric IP address:port, or the name of a host"), -#ifdef _OSD_POSIX -AP_INIT_TAKE1("BS2000Account", set_bs2000_account, NULL, RSRC_CONF, - "Name of server User's bs2000 logon account name"), -#endif -#ifdef WIN32 -AP_INIT_TAKE1("ScriptInterpreterSource", set_interpreter_source, NULL, - OR_FILEINFO, - "Where to find interpreter to run Win32 scripts (Registry or script shebang line)"), -#endif -AP_INIT_TAKE1("ServerTokens", set_serv_tokens, NULL, RSRC_CONF, - "Determine tokens displayed in the Server: header - Min(imal), OS or Full"), -AP_INIT_TAKE1("LimitRequestLine", set_limit_req_line, NULL, RSRC_CONF, - "Limit on maximum size of an HTTP request line"), -AP_INIT_TAKE1("LimitRequestFieldsize", set_limit_req_fieldsize, NULL, - RSRC_CONF, - "Limit on maximum size of an HTTP request header field"), -AP_INIT_TAKE1("LimitRequestFields", set_limit_req_fields, NULL, RSRC_CONF, - "Limit (0 = unlimited) on max number of header fields in a request message"), -AP_INIT_TAKE1("LimitRequestBody", set_limit_req_body, - (void*)XtOffsetOf(core_dir_config, limit_req_body), OR_ALL, - "Limit (in bytes) on maximum size of request message body"), -AP_INIT_TAKE1("LimitXMLRequestBody", set_limit_xml_req_body, NULL, OR_ALL, - "Limit (in bytes) on maximum size of an XML-based request " - "body"), - -/* System Resource Controls */ -#ifdef RLIMIT_CPU -AP_INIT_TAKE12("RLimitCPU", set_limit_cpu, - (void*)XtOffsetOf(core_dir_config, limit_cpu), - OR_ALL, "Soft/hard limits for max CPU usage in seconds"), -#else -AP_INIT_TAKE12("RLimitCPU", no_set_limit, NULL, - OR_ALL, "Soft/hard limits for max CPU usage in seconds"), -#endif -#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined (RLIMIT_AS) -AP_INIT_TAKE12("RLimitMEM", set_limit_mem, - (void*)XtOffsetOf(core_dir_config, limit_mem), - OR_ALL, "Soft/hard limits for max memory usage per process"), -#else -AP_INIT_TAKE12("RLimitMEM", no_set_limit, NULL, - OR_ALL, "Soft/hard limits for max memory usage per process"), -#endif -#ifdef RLIMIT_NPROC -AP_INIT_TAKE12("RLimitNPROC", set_limit_nproc, - (void*)XtOffsetOf(core_dir_config, limit_nproc), - OR_ALL, "soft/hard limits for max number of processes per uid"), -#else -AP_INIT_TAKE12("RLimitNPROC", no_set_limit, NULL, - OR_ALL, "soft/hard limits for max number of processes per uid"), -#endif -/* XXX These should be allowable in .htaccess files, but currently it won't - * play well with the Options stuff. Until that is fixed, I would prefer - * to leave it just in the conf file. Other should feel free to disagree - * with me. Rbb. - */ -AP_INIT_ITERATE("SetOutputFilter", add_filter, NULL, ACCESS_CONF, - "filters to be run"), -AP_INIT_ITERATE("SetInputFilter", add_input_filter, NULL, ACCESS_CONF, - "filters to be run on the request body"), -{ NULL } -}; - -/***************************************************************** - * - * Core handlers for various phases of server operation... - */ - -AP_DECLARE_NONSTD(int) ap_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, 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->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_size_t *readbytes) -{ - 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) { - if (!fd) { - if (nvec == MAX_IOVEC_TO_WRITE) { - /* woah! too many. stop now. */ - more = apr_brigade_split(b, e); - break; - } - vec[nvec].iov_base = (char*) str; - vec[nvec].iov_len = n; - nvec++; - } - else { - /* The bucket is a trailer to a file bucket */ - - if (nvec_trailers == MAX_IOVEC_TO_WRITE) { - /* woah! too many. stop now. */ - more = apr_brigade_split(b, e); - break; - } - vec_trailers[nvec_trailers].iov_base = (char*) str; - vec_trailers[nvec_trailers].iov_len = n; - nvec_trailers++; - } - nbytes += n; - } - } - } - - /* 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 + flen < AP_MIN_BYTES_TO_WRITE) && !APR_BUCKET_IS_FLUSH(e)) - || (nbytes + flen < AP_MIN_BYTES_TO_WRITE && 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 *bucket = NULL; - /* If we are in here, then this request is a keepalive. We - * need to be certain that any data in a bucket is valid - * after the request_pool is cleared. - */ - if (ctx->b == NULL) { - ctx->b = apr_brigade_create(f->c->pool); - } - - APR_BRIGADE_FOREACH(bucket, b) { - const char *str; - apr_size_t n; - - rv = apr_bucket_read(bucket, &str, &n, APR_BLOCK_READ); - - /* This apr_brigade_write does not use a flush function - because we assume that we will not write enough data - into it to cause a flush. However, if we *do* write - "too much", then we could end up with transient - buckets which would suck. This works for now, but is - a bit shaky if changes are made to some of the - buffering sizes. Let's do an assert to prevent - potential future problems... */ - AP_DEBUG_ASSERT(AP_MIN_BYTES_TO_WRITE <= - APR_BUCKET_BUFF_SIZE); - apr_brigade_write(ctx->b, NULL, NULL, str, n); - } - apr_brigade_destroy(b); - } - else { - 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) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, c->base_server, - "core_output_filter: writing data to the network"); - if (more) - apr_brigade_destroy(more); - if (APR_STATUS_IS_ECONNABORTED(rv) || - APR_STATUS_IS_ECONNRESET(rv)) { - c->aborted = 1; - } - 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 int core_create_req(request_rec *r) -{ - if (r->main) { - ap_set_module_config(r->request_config, &core_module, - ap_get_module_config(r->main->request_config, &core_module)); - } - else { - core_request_config *req_cfg; - - 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); - } - return OK; -} - -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); - ap_hook_create_request(core_create_req, NULL, NULL, APR_HOOK_MIDDLE); - - /* 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("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 7a786ff4d8..0000000000 --- a/server/error_bucket.c +++ /dev/null @@ -1,106 +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/>. - */ - -#include "http_protocol.h" -#include "apr_buckets.h" -#include "apr_strings.h" -#include <stdlib.h> -#if APR_HAVE_STRINGS_H -#include <strings.h> -#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; - h->data = (buf) ? apr_pstrdup(p, buf) : NULL; - - b->length = 0; - b->start = 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 *b = (apr_bucket *)calloc(1, sizeof(*b)); - - APR_BUCKET_INIT(b); - return 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 5bc1f97f01..0000000000 --- a/server/gen_test_char.c +++ /dev/null @@ -1,128 +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. - */ - -#include "apr.h" -#include "apr_lib.h" - -#if APR_HAVE_STDIO_H -#include <stdio.h> -#endif - -/* we need some of the portability definitions... for strchr */ -#include "ap_config.h" -#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 (!apr_isalnum(c) && !strchr("$-_.+!*'(),:@&=~", c)) { - flags |= T_ESCAPE_PATH_SEGMENT; - } - - if (!apr_isalnum(c) && !strchr("$-_.+!*'(),:@&=/~", c)) { - flags |= T_OS_ESCAPE_PATH; - } - - /* these are the "tspecials" from RFC2068 */ - if (apr_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 26c12386db..0000000000 --- a/server/gen_test_char.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gen_test_char" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.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 AllowPerConfigDependencies 0 -# 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 "" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" -# 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" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "..\include" /I "..\srclib\apr\include" /I "..\srclib\apr-util\include" /I "..\os\win32" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fd"Release\gen_test_char" /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 /incremental:no /pdb:"Release\gen_test_char.pdb" /machine:I386 -# ADD LINK32 kernel32.lib /nologo /subsystem:console /incremental:no /pdb:"Release\gen_test_char.pdb" /machine:I386 - -!ELSEIF "$(CFG)" == "gen_test_char - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" -# 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" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\include" /I "..\srclib\apr\include" /I "..\srclib\apr-util\include" /I "..\os\win32" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fd"Debug\gen_test_char" /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 /incremental:no /pdb:"Debug\gen_test_char.pdb" /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib /nologo /subsystem:console /incremental:no /pdb:"Debug\gen_test_char.pdb" /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "gen_test_char - Win32 Release" -# Name "gen_test_char - Win32 Debug" -# Begin Source File - -SOURCE=.\gen_test_char.c -# End Source File -# End Target -# End Project diff --git a/server/gen_test_char.mak b/server/gen_test_char.mak deleted file mode 100644 index c884e79eb4..0000000000 --- a/server/gen_test_char.mak +++ /dev/null @@ -1,300 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on gen_test_char.dsp -!IF "$(CFG)" == "" -CFG=gen_test_char - Win32 Debug -!MESSAGE No configuration specified. Defaulting to gen_test_char - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "gen_test_char - Win32 Release" && "$(CFG)" !=\ - "gen_test_char - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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 -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "gen_test_char - Win32 Release" - -OUTDIR=. -INTDIR=.\Release -# Begin Custom Macros -OutDir=. -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\gen_test_char.exe" - -!ELSE - -ALL : "aprutil - Win32 Release" "apr - Win32 Release"\ - "$(OUTDIR)\gen_test_char.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\gen_test_char.idb" - -@erase "$(INTDIR)\gen_test_char.obj" - -@erase "$(OUTDIR)\gen_test_char.exe" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "..\include" /I "..\srclib\apr\include" /I\ - "..\srclib\apr-util\include" /I "..\os\win32" /D "WIN32" /D "NDEBUG" /D\ - "_CONSOLE" /D "_MBCS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\gen_test_char" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\gen_test_char.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:console /incremental:no\ - /pdb:"$(OUTDIR)\Release\gen_test_char.pdb" /machine:I386\ - /out:"$(OUTDIR)\gen_test_char.exe" -LINK32_OBJS= \ - "$(INTDIR)\gen_test_char.obj" \ - "..\srclib\apr-util\LibR\aprutil.lib" \ - "..\srclib\apr\LibR\apr.lib" - -"$(OUTDIR)\gen_test_char.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "gen_test_char - Win32 Debug" - -OUTDIR=. -INTDIR=.\Debug -# Begin Custom Macros -OutDir=. -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\gen_test_char.exe" - -!ELSE - -ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\gen_test_char.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\gen_test_char.idb" - -@erase "$(INTDIR)\gen_test_char.obj" - -@erase "$(OUTDIR)\Debug\gen_test_char.pdb" - -@erase "$(OUTDIR)\gen_test_char.exe" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Zi /Od /I "..\include" /I\ - "..\srclib\apr\include" /I "..\srclib\apr-util\include" /I "..\os\win32" /D\ - "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\gen_test_char" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\gen_test_char.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:console /incremental:no\ - /pdb:"$(OUTDIR)\Debug\gen_test_char.pdb" /debug /machine:I386\ - /out:"$(OUTDIR)\gen_test_char.exe" -LINK32_OBJS= \ - "$(INTDIR)\gen_test_char.obj" \ - "..\srclib\apr-util\LibD\aprutil.lib" \ - "..\srclib\apr\LibD\apr.lib" - -"$(OUTDIR)\gen_test_char.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "gen_test_char - Win32 Release" || "$(CFG)" ==\ - "gen_test_char - Win32 Debug" - -!IF "$(CFG)" == "gen_test_char - Win32 Release" - -"apr - Win32 Release" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\apr.mak CFG="apr - Win32 Release" - cd "..\..\server" - -"apr - Win32 ReleaseCLEAN" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\apr.mak CFG="apr - Win32 Release" RECURSE=1\ - - cd "..\..\server" - -!ELSEIF "$(CFG)" == "gen_test_char - Win32 Debug" - -"apr - Win32 Debug" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\apr.mak CFG="apr - Win32 Debug" - cd "..\..\server" - -"apr - Win32 DebugCLEAN" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\apr.mak CFG="apr - Win32 Debug" RECURSE=1 - cd "..\..\server" - -!ENDIF - -!IF "$(CFG)" == "gen_test_char - Win32 Release" - -"aprutil - Win32 Release" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" - cd "..\..\server" - -"aprutil - Win32 ReleaseCLEAN" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\aprutil.mak" CFG="aprutil - Win32 Release"\ - RECURSE=1 - cd "..\..\server" - -!ELSEIF "$(CFG)" == "gen_test_char - Win32 Debug" - -"aprutil - Win32 Debug" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" - cd "..\..\server" - -"aprutil - Win32 DebugCLEAN" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"\ - RECURSE=1 - cd "..\..\server" - -!ENDIF - -SOURCE=.\gen_test_char.c -DEP_CPP_GEN_T=\ - "..\include\ap_config.h"\ - "..\include\ap_mmn.h"\ - "..\include\ap_release.h"\ - "..\include\httpd.h"\ - "..\include\pcreposix.h"\ - "..\include\util_uri.h"\ - "..\os\win32\os.h"\ - "..\srclib\apr-util\include\apr_hooks.h"\ - "..\srclib\apr-util\include\apu.h"\ - "..\srclib\apr\include\apr.h"\ - "..\srclib\apr\include\apr_errno.h"\ - "..\srclib\apr\include\apr_file_info.h"\ - "..\srclib\apr\include\apr_file_io.h"\ - "..\srclib\apr\include\apr_general.h"\ - "..\srclib\apr\include\apr_lib.h"\ - "..\srclib\apr\include\apr_network_io.h"\ - "..\srclib\apr\include\apr_pools.h"\ - "..\srclib\apr\include\apr_tables.h"\ - "..\srclib\apr\include\apr_time.h"\ - "..\srclib\apr\include\apr_user.h"\ - "..\srclib\apr\include\apr_want.h"\ - -NODEP_CPP_GEN_T=\ - "..\include\ap_config_auto.h"\ - - -"$(INTDIR)\gen_test_char.obj" : $(SOURCE) $(DEP_CPP_GEN_T) "$(INTDIR)" - - - -!ENDIF - diff --git a/server/gen_uri_delims.c b/server/gen_uri_delims.c deleted file mode 100644 index df82916083..0000000000 --- a/server/gen_uri_delims.c +++ /dev/null @@ -1,89 +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. - */ - -#include <stdio.h> - -/* generate a apr_table_t of 256 values, where certain characters are - * marked "interesting"... for the uri parsing process. - */ - -int main(int argc, char *argv[]) -{ - int i; - char *value; - - printf("/* this file is automatically generated by " - "gen_uri_delims, do not edit */\n"); - printf("static const unsigned char uri_delims[256] = {"); - for (i = 0; i < 256; ++i) { - if (i % 20 == 0) - printf("\n "); - switch (i) { - case ':': value = "T_COLON"; break; - case '/': value = "T_SLASH"; break; - case '?': value = "T_QUESTION"; break; - case '#': value = "T_HASH"; break; - case '\0': value = "T_NUL"; break; - default: value = "0"; break; - } - printf("%s%c", value, (i < 255) ? ',' : ' '); - } - printf("\n};\n"); - - return 0; -} diff --git a/server/gen_uri_delims.dsp b/server/gen_uri_delims.dsp deleted file mode 100644 index fafe5bfea0..0000000000 --- a/server/gen_uri_delims.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gen_uri_delims" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=gen_uri_delims - 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_uri_delims.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_uri_delims.mak" CFG="gen_uri_delims - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gen_uri_delims - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "gen_uri_delims - 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)" == "gen_uri_delims - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" -# 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" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fd"Release\gen_uri_delims" /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 /incremental:no /pdb:"Release\gen_uri_delims.pdb" /machine:I386 -# ADD LINK32 kernel32.lib /nologo /subsystem:console /incremental:no /pdb:"Release\gen_uri_delims.pdb" /machine:I386 - -!ELSEIF "$(CFG)" == "gen_uri_delims - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" -# 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" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fd"Debug\gen_uri_delims" /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 /incremental:no /pdb:"Debug\gen_uri_delims.pdb" /debug /machine:I386 -# ADD LINK32 kernel32.lib /nologo /subsystem:console /incremental:no /pdb:"Debug\gen_uri_delims.pdb" /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "gen_uri_delims - Win32 Release" -# Name "gen_uri_delims - Win32 Debug" -# Begin Source File - -SOURCE=.\gen_uri_delims.c -# End Source File -# End Target -# End Project diff --git a/server/gen_uri_delims.mak b/server/gen_uri_delims.mak deleted file mode 100644 index 5084add7e0..0000000000 --- a/server/gen_uri_delims.mak +++ /dev/null @@ -1,203 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on gen_uri_delims.dsp -!IF "$(CFG)" == "" -CFG=gen_uri_delims - Win32 Debug -!MESSAGE No configuration specified. Defaulting to gen_uri_delims - Win32\ - Debug. -!ENDIF - -!IF "$(CFG)" != "gen_uri_delims - Win32 Release" && "$(CFG)" !=\ - "gen_uri_delims - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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_uri_delims.mak" CFG="gen_uri_delims - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gen_uri_delims - Win32 Release" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "gen_uri_delims - Win32 Debug" (based on\ - "Win32 (x86) Console Application") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "gen_uri_delims - Win32 Release" - -OUTDIR=. -INTDIR=.\Release -# Begin Custom Macros -OutDir=. -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\gen_uri_delims.exe" - -!ELSE - -ALL : "$(OUTDIR)\gen_uri_delims.exe" - -!ENDIF - -CLEAN : - -@erase "$(INTDIR)\gen_uri_delims.idb" - -@erase "$(INTDIR)\gen_uri_delims.obj" - -@erase "$(OUTDIR)\gen_uri_delims.exe" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS"\ - /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\gen_uri_delims" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\gen_uri_delims.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:console /incremental:no\ - /pdb:"$(OUTDIR)\Release\gen_uri_delims.pdb" /machine:I386\ - /out:"$(OUTDIR)\gen_uri_delims.exe" -LINK32_OBJS= \ - "$(INTDIR)\gen_uri_delims.obj" - -"$(OUTDIR)\gen_uri_delims.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "gen_uri_delims - Win32 Debug" - -OUTDIR=. -INTDIR=.\Debug -# Begin Custom Macros -OutDir=. -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\gen_uri_delims.exe" - -!ELSE - -ALL : "$(OUTDIR)\gen_uri_delims.exe" - -!ENDIF - -CLEAN : - -@erase "$(INTDIR)\gen_uri_delims.idb" - -@erase "$(INTDIR)\gen_uri_delims.obj" - -@erase "$(OUTDIR)\Debug\gen_uri_delims.pdb" - -@erase "$(OUTDIR)\gen_uri_delims.exe" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D\ - "_MBCS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\gen_uri_delims" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\gen_uri_delims.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:console /incremental:no\ - /pdb:"$(OUTDIR)\Debug\gen_uri_delims.pdb" /debug /machine:I386\ - /out:"$(OUTDIR)\gen_uri_delims.exe" -LINK32_OBJS= \ - "$(INTDIR)\gen_uri_delims.obj" - -"$(OUTDIR)\gen_uri_delims.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "gen_uri_delims - Win32 Release" || "$(CFG)" ==\ - "gen_uri_delims - Win32 Debug" -SOURCE=.\gen_uri_delims.c - -"$(INTDIR)\gen_uri_delims.obj" : $(SOURCE) "$(INTDIR)" - - - -!ENDIF - diff --git a/server/listen.c b/server/listen.c deleted file mode 100644 index a525de09ba..0000000000 --- a/server/listen.c +++ /dev/null @@ -1,390 +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. - */ - -#include "apr_network_io.h" -#include "apr_strings.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#define CORE_PRIVATE -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "ap_listen.h" -#include "http_log.h" -#include "mpm.h" -#include "mpm_common.h" - - -ap_listen_rec *ap_listeners; -#if APR_HAVE_IPV6 -static int default_family = APR_UNSPEC; -#else -static int default_family = APR_INET; -#endif -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 apr_status_t make_sock(apr_pool_t *p, ap_listen_rec *server) -{ - apr_socket_t *s = server->sd; - int one = 1; - apr_status_t stat; - - stat = apr_setsocketopt(s, APR_SO_REUSEADDR, one); - if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) { - ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p, - "make_sock: for address %pI, setsockopt: (SO_REUSEADDR)", - server->bind_addr); - apr_socket_close(s); - return stat; - } - - stat = apr_setsocketopt(s, APR_SO_KEEPALIVE, one); - if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) { - ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p, - "make_sock: for address %pI, setsockopt: (SO_KEEPALIVE)", - server->bind_addr); - apr_socket_close(s); - return stat; - } - - /* - * 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 <johnh@isi.edu> 25-Oct-96 - * - * If no size is specified, use the kernel default. - */ - if (send_buffer_size) { - stat = apr_setsocketopt(s, APR_SO_SNDBUF, send_buffer_size); - if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) { - ap_log_perror(APLOG_MARK, APLOG_WARNING, stat, p, - "make_sock: failed to set SendBufferSize for " - "address %pI, using default", - server->bind_addr); - /* not a fatal error */ - } - } - -#if APR_TCP_NODELAY_INHERITED - ap_sock_disable_nagle(s); -#endif - - if ((stat = apr_bind(s, server->bind_addr)) != APR_SUCCESS) { - ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p, - "make_sock: could not bind to address %pI", - server->bind_addr); - apr_socket_close(s); - return stat; - } - - if ((stat = apr_listen(s, ap_listenbacklog)) != APR_SUCCESS) { - ap_log_perror(APLOG_MARK, APLOG_ERR, stat, p, - "make_sock: unable to listen for connections on address %pI", - server->bind_addr); - apr_socket_close(s); - return stat; - } - -#ifdef APR_HAS_SO_ACCEPTFILTER -#ifndef ACCEPT_FILTER_NAME -#define ACCEPT_FILTER_NAME "dataready" -#endif - apr_socket_accept_filter(s, ACCEPT_FILTER_NAME, ""); -#endif - - server->sd = s; - server->active = 1; - return APR_SUCCESS; -} - -static apr_status_t close_listeners_on_exec(void *v) -{ - ap_listen_rec *lr; - - for (lr = ap_listeners; lr; lr = lr->next) { - apr_socket_close(lr->sd); - lr->active = 0; - } - return APR_SUCCESS; -} - - -static void find_default_family(apr_pool_t *p) -{ -#if APR_HAVE_IPV6 - /* We know the platform supports IPv6, but this particular - * system may not have IPv6 enabled. See if we can get an - * AF_INET6 socket. - */ - if (default_family == APR_UNSPEC) { - apr_socket_t *tmp_sock; - - if (apr_socket_create(&tmp_sock, APR_INET6, SOCK_STREAM, - p) == APR_SUCCESS) { - apr_socket_close(tmp_sock); - default_family = APR_INET6; - } - else { - default_family = APR_INET; - } - } -#endif -} - - -static void alloc_listener(process_rec *process, char *addr, apr_port_t port) -{ - ap_listen_rec **walk; - ap_listen_rec *new; - apr_status_t status; - char *oldaddr; - apr_port_t oldport; - apr_sockaddr_t *sa; - - if (!addr) { /* don't bind to specific interface */ - find_default_family(process->pool); - switch(default_family) { - case APR_INET: - addr = "0.0.0.0"; - break; -#if APR_HAVE_IPV6 - case APR_INET6: - addr = "::"; - break; -#endif - default: - ap_assert(1 != 1); /* should not occur */ - } - } - - /* see if we've got an old listener for this address:port */ - for (walk = &old_listeners; *walk; walk = &(*walk)->next) { - sa = (*walk)->bind_addr; - apr_sockaddr_port_get(&oldport, sa); - apr_sockaddr_ip_get(&oldaddr, sa); - if (!strcmp(oldaddr, addr) && port == oldport) { - /* re-use existing record */ - new = *walk; - *walk = new->next; - new->next = ap_listeners; - ap_listeners = new; - return; - } - } - - /* this has to survive restarts */ - new = apr_palloc(process->pool, sizeof(ap_listen_rec)); - new->active = 0; - if ((status = apr_sockaddr_info_get(&new->bind_addr, addr, APR_UNSPEC, port, 0, - process->pool)) != APR_SUCCESS) { - ap_log_perror(APLOG_MARK, APLOG_CRIT, status, process->pool, - "alloc_listener: failed to set up sockaddr for %s", addr); - return; - } - if ((status = apr_socket_create(&new->sd, new->bind_addr->sa.sin.sin_family, - SOCK_STREAM, process->pool)) != APR_SUCCESS) { - ap_log_perror(APLOG_MARK, APLOG_CRIT, status, process->pool, - "alloc_listener: failed to get a socket for %s", addr); - return; - } - new->next = ap_listeners; - ap_listeners = new; -} - -#if !defined(SPMT_OS2_MPM) -static -#endif -int ap_listen_open(process_rec *process, apr_port_t port) -{ - apr_pool_t *pconf = process->pconf; - ap_listen_rec *lr; - ap_listen_rec *next; - int num_open; - - /* allocate a default listener if necessary */ - if (ap_listeners == NULL) { - alloc_listener(process, NULL, port ? port : DEFAULT_HTTP_PORT); - } - - num_open = 0; - for (lr = ap_listeners; lr; lr = lr->next) { - if (lr->active) { - ++num_open; - } - else { - if (make_sock(pconf, lr) == APR_SUCCESS) { - ++num_open; - lr->active = 1; - } - } - } - - /* close the old listeners */ - for (lr = old_listeners; lr; lr = next) { - apr_socket_close(lr->sd); - lr->active = 0; - next = lr->next; -/* free(lr);*/ - } - old_listeners = NULL; - - apr_pool_cleanup_register(pconf, NULL, apr_pool_cleanup_null, close_listeners_on_exec); - - return num_open ? 0 : -1; -} - -int ap_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; -} - -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, const char *ips) -{ - char *host, *scope_id; - apr_port_t port; - apr_status_t rv; - - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - rv = apr_parse_addr_port(&host, &scope_id, &port, ips, cmd->pool); - if (rv != APR_SUCCESS) { - return "Invalid address or port"; - } - if (host && !strcmp(host, "*")) { - host = NULL; - } - if (scope_id) { - /* XXX scope id support is useful with link-local IPv6 addresses */ - return "Scope id is not supported"; - } - if (!port) { - return "Port must be specified"; - } - - alloc_listener(cmd->server->process, host, port); - - return NULL; -} - -const char *ap_set_listenbacklog(cmd_parms *cmd, void *dummy, const 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, const 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 4ba0b4c6f3..0000000000 --- a/server/log.c +++ /dev/null @@ -1,753 +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. - */ - -/* - * http_log.c: Dealing with the logs and errors - * - * Rob McCool - * - */ - -#include "apr.h" -#include "apr_general.h" /* for signal stuff */ -#include "apr_strings.h" -#include "apr_errno.h" -#include "apr_thread_proc.h" -#include "apr_lib.h" -#include "apr_signal.h" - -#define APR_WANT_STDIO -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if APR_HAVE_STDARG_H -#include <stdarg.h> -#endif -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#endif - -#define CORE_PRIVATE - -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_log.h" -#include "http_main.h" - -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 apr_file_t *stderr_log; - -AP_DECLARE(void) ap_open_stderr_log(apr_pool_t *p) -{ - apr_file_open_stderr(&stderr_log, p); -} - -static int log_child(apr_pool_t *p, const char *progname, - apr_file_t **fpin) -{ - /* 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... - */ - apr_status_t rc; - apr_procattr_t *procattr; - apr_proc_t *procnew; - -#ifdef SIGHUP - /* No concept of a child process on Win32 */ - apr_signal(SIGHUP, SIG_IGN); -#endif /* ndef SIGHUP */ - - if (((rc = apr_procattr_create(&procattr, p)) == APR_SUCCESS) && - ((rc = apr_procattr_io_set(procattr, - APR_FULL_BLOCK, - APR_NO_PIPE, - APR_NO_PIPE)) == APR_SUCCESS)) { - char **args; - const char *pname; - - apr_tokenize_to_argv(progname, &args, p); - pname = apr_pstrdup(p, args[0]); - procnew = (apr_proc_t *) apr_pcalloc(p, sizeof(*procnew)); - rc = apr_proc_create(procnew, pname, (const char * const *)args, - NULL, procattr, p); - - if (rc == APR_SUCCESS) { - apr_pool_note_subprocess(p, procnew, kill_after_timeout); - (*fpin) = procnew->in; - } - } - - return(rc); -} - -static void open_error_log(server_rec *s, apr_pool_t *p) -{ - const char *fname; - int rc; - - if (*s->error_fname == '|') { - apr_file_t *dummy = NULL; - - /* This starts a new process... */ - rc = log_child (p, s->error_fname+1, &dummy); - if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL, - "Couldn't start ErrorLog process"); - 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); - rc = apr_file_open(&s->error_log, fname, - APR_APPEND | APR_READ | APR_WRITE | APR_CREATE, - APR_OS_DEFAULT, p); - if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL, - "%s: could not open error log file %s.", - ap_server_argv0, fname); - exit(1); - } - } -} - -void ap_open_logs(server_rec *s_main, apr_pool_t *p) -{ - apr_status_t rc = APR_SUCCESS; - server_rec *virt, *q; - int replace_stderr; - apr_file_t *errfile = NULL; - - open_error_log(s_main, p); - - replace_stderr = 1; - if (s_main->error_log) { - /* replace stderr with this new log */ - apr_file_flush(s_main->error_log); - apr_file_open_stderr(&errfile, p); - if ((rc = apr_file_dup(&errfile, s_main->error_log, p)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rc, 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, errno, 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; - } -} - -AP_DECLARE(void) ap_error_log2stderr(server_rec *s) { - apr_file_t *errfile = NULL; - - apr_file_open_stderr(&errfile, s->process->pool); - if (s->error_log != NULL) { - apr_file_dup(&(s->error_log), errfile, s->process->pool); - } -} - -static void log_error_core(const char *file, int line, int level, - apr_status_t status, const server_rec *s, - const request_rec *r, apr_pool_t *pool, - const char *fmt, va_list args) -{ - char errstr[MAX_STRING_LEN]; - size_t len; - apr_file_t *logf = NULL; - const char *referer; - int level_and_mask = level & APLOG_LEVELMASK; - - 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_and_mask != APLOG_NOTICE) && - (level_and_mask > DEFAULT_LOGLEVEL)) - return; - logf = stderr_log; - } - 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_and_mask != APLOG_NOTICE) && - (level_and_mask > 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_and_mask != APLOG_NOTICE) && - (level_and_mask > 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_and_mask > s->loglevel) - return; - } - - if (logf && ((level & APLOG_STARTUP) != APLOG_STARTUP)) { - errstr[0] = '['; - apr_ctime(errstr + 1, apr_time_now()); - errstr[1 + APR_CTIME_LEN - 1] = ']'; - errstr[1 + APR_CTIME_LEN ] = ' '; - len = 1 + APR_CTIME_LEN + 1; - } else { - len = 0; - } - - if ((level & APLOG_STARTUP) != APLOG_STARTUP) { - len += apr_snprintf(errstr + len, MAX_STRING_LEN - len, - "[%s] ", priorities[level_and_mask].t_name); - } -#ifndef TPF - if (file && level_and_mask == 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') { - apr_snprintf(tmp, sizeof(tmp), "%s", &e[1]); - e = &tmp[strlen(tmp)-1]; - if (*e == ')') - *e = '\0'; - file = tmp; - } -#endif /*_OSD_POSIX*/ - len += apr_snprintf(errstr + len, MAX_STRING_LEN - len, - "%s(%d): ", file, line); - } -#endif /* TPF */ - if (r && r->connection) { - /* 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 += apr_snprintf(errstr + len, MAX_STRING_LEN - len, - "[client %s] ", r->connection->remote_ip); - } - if (!(level & APLOG_NOERRNO) - && (status != 0)) { - char buf[120]; - len += apr_snprintf(errstr + len, MAX_STRING_LEN - len, - "(%d)%s: ", status, apr_strerror(status, buf, sizeof(buf))); - } - len += apr_vsnprintf(errstr + len, MAX_STRING_LEN - len, fmt, args); - - if (r && (referer = apr_table_get(r->headers_in, "Referer"))) { - len += apr_snprintf(errstr + len, MAX_STRING_LEN - len, - ", referer: %s", referer); - } - - /* NULL if we are logging to syslog */ - if (logf) { - /* Truncate for the terminator (as apr_snprintf does) */ - if (len > MAX_STRING_LEN - sizeof(APR_EOL_STR)) - len = MAX_STRING_LEN - sizeof(APR_EOL_STR); - strcpy(errstr + len, APR_EOL_STR); - apr_file_puts(errstr, logf); - apr_file_flush(logf); - } -#ifdef HAVE_SYSLOG - else { - syslog(level_and_mask, "%s", errstr); - } -#endif -} - -AP_DECLARE(void) ap_log_error(const char *file, int line, int level, - apr_status_t status, const server_rec *s, - const char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - log_error_core(file, line, level, status, s, NULL, NULL, fmt, args); - va_end(args); -} - -AP_DECLARE(void) ap_log_perror(const char *file, int line, int level, - apr_status_t status, apr_pool_t *p, - const char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - log_error_core(file, line, level, status, NULL, NULL, p, fmt, args); - va_end(args); -} - -AP_DECLARE(void) ap_log_rerror(const char *file, int line, int level, - apr_status_t status, const request_rec *r, - const char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - log_error_core(file, line, level, status, r->server, r, NULL, 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) - && (apr_table_get(r->notes, "error-notes") == NULL)) { - apr_table_setn(r->notes, "error-notes", - ap_escape_html(r->pool, apr_pvsprintf(r->pool, fmt, - args))); - } - va_end(args); -} - -void ap_log_pid(apr_pool_t *p, const char *fname) -{ - apr_file_t *pid_file = NULL; - apr_finfo_t finfo; - static pid_t saved_pid = -1; - pid_t mypid; - apr_status_t rv; - - if (!fname) - return; - - fname = ap_server_root_relative(p, fname); - mypid = getpid(); - if (mypid != saved_pid - && apr_stat(&finfo, fname, APR_FINFO_MTIME, p) == APR_SUCCESS) { - /* WINCH 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_perror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, p, - apr_psprintf(p, - "pid file %s overwritten -- Unclean shutdown of previous Apache run?", - fname) - ); - } - - if ((rv = apr_file_open(&pid_file, fname, APR_WRITE | APR_CREATE | APR_TRUNCATE, - APR_UREAD | APR_UWRITE | APR_GREAD | APR_WREAD, p)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, - "could not create %s", fname); - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, NULL, - "%s: could not log pid to file %s", - ap_server_argv0, fname); - exit(1); - } - apr_file_printf(pid_file, "%ld" APR_EOL_STR, (long)mypid); - apr_file_close(pid_file); - saved_pid = mypid; -} - -AP_DECLARE(void) ap_log_assert(const char *szExp, const char *szFile, int nLine) -{ - char time_str[APR_CTIME_LEN]; - - apr_ctime(time_str, apr_time_now()); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "[%s] file %s, line %d, assertion \"%s\" failed", - time_str, szFile, nLine, szExp); -#ifndef WIN32 - /* unix assert does an abort leading to a core dump */ - abort(); -#else - exit(1); -#endif -} - -/* piped log support */ - -#ifdef AP_HAVE_RELIABLE_PIPED_LOGS -/* forward declaration */ -static void piped_log_maintenance(int reason, void *data, apr_wait_t status); - -static int piped_log_spawn(piped_log *pl) -{ - int rc; - apr_procattr_t *procattr; - apr_proc_t *procnew = NULL; - apr_status_t status; - -#ifdef SIGHUP - apr_signal(SIGHUP, SIG_IGN); -#endif - if (((status = apr_procattr_create(&procattr, pl->p)) != APR_SUCCESS) || - ((status = apr_procattr_child_in_set(procattr, ap_piped_log_read_fd(pl), - ap_piped_log_write_fd(pl))) != APR_SUCCESS)) { - char buf[120]; - /* Something bad happened, give up and go away. */ - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "piped_log_spawn: unable to setup child process '%s': %s", - pl->program, apr_strerror(status, buf, sizeof(buf))); - rc = -1; - } - else { - char **args; - const char *pname; - - apr_tokenize_to_argv(pl->program, &args, pl->p); - pname = apr_pstrdup(pl->p, args[0]); - procnew = apr_pcalloc(pl->p, sizeof(apr_proc_t)); - rc = apr_proc_create(procnew, pname, (const char * const *) args, - NULL, procattr, pl->p); - - if (rc == APR_SUCCESS) { - /* pjr - This no longer happens inside the child, */ - /* I am assuming that if apr_proc_create was */ - /* successful that the child is running. */ - RAISE_SIGSTOP(PIPED_LOG_SPAWN); - pl->pid = procnew; - ap_piped_log_write_fd(pl) = procnew->in; - apr_proc_other_child_register(procnew, piped_log_maintenance, pl, - ap_piped_log_write_fd(pl), pl->p); - } - } - - return 0; -} - - -static void piped_log_maintenance(int reason, void *data, apr_wait_t status) -{ - piped_log *pl = data; - apr_status_t stats; - - switch (reason) { - case APR_OC_REASON_DEATH: - pl->pid = NULL; - apr_proc_other_child_unregister(pl); - if (pl->program == NULL) { - /* during a restart */ - break; - } - break; - case APR_OC_REASON_LOST: - pl->pid = NULL; - apr_proc_other_child_unregister(pl); - if (pl->program == NULL) { - /* during a restart */ - break; - } - if ((stats = piped_log_spawn(pl)) != APR_SUCCESS) { - /* what can we do? This could be the error log we're having - * problems opening up... */ - char buf[120]; - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "piped_log_maintenance: unable to respawn '%s': %s", - pl->program, apr_strerror(stats, buf, sizeof(buf))); - } - break; - - case APR_OC_REASON_UNWRITABLE: - /* We should not kill off the pipe here, since it may only be full. - * If it really is locked, we should kill it off manually. */ - break; - - case APR_OC_REASON_RESTART: - pl->program = NULL; - if (pl->pid != NULL) { - apr_proc_kill(pl->pid, SIGTERM); - } - break; - - case APR_OC_REASON_UNREGISTER: - break; - } -} - - -static apr_status_t piped_log_cleanup(void *data) -{ - piped_log *pl = data; - - if (pl->pid != NULL) { - apr_proc_kill(pl->pid, SIGTERM); - } - apr_proc_other_child_unregister(pl); - apr_file_close(ap_piped_log_read_fd(pl)); - apr_file_close(ap_piped_log_write_fd(pl)); - return APR_SUCCESS; -} - - -static apr_status_t piped_log_cleanup_for_exec(void *data) -{ - piped_log *pl = data; - - apr_file_close(ap_piped_log_read_fd(pl)); - apr_file_close(ap_piped_log_write_fd(pl)); - return APR_SUCCESS; -} - -AP_DECLARE(piped_log *) ap_open_piped_log(apr_pool_t *p, const char *program) -{ - piped_log *pl; - - pl = apr_palloc(p, sizeof (*pl)); - pl->p = p; - pl->program = apr_pstrdup(p, program); - pl->pid = NULL; - if (apr_file_pipe_create(&ap_piped_log_read_fd(pl), &ap_piped_log_write_fd(pl), p) != APR_SUCCESS) { - return NULL; - } - apr_pool_cleanup_register(p, pl, piped_log_cleanup, piped_log_cleanup_for_exec); - if (piped_log_spawn(pl) == -1) { - int save_errno = errno; - apr_pool_cleanup_kill(p, pl, piped_log_cleanup); - apr_file_close(ap_piped_log_read_fd(pl)); - apr_file_close(ap_piped_log_write_fd(pl)); - errno = save_errno; - return NULL; - } - return pl; -} - -#else /* !AP_HAVE_RELIABLE_PIPED_LOGS */ - -static apr_status_t piped_log_cleanup(void *data) -{ - piped_log *pl = data; - - apr_file_close(ap_piped_log_write_fd(pl)); - return APR_SUCCESS; -} - -AP_DECLARE(piped_log *) ap_open_piped_log(apr_pool_t *p, const char *program) -{ - piped_log *pl; - apr_file_t *dummy = NULL; - int rc; - - rc = log_child(p, program, &dummy); - if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL, - "Couldn't start piped log process"); - exit (1); - } - - pl = apr_palloc(p, sizeof (*pl)); - pl->p = p; - ap_piped_log_read_fd(pl) = NULL; - ap_piped_log_write_fd(pl) = dummy; - apr_pool_cleanup_register(p, pl, piped_log_cleanup, piped_log_cleanup); - - return pl; -} - -#endif - -AP_DECLARE(void) ap_close_piped_log(piped_log *pl) -{ - apr_pool_cleanup_run(pl->p, pl, piped_log_cleanup); -} - diff --git a/server/main.c b/server/main.c deleted file mode 100644 index ad71b60d2b..0000000000 --- a/server/main.c +++ /dev/null @@ -1,464 +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. - */ - -#include "apr.h" -#include "apr_strings.h" -#include "apr_getopt.h" -#include "apr_general.h" -#include "apr_lib.h" - -#define APR_WANT_STDIO -#include "apr_want.h" - -#define CORE_PRIVATE -#include "ap_config.h" -#include "httpd.h" -#include "http_main.h" -#include "http_log.h" -#include "http_config.h" -#include "http_vhost.h" -#include "util_uri.h" -#include "util_ebcdic.h" -#include "ap_mpm.h" - -/* WARNING: Win32 binds http_main.c dynamically to the server. Please place - * extern functions and global data in another appropriate module. - * - * Most significant main() global data can be found in http_config.c - */ - -/* XXX - We should be able to grab the per-MPM settings here too */ -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 APACHE_MPM_DIR - printf(" -D APACHE_MPM_DIR=\"%s\"\n", APACHE_MPM_DIR); -#endif -#ifdef HAVE_SHMGET - printf(" -D HAVE_SHMGET\n"); -#endif -#if APR_FILE_BASED_SHM - printf(" -D APR_FILE_BASED_SHM\n"); -#endif -#if APR_HAS_MMAP - printf(" -D APR_HAS_MMAP\n"); -#endif -#ifdef NO_WRITEV - printf(" -D NO_WRITEV\n"); -#endif -#ifdef NO_LINGCLOSE - printf(" -D NO_LINGCLOSE\n"); -#endif -#if APR_HAVE_IPV6 - printf(" -D APR_HAVE_IPV6\n"); -#endif -#if APR_USE_FLOCK_SERIALIZE - printf(" -D APR_USE_FLOCK_SERIALIZE\n"); -#endif -#if APR_USE_SYSVSEM_SERIALIZE - printf(" -D APR_USE_SYSVSEM_SERIALIZE\n"); -#endif -#if APR_USE_FCNTL_SERIALIZE - printf(" -D APR_USE_FCNTL_SERIALIZE\n"); -#endif -#if APR_USE_PROC_PTHREAD_SERIALIZE - printf(" -D APR_USE_PROC_PTHREAD_SERIALIZE\n"); -#endif -#if APR_USE_PTHREAD_SERIALIZE - printf(" -D APR_USE_PTHREAD_SERIALIZE\n"); -#endif -#if APR_PROCESS_LOCK_IS_GLOBAL - printf(" -D APR_PROCESS_LOCK_IS_GLOBAL\n"); -#endif -#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT - printf(" -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT\n"); -#endif -#if APR_HAS_OTHER_CHILD - printf(" -D APR_HAS_OTHER_CHILD\n"); -#endif -#ifdef AP_HAVE_RELIABLE_PIPED_LOGS - printf(" -D AP_HAVE_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 -#if APR_CHARSET_EBCDIC - printf(" -D APR_CHARSET_EBCDIC\n"); -#endif -#ifdef APACHE_XLATE - printf(" -D APACHE_XLATE\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_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 -} - -static void destroy_and_exit_process(process_rec *process, int process_exit_value) -{ - apr_pool_destroy(process->pool); /* and destroy all descendent pools */ - apr_terminate(); - exit(process_exit_value); -} - -static process_rec *create_process(int argc, const char * const *argv) -{ - process_rec *process; - apr_pool_t *cntx; - apr_status_t stat; - - stat = apr_pool_create(&cntx, NULL); - if (stat != APR_SUCCESS) { - /* XXX From the time that we took away the NULL pool->malloc mapping - * we have been unable to log here without segfaulting. - */ - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL, - "apr_pool_create() failed to create " - "initial context"); - apr_terminate(); - exit(1); - } - - ap_open_stderr_log(cntx); - - process = apr_palloc(cntx, sizeof(process_rec)); - process->pool = cntx; - - apr_pool_create(&process->pconf, process->pool); - process->argc = argc; - process->argv = argv; - process->short_name = apr_filename_of_pathname(argv[0]); - return process; -} - -static void usage(process_rec *process) -{ - const char *bin = process->argv[0]; - char pad[MAX_STRING_LEN]; - unsigned i; - - for (i = 0; i < strlen(bin); i++) - pad[i] = ' '; - pad[i] = '\0'; -#ifdef SHARED_CORE - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0,NULL , "Usage: %s [-R directory] [-D name] [-d directory] [-f file]", bin); -#else - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Usage: %s [-D name] [-d directory] [-f file]", bin); -#endif - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-C \"directive\"] [-c \"directive\"]", pad); -#ifdef WIN32 - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-k restart|shutdown|start]", pad); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-n service_name]", pad); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-i] [-u]", pad); -#endif - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-v] [-V] [-h] [-l] [-L] [-t] [-T]", pad); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Options:"); -#ifdef SHARED_CORE - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -R directory : specify an alternate location for shared object files"); -#endif - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -D name : define a name for use in <IfDefine name> directives"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -d directory : specify an alternate initial ServerRoot"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -f file : specify an alternate ServerConfigFile"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -C \"directive\" : process directive before reading config files"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -c \"directive\" : process directive after reading config files"); -#ifdef WIN32 - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -n name : set service name and use its ServerConfigFile"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -k shutdown : tell running Apache to shutdown"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -k restart : tell running Apache to do a graceful restart"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -k start : tell Apache to start"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -i : install an Apache service"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -u : uninstall an Apache service"); -#endif - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -v : show version number"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -V : show compile settings"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -h : list available command line options (this page)"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -l : list compiled in modules"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -L : list available configuration directives"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -t -D DUMP_VHOSTS : show parsed settings (currently only vhost settings)"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -t : run syntax check for config files (with docroot check)"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -T : run syntax check for config files (without docroot check)"); - /* TODOC: -X goes away, expect MPMs to use -D options */ - destroy_and_exit_process(process, 1); -} - -int main(int argc, const char * const argv[]) -{ - char c; - int configtestonly = 0; - const char *confname = SERVER_CONFIG_FILE; - const char *def_server_root = HTTPD_ROOT; - process_rec *process; - server_rec *server_conf; - apr_pool_t *pglobal; - apr_pool_t *pconf; - apr_pool_t *plog; /* Pool of log streams, reset _after_ each read of conf */ - apr_pool_t *ptemp; /* Pool for temporary config stuff, reset often */ - apr_pool_t *pcommands; /* Pool for -D, -C and -c switches */ - apr_getopt_t *opt; - module **mod; - const char *optarg; - - apr_initialize(); - - process = create_process(argc, argv); - pglobal = process->pool; - pconf = process->pconf; - ap_server_argv0 = process->short_name; - -#if APR_CHARSET_EBCDIC - if (ap_init_ebcdic(pglobal) != APR_SUCCESS) { - destroy_and_exit_process(process, 1); - } -#endif - - ap_setup_prelinked_modules(process); - - apr_pool_create(&pcommands, pglobal); - ap_server_pre_read_config = apr_array_make(pcommands, 1, sizeof(char *)); - ap_server_post_read_config = apr_array_make(pcommands, 1, sizeof(char *)); - ap_server_config_defines = apr_array_make(pcommands, 1, sizeof(char *)); - - ap_run_rewrite_args(process); - - /* Maintain AP_SERVER_BASEARGS list in http_main.h to allow the MPM - * to safely pass on our args from its rewrite_args() handler. - */ - apr_getopt_init(&opt, pcommands, process->argc, process->argv); - - while (apr_getopt(opt, AP_SERVER_BASEARGS, &c, &optarg) - == APR_SUCCESS) { - char **new; - switch (c) { - case 'c': - new = (char **)apr_array_push(ap_server_post_read_config); - *new = apr_pstrdup(pcommands, optarg); - break; - case 'C': - new = (char **)apr_array_push(ap_server_pre_read_config); - *new = apr_pstrdup(pcommands, optarg); - break; - case 'd': - def_server_root = optarg; - break; - case 'D': - new = (char **)apr_array_push(ap_server_config_defines); - *new = apr_pstrdup(pcommands, optarg); - break; - case 'f': - confname = optarg; - break; - case 'v': - printf("Server version: %s\n", ap_get_server_version()); - printf("Server built: %s\n", ap_get_server_built()); - destroy_and_exit_process(process, 0); - case 'V': - show_compile_settings(); - destroy_and_exit_process(process, 0); - case 'l': - ap_show_modules(); - destroy_and_exit_process(process, 0); - case 'L': - ap_show_directives(); - destroy_and_exit_process(process, 0); - case 't': - configtestonly = 1; - break; - case '?': - case 'h': - usage(process); - } - } - - apr_pool_create(&plog, pglobal); - apr_pool_create(&ptemp, pconf); - - /* Note that we preflight the config file once - before reading it _again_ in the main loop. - This allows things, log files configuration - for example, to settle down. */ - - ap_server_root = def_server_root; - server_conf = ap_read_config(process, ptemp, confname, &ap_conftree); - ap_run_pre_config(pconf, plog, ptemp); - ap_process_config_tree(server_conf, ap_conftree, process->pconf, ptemp); - ap_fixup_virtual_hosts(pconf, server_conf); - ap_fini_vhost_config(pconf, server_conf); - apr_sort_hooks(); - if (configtestonly) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Syntax OK\n"); - destroy_and_exit_process(process, 0); - } - apr_pool_clear(plog); - ap_run_open_logs(pconf, plog, ptemp, server_conf); - ap_run_post_config(pconf, plog, ptemp, server_conf); - apr_pool_destroy(ptemp); - - for (;;) { - apr_hook_deregister_all(); - apr_pool_clear(pconf); - for (mod = ap_prelinked_modules; *mod != NULL; mod++) { - ap_register_hooks(*mod, pconf); - } - - - /* This is a hack until we finish the code so that it only reads - * the config file once and just operates on the tree already in - * memory. rbb - */ - ap_conftree = NULL; - apr_pool_create(&ptemp, pconf); - ap_server_root = def_server_root; - server_conf = ap_read_config(process, ptemp, confname, &ap_conftree); - ap_run_pre_config(pconf, plog, ptemp); - ap_process_config_tree(server_conf, ap_conftree, process->pconf, ptemp); - ap_fixup_virtual_hosts(pconf, server_conf); - ap_fini_vhost_config(pconf, server_conf); - apr_sort_hooks(); - apr_pool_clear(plog); - ap_run_open_logs(pconf, plog, ptemp, server_conf); - ap_run_post_config(pconf, plog, ptemp, server_conf); - apr_pool_destroy(ptemp); - - ap_run_optional_fn_retrieve(); - - if (ap_mpm_run(pconf, plog, server_conf)) break; - } - destroy_and_exit_process(process, 0); - return 0; /* Supress compiler warning. */ -} - -/* 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 */ - -#ifndef SHARED_CORE_BOOTSTRAP -/* - * Force apr_password_validate() into the image so that modules like - * mod_auth can use it even if they're dynamically loaded. - */ -void suck_in_apr_password_validate(void); -void suck_in_apr_password_validate(void) -{ - apr_password_validate("a", "b"); -} -#endif - -#ifdef AP_USING_AUTOCONF -/* This ugly little hack pulls any function referenced in exports.c into - * the web server. exports.c is generated during the build, and it - * has all of the APR functions specified by the apr/apr.exports and - * apr-util/aprutil.exports files. - */ -const void *suck_in_APR(void); -const void *suck_in_APR(void) -{ - extern const void *ap_ugly_hack; - - return ap_ugly_hack; -} -#endif diff --git a/server/mpm/.cvsignore b/server/mpm/.cvsignore deleted file mode 100644 index bd5fe06963..0000000000 --- a/server/mpm/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -.deps diff --git a/server/mpm/MPM.NAMING b/server/mpm/MPM.NAMING deleted file mode 100644 index 62b60a0328..0000000000 --- a/server/mpm/MPM.NAMING +++ /dev/null @@ -1,13 +0,0 @@ - -The following MPMs currently exist: - - prefork ....... Multi Process Model with Preforking (Apache 1.3) - perchild ...... Multi Process Model with Threading. - Constant number of processes, variable number of threads - each child process can have a different uid/gid. - threaded ...... Multi Process Model with Threading. - Variable number of processes, constant number of - threads/child (= Apache/thread) - spmt_os2 ...... Single Process Model with Threading on OS/2 - winnt ......... Single Process Model with Threading on Windows NT - diff --git a/server/mpm/Makefile.in b/server/mpm/Makefile.in deleted file mode 100644 index b68fee5cd7..0000000000 --- a/server/mpm/Makefile.in +++ /dev/null @@ -1,4 +0,0 @@ - -SUBDIRS = $(MPM_NAME) - -include $(top_srcdir)/build/rules.mk diff --git a/server/mpm/beos/.cvsignore b/server/mpm/beos/.cvsignore deleted file mode 100644 index 84df257214..0000000000 --- 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 3f88b0415f..0000000000 --- a/server/mpm/beos/Makefile.in +++ /dev/null @@ -1,5 +0,0 @@ - -LTLIBRARY_NAME = libbeos.la -LTLIBRARY_SOURCES = beos.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 c0128df9b5..0000000000 --- a/server/mpm/beos/beos.c +++ /dev/null @@ -1,1122 +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. - */ - -/* 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_strings.h" -#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 "ap_listen.h" -#include "scoreboard.h" -#include <kernel/OS.h> -#include "mpm_common.h" -#include "mpm.h" -#include <unistd.h> -#include <sys/socket.h> -#include <signal.h> - -/* - * Actual definitions of config globals - */ - -int ap_threads_per_child=HARD_THREAD_LIMIT; /* Worker threads per child */ -int ap_max_requests_per_child=0; -static const char *ap_pid_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 int num_listening_sockets = 0; /* set by open_listeners in ap_mpm_run */ -static apr_socket_t ** listening_sockets; -apr_lock_t *accept_mutex = NULL; - -static apr_pool_t *pconf; /* Pool for config stuff */ -static apr_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; -apr_lock_t *worker_thread_count_mutex; - -/* The structure used to pass unique initialization info to each thread */ -typedef struct { - int slot; - apr_pool_t *tpool; -} proc_info; - -/* - * 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; -char ap_coredump_dir[MAX_STRING_LEN]; - -static apr_socket_t *udp_sock; -static apr_sockaddr_t *udp_sa; - -/* shared http_main globals... */ - -server_rec *ap_server_conf; - -/* one_process */ -static int one_process = 0; - -#ifdef DEBUG_SIGSTOP -int raise_sigstop_flags; -#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) - apr_pool_destroy(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_generation_t volatile ap_my_generation = 0; - -/* - * 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 tell_workers_to_exit(void) -{ - apr_size_t len; - int i = 0; - for (i = 0 ; i < ap_max_child_assigned; i++){ - len = 4; - if (apr_sendto(udp_sock, udp_sa, 0, "die!", &len) != APR_SUCCESS) - break; - } -} - -static void set_signals(void) -{ - struct sigaction sa; - - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - - if (!one_process) { - sa.sa_handler = sig_coredump; - - if (sigaction(SIGSEGV, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGSEGV)"); - if (sigaction(SIGBUS, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGBUS)"); - if (sigaction(SIGABRT, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGABRT)"); - if (sigaction(SIGILL, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGILL)"); - 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_IGN; - if (sigaction(SIGPIPE, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGPIPE)"); - - /* 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)"); -} - -/***************************************************************** - * 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) -{ - conn_rec *current_conn; - long conn_id = my_child_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, - "filedescriptor (%u) larger than FD_SETSIZE (%u) " - "found, you probably need to rebuild Apache with a " - "larger FD_SETSIZE", csd, FD_SETSIZE); - apr_socket_close(sock); - return; - } - - 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); - } -} - -static int32 worker_thread(void * dummy) -{ - proc_info * ti = dummy; - int child_slot = ti->slot; - 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; - apr_status_t rv = APR_EINIT; - int srv , n; - int curr_pollfd = 0, last_pollfd = 0; - sigset_t sig_mask; - int requests_this_child = ap_max_requests_per_child; - apr_pollfd_t *pollset; - /* each worker thread is in control of it's own destiny...*/ - int this_worker_should_exit = 0; - free(ti); - - /* block the signals for this thread */ - sigfillset(&sig_mask); - sigprocmask(SIG_BLOCK, &sig_mask, NULL); - - apr_pool_create(&ptrans, tpool); - - apr_lock_acquire(worker_thread_count_mutex); - worker_thread_count++; - apr_lock_release(worker_thread_count_mutex); - - (void) ap_update_child_status(0, child_slot, SERVER_STARTING, - (request_rec*)NULL); - - apr_poll_setup(&pollset, num_listening_sockets, tpool); - for(n=0 ; n <= num_listening_sockets ; n++) - apr_poll_socket_add(pollset, listening_sockets[n], APR_POLLIN); - - while (1) { - /* If we're here, then chances are (unless we're the first thread created) we're going - to be held up on the accept_muetx, so doing this here shouldn't be a peformance hit. - If it is, you probably need more threads... - */ - - this_worker_should_exit |= (ap_max_requests_per_child != 0) && (requests_this_child <= 0); - - if (this_worker_should_exit) break; - - (void) ap_update_child_status(0, child_slot, SERVER_READY, - (request_rec*)NULL); - - apr_lock_acquire(accept_mutex); - - while (!this_worker_should_exit) { - apr_int16_t event; - apr_status_t ret; - - ret = apr_poll(pollset, &srv, -1); - - if (ret != APR_SUCCESS) { - if (APR_STATUS_IS_EINTR(ret)) { - continue; - } - /* 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)"); - this_worker_should_exit = 1; - } else { - /* if we've bailed in apr_poll what's the point of trying to use the data? */ - apr_poll_revents_get(&event, listening_sockets[0], pollset); - - if (event & APR_POLLIN){ - apr_sockaddr_t *rec_sa; - char *tmpbuf = apr_pcalloc(ptrans, sizeof(char) * 5); - apr_size_t len = 5; - apr_sockaddr_info_get(&rec_sa, "127.0.0.1", APR_UNSPEC, 7772, 0, ptrans); - - if ((ret = apr_recvfrom(rec_sa, listening_sockets[0], 0, tmpbuf, &len)) - != APR_SUCCESS){ - ap_log_error(APLOG_MARK, APLOG_ERR, ret, NULL, - "error getting data from UDP!!"); - }else { - /* add checking??? */ - } - 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... */ - apr_poll_revents_get(&event, listening_sockets[curr_pollfd], pollset); - - 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) { - rv = apr_accept(&csd, sd, ptrans); - apr_lock_release(accept_mutex); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf, - "apr_accept"); - } else { - process_socket(ptrans, csd, child_slot); - requests_this_child--; - } - } - else { - apr_lock_release(accept_mutex); - break; - } - apr_pool_clear(ptrans); - - } - - ap_update_child_status(0, child_slot, SERVER_DEAD, (request_rec*)NULL); - - apr_lock_acquire(worker_thread_count_mutex); - worker_thread_count--; - apr_lock_release(worker_thread_count_mutex); - - return (0); -} - -static int make_worker(server_rec *s, int slot) -{ - thread_id tid; - proc_info *my_info = (proc_info *)malloc(sizeof(proc_info)); /* freed by thread... */ - - 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; - apr_pool_create(&my_info->tpool, pchild); - - if (slot + 1 > ap_max_child_assigned) - ap_max_child_assigned = slot + 1; - - if (one_process) { - set_signals(); - ap_scoreboard_image->parent[0].pid = getpid(); - return 0; - } - - (void) ap_update_child_status(0, slot, SERVER_STARTING, (request_rec*)NULL); - 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. */ - (void) ap_update_child_status(0, slot, SERVER_DEAD, - (request_rec*)NULL); - - sleep(10); - free(my_info); - - return -1; - } - resume_thread(tid); - - ap_scoreboard_image->servers[0][slot].tid = tid; - 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_scoreboard_image->servers[0][i].tid) { - continue; - } - if (make_worker(ap_server_conf, i) < 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; - 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_scoreboard_image->servers[0][i].tid == 0) { - 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]); - } - /* 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; - 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 >= 0) { - ap_process_child_status(&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_scoreboard_image->servers[0][i].tid == pid.pid) { - child_slot = i; - break; - } - } - if (child_slot >= 0) { - ap_scoreboard_image->servers[0][child_slot].tid = 0; - (void) ap_update_child_status(0, child_slot, SERVER_DEAD, (request_rec*)NULL); - - 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); - --remaining_threads_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)", 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(); - } -} - -AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result) -{ - switch(query_code){ - case AP_MPMQ_MAX_DAEMONS: - *result = ap_max_child_assigned; - 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_MAX_THREADS: - *result = ap_threads_per_child; - return APR_SUCCESS; - } - return APR_ENOTIMPL; -} - -int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) -{ - int remaining_threads_to_start, i,j; - apr_status_t rv; - ap_listen_rec *lr; - pconf = _pconf; - ap_server_conf = s; - - ap_scoreboard_fname = DEFAULT_SCOREBOARD; - - /* BeOS R5 doesn't support pipes on select() calls, so we use a - UDP socket as these are supported in both R5 and BONE. If we only cared - about BONE we'd use a pipe, but there it is. - As we have UDP support in APR, now use the APR functions and check all the - return values... - */ - if (apr_sockaddr_info_get(&udp_sa, "127.0.0.1", APR_UNSPEC, 7772, 0, _pconf) - != APR_SUCCESS){ - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, s, - "couldn't create control socket information, shutting down"); - return 1; - } - if (apr_socket_create(&udp_sock, udp_sa->sa.sin.sin_family, SOCK_DGRAM, - _pconf) != APR_SUCCESS){ - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, s, - "couldn't create control socket, shutting down"); - return 1; - } - if (apr_bind(udp_sock, udp_sa) != APR_SUCCESS){ - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, s, - "couldn't bind UDP socket!"); - return 1; - } - - if ((num_listening_sockets = 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; - } - - 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 = apr_lock_create(&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 = apr_lock_create(&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) - ap_create_scoreboard(pconf, SB_SHARED); - - if (!is_graceful) { - for (i = 0; i < HARD_SERVER_LIMIT; i++) { - ap_scoreboard_image->parent[i].pid = 0; - for (j = 0;j < HARD_THREAD_LIMIT; j++) - ap_scoreboard_image->servers[i][j].tid = 0; - } - } - if (HARD_SERVER_LIMIT == 1) - ap_scoreboard_image->parent[0].pid = getpid(); - - set_signals(); - - /* Sanity checks 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. - */ - apr_pool_create(&pchild, pconf); - ap_run_child_init(pchild, ap_server_conf); - - /* Now that we have the child pool (pchild) we can allocate - * the listenfds and creat the pollset... - */ - listening_sockets = apr_palloc(pchild, - sizeof(*listening_sockets) * (num_listening_sockets + 1)); - - listening_sockets[0] = udp_sock; - for (lr = ap_listeners, i = 1; 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, 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; - - /* - * main_loop until it's all over - */ - server_main_loop(remaining_threads_to_start); - - tell_workers_to_exit(); /* if we get here we're exiting... */ - sleep(1); /* give them a brief chance to exit */ - - /* close the UDP socket we've been using... */ - apr_socket_close(listening_sockets[0]); - - /* - * 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, - 0, 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, 0, 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, 0, ap_server_conf, - "SIGWINCH received. Doing graceful restart"); - } - 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. - */ - - 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"); - } - - /* just before we go, tidy up the locks we've created to prevent a - * potential leak of semaphores... */ - apr_lock_destroy(worker_thread_count_mutex); - apr_lock_destroy(accept_mutex); - - return 0; -} - -static void beos_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(); - - server_pid = getpid(); - } - - beosd_pre_config(); - ap_listen_pre_config(); - ap_threads_to_start = DEFAULT_START_THREADS; - min_spare_threads = DEFAULT_MIN_FREE_THREADS; - max_spare_threads = DEFAULT_MAX_FREE_THREADS; - ap_thread_limit = HARD_THREAD_LIMIT; - ap_threads_per_child = DEFAULT_THREADS_PER_CHILD; - ap_pid_fname = DEFAULT_PIDLOG; - ap_scoreboard_fname = DEFAULT_SCOREBOARD; - ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; - - apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir)); -} - -static void beos_hooks(apr_pool_t *p) -{ - one_process = 0; - - ap_hook_pre_config(beos_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 <VirtualHost>"; - } - 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_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_threads_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_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, 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); - } - 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 command_rec beos_cmds[] = { -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( "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" ), -{ NULL } -}; - -module AP_MODULE_DECLARE_DATA 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 apr_table_t */ - beos_hooks /* register_hooks */ -}; - diff --git a/server/mpm/beos/beos.h b/server/mpm/beos/beos.h deleted file mode 100644 index 4b37a65ec9..0000000000 --- a/server/mpm/beos/beos.h +++ /dev/null @@ -1,69 +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 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 4f201408d6..0000000000 --- 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 3a652f0502..0000000000 --- a/server/mpm/beos/mpm.h +++ /dev/null @@ -1,77 +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 APACHE_MPM_BEOS_H -#define APACHE_MPM_BEOS_H - -#define BEOS_MPM -#include "scoreboard.h" - -#define MPM_NAME "Beos" -#define AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1 -#define MPM_SYNC_CHILD_TABLE() -#define MPM_CHILD_PID(i) (ap_scoreboard_image->servers[0][i].tid) -#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) - -extern int ap_max_child_assigned; - -extern server_rec *ap_server_conf; -extern char ap_coredump_dir[MAX_STRING_LEN]; -extern int ap_threads_per_child; - -#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 2517bb8c95..0000000000 --- a/server/mpm/beos/mpm_default.h +++ /dev/null @@ -1,149 +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 APACHE_MPM_DEFAULT_H -#define APACHE_MPM_DEFAULT_H - -/* we use the child (c) as zero in our code... */ -#define AP_ID_FROM_CHILD_THREAD(c, t) t -/* as the child is always zero, just return the id... */ -#define AP_CHILD_THREAD_FROM_ID(i) 0 , i - -/* 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_THREADS -#define DEFAULT_START_THREADS 25 -#endif - -/* Maximum number of *free* threads --- more than this, and - * they will die off. - */ - -#ifndef DEFAULT_MAX_FREE_THREADS -#define DEFAULT_MAX_FREE_THREADS 50 -#endif - -/* Minimum --- fewer than this, and more will be created */ - -#ifndef DEFAULT_MIN_FREE_THREADS -#define DEFAULT_MIN_FREE_THREADS 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. - */ - -/* we only ever have 1 main process running... */ -#define HARD_SERVER_LIMIT 1 - -/* 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 50 -#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 - -/* Scoreboard file, if there is one */ -#ifndef DEFAULT_SCOREBOARD -#define DEFAULT_SCOREBOARD "logs/apache_runtime_status" -#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 9d2c3fba6a..0000000000 --- a/server/mpm/config.m4 +++ /dev/null @@ -1,34 +0,0 @@ -AC_MSG_CHECKING(which MPM to use) -AC_ARG_WITH(mpm, -[ --with-mpm=MPM Choose the process model for Apache to use. - MPM={beos,threaded,prefork,spmt_os2,perchild}],[ - APACHE_MPM=$withval -],[ - if test "x$APACHE_MPM" = "x"; then - APACHE_MPM=threaded - fi -]) -AC_MSG_RESULT($APACHE_MPM) - -apache_cv_mpm=$APACHE_MPM - -if test "$apache_cv_mpm" = "threaded" -o "$apache_cv_mpm" = "perchild"; then - APR_CHECK_APR_DEFINE(APR_HAS_THREADS, srclib/apr) - - if test "x$ac_cv_define_APR_HAS_THREADS" = "xno"; then - AC_MSG_RESULT(The currently selected MPM requires threads which your system seems to lack) - AC_MSG_CHECKING(checking for replacement) - AC_MSG_RESULT(prefork selected) - apache_cv_mpm=prefork - fi -fi - -APACHE_FAST_OUTPUT(server/mpm/Makefile) - -MPM_NAME=$apache_cv_mpm -MPM_DIR=server/mpm/$MPM_NAME -MPM_LIB=$MPM_DIR/lib${MPM_NAME}.la - -APACHE_SUBST(MPM_NAME) -MODLIST="$MODLIST mpm_${MPM_NAME}" - diff --git a/server/mpm/experimental/perchild/.cvsignore b/server/mpm/experimental/perchild/.cvsignore deleted file mode 100644 index 84df257214..0000000000 --- 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 374f130646..0000000000 --- a/server/mpm/experimental/perchild/Makefile.in +++ /dev/null @@ -1,5 +0,0 @@ - -LTLIBRARY_NAME = libperchild.la -LTLIBRARY_SOURCES = perchild.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 bd179baed9..0000000000 --- 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 d24f8b4aba..0000000000 --- a/server/mpm/experimental/perchild/mpm.h +++ /dev/null @@ -1,91 +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. - */ - -#include "httpd.h" -#include "mpm_default.h" -#include "unixd.h" - -#ifndef APACHE_MPM_PERCHILD_H -#define APACHE_MPM_PERCHILD_H - -#define PERCHILD_MPM - -#define MPM_NAME "Perchild" - -#define AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1 -#define MPM_SYNC_CHILD_TABLE() -#define MPM_CHILD_PID(i) (ap_child_table[i].pid) -#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) - -/* 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_threads_per_child; -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 f462ea8f90..0000000000 --- a/server/mpm/experimental/perchild/mpm_default.h +++ /dev/null @@ -1,147 +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 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 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 0fa14997b1..0000000000 --- a/server/mpm/experimental/perchild/perchild.c +++ /dev/null @@ -1,1829 +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. - */ - -#include "apr_hash.h" -#include "apr_strings.h" -#include "apr_pools.h" -#include "apr_portable.h" -#include "apr_file_io.h" -#include "apr_signal.h" - -#define APR_WANT_IOVEC -#include "apr_want.h" - -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#endif -#if APR_HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif - -#if !APR_HAS_THREADS -#error The perchild 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_protocol.h" -#include "http_connection.h" -#include "ap_mpm.h" -#include "unixd.h" -#include "mpm_common.h" -#include "ap_listen.h" -#include "mpm_default.h" -#include "mpm.h" -#include "scoreboard.h" -#include "util_filter.h" - -/* ### should be APR-ized */ -#include <poll.h> -#include <grp.h> -#include <pwd.h> -#include <sys/stat.h> -#include <sys/un.h> -#include <setjmp.h> - -/* - * 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; -static int num_daemons=0; -static int curr_child_num=0; -static int workers_may_exit = 0; -static int requests_this_child; -static int num_listenfds = 0; -static apr_socket_t **listenfds; -static jmp_buf jmpbuffer; - -struct child_info_t { - uid_t uid; - gid_t gid; - int sd; -}; - -typedef struct { - const char *sockname; /* The base name for the socket */ - const char *fullsockname; /* socket base name + extension */ - int sd; /* The socket descriptor */ - int sd2; /* The socket descriptor */ -} perchild_server_conf; - -typedef struct child_info_t child_info_t; - -/* Tables used to determine the user and group each child process should - * run as. The hash table is used to correlate a server name with a child - * process. - */ -static child_info_t child_info_table[HARD_SERVER_LIMIT]; -static int thread_socket_table[HARD_THREAD_LIMIT]; - - -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; -int ap_threads_per_child = HARD_THREAD_LIMIT; - -char ap_coredump_dir[MAX_STRING_LEN]; - -module AP_MODULE_DECLARE_DATA mpm_perchild_module; - -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; - -/* *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 apr_pool_t *thread_pool_parent; /* Parent of per-thread pools */ -static apr_lock_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 apr_lock_t *worker_thread_count_mutex; -static int worker_thread_free_ids[HARD_THREAD_LIMIT]; -static apr_threadattr_t *worker_thread_attr; - -/* Keep track of the number of idle worker threads */ -static int idle_thread_count; -static apr_lock_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 apr_lock_t *process_accept_mutex; -#endif /* NO_SERIALIZED_ACCEPT */ -static const char *lock_fname; -static apr_lock_t *thread_accept_mutex; - -AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result) -{ - switch(query_code){ - case AP_MPMQ_MAX_DAEMONS: - *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_STATIC; - 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 = max_threads; - return APR_SUCCESS; - } - return APR_ENOTIMPL; -} - -/* a clean exit from a child with proper cleanup */ -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(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; -/* we don't currently track ap_my_generation, but mod_status - * references it so it must be defined */ -ap_generation_t volatile ap_my_generation=0; - -/* - * 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) -{ -#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) { - 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, long conn_id) -{ - conn_rec *current_conn; - int csd; - apr_status_t rv; - int thread_num = conn_id % HARD_THREAD_LIMIT; - - if ((rv = apr_os_sock_get(&csd, sock)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, "apr_os_sock_get"); - } - - 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; - } - - if (thread_socket_table[thread_num] < 0) { - 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); - } -} - -static void *worker_thread(void *); - -/* Starts a thread as long as we're below max_threads */ -static int start_thread(void) -{ - apr_thread_t *thread; - int rc; - - apr_lock_acquire(worker_thread_count_mutex); - if (worker_thread_count < max_threads - 1) { - if ((rc = apr_thread_create(&thread, worker_thread_attr, worker_thread, - &worker_thread_free_ids[worker_thread_count], pchild))) { - ap_log_error(APLOG_MARK, APLOG_ALERT, rc, 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); - workers_may_exit = 1; - apr_lock_release(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; - } - apr_lock_release(worker_thread_count_mutex); - return 0; - } - apr_lock_release(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) -{ - apr_lock_acquire(pipe_of_death_mutex); - if (!workers_may_exit) { - int ret; - char pipe_read_char; - apr_size_t n = 1; - - ret = apr_recv(listenfds[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); -} - -/* idle_thread_count should be incremented before starting a worker_thread */ - -static void *worker_thread(void *arg) -{ - apr_socket_t *csd = NULL; - apr_pool_t *tpool; /* Pool for this thread */ - apr_pool_t *ptrans; /* Pool for per-transaction stuff */ - apr_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; - apr_pollfd_t *pollset; - int n; - apr_status_t rv; - - apr_lock_acquire(thread_pool_parent_mutex); - apr_pool_create(&tpool, thread_pool_parent); - apr_lock_release(thread_pool_parent_mutex); - apr_pool_create(&ptrans, tpool); - - (void) ap_update_child_status(child_num, thread_num, SERVER_STARTING, - (request_rec *) NULL); - - apr_poll_setup(&pollset, num_listenfds+1, tpool); - for(n=0 ; n <= num_listenfds ; ++n) { - apr_poll_socket_add(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) { - apr_lock_acquire(idle_thread_count_mutex); - if (idle_thread_count < max_spare_threads) { - idle_thread_count++; - apr_lock_release(idle_thread_count_mutex); - } - else { - apr_lock_release(idle_thread_count_mutex); - break; - } - } - else { - thread_just_started = 0; - } - - (void) ap_update_child_status(child_num, thread_num, SERVER_READY, - (request_rec *) NULL); - - apr_lock_acquire(thread_accept_mutex); - if (workers_may_exit) { - apr_lock_release(thread_accept_mutex); - break; - } - if ((rv = SAFE_ACCEPT(apr_lock_acquire(process_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_int16_t event; - srv = apr_poll(pollset, &n, -1); - - if (srv != APR_SUCCESS) { - if (APR_STATUS_IS_EINTR(srv)) { - continue; - } - - /* apr_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, "apr_poll: (listen)"); - workers_may_exit = 1; - } - if (workers_may_exit) break; - - apr_poll_revents_get(&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; - } - - apr_poll_revents_get(&event, listenfds[1], pollset); - if (event & APR_POLLIN || event & APR_POLLOUT) { - /* This request is from another child in our current process. - * We should set a flag here, and then below we will read - * two bytes (the socket number and the NULL byte. - */ - thread_socket_table[thread_num] = -2; - goto got_from_other_child; - } - - 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? */ - apr_poll_revents_get(&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 = apr_accept(&csd, sd, ptrans)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf, "apr_accept"); - } - if ((rv = SAFE_ACCEPT(apr_lock_release(process_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; - } - apr_lock_release(thread_accept_mutex); - apr_lock_acquire(idle_thread_count_mutex); - if (idle_thread_count > min_spare_threads) { - idle_thread_count--; - } - else { - if (!start_thread()) { - idle_thread_count--; - } - } - apr_lock_release(idle_thread_count_mutex); - got_from_other_child: - if (thread_socket_table[thread_num] == -2) { - struct msghdr msg; - struct cmsghdr *cmsg; - char sockname[80]; - struct iovec iov; - int ret, sd, dp; - - iov.iov_base = sockname; - iov.iov_len = 80; - - msg.msg_name = NULL; - msg.msg_namelen = 0; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - cmsg = apr_palloc(ptrans, sizeof(*cmsg) + sizeof(sd)); - cmsg->cmsg_len = sizeof(*cmsg) + sizeof(sd); - msg.msg_control = (caddr_t)cmsg; - msg.msg_controllen = cmsg->cmsg_len; - msg.msg_flags = 0; - - ret = recvmsg(child_info_table[child_num].sd, &msg, 0); - - memcpy(&dp, CMSG_DATA(cmsg), sizeof(dp)); - - thread_socket_table[thread_num] = dp; - apr_os_sock_put(&csd, &child_info_table[child_num].sd, ptrans); - } - if (setjmp(jmpbuffer) != 1) { - process_socket(ptrans, csd, conn_id); - } - else { - thread_socket_table[thread_num] = -1; - } - requests_this_child--; - } else { - if ((rv = SAFE_ACCEPT(apr_lock_release(process_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; - } - apr_lock_release(thread_accept_mutex); - apr_lock_acquire(idle_thread_count_mutex); - idle_thread_count--; - apr_lock_release(idle_thread_count_mutex); - break; - } - apr_pool_clear(ptrans); - } - - apr_lock_acquire(thread_pool_parent_mutex); - ap_update_child_status(child_num, thread_num, SERVER_DEAD, - (request_rec *) NULL); - apr_pool_destroy(tpool); - apr_lock_release(thread_pool_parent_mutex); - apr_lock_acquire(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); - } - apr_lock_release(worker_thread_count_mutex); - - return NULL; -} - -/* 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(uid_t uid, gid_t gid) -{ - if (!geteuid()) { - const char *name; - - /* Get username if passed as a uid */ - - struct passwd *ent; - - if ((ent = getpwuid(uid)) == NULL) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, 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; - - /* - * Set the GID before initgroups(), since on some platforms - * setgid() is known to zap the group list. - */ - if (setgid(gid) == -1) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, - "setgid: unable to set group id to Group %u", - (unsigned)gid); - return -1; - } - - /* Reset `groups' attributes. */ - - if (initgroups(name, gid) == -1) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, - "initgroups: unable to set groups for User %s " - "and Group %u", name, (unsigned)gid); - return -1; - } - } - return 0; -} - - -static int perchild_setup_child(int childnum) -{ - child_info_t *ug = &child_info_table[childnum]; - - if (ug->uid == -1 && ug->gid == -1) { - return unixd_setup_child(); - } - if (set_group_privs(ug->uid, ug->gid)) { - return -1; - } - /* 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(ug->uid) == -1)) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, - "setuid: unable to change to uid: %ld", - (long) ug->uid); - return -1; - } - return 0; -} - -static int check_signal(int signum) -{ - switch (signum) { - case SIGTERM: - case SIGINT: - just_die(signum); - return 1; - } - return 0; -} - -static void child_main(int child_num_arg) -{ - int i; - ap_listen_rec *lr; - apr_status_t rv; - apr_thread_t *thread; - - my_pid = getpid(); - child_num = child_num_arg; - apr_pool_create(&pchild, pconf); - - /*stuff to do before we switch id's, so we have permissions.*/ - - rv = SAFE_ACCEPT(apr_lock_child_init(&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 (perchild_setup_child(child_num)) { - clean_child_exit(APEXIT_CHILDFATAL); - } - - ap_run_child_init(pchild, ap_server_conf); - - /*done with init critical section */ - - apr_setup_signal_thread(); - - requests_this_child = max_requests_per_child; - - /* Set up the pollfd array, num_listenfds + 1 for the pipe and 1 for - * the child socket. - */ - listenfds = apr_pcalloc(pchild, sizeof(*listenfds) * (num_listenfds + 2)); -#if APR_FILES_AS_SOCKETS - apr_socket_from_file(&listenfds[0], pipe_of_death_in); -#endif - - /* The child socket */ - apr_os_sock_put(&listenfds[1], &child_info_table[child_num].sd, pchild); - - num_listenfds++; - for (lr = ap_listeners, i = 2; 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; - } - apr_pool_create(&thread_pool_parent, pchild); - apr_lock_create(&thread_pool_parent_mutex, APR_MUTEX, APR_INTRAPROCESS, - NULL, pchild); - apr_lock_create(&idle_thread_count_mutex, APR_MUTEX, APR_INTRAPROCESS, - NULL, pchild); - 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); - apr_lock_create(&thread_accept_mutex, APR_MUTEX, APR_INTRAPROCESS, - NULL, pchild); - - apr_threadattr_create(&worker_thread_attr, pchild); - apr_threadattr_detach_set(worker_thread_attr, 1); - - /* 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; - } - } - - apr_signal_thread(check_signal); -} - -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_child_table[slot].pid = getpid(); - ap_child_table[slot].status = SERVER_ALIVE; - child_main(slot); - } - (void) ap_update_child_status(slot, 0, SERVER_STARTING, (request_rec *) NULL); - - 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 <sys/processor.h> - 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 - apr_signal(SIGTERM, just_die); - */ - child_main(slot); - clean_child_exit(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].pid) { - continue; - } - if (make_child(ap_server_conf, i) < 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; - 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].pid == 0) { - 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]); - } - /* 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; - 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 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) { - child_slot = i; - break; - } - } - if (child_slot >= 0) { - ap_child_table[child_slot].pid = 0; - ap_update_child_status(child_slot, i, SERVER_DEAD, (request_rec *) NULL); - - - 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); - --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 - * 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(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) -{ - int remaining_children_to_start; - int i; - apr_status_t rv; - apr_size_t one = 1; - - pconf = _pconf; - ap_server_conf = s; - if ((rv = apr_file_pipe_create(&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, - "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); - } - 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 = apr_psprintf(_pconf, "%s.%u", - ap_server_root_relative(_pconf, lock_fname), - my_pid); - rv = SAFE_ACCEPT(apr_lock_create(&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) { - ap_create_scoreboard(pconf, SB_SHARED); - } - /* Initialize the child table */ - if (!is_graceful) { - for (i = 0; i < HARD_SERVER_LIMIT; i++) { - ap_child_table[i].pid = 0; - } - } - - 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 */ - apr_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].pid) { - ap_child_table[i].status = SERVER_DYING; - } - } - /* give the children the signal to die */ - for (i = 0; i < num_daemons;) { - 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++; - } - } - 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(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp) -{ - static int restart_num = 0; - int no_detach = 0; - int i; - - 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(); - } - - my_pid = getpid(); - } - - unixd_pre_config(ptemp); - 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; - curr_child_num = 0; - - apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir)); - - for (i = 0; i < HARD_SERVER_LIMIT; i++) { - child_info_table[i].uid = -1; - child_info_table[i].gid = -1; - child_info_table[i].sd = -1; - } - for (i = 0; i < HARD_THREAD_LIMIT; i++) { - thread_socket_table[i] = -1; - } -} - -static int pass_request(request_rec *r) -{ - apr_socket_t *thesock = r->connection->client_socket; - struct msghdr msg; - struct cmsghdr *cmsg; - int sfd; - struct iovec iov; - apr_bucket_brigade *bb = apr_brigade_create(r->pool); - perchild_server_conf *sconf = (perchild_server_conf *) - ap_get_module_config(r->server->module_config, - &mpm_perchild_module); - char *foo; - apr_size_t len; - apr_size_t readbytes = 0; - - apr_pool_userdata_get((void **)&foo, "PERCHILD_BUFFER", r->connection->pool); - len = strlen(foo); - - apr_pool_userdata_set(NULL, "PERCHILD_BUFFER", apr_pool_cleanup_null, - r->connection->pool); - - apr_os_sock_get(&sfd, thesock); - - iov.iov_base = NULL; - iov.iov_len = 0; - - msg.msg_name = NULL; - msg.msg_namelen = 0; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - cmsg = apr_palloc(r->pool, sizeof(*cmsg) + sizeof(sfd)); - cmsg->cmsg_len = sizeof(*cmsg) + sizeof(int); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - - memcpy(CMSG_DATA(cmsg), &sfd, sizeof(sfd)); - - msg.msg_control = (caddr_t)cmsg; - msg.msg_controllen = cmsg->cmsg_len; - msg.msg_flags=0; - - if (sendmsg(sconf->sd2, &msg, 0) == -1) { - apr_pool_destroy(r->pool); - return -1; - } - - write(sconf->sd2, foo, len); - - while (ap_get_brigade(r->input_filters, bb, AP_MODE_NONBLOCKING, &readbytes) == APR_SUCCESS) { - apr_bucket *e; - APR_BRIGADE_FOREACH(e, bb) { - const char *str; - - apr_bucket_read(e, &str, &len, APR_NONBLOCK_READ); - write(sconf->sd2, str, len); - } - } - - apr_pool_destroy(r->pool); - return 1; -} - -static char *make_perchild_socket(const char *fullsockname, int sd[2]) -{ - socketpair(PF_UNIX, SOCK_STREAM, 0, sd); - return NULL; -} - - -static void perchild_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) -{ - int i; - server_rec *sr; - perchild_server_conf *sconf; - int def_sd[2]; - - def_sd[0] = -1; - def_sd[1] = -1; - - for (sr = s; sr; sr = sr->next) { - sconf = (perchild_server_conf *)ap_get_module_config(sr->module_config, - &mpm_perchild_module); - - if (sconf->sd == -1) { - sconf->fullsockname = apr_pstrcat(sr->process->pool, - sconf->sockname, ".DEFAULT", NULL); - if (def_sd[0] == -1) { - if (!make_perchild_socket(sconf->fullsockname, def_sd)) { - /* log error */ - } - } - sconf->sd = def_sd[0]; - sconf->sd2 = def_sd[1]; - } - } - - for (i = 0; i < num_daemons; i++) { - if (child_info_table[i].uid == -1) { - child_info_table[i].sd = def_sd[0]; - } - } -} - -static int perchild_post_read(request_rec *r) -{ - ap_filter_t *f = r->connection->input_filters; - int thread_num = r->connection->id % HARD_THREAD_LIMIT; - perchild_server_conf *sconf = (perchild_server_conf *) - ap_get_module_config(r->server->module_config, - &mpm_perchild_module); - - while (f) { - if (!strcmp("PERCHILD_BUFFER", f->frec->name)) { - ap_remove_output_filter(f); - break; - } - f = f->next; - } - - if (thread_socket_table[thread_num] != -1) { - apr_socket_t *csd = NULL; - - apr_os_sock_put(&csd, &thread_socket_table[thread_num], - r->connection->pool); - ap_sock_disable_nagle(csd); - r->connection->client_socket = csd; - return OK; - } - else { - if (sconf->sd != child_info_table[child_num].sd) { - if (pass_request(r) == -1) { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, - ap_server_conf, "Could not pass request to proper " - "child, request will not be honored."); - } - longjmp(jmpbuffer, 1); - } - return OK; - } - return OK; -} - -static apr_status_t perchild_buffer(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_size_t *readbytes) -{ - apr_bucket *e; - apr_status_t rv; - char *buffer = NULL; - const char *str; - apr_size_t len; - - if ((rv = ap_get_brigade(f->next, b, mode, readbytes)) != APR_SUCCESS) { - return rv; - } - - apr_pool_userdata_get((void **)&buffer, "PERCHILD_BUFFER", f->c->pool); - - APR_BRIGADE_FOREACH(e, b) { - if (e->length != 0) { - apr_bucket_read(e, &str, &len, APR_NONBLOCK_READ); - - if (buffer == NULL) { - buffer = apr_pstrndup(f->c->pool, str, len); - } - else { - buffer = apr_pstrcat(f->c->pool, buffer, - apr_pstrndup(f->c->pool, str, len), NULL); - } - } - } - apr_pool_userdata_set(buffer, "PERCHILD_BUFFER", apr_pool_cleanup_null, f->c->pool); - - return APR_SUCCESS; -} - -static int perchild_pre_connection(conn_rec *c) -{ - ap_add_input_filter("PERCHILD_BUFFER", NULL, NULL, c); - return OK; -} - -static void perchild_hooks(apr_pool_t *p) -{ - one_process = 0; - - ap_hook_pre_config(perchild_pre_config, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_post_config(perchild_post_config, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_pre_connection(perchild_pre_connection,NULL,NULL, APR_HOOK_MIDDLE); - - /* This must be run absolutely first. If this request isn't for this - * server then we need to forward it to the proper child. No sense - * tying up this server running more post_read request hooks if it is - * just going to be forwarded along. - */ - ap_hook_post_read_request(perchild_post_read, NULL, NULL, APR_HOOK_REALLY_FIRST); - ap_register_input_filter("PERCHILD_BUFFER", perchild_buffer, AP_FTYPE_CONTENT); -} - -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 <VirtualHost>"; - } - 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_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_child_per_uid(cmd_parms *cmd, void *dummy, const char *u, - const char *g, const char *num) -{ - int i; - int max_this_time = atoi(num) + curr_child_num; - for (i = curr_child_num; i < max_this_time; i++, curr_child_num++); { - child_info_t *ug = &child_info_table[i - 1]; - - if (i > num_daemons) { - return "Trying to use more child ID's than NumServers. Increase " - "NumServers in your config file."; - } - - ug->uid = atoi(u); - ug->gid = atoi(g); - } - return NULL; -} - -static const char *assign_childuid(cmd_parms *cmd, void *dummy, const char *uid, - const char *gid) -{ - int i; - int u = atoi(uid); - int g = atoi(gid); - const char *errstr; - int socks[2]; - perchild_server_conf *sconf = (perchild_server_conf *) - ap_get_module_config(cmd->server->module_config, - &mpm_perchild_module); - - sconf->fullsockname = apr_pstrcat(cmd->pool, sconf->sockname, ".", uid, ":", gid, NULL); - - if ((errstr = make_perchild_socket(sconf->fullsockname, socks))) { - return errstr; - } - - sconf->sd = socks[0]; - sconf->sd2 = socks[1]; - - for (i = 0; i < num_daemons; i++) { - if (u == child_info_table[i].uid && g == child_info_table[i].gid) { - child_info_table[i].sd = sconf->sd; - } - } - - return NULL; -} - - -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_TAKE1("CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF, - "The location of the directory Apache changes to before dumping core"), -AP_INIT_TAKE3("ChildperUserID", set_child_per_uid, NULL, RSRC_CONF, - "Specify a User and Group for a specific child process."), -AP_INIT_TAKE2("AssignUserID", assign_childuid, NULL, RSRC_CONF, - "Tie a virtual host to a specific child process."), -{ NULL } -}; - -static void *perchild_create_config(apr_pool_t *p, server_rec *s) -{ - perchild_server_conf *c = - (perchild_server_conf *) apr_pcalloc(p, sizeof(perchild_server_conf)); - - c->sd = -1; - return c; -} - -module AP_MODULE_DECLARE_DATA 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 */ - perchild_create_config, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - perchild_cmds, /* command apr_table_t */ - perchild_hooks /* register_hooks */ -}; - diff --git a/server/mpm/monitoring-services.txt b/server/mpm/monitoring-services.txt deleted file mode 100644 index 2466589025..0000000000 --- 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/perchild/.cvsignore b/server/mpm/perchild/.cvsignore deleted file mode 100644 index 84df257214..0000000000 --- a/server/mpm/perchild/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -*.lo -*.la -Makefile diff --git a/server/mpm/perchild/Makefile.in b/server/mpm/perchild/Makefile.in deleted file mode 100644 index 374f130646..0000000000 --- a/server/mpm/perchild/Makefile.in +++ /dev/null @@ -1,5 +0,0 @@ - -LTLIBRARY_NAME = libperchild.la -LTLIBRARY_SOURCES = perchild.c - -include $(top_srcdir)/build/ltlib.mk diff --git a/server/mpm/perchild/config5.m4 b/server/mpm/perchild/config5.m4 deleted file mode 100644 index bd179baed9..0000000000 --- a/server/mpm/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/perchild/mpm.h b/server/mpm/perchild/mpm.h deleted file mode 100644 index d24f8b4aba..0000000000 --- a/server/mpm/perchild/mpm.h +++ /dev/null @@ -1,91 +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. - */ - -#include "httpd.h" -#include "mpm_default.h" -#include "unixd.h" - -#ifndef APACHE_MPM_PERCHILD_H -#define APACHE_MPM_PERCHILD_H - -#define PERCHILD_MPM - -#define MPM_NAME "Perchild" - -#define AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1 -#define MPM_SYNC_CHILD_TABLE() -#define MPM_CHILD_PID(i) (ap_child_table[i].pid) -#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) - -/* 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_threads_per_child; -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/perchild/mpm_default.h b/server/mpm/perchild/mpm_default.h deleted file mode 100644 index f462ea8f90..0000000000 --- a/server/mpm/perchild/mpm_default.h +++ /dev/null @@ -1,147 +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 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 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/perchild/perchild.c b/server/mpm/perchild/perchild.c deleted file mode 100644 index 0fa14997b1..0000000000 --- a/server/mpm/perchild/perchild.c +++ /dev/null @@ -1,1829 +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. - */ - -#include "apr_hash.h" -#include "apr_strings.h" -#include "apr_pools.h" -#include "apr_portable.h" -#include "apr_file_io.h" -#include "apr_signal.h" - -#define APR_WANT_IOVEC -#include "apr_want.h" - -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#endif -#if APR_HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif - -#if !APR_HAS_THREADS -#error The perchild 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_protocol.h" -#include "http_connection.h" -#include "ap_mpm.h" -#include "unixd.h" -#include "mpm_common.h" -#include "ap_listen.h" -#include "mpm_default.h" -#include "mpm.h" -#include "scoreboard.h" -#include "util_filter.h" - -/* ### should be APR-ized */ -#include <poll.h> -#include <grp.h> -#include <pwd.h> -#include <sys/stat.h> -#include <sys/un.h> -#include <setjmp.h> - -/* - * 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; -static int num_daemons=0; -static int curr_child_num=0; -static int workers_may_exit = 0; -static int requests_this_child; -static int num_listenfds = 0; -static apr_socket_t **listenfds; -static jmp_buf jmpbuffer; - -struct child_info_t { - uid_t uid; - gid_t gid; - int sd; -}; - -typedef struct { - const char *sockname; /* The base name for the socket */ - const char *fullsockname; /* socket base name + extension */ - int sd; /* The socket descriptor */ - int sd2; /* The socket descriptor */ -} perchild_server_conf; - -typedef struct child_info_t child_info_t; - -/* Tables used to determine the user and group each child process should - * run as. The hash table is used to correlate a server name with a child - * process. - */ -static child_info_t child_info_table[HARD_SERVER_LIMIT]; -static int thread_socket_table[HARD_THREAD_LIMIT]; - - -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; -int ap_threads_per_child = HARD_THREAD_LIMIT; - -char ap_coredump_dir[MAX_STRING_LEN]; - -module AP_MODULE_DECLARE_DATA mpm_perchild_module; - -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; - -/* *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 apr_pool_t *thread_pool_parent; /* Parent of per-thread pools */ -static apr_lock_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 apr_lock_t *worker_thread_count_mutex; -static int worker_thread_free_ids[HARD_THREAD_LIMIT]; -static apr_threadattr_t *worker_thread_attr; - -/* Keep track of the number of idle worker threads */ -static int idle_thread_count; -static apr_lock_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 apr_lock_t *process_accept_mutex; -#endif /* NO_SERIALIZED_ACCEPT */ -static const char *lock_fname; -static apr_lock_t *thread_accept_mutex; - -AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result) -{ - switch(query_code){ - case AP_MPMQ_MAX_DAEMONS: - *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_STATIC; - 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 = max_threads; - return APR_SUCCESS; - } - return APR_ENOTIMPL; -} - -/* a clean exit from a child with proper cleanup */ -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(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; -/* we don't currently track ap_my_generation, but mod_status - * references it so it must be defined */ -ap_generation_t volatile ap_my_generation=0; - -/* - * 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) -{ -#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) { - 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, long conn_id) -{ - conn_rec *current_conn; - int csd; - apr_status_t rv; - int thread_num = conn_id % HARD_THREAD_LIMIT; - - if ((rv = apr_os_sock_get(&csd, sock)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, "apr_os_sock_get"); - } - - 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; - } - - if (thread_socket_table[thread_num] < 0) { - 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); - } -} - -static void *worker_thread(void *); - -/* Starts a thread as long as we're below max_threads */ -static int start_thread(void) -{ - apr_thread_t *thread; - int rc; - - apr_lock_acquire(worker_thread_count_mutex); - if (worker_thread_count < max_threads - 1) { - if ((rc = apr_thread_create(&thread, worker_thread_attr, worker_thread, - &worker_thread_free_ids[worker_thread_count], pchild))) { - ap_log_error(APLOG_MARK, APLOG_ALERT, rc, 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); - workers_may_exit = 1; - apr_lock_release(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; - } - apr_lock_release(worker_thread_count_mutex); - return 0; - } - apr_lock_release(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) -{ - apr_lock_acquire(pipe_of_death_mutex); - if (!workers_may_exit) { - int ret; - char pipe_read_char; - apr_size_t n = 1; - - ret = apr_recv(listenfds[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); -} - -/* idle_thread_count should be incremented before starting a worker_thread */ - -static void *worker_thread(void *arg) -{ - apr_socket_t *csd = NULL; - apr_pool_t *tpool; /* Pool for this thread */ - apr_pool_t *ptrans; /* Pool for per-transaction stuff */ - apr_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; - apr_pollfd_t *pollset; - int n; - apr_status_t rv; - - apr_lock_acquire(thread_pool_parent_mutex); - apr_pool_create(&tpool, thread_pool_parent); - apr_lock_release(thread_pool_parent_mutex); - apr_pool_create(&ptrans, tpool); - - (void) ap_update_child_status(child_num, thread_num, SERVER_STARTING, - (request_rec *) NULL); - - apr_poll_setup(&pollset, num_listenfds+1, tpool); - for(n=0 ; n <= num_listenfds ; ++n) { - apr_poll_socket_add(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) { - apr_lock_acquire(idle_thread_count_mutex); - if (idle_thread_count < max_spare_threads) { - idle_thread_count++; - apr_lock_release(idle_thread_count_mutex); - } - else { - apr_lock_release(idle_thread_count_mutex); - break; - } - } - else { - thread_just_started = 0; - } - - (void) ap_update_child_status(child_num, thread_num, SERVER_READY, - (request_rec *) NULL); - - apr_lock_acquire(thread_accept_mutex); - if (workers_may_exit) { - apr_lock_release(thread_accept_mutex); - break; - } - if ((rv = SAFE_ACCEPT(apr_lock_acquire(process_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_int16_t event; - srv = apr_poll(pollset, &n, -1); - - if (srv != APR_SUCCESS) { - if (APR_STATUS_IS_EINTR(srv)) { - continue; - } - - /* apr_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, "apr_poll: (listen)"); - workers_may_exit = 1; - } - if (workers_may_exit) break; - - apr_poll_revents_get(&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; - } - - apr_poll_revents_get(&event, listenfds[1], pollset); - if (event & APR_POLLIN || event & APR_POLLOUT) { - /* This request is from another child in our current process. - * We should set a flag here, and then below we will read - * two bytes (the socket number and the NULL byte. - */ - thread_socket_table[thread_num] = -2; - goto got_from_other_child; - } - - 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? */ - apr_poll_revents_get(&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 = apr_accept(&csd, sd, ptrans)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf, "apr_accept"); - } - if ((rv = SAFE_ACCEPT(apr_lock_release(process_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; - } - apr_lock_release(thread_accept_mutex); - apr_lock_acquire(idle_thread_count_mutex); - if (idle_thread_count > min_spare_threads) { - idle_thread_count--; - } - else { - if (!start_thread()) { - idle_thread_count--; - } - } - apr_lock_release(idle_thread_count_mutex); - got_from_other_child: - if (thread_socket_table[thread_num] == -2) { - struct msghdr msg; - struct cmsghdr *cmsg; - char sockname[80]; - struct iovec iov; - int ret, sd, dp; - - iov.iov_base = sockname; - iov.iov_len = 80; - - msg.msg_name = NULL; - msg.msg_namelen = 0; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - cmsg = apr_palloc(ptrans, sizeof(*cmsg) + sizeof(sd)); - cmsg->cmsg_len = sizeof(*cmsg) + sizeof(sd); - msg.msg_control = (caddr_t)cmsg; - msg.msg_controllen = cmsg->cmsg_len; - msg.msg_flags = 0; - - ret = recvmsg(child_info_table[child_num].sd, &msg, 0); - - memcpy(&dp, CMSG_DATA(cmsg), sizeof(dp)); - - thread_socket_table[thread_num] = dp; - apr_os_sock_put(&csd, &child_info_table[child_num].sd, ptrans); - } - if (setjmp(jmpbuffer) != 1) { - process_socket(ptrans, csd, conn_id); - } - else { - thread_socket_table[thread_num] = -1; - } - requests_this_child--; - } else { - if ((rv = SAFE_ACCEPT(apr_lock_release(process_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; - } - apr_lock_release(thread_accept_mutex); - apr_lock_acquire(idle_thread_count_mutex); - idle_thread_count--; - apr_lock_release(idle_thread_count_mutex); - break; - } - apr_pool_clear(ptrans); - } - - apr_lock_acquire(thread_pool_parent_mutex); - ap_update_child_status(child_num, thread_num, SERVER_DEAD, - (request_rec *) NULL); - apr_pool_destroy(tpool); - apr_lock_release(thread_pool_parent_mutex); - apr_lock_acquire(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); - } - apr_lock_release(worker_thread_count_mutex); - - return NULL; -} - -/* 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(uid_t uid, gid_t gid) -{ - if (!geteuid()) { - const char *name; - - /* Get username if passed as a uid */ - - struct passwd *ent; - - if ((ent = getpwuid(uid)) == NULL) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, 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; - - /* - * Set the GID before initgroups(), since on some platforms - * setgid() is known to zap the group list. - */ - if (setgid(gid) == -1) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, - "setgid: unable to set group id to Group %u", - (unsigned)gid); - return -1; - } - - /* Reset `groups' attributes. */ - - if (initgroups(name, gid) == -1) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, - "initgroups: unable to set groups for User %s " - "and Group %u", name, (unsigned)gid); - return -1; - } - } - return 0; -} - - -static int perchild_setup_child(int childnum) -{ - child_info_t *ug = &child_info_table[childnum]; - - if (ug->uid == -1 && ug->gid == -1) { - return unixd_setup_child(); - } - if (set_group_privs(ug->uid, ug->gid)) { - return -1; - } - /* 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(ug->uid) == -1)) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, - "setuid: unable to change to uid: %ld", - (long) ug->uid); - return -1; - } - return 0; -} - -static int check_signal(int signum) -{ - switch (signum) { - case SIGTERM: - case SIGINT: - just_die(signum); - return 1; - } - return 0; -} - -static void child_main(int child_num_arg) -{ - int i; - ap_listen_rec *lr; - apr_status_t rv; - apr_thread_t *thread; - - my_pid = getpid(); - child_num = child_num_arg; - apr_pool_create(&pchild, pconf); - - /*stuff to do before we switch id's, so we have permissions.*/ - - rv = SAFE_ACCEPT(apr_lock_child_init(&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 (perchild_setup_child(child_num)) { - clean_child_exit(APEXIT_CHILDFATAL); - } - - ap_run_child_init(pchild, ap_server_conf); - - /*done with init critical section */ - - apr_setup_signal_thread(); - - requests_this_child = max_requests_per_child; - - /* Set up the pollfd array, num_listenfds + 1 for the pipe and 1 for - * the child socket. - */ - listenfds = apr_pcalloc(pchild, sizeof(*listenfds) * (num_listenfds + 2)); -#if APR_FILES_AS_SOCKETS - apr_socket_from_file(&listenfds[0], pipe_of_death_in); -#endif - - /* The child socket */ - apr_os_sock_put(&listenfds[1], &child_info_table[child_num].sd, pchild); - - num_listenfds++; - for (lr = ap_listeners, i = 2; 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; - } - apr_pool_create(&thread_pool_parent, pchild); - apr_lock_create(&thread_pool_parent_mutex, APR_MUTEX, APR_INTRAPROCESS, - NULL, pchild); - apr_lock_create(&idle_thread_count_mutex, APR_MUTEX, APR_INTRAPROCESS, - NULL, pchild); - 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); - apr_lock_create(&thread_accept_mutex, APR_MUTEX, APR_INTRAPROCESS, - NULL, pchild); - - apr_threadattr_create(&worker_thread_attr, pchild); - apr_threadattr_detach_set(worker_thread_attr, 1); - - /* 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; - } - } - - apr_signal_thread(check_signal); -} - -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_child_table[slot].pid = getpid(); - ap_child_table[slot].status = SERVER_ALIVE; - child_main(slot); - } - (void) ap_update_child_status(slot, 0, SERVER_STARTING, (request_rec *) NULL); - - 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 <sys/processor.h> - 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 - apr_signal(SIGTERM, just_die); - */ - child_main(slot); - clean_child_exit(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].pid) { - continue; - } - if (make_child(ap_server_conf, i) < 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; - 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].pid == 0) { - 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]); - } - /* 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; - 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 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) { - child_slot = i; - break; - } - } - if (child_slot >= 0) { - ap_child_table[child_slot].pid = 0; - ap_update_child_status(child_slot, i, SERVER_DEAD, (request_rec *) NULL); - - - 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); - --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 - * 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(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) -{ - int remaining_children_to_start; - int i; - apr_status_t rv; - apr_size_t one = 1; - - pconf = _pconf; - ap_server_conf = s; - if ((rv = apr_file_pipe_create(&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, - "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); - } - 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 = apr_psprintf(_pconf, "%s.%u", - ap_server_root_relative(_pconf, lock_fname), - my_pid); - rv = SAFE_ACCEPT(apr_lock_create(&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) { - ap_create_scoreboard(pconf, SB_SHARED); - } - /* Initialize the child table */ - if (!is_graceful) { - for (i = 0; i < HARD_SERVER_LIMIT; i++) { - ap_child_table[i].pid = 0; - } - } - - 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 */ - apr_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].pid) { - ap_child_table[i].status = SERVER_DYING; - } - } - /* give the children the signal to die */ - for (i = 0; i < num_daemons;) { - 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++; - } - } - 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(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp) -{ - static int restart_num = 0; - int no_detach = 0; - int i; - - 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(); - } - - my_pid = getpid(); - } - - unixd_pre_config(ptemp); - 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; - curr_child_num = 0; - - apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir)); - - for (i = 0; i < HARD_SERVER_LIMIT; i++) { - child_info_table[i].uid = -1; - child_info_table[i].gid = -1; - child_info_table[i].sd = -1; - } - for (i = 0; i < HARD_THREAD_LIMIT; i++) { - thread_socket_table[i] = -1; - } -} - -static int pass_request(request_rec *r) -{ - apr_socket_t *thesock = r->connection->client_socket; - struct msghdr msg; - struct cmsghdr *cmsg; - int sfd; - struct iovec iov; - apr_bucket_brigade *bb = apr_brigade_create(r->pool); - perchild_server_conf *sconf = (perchild_server_conf *) - ap_get_module_config(r->server->module_config, - &mpm_perchild_module); - char *foo; - apr_size_t len; - apr_size_t readbytes = 0; - - apr_pool_userdata_get((void **)&foo, "PERCHILD_BUFFER", r->connection->pool); - len = strlen(foo); - - apr_pool_userdata_set(NULL, "PERCHILD_BUFFER", apr_pool_cleanup_null, - r->connection->pool); - - apr_os_sock_get(&sfd, thesock); - - iov.iov_base = NULL; - iov.iov_len = 0; - - msg.msg_name = NULL; - msg.msg_namelen = 0; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - cmsg = apr_palloc(r->pool, sizeof(*cmsg) + sizeof(sfd)); - cmsg->cmsg_len = sizeof(*cmsg) + sizeof(int); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - - memcpy(CMSG_DATA(cmsg), &sfd, sizeof(sfd)); - - msg.msg_control = (caddr_t)cmsg; - msg.msg_controllen = cmsg->cmsg_len; - msg.msg_flags=0; - - if (sendmsg(sconf->sd2, &msg, 0) == -1) { - apr_pool_destroy(r->pool); - return -1; - } - - write(sconf->sd2, foo, len); - - while (ap_get_brigade(r->input_filters, bb, AP_MODE_NONBLOCKING, &readbytes) == APR_SUCCESS) { - apr_bucket *e; - APR_BRIGADE_FOREACH(e, bb) { - const char *str; - - apr_bucket_read(e, &str, &len, APR_NONBLOCK_READ); - write(sconf->sd2, str, len); - } - } - - apr_pool_destroy(r->pool); - return 1; -} - -static char *make_perchild_socket(const char *fullsockname, int sd[2]) -{ - socketpair(PF_UNIX, SOCK_STREAM, 0, sd); - return NULL; -} - - -static void perchild_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) -{ - int i; - server_rec *sr; - perchild_server_conf *sconf; - int def_sd[2]; - - def_sd[0] = -1; - def_sd[1] = -1; - - for (sr = s; sr; sr = sr->next) { - sconf = (perchild_server_conf *)ap_get_module_config(sr->module_config, - &mpm_perchild_module); - - if (sconf->sd == -1) { - sconf->fullsockname = apr_pstrcat(sr->process->pool, - sconf->sockname, ".DEFAULT", NULL); - if (def_sd[0] == -1) { - if (!make_perchild_socket(sconf->fullsockname, def_sd)) { - /* log error */ - } - } - sconf->sd = def_sd[0]; - sconf->sd2 = def_sd[1]; - } - } - - for (i = 0; i < num_daemons; i++) { - if (child_info_table[i].uid == -1) { - child_info_table[i].sd = def_sd[0]; - } - } -} - -static int perchild_post_read(request_rec *r) -{ - ap_filter_t *f = r->connection->input_filters; - int thread_num = r->connection->id % HARD_THREAD_LIMIT; - perchild_server_conf *sconf = (perchild_server_conf *) - ap_get_module_config(r->server->module_config, - &mpm_perchild_module); - - while (f) { - if (!strcmp("PERCHILD_BUFFER", f->frec->name)) { - ap_remove_output_filter(f); - break; - } - f = f->next; - } - - if (thread_socket_table[thread_num] != -1) { - apr_socket_t *csd = NULL; - - apr_os_sock_put(&csd, &thread_socket_table[thread_num], - r->connection->pool); - ap_sock_disable_nagle(csd); - r->connection->client_socket = csd; - return OK; - } - else { - if (sconf->sd != child_info_table[child_num].sd) { - if (pass_request(r) == -1) { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, - ap_server_conf, "Could not pass request to proper " - "child, request will not be honored."); - } - longjmp(jmpbuffer, 1); - } - return OK; - } - return OK; -} - -static apr_status_t perchild_buffer(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_size_t *readbytes) -{ - apr_bucket *e; - apr_status_t rv; - char *buffer = NULL; - const char *str; - apr_size_t len; - - if ((rv = ap_get_brigade(f->next, b, mode, readbytes)) != APR_SUCCESS) { - return rv; - } - - apr_pool_userdata_get((void **)&buffer, "PERCHILD_BUFFER", f->c->pool); - - APR_BRIGADE_FOREACH(e, b) { - if (e->length != 0) { - apr_bucket_read(e, &str, &len, APR_NONBLOCK_READ); - - if (buffer == NULL) { - buffer = apr_pstrndup(f->c->pool, str, len); - } - else { - buffer = apr_pstrcat(f->c->pool, buffer, - apr_pstrndup(f->c->pool, str, len), NULL); - } - } - } - apr_pool_userdata_set(buffer, "PERCHILD_BUFFER", apr_pool_cleanup_null, f->c->pool); - - return APR_SUCCESS; -} - -static int perchild_pre_connection(conn_rec *c) -{ - ap_add_input_filter("PERCHILD_BUFFER", NULL, NULL, c); - return OK; -} - -static void perchild_hooks(apr_pool_t *p) -{ - one_process = 0; - - ap_hook_pre_config(perchild_pre_config, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_post_config(perchild_post_config, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_pre_connection(perchild_pre_connection,NULL,NULL, APR_HOOK_MIDDLE); - - /* This must be run absolutely first. If this request isn't for this - * server then we need to forward it to the proper child. No sense - * tying up this server running more post_read request hooks if it is - * just going to be forwarded along. - */ - ap_hook_post_read_request(perchild_post_read, NULL, NULL, APR_HOOK_REALLY_FIRST); - ap_register_input_filter("PERCHILD_BUFFER", perchild_buffer, AP_FTYPE_CONTENT); -} - -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 <VirtualHost>"; - } - 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_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_child_per_uid(cmd_parms *cmd, void *dummy, const char *u, - const char *g, const char *num) -{ - int i; - int max_this_time = atoi(num) + curr_child_num; - for (i = curr_child_num; i < max_this_time; i++, curr_child_num++); { - child_info_t *ug = &child_info_table[i - 1]; - - if (i > num_daemons) { - return "Trying to use more child ID's than NumServers. Increase " - "NumServers in your config file."; - } - - ug->uid = atoi(u); - ug->gid = atoi(g); - } - return NULL; -} - -static const char *assign_childuid(cmd_parms *cmd, void *dummy, const char *uid, - const char *gid) -{ - int i; - int u = atoi(uid); - int g = atoi(gid); - const char *errstr; - int socks[2]; - perchild_server_conf *sconf = (perchild_server_conf *) - ap_get_module_config(cmd->server->module_config, - &mpm_perchild_module); - - sconf->fullsockname = apr_pstrcat(cmd->pool, sconf->sockname, ".", uid, ":", gid, NULL); - - if ((errstr = make_perchild_socket(sconf->fullsockname, socks))) { - return errstr; - } - - sconf->sd = socks[0]; - sconf->sd2 = socks[1]; - - for (i = 0; i < num_daemons; i++) { - if (u == child_info_table[i].uid && g == child_info_table[i].gid) { - child_info_table[i].sd = sconf->sd; - } - } - - return NULL; -} - - -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_TAKE1("CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF, - "The location of the directory Apache changes to before dumping core"), -AP_INIT_TAKE3("ChildperUserID", set_child_per_uid, NULL, RSRC_CONF, - "Specify a User and Group for a specific child process."), -AP_INIT_TAKE2("AssignUserID", assign_childuid, NULL, RSRC_CONF, - "Tie a virtual host to a specific child process."), -{ NULL } -}; - -static void *perchild_create_config(apr_pool_t *p, server_rec *s) -{ - perchild_server_conf *c = - (perchild_server_conf *) apr_pcalloc(p, sizeof(perchild_server_conf)); - - c->sd = -1; - return c; -} - -module AP_MODULE_DECLARE_DATA 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 */ - perchild_create_config, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - perchild_cmds, /* command apr_table_t */ - perchild_hooks /* register_hooks */ -}; - diff --git a/server/mpm/prefork/.cvsignore b/server/mpm/prefork/.cvsignore deleted file mode 100644 index dc53ac865d..0000000000 --- a/server/mpm/prefork/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -*.lo -*.la -Makefile -.deps -.libs diff --git a/server/mpm/prefork/Makefile.in b/server/mpm/prefork/Makefile.in deleted file mode 100644 index 034bf5ce84..0000000000 --- a/server/mpm/prefork/Makefile.in +++ /dev/null @@ -1,5 +0,0 @@ - -LTLIBRARY_NAME = libprefork.la -LTLIBRARY_SOURCES = prefork.c - -include $(top_srcdir)/build/ltlib.mk diff --git a/server/mpm/prefork/config.m4 b/server/mpm/prefork/config.m4 deleted file mode 100644 index 9c189a8642..0000000000 --- a/server/mpm/prefork/config.m4 +++ /dev/null @@ -1,3 +0,0 @@ -if test "$MPM_NAME" = "prefork" ; then - APACHE_FAST_OUTPUT(server/mpm/$MPM_NAME/Makefile) -fi diff --git a/server/mpm/prefork/mpm.h b/server/mpm/prefork/mpm.h deleted file mode 100644 index 6a923b0636..0000000000 --- a/server/mpm/prefork/mpm.h +++ /dev/null @@ -1,80 +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. - */ - -#include "httpd.h" -#include "mpm_default.h" -#include "scoreboard.h" -#include "unixd.h" - -#ifndef APACHE_MPM_PREFORK_H -#define APACHE_MPM_PREFORK_H - -#define PREFORK_MPM - -#define MPM_NAME "Prefork" - -#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_PREFORK_H */ diff --git a/server/mpm/prefork/mpm_default.h b/server/mpm/prefork/mpm_default.h deleted file mode 100644 index 3763037ae6..0000000000 --- a/server/mpm/prefork/mpm_default.h +++ /dev/null @@ -1,135 +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 APACHE_MPM_DEFAULT_H -#define APACHE_MPM_DEFAULT_H - -#define AP_ID_FROM_CHILD_THREAD(c, t) c -#define AP_CHILD_THREAD_FROM_ID(i) i, 0 - - -/* 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 - -#ifndef HARD_THREAD_LIMIT -#define HARD_THREAD_LIMIT 1 -#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/prefork/prefork.c b/server/mpm/prefork/prefork.c deleted file mode 100644 index 52ed0b51e0..0000000000 --- a/server/mpm/prefork/prefork.c +++ /dev/null @@ -1,1515 +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. - */ - -/* - * 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" - -#define APR_WANT_STDIO -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#endif -#if APR_HAVE_SYS_TYPES_H -#include <sys/types.h> -#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 "unixd.h" -#include "mpm_common.h" -#include "ap_listen.h" -#include "ap_mmn.h" - -#ifdef HAVE_BSTRING_H -#include <bstring.h> /* for IRIX, FD_SET calls bzero() */ -#endif -#ifdef HAVE_TIME_H -#include <time.h> -#endif - -#include <signal.h> -#include <sys/times.h> - -/* 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 apr_lock_t *accept_lock; -static const char *ap_lock_fname; -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; - -/* - * 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; -server_rec *ap_server_conf; - -char ap_coredump_dir[MAX_STRING_LEN]; - -/* *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 *pchild; /* Pool for httpd child stuff */ - -static pid_t ap_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 */ - -#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) -{ - if (pchild) { - apr_pool_destroy(pchild); - } - ap_scoreboard_image->servers[my_child_num][0].life_status = SB_WORKING; - chdir_for_gprof(); - exit(code); -} - -static void expand_lock_fname(apr_pool_t *p) -{ - /* XXXX possibly bogus cast */ - ap_lock_fname = apr_psprintf(p, "%s.%lu", - ap_server_root_relative(p, ap_lock_fname), (unsigned long)getpid()); -} - -/* Initialize mutex lock. - * Done by each child at its birth - */ -static void accept_mutex_child_init(apr_pool_t *p) -{ - apr_status_t rv; - - rv = apr_lock_child_init(&accept_lock, ap_lock_fname, p); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, - "couldn't do child init for accept mutex"); - clean_child_exit(APEXIT_CHILDINIT); - } -} - -/* Initialize mutex lock. - * Must be safe to call this on a restart. - */ -static void accept_mutex_init(apr_pool_t *p) -{ - apr_status_t rv; - - expand_lock_fname(p); - rv = apr_lock_create(&accept_lock, APR_MUTEX, APR_CROSS_PROCESS, ap_lock_fname, p); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, "couldn't create accept mutex"); - exit(APEXIT_INIT); - } -} - -static void accept_mutex_on(void) -{ - apr_status_t rv = apr_lock_acquire(accept_lock); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, "couldn't grab the accept mutex"); - exit(APEXIT_CHILDFATAL); - } -} - -static void accept_mutex_off(void) -{ - apr_status_t rv = apr_lock_release(accept_lock); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, "couldn't release the accept mutex"); - 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 - -AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result) -{ - switch(query_code){ - case AP_MPMQ_MAX_DAEMONS: - *result = ap_daemons_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; - } - return APR_ENOTIMPL; -} - -#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(apr_wait_t *status) -{ - int n, pid; - - for (n = 0; n < ap_max_daemons_limit; ++n) { - ap_sync_scoreboard_image(); - if (ap_scoreboard_image->servers[n][0].status != SERVER_DEAD && - kill((pid = ap_scoreboard_image->parent[n].pid), 0) == -1) { - ap_update_child_status(AP_CHILD_THREAD_FROM_ID(n), SERVER_DEAD, NULL); - /* just mark it as having a successful exit status */ - memset(status, 0, sizeof(apr_wait_t)); - return(pid); - } - } - return 0; -} -#endif - -/* handle all varieties of core dumping signals */ -static void sig_coredump(int sig) -{ - chdir(ap_coredump_dir); - apr_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 void please_die_gracefully(int sig) -{ - /* clean_child_exit(0); */ - ap_scoreboard_image->servers[my_child_num][0].life_status = SB_IDLE_DIE; - if (sig == SIGHUP) { - (void) ap_update_child_status(AP_CHILD_THREAD_FROM_ID(my_child_num), - SERVER_GRACEFUL, (request_rec *) NULL); - } - else { - (void) ap_update_child_status(AP_CHILD_THREAD_FROM_ID(my_child_num), - SERVER_IDLE_KILL, (request_rec *) NULL); - } -} - -/* 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; - if ((is_graceful = (sig == SIGWINCH))) { - apr_pool_cleanup_kill(pconf, NULL, ap_cleanup_scoreboard); - } -} - -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 -} - -/***************************************************************** - * 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; - -#define I_AM_TO_SHUTDOWN() \ -(ap_scoreboard_image->servers[my_child_num][0].life_status != SB_WORKING) - -int ap_graceful_stop_signalled(void) -{ - /* not ever called anymore... */ - return 0; -} - - -static void child_main(int child_num_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; - - my_child_num = child_num_arg; - ap_my_pid = getpid(); - csd = NULL; - requests_this_child = 0; - last_lr = NULL; - - /* Get a sub context for global allocations in this child, so that - * we can have cleanups occur when the child exits. - */ - apr_pool_create(&pchild, pconf); - - apr_pool_create(&ptrans, 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_run_child_init(pchild, ap_server_conf); - - (void) ap_update_child_status(AP_CHILD_THREAD_FROM_ID(my_child_num), SERVER_READY, (request_rec *) NULL); - - apr_signal(SIGHUP, please_die_gracefully); - - ap_sync_scoreboard_image(); - while (!I_AM_TO_SHUTDOWN()) { - - /* Prepare to receive a SIGWINCH due to graceful restart so that - * we can exit cleanly. - */ - apr_signal(SIGWINCH, please_die_gracefully); - apr_signal(SIGTERM, just_die); - - /* - * (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); - } - - (void) ap_update_child_status(AP_CHILD_THREAD_FROM_ID(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) { - /* more than one socket */ - memcpy(&main_fds, &listenfds, sizeof(fd_set)); - srv = 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, 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; - } - else { - /* only one socket, just pretend we did the other stuff */ - sd = ap_listeners->sd; - } - - /* if we accept() something we don't want to die, so we have to - * defer the exit - */ - apr_signal(SIGTERM, please_die_gracefully); - for (;;) { - ap_sync_scoreboard_image(); - if (I_AM_TO_SHUTDOWN()) { - /* we didn't get a socket, and we were told to die */ - clean_child_exit(0); - } - 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 { - -/* TODO: this accept result handling stuff should be abstracted... - * it's already out of date between the various unix mpms - */ - /* 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) { -#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, stat, ap_server_conf, - "apr_accept: giving up."); - clean_child_exit(APEXIT_CHILDFATAL); -#endif /*ENETDOWN*/ - -#ifdef TPF - case EINACT: - ap_log_error(APLOG_MARK, APLOG_EMERG, stat, ap_server_conf, - "offload device inactive"); - clean_child_exit(APEXIT_CHILDFATAL); - break; - default: - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, ap_server_conf, - "select/accept error (%u)", stat); - clean_child_exit(APEXIT_CHILDFATAL); -#else - default: - ap_log_error(APLOG_MARK, APLOG_ERR, stat, ap_server_conf, - "apr_accept: (client socket)"); - clean_child_exit(1); -#endif - } - } - - ap_sync_scoreboard_image(); - if (I_AM_TO_SHUTDOWN()) { - clean_child_exit(0); - } - } - - SAFE_ACCEPT(accept_mutex_off()); /* unlock after "accept" */ - - /* 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. - */ - apr_signal(SIGWINCH, SIG_IGN); - /* - * 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; - } - -#ifdef TPF - if (sockdes == 0) { /* 0 is invalid socket for TPF */ - ap_sync_scoreboard_image(); - continue; - } -#endif - - 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 pid; - - if (slot + 1 > ap_max_daemons_limit) { - ap_max_daemons_limit = slot + 1; - } - - if (one_process) { - apr_signal(SIGHUP, please_die_gracefully); - apr_signal(SIGINT, please_die_gracefully); -#ifdef SIGQUIT - apr_signal(SIGQUIT, SIG_DFL); -#endif - apr_signal(SIGTERM, just_die); - ap_scoreboard_image->servers[slot][0].life_status = SB_WORKING; - child_main(slot); - } - - (void) ap_update_child_status(AP_CHILD_THREAD_FROM_ID(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, 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(AP_CHILD_THREAD_FROM_ID(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 <sys/processor.h> - int status = bindprocessor(BINDPROCESS, (int)getpid(), - PROCESSOR_CLASS_ANY); - if (status != OK) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, ap_server_conf, - "processor unbind failed %d", status); - } -#endif - RAISE_SIGSTOP(MAKE_CHILD); - /* Disable the restart signal handlers and enable the please_die_gracefully stuff. - * Note that since restart() just notes that a restart has been - * requested there's no race condition here. - */ - apr_signal(SIGHUP, please_die_gracefully); - apr_signal(SIGWINCH, please_die_gracefully); - apr_signal(SIGTERM, just_die); - ap_scoreboard_image->servers[slot][0].life_status = SB_WORKING; - 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; - - for (i = 0; number_to_start && i < ap_daemons_limit; ++i) { - if (ap_scoreboard_image->servers[i][0].status != SERVER_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(void) -{ - int i; - int to_kill; - int idle_count; - short_score *ss; - 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 >= ap_max_daemons_limit && free_length == idle_spawn_rate) - break; - ss = &ap_scoreboard_image->servers[i][0]; - 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; - } - } - ap_max_daemons_limit = last_non_dead + 1; - if (idle_count > ap_daemons_max_free) { - /* kill off one child... we use SIGWINCH 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, SIGWINCH); - 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, 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) { -#ifdef TPF - if (make_child(ap_server_conf, free_slots[i]) == -1) { - if(free_length == 1) { - shutdown_pending = 1; - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, 0, ap_server_conf, - "No active child processes: shutting down"); - } - } -#else - make_child(ap_server_conf, free_slots[i]); -#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 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_children_to_start; - - pconf = _pconf; - - ap_server_conf = s; - - ap_log_pid(pconf, ap_pid_fname); - - if (setup_listeners(s)) { - /* XXX: hey, what's the right way for the mpm to indicate a fatal error? */ - return 1; - } - - SAFE_ACCEPT(accept_mutex_init(pconf)); - if (!is_graceful) { - ap_create_scoreboard(pconf, SB_SHARED); - } -#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 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; - - while (!restart_pending && !shutdown_pending) { - int child_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) { - (void) ap_update_child_status(AP_CHILD_THREAD_FROM_ID(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(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(); -#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 (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); - apr_signal(SIGWINCH, 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(); - - for (index = 0; index < ap_daemons_limit; ++index) { - ap_scoreboard_image->servers[index][0].life_status = SB_IDLE_DIE; - } - - if (is_graceful) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "SIGWINCH received. Doing graceful restart"); - - /* kill off the idle ones */ - if (unixd_killpg(getpgrp(), SIGWINCH) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGWINCH"); - } -#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_daemons_limit; ++index) { - if (ap_scoreboard_image->servers[index][0].status != SERVER_DEAD) { - ap_scoreboard_image->servers[index][0].status = SERVER_GRACEFUL; - } - } -#endif - } - else { - /* Kill 'em off */ - if (unixd_killpg(getpgrp(), SIGHUP) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGHUP"); - } - ap_reclaim_child_processes(0); /* Not when just starting up */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "SIGHUP received. Attempting to restart"); - } - - return 0; -} - -static void prefork_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp) -{ - static int restart_num = 0; - int no_detach = 0; - - 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(); - } - - ap_my_pid = getpid(); - } - - unixd_pre_config(ptemp); - ap_listen_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; - ap_extended_status = 0; - - apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir)); -} - -static void prefork_hooks(apr_pool_t *p) -{ -#ifdef AUX3 - (void) set42sig(); -#endif - - ap_hook_pre_config(prefork_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 <VirtualHost>"; - } - 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; - } - - ap_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_free_servers(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_min_free = atoi(arg); - if (ap_daemons_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_daemons_min_free = 1; - } - - return NULL; -} - -static const char *set_max_free_servers(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_max_free = 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_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 command_rec prefork_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("MinSpareServers", set_min_free_servers, NULL, RSRC_CONF, - "Minimum number of idle children, to handle request spikes"), -AP_INIT_TAKE1("MaxSpareServers", set_max_free_servers, 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("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"), -{ NULL } -}; - -module AP_MODULE_DECLARE_DATA mpm_prefork_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 */ - prefork_cmds, /* command apr_table_t */ - prefork_hooks, /* register hooks */ -}; diff --git a/server/mpm/spmt_os2/.cvsignore b/server/mpm/spmt_os2/.cvsignore deleted file mode 100644 index dc53ac865d..0000000000 --- a/server/mpm/spmt_os2/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -*.lo -*.la -Makefile -.deps -.libs diff --git a/server/mpm/spmt_os2/Makefile.in b/server/mpm/spmt_os2/Makefile.in deleted file mode 100644 index 105f39128f..0000000000 --- a/server/mpm/spmt_os2/Makefile.in +++ /dev/null @@ -1,5 +0,0 @@ - -LTLIBRARY_NAME = libspmt_os2.la -LTLIBRARY_SOURCES = spmt_os2.c - -include $(top_srcdir)/build/ltlib.mk diff --git a/server/mpm/spmt_os2/config5.m4 b/server/mpm/spmt_os2/config5.m4 deleted file mode 100644 index 770b9d2212..0000000000 --- a/server/mpm/spmt_os2/config5.m4 +++ /dev/null @@ -1,5 +0,0 @@ -if test "$MPM_NAME" = "spmt_os2" ; then - AC_CACHE_SAVE - APACHE_FAST_OUTPUT(server/mpm/$MPM_NAME/Makefile) - APR_ADDTO(CFLAGS,-Zmt) -fi diff --git a/server/mpm/spmt_os2/mpm.h b/server/mpm/spmt_os2/mpm.h deleted file mode 100644 index 96062ed7d6..0000000000 --- a/server/mpm/spmt_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 - * <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 APACHE_MPM_SPMT_OS2_H -#define APACHE_MPM_SPMT_OS2_H - -#define SPMT_OS2_MPM - -#include "httpd.h" -#include "mpm_default.h" -#include "scoreboard.h" - -#define MPM_NAME "SPMT_OS2" - -extern char ap_coredump_dir[MAX_STRING_LEN]; -extern server_rec *ap_server_conf; -extern int ap_threads_per_child; - -#endif /* APACHE_MPM_SPMT_OS2_H */ diff --git a/server/mpm/spmt_os2/mpm_default.h b/server/mpm/spmt_os2/mpm_default.h deleted file mode 100644 index c554fddf60..0000000000 --- a/server/mpm/spmt_os2/mpm_default.h +++ /dev/null @@ -1,123 +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 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 - -/* SPMT_OS2 only ever has 1 process */ -#define HARD_SERVER_LIMIT 1 - -/* 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_THREAD_LIMIT -#define HARD_THREAD_LIMIT 256 -#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) 0, i - -#endif /* AP_MPM_DEFAULT_H */ diff --git a/server/mpm/spmt_os2/spmt_os2.c b/server/mpm/spmt_os2/spmt_os2.c deleted file mode 100644 index b991c9df36..0000000000 --- a/server/mpm/spmt_os2/spmt_os2.c +++ /dev/null @@ -1,1322 +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. - */ - -#define CORE_PRIVATE -#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 <os2.h> -#include <stdlib.h> -#include <sys/signal.h> -#include <process.h> -#include <time.h> -#include <io.h> - -/* config globals */ - -static int ap_max_requests_per_child=0; -static char *ap_pid_fname=NULL; -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; - -/* - * 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; -int ap_threads_per_child = HARD_THREAD_LIMIT; -ap_generation_t volatile ap_my_generation=0; /* Used by the scoreboard */ - -char ap_coredump_dir[MAX_STRING_LEN]; - -/* *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; - -static apr_pool_t *pconf; /* Pool for config stuff */ - -struct thread_globals { - int thread_num; - apr_pool_t *pchild; /* Pool for httpd child stuff */ - int usr1_just_die; -}; - -static struct thread_globals **ppthread_globals = NULL; - -#define THREAD_GLOBAL(gvar) ((*ppthread_globals)->gvar) - -struct thread_control_t { - apr_wait_t thread_retval; - char deferred_die; - ap_generation_t generation; /* generation of this thread */ -} thread_control[HARD_THREAD_LIMIT]; - -/* a clean exit from a child with proper cleanup */ -static void clean_child_exit(int code) -{ - if (THREAD_GLOBAL(pchild)) { - apr_pool_destroy(THREAD_GLOBAL(pchild)); - } - - thread_control[THREAD_GLOBAL(thread_num)].deferred_die = 0; - thread_control[THREAD_GLOBAL(thread_num)].thread_retval = code; - _endthread(); -} - - - -static apr_lock_t *accept_mutex = NULL; - -static apr_status_t accept_mutex_child_cleanup(void *foo) -{ - return apr_lock_release(accept_mutex); -} - -/* - * Initialize mutex lock. - * Done by each child at it's 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); -} - -/* - * Initialize mutex lock. - * Must be safe to call this on a restart. - */ -static void accept_mutex_init(apr_pool_t *p) -{ - apr_status_t rc = apr_lock_create(&accept_mutex, APR_MUTEX, APR_INTRAPROCESS, NULL, p); - - if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rc, ap_server_conf, - "Error creating accept lock. Exiting!"); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -static void accept_mutex_on(void) -{ - apr_status_t rc = apr_lock_acquire(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_lock_release(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 - -static int find_thread_by_tid(int tid) -{ - int i; - - for (i = 0; i < max_daemons_limit; ++i) - if (ap_scoreboard_image->servers[0][i].tid == tid) - return i; - - return -1; -} - -/* Finally, this routine is used by the caretaker thread 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(apr_wait_t *status) -{ - int ret; - ULONG tid; - - ++wait_or_timeout_counter; - if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) { - wait_or_timeout_counter = 0; -#if APR_HAS_OTHER_CHILD - apr_proc_probe_writable_fds(); -#endif - } - - tid = 0; - ret = DosWaitThread(&tid, DCWW_NOWAIT); - - if (ret == 0) { - int thread_num = find_thread_by_tid(tid); - ap_assert( thread_num > 0 ); - *status = thread_control[thread_num].thread_retval; - return tid; - } - - DosSleep(SCOREBOARD_MAINTENANCE_INTERVAL / 1000); - return -1; -} - - - -/* 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 void usr1_handler(int sig) -{ - if (THREAD_GLOBAL(usr1_just_die)) { - just_die(sig); - } - thread_control[THREAD_GLOBAL(thread_num)].deferred_die = 1; -} - -/* volatile just in case */ -static int volatile shutdown_pending; -static int volatile restart_pending; -static int volatile is_graceful; - -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, 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 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, 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)"); -#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 -} - -/***************************************************************** - * Child process main loop. - */ - -AP_DECLARE(void) ap_child_terminate(request_rec *r) -{ - r->connection->keepalive = 0; - thread_control[THREAD_GLOBAL(thread_num)].deferred_die = 1; -} - - - -int ap_graceful_stop_signalled(void) -{ - if (thread_control[THREAD_GLOBAL(thread_num)].deferred_die || - ap_scoreboard_image->global.running_generation != thread_control[THREAD_GLOBAL(thread_num)].generation) { - return 1; - } - return 0; -} - - - -int ap_stop_signalled(void) -{ - if (shutdown_pending || restart_pending || - thread_control[THREAD_GLOBAL(thread_num)].deferred_die || - ap_scoreboard_image->global.running_generation != thread_control[THREAD_GLOBAL(thread_num)].generation) { - return 1; - } - return 0; -} - - - -static int setup_listen_poll(apr_pool_t *pchild, 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, pchild); - - for (lr = ap_listeners; lr; lr = lr->next) { - apr_poll_socket_add(*listen_poll, lr->sd, APR_POLLIN); - } - return 0; -} - - - -static void thread_main(void *thread_num_arg) -{ - ap_listen_rec *lr = NULL; - ap_listen_rec *first_lr = NULL; - apr_pool_t *ptrans; - conn_rec *current_conn; - apr_pool_t *pchild; - int requests_this_child = 0; - apr_pollfd_t *listen_poll; - apr_socket_t *csd = NULL; - int nsds, rv; - - /* 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. - */ - - set_signals(); /* signals aren't inherrited by child threads */ - signal(SIGHUP, just_die); - signal(SIGUSR1, just_die); - signal(SIGTERM, just_die); - - /* Get a sub pool for global allocations in this child, so that - * we can have cleanups occur when the child exits. - */ - apr_pool_create(&pchild, pconf); - *ppthread_globals = (struct thread_globals *)apr_palloc(pchild, sizeof(struct thread_globals)); - THREAD_GLOBAL(thread_num) = (int)thread_num_arg; - THREAD_GLOBAL(pchild) = pchild; - thread_control[THREAD_GLOBAL(thread_num)].generation = ap_scoreboard_image->global.running_generation; - apr_pool_create(&ptrans, pchild); - - if (setup_listen_poll(pchild, &listen_poll)) { - clean_child_exit(1); - } - - /* needs to be done before we switch UIDs so we have permissions */ - SAFE_ACCEPT(accept_mutex_child_init(pchild)); - - ap_run_child_init(pchild, ap_server_conf); - - (void) ap_update_child_status(0, THREAD_GLOBAL(thread_num), SERVER_READY, (request_rec *) NULL); - - - signal(SIGHUP, just_die); - signal(SIGTERM, just_die); - - while (!ap_stop_signalled()) { - int srv; - apr_socket_t *sd; - - /* Prepare to receive a SIGUSR1 due to graceful restart so that - * we can exit cleanly. - */ - THREAD_GLOBAL(usr1_just_die) = 1; - signal(SIGUSR1, usr1_handler); - - /* - * (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); - } - - (void) ap_update_child_status(0, THREAD_GLOBAL(thread_num), SERVER_READY, (request_rec *) NULL); - - /* - * Wait for an acceptable connection to arrive. - */ - - /* Lock around "accept", if necessary */ - SAFE_ACCEPT(accept_mutex_on()); - - if (ap_stop_signalled()) { - clean_child_exit(0); - } - - for (;;) { - if (ap_listeners->next) { - /* more than one socket */ - srv = apr_poll(listen_poll, &nsds, -1); - - if (srv != APR_SUCCESS) { - /* 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, errno, ap_server_conf, "select: (listen)"); - clean_child_exit(1); - } - - /* we remember the last_lr we searched last time around so that - we don't end up starving any particular listening socket */ - if (first_lr == NULL) { - first_lr = ap_listeners; - } - - lr = first_lr; - - do { - apr_int16_t event; - - if (!lr) { - lr = ap_listeners; - } - - apr_poll_revents_get(&event, lr->sd, listen_poll); - - if (event == APR_POLLIN) { - first_lr = lr->next; - break; - } - lr = lr->next; - } while (lr != first_lr); - - if (lr == first_lr) { - continue; - } - sd = lr->sd; - } - else { - /* only one socket, just pretend we did the other stuff */ - sd = ap_listeners->sd; - } - - /* if we accept() something we don't want to die, so we have to - * defer the exit - */ - THREAD_GLOBAL(usr1_just_die) = 0; - rv = apr_accept(&csd, sd, ptrans); - - if (APR_STATUS_IS_SUCCESS(rv)) { - break; /* We have a socket ready for reading */ - } - else if (APR_STATUS_IS_ECONNABORTED(rv) - || APR_STATUS_IS_ECONNRESET(rv) - || APR_STATUS_IS_ETIMEDOUT(rv) - || APR_STATUS_IS_EHOSTUNREACH(rv) - || APR_STATUS_IS_ENETUNREACH(rv)) { - - /* 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. - */ - - /* Linux generates most 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. - */ - break; - } - else if (APR_STATUS_IS_EINTR(rv)) { - /* We only get hit by an EINTR if the parent is - * killing us off - */ - clean_child_exit(0); - } - else { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf, - "accept: (client socket)"); - clean_child_exit(1); - } - - if (ap_stop_signalled()) { - clean_child_exit(0); - } - THREAD_GLOBAL(usr1_just_die) = 1; - } - - SAFE_ACCEPT(accept_mutex_off()); /* unlock after "accept" */ - - /* 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); - - /* - * We now have a connection, so set it up with the appropriate - * socket options, file descriptors, and read/write buffers. - */ - - ap_sock_disable_nagle(csd); - - current_conn = ap_new_connection(ptrans, ap_server_conf, csd, - THREAD_GLOBAL(thread_num)); - - if (current_conn) { - ap_process_connection(current_conn); - ap_lingering_close(current_conn); - } - } - - clean_child_exit(0); -} - - -static int make_child(server_rec *s, int slot) -{ - TID tid; - - if (slot + 1 > max_daemons_limit) { - max_daemons_limit = slot + 1; - } - - if (one_process) { - struct thread_globals *parent_globals = *ppthread_globals; - signal(SIGHUP, just_die); - signal(SIGINT, just_die); -#ifdef SIGQUIT - signal(SIGQUIT, SIG_DFL); -#endif - signal(SIGTERM, just_die); - thread_main((void *)slot); - *ppthread_globals = parent_globals; - } - - ap_update_child_status(0, slot, SERVER_STARTING, (request_rec *) NULL); - - if ((tid = _beginthread(thread_main, NULL, 256*1024, (void *)slot)) == -1) { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, s, "_beginthread: Unable to create new thread"); - - /* _beginthread didn't succeed. Fix the scoreboard or else - * it will say SERVER_STARTING forever and ever - */ - (void) ap_update_child_status(0, 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 _beginthread over and - over and over again. */ - sleep(10); - - return -1; - } - - ap_scoreboard_image->servers[0][slot].tid = tid; - return 0; -} - - -/* 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->servers[0][i].status != SERVER_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(void) -{ - int i; - int to_kill; - int idle_count; - short_score *ss; - 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; - - 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[0][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 - */ - thread_control[to_kill].deferred_die = 1; - 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, 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; - } -} - -AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result) -{ - switch(query_code){ - case AP_MPMQ_MAX_DAEMONS: - *result = 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_MAX_THREADS: - *result = ap_threads_per_child; - return APR_SUCCESS; - } - return APR_ENOTIMPL; -} - -/***************************************************************** - * Executive routines. - */ - -int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) -{ - int remaining_children_to_start; - int i; - apr_status_t status; - - pconf = _pconf; - ap_server_conf = s; - ap_log_pid(pconf, ap_pid_fname); - - if ((status = ap_listen_open(s->process, s->port)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, status, s, - "no listening sockets available, shutting down"); - return -1; - } - - SAFE_ACCEPT(accept_mutex_init(pconf)); - - if (!is_graceful) { - ap_create_scoreboard(pconf, SB_NOT_SHARED); - memset(thread_control, 0, sizeof(thread_control)); - } - - set_signals(); - DosSetMaxFH(ap_daemons_limit * 2); - - if (ppthread_globals == NULL) { - if (DosAllocThreadLocalMemory(1, (PULONG *)&ppthread_globals)) { - ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, ap_server_conf, - "Error allocating thread local storage" - "Apache is exiting!"); - } else { - *ppthread_globals = (struct thread_globals *)apr_palloc(pconf, sizeof(struct thread_globals)); - } - } - - 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, 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 thread_slot; - apr_wait_t status; - int tid = 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 (tid >= 0) { - apr_proc_t dummyproc; - dummyproc.pid = tid; - ap_process_child_status(&dummyproc, status); - /* non-fatal death... note that it's gone in the scoreboard. */ - thread_slot = find_thread_by_tid(tid); - if (thread_slot >= 0) { - (void) ap_update_child_status(0, thread_slot, SERVER_DEAD, - (request_rec *) NULL); - if (remaining_children_to_start - && thread_slot < ap_daemons_limit) { - /* we're still doing a 1-for-1 replacement of dead - * children with new children - */ - make_child(ap_server_conf, thread_slot); - --remaining_children_to_start; - } -#if APR_HAS_OTHER_CHILD -/* TODO: this won't work, we waited on a thread not a process - } - else if (reap_other_child(pid, status) == 0) { -*/ -#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! (tid %d)", tid); - } - /* 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(); - } - - if (shutdown_pending) { - /* Time to gracefully shut down */ - const char *pidfile = NULL; - int slot; - TID tid; - ULONG rc; - ap_listen_rec *lr; - - for (lr = ap_listeners; lr; lr = lr->next) { - apr_socket_close(lr->sd); - DosSleep(0); - } - - /* Kill off running threads */ - for (slot=0; slot<max_daemons_limit; slot++) { - if (ap_scoreboard_image->servers[0][slot].status != SERVER_DEAD) { - tid = ap_scoreboard_image->servers[0][slot].tid; - rc = DosKillThread(tid); - - if (rc != ERROR_INVALID_THREADID) { // Already dead, ignore - if (rc == 0) { - rc = DosWaitThread(&tid, DCWW_WAIT); - - if (rc) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, ap_server_conf, - "error %lu waiting for thread to terminate", rc); - } - } else { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, ap_server_conf, - "error %lu killing thread", rc); - } - } - } - } - - /* cleanup pid file on normal shutdown */ - 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 */ - 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_scoreboard_image->global.running_generation; - - if (is_graceful) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "SIGUSR1 received. Doing graceful restart"); - - /* kill off the idle ones */ - for (i = 0; i < ap_daemons_limit; ++i) { - thread_control[i].deferred_die = 1; - } - - /* 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. - */ - for (i = 0; i < ap_daemons_limit; ++i) { - if (ap_scoreboard_image->servers[0][i].status != SERVER_DEAD) { - ap_scoreboard_image->servers[0][i].status = SERVER_GRACEFUL; - } - } - } - else { - /* Kill 'em off */ - for (i = 0; i < ap_daemons_limit; ++i) { - DosKillThread(ap_scoreboard_image->servers[0][i].tid); - } - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "SIGHUP received. Attempting to restart"); - } - - return 0; -} - -static void spmt_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_daemons_min_free = DEFAULT_MIN_FREE_DAEMON; - ap_daemons_max_free = DEFAULT_MAX_FREE_DAEMON; - ap_daemons_limit = HARD_THREAD_LIMIT; - ap_pid_fname = DEFAULT_PIDLOG; - ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; - ap_extended_status = 0; - ap_scoreboard_fname = NULL; - - apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir)); -} - -static void spmt_os2_hooks(apr_pool_t *p) -{ - /* TODO: set one_process properly */ one_process = 0; - - ap_hook_pre_config(spmt_os2_pre_config, NULL, NULL, APR_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 <VirtualHost>"; - } - ap_pid_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) { - 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_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_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_daemons_limit, HARD_THREAD_LIMIT); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - " lowering MaxClients 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_daemons_limit = HARD_THREAD_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_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) -{ - 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; -} - -/* Stub functions until this MPM supports the connection status API */ - -AP_DECLARE(void) ap_update_connection_status(long conn_id, const char *key, \ - const char *value) -{ - /* NOP */ -} - -AP_DECLARE(void) ap_reset_connection_status(long conn_id) -{ - /* NOP */ -} - -static const command_rec spmt_os2_cmds[] = { -LISTEN_COMMANDS -{ "PidFile", set_pidfile, NULL, RSRC_CONF, TAKE1, - "A file for logging the server process ID"}, -{ "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" }, -{ NULL } -}; - -module AP_MODULE_DECLARE_DATA mpm_spmt_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 */ - spmt_os2_cmds, /* command apr_table_t */ - spmt_os2_hooks, /* register_hooks */ -}; diff --git a/server/mpm/threaded/.cvsignore b/server/mpm/threaded/.cvsignore deleted file mode 100644 index 84df257214..0000000000 --- a/server/mpm/threaded/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -*.lo -*.la -Makefile diff --git a/server/mpm/threaded/Makefile.in b/server/mpm/threaded/Makefile.in deleted file mode 100644 index b5fb3691a6..0000000000 --- a/server/mpm/threaded/Makefile.in +++ /dev/null @@ -1,5 +0,0 @@ - -LTLIBRARY_NAME = libthreaded.la -LTLIBRARY_SOURCES = threaded.c - -include $(top_srcdir)/build/ltlib.mk diff --git a/server/mpm/threaded/config5.m4 b/server/mpm/threaded/config5.m4 deleted file mode 100644 index dbc00cbf72..0000000000 --- a/server/mpm/threaded/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" = "threaded" ; then - APACHE_FAST_OUTPUT(server/mpm/$MPM_NAME/Makefile) -fi diff --git a/server/mpm/threaded/mpm.h b/server/mpm/threaded/mpm.h deleted file mode 100644 index 3359f8cca5..0000000000 --- a/server/mpm/threaded/mpm.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. - */ -#include "scoreboard.h" -#include "unixd.h" - -#ifndef APACHE_MPM_THREADED_H -#define APACHE_MPM_THREADED_H - -#define THREADED_MPM - -#define MPM_NAME "Threaded" - -#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_requests_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_THREADED_H */ diff --git a/server/mpm/threaded/mpm_default.h b/server/mpm/threaded/mpm_default.h deleted file mode 100644 index 84c1304bfa..0000000000 --- a/server/mpm/threaded/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 - * <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 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/threaded/threaded.c b/server/mpm/threaded/threaded.c deleted file mode 100644 index 05e29a781b..0000000000 --- a/server/mpm/threaded/threaded.c +++ /dev/null @@ -1,1450 +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. - */ - -#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" - -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#endif -#if APR_HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif -#if APR_HAVE_SYS_WAIT_H -#include <sys/wait.h> -#endif - -#if !APR_HAS_THREADS -#error The threaded 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 <signal.h> -#include <limits.h> /* for INT_MAX */ - -/* - * Actual definitions of config globals - */ - -int ap_threads_per_child=0; /* Worker threads per child */ -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 workers_may_exit = 0; -static int requests_this_child; -static int num_listensocks = 0; -static apr_socket_t **listensocks; - -/* 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; - -/* - * 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 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_DAEMONS: - *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; - } - 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); - } -} -/* 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 * worker_thread(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); - - /* TODO: Switch to a system where threads reuse the results from earlier - poll calls - manoj */ - while (1) { - workers_may_exit |= (requests_this_child <= 0); - if (workers_may_exit) break; - - (void) ap_update_child_status(process_slot, thread_slot, SERVER_READY, - (request_rec *) NULL); - 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) { - process_socket(ptrans, csd, process_slot, thread_slot); - requests_this_child--; - } - } - 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_clear(ptrans); - } - - apr_pool_destroy(tpool); - ap_update_child_status(process_slot, thread_slot, SERVER_DEAD, - (request_rec *) NULL); - 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 int check_signal(int signum) -{ - switch (signum) { - case SIGTERM: - case SIGINT: - return 1; - } - return 0; -} - -static void child_main(int child_num_arg) -{ - apr_thread_t **threads; - apr_threadattr_t *thread_attr; - int i; - int my_child_num = child_num_arg; - proc_info *my_info = NULL; - ap_listen_rec *lr; - apr_status_t rv; - - - 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); - } - - requests_this_child = ap_max_requests_per_child; - - /* 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 */ - - threads = (apr_thread_t **)malloc(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); - apr_threadattr_create(&thread_attr, pchild); - apr_threadattr_detach_set(thread_attr, 0); /* 0 means PTHREAD_CREATE_JOINABLE */ - - for (i=0; i < ap_threads_per_child; i++) { - - 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); - 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); - } - /* We let each thread update it's own scoreboard entry. This is done - * because it let's us deal with tid better. - */ - } - - /* 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 - */ - - 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). - */ - for (i = 0; i < ap_threads_per_child; i++) { - 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); - } - - /* Tag this slot as occupied so that perform_idle_server_maintenance - * doesn't try to steal it */ - (void) ap_update_child_status(slot, 0, SERVER_STARTING, (request_rec *) NULL); - - 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 AIX_BIND_PROCESSOR - /* By default, AIX binds to a single processor. This bit unbinds - children which will then bind to another CPU. - */ -#include <sys/processor.h> - 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].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; - short_score *ss; - 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 all_dead_threads = 1; - int idle_thread_addition = 0; - - if (i >= ap_max_daemons_limit && free_length == idle_spawn_rate) - break; - for (j = 0; j < ap_threads_per_child; j++) { - ss = &ap_scoreboard_image->servers[i][j]; - status = ss->status; - - any_dying_threads = any_dying_threads || (status == SERVER_DEAD) - || (status == SERVER_GRACEFUL); - all_dead_threads = all_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) { - ++idle_thread_addition; - } - } - if (all_dead_threads && free_length < idle_spawn_rate) { - free_slots[free_length] = i; - ++free_length; - } - if (!all_dead_threads) { - last_non_dead = i; - } - if (!any_dying_threads) { - ++total_non_dead; - idle_thread_count += idle_thread_addition; - } - } - ap_max_daemons_limit = last_non_dead + 1; - - if (idle_thread_count > max_spare_threads) { - /* Kill off one child */ - char char_of_death = '!'; - 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", idle_spawn_rate, - 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); - - 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); - } - ap_server_conf = s; - 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(&accept_mutex, APR_MUTEX, APR_LOCKALL, - 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_create_scoreboard(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) { - int i, j; - - 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 < ap_daemons_limit; ++i) { - for (j = 0; j < ap_threads_per_child; j++) { - if (ap_scoreboard_image->servers[i][j].status != SERVER_DEAD) { - ap_scoreboard_image->servers[i][j].status = SERVER_GRACEFUL; - } - } - } - } - 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 threaded_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 threaded_hooks(apr_pool_t *p) -{ - one_process = 0; - - ap_hook_pre_config(threaded_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 <VirtualHost>"; - } - 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); - } - 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); - - /* a value of zero means infinity. The following removes a conditional - * from worker_thread's hot path - */ - - if (!ap_max_requests_per_child) { - ap_max_requests_per_child = INT_MAX; - } - - 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 command_rec threaded_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"), -{ NULL } -}; - -module AP_MODULE_DECLARE_DATA mpm_threaded_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 */ - threaded_cmds, /* command apr_table_t */ - threaded_hooks /* register_hooks */ -}; - diff --git a/server/mpm/winnt/Win9xConHook.c b/server/mpm/winnt/Win9xConHook.c deleted file mode 100644 index a285329b43..0000000000 --- a/server/mpm/winnt/Win9xConHook.c +++ /dev/null @@ -1,739 +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 - * <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. - */ - -#ifdef WIN32 - -/* - * 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. - */ - -/* This debugging define turns on output to COM1, although you better init - * the port first (even using hyperterm). It's the only way to catch the - * goings on within system logoff/shutdown. - * #define DBG 1 - */ - -#include <windows.h> - -/* Variables used within any process context: - * hookwndmsg is a shared message to send Win9xConHook signals - * origwndprop is a wndprop atom to store the orig wndproc of the tty - * hookwndprop is a wndprop atom to store the hwnd of the hidden child - * is_service reminds us to unmark this process on the way out - */ -static UINT hookwndmsg = 0; -static LPCTSTR origwndprop; -static LPCTSTR hookwndprop; -static BOOL is_service = 0; -//static HMODULE hmodThis = NULL; - -/* Variables used within the tty processes' context: - * 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 on unload - * hmodLock is there to try and prevent this dll from being unloaded if the - * hook is removed while we are subclassed - */ -static int is_tty = -1; -static HWND hwtty = NULL; -static BOOL is_subclassed = 0; - -// This simply causes a gpfault the moment it tries to FreeLibrary within -// the subclass procedure ... not good. -//static HMODULE hmodLock = NULL; - -/* Variables used within the service or console app's context: - * hmodHook is the instance handle of this module for registering the hooks - * hhkGetMessage is the hook handle for catching Posted messages - * hhkGetMessage is the hook handle for catching Sent messages - * monitor_hwnd is the invisible window that handles our tty messages - * the tty_info strucure is used to pass args into the hidden window's thread - */ -static HMODULE hmodHook = NULL; -static HHOOK hhkGetMessage; -//static HHOOK hhkCallWndProc; -static HWND monitor_hwnd = NULL; - -typedef struct { - PHANDLER_ROUTINE phandler; - HINSTANCE instance; - HWND parent; - INT type; - LPCSTR name; -} tty_info; - -/* These are the GetWindowLong offsets for the hidden window's internal info - * gwltty_phandler is the address of the app's HandlerRoutine - * gwltty_ttywnd is the tty this hidden window will handle messages from - */ -#define gwltty_phandler 0 -#define gwltty_ttywnd 4 - -/* Forward declaration prototypes for internal functions - */ -static BOOL CALLBACK EnumttyWindow(HWND wnd, LPARAM retwnd); -static LRESULT WINAPI RegisterWindows9xService(BOOL set_service); -static LRESULT CALLBACK ttyConsoleCtrlWndProc(HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam); -static DWORD WINAPI ttyConsoleCtrlThread(LPVOID tty); -static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam); -static int HookProc(int hc, HWND *hwnd, UINT *msg, - WPARAM *wParam, LPARAM *lParam); -#ifdef DBG -static VOID DbgPrintf(LPTSTR fmt, ...); -#endif - - -/* DllMain is invoked by every process in the entire system that is hooked - * by our window hooks, notably the tty processes' context, and by the user - * who wants tty messages (the app). Keep it light and simple. - */ -BOOL __declspec(dllexport) APIENTRY DllMain(HINSTANCE hModule, ULONG ulReason, - LPVOID pctx) -{ - if (ulReason == DLL_PROCESS_ATTACH) - { - //hmodThis = hModule; - if (!hookwndmsg) { - origwndprop = MAKEINTATOM(GlobalAddAtom("Win9xConHookOrigProc")); - hookwndprop = MAKEINTATOM(GlobalAddAtom("Win9xConHookThunkWnd")); - hookwndmsg = RegisterWindowMessage("Win9xConHookMsg"); - } -#ifdef DBG -// DbgPrintf("H ProcessAttach:%8.8x\r\n", -// GetCurrentProcessId()); -#endif - } - else if ( ulReason == DLL_PROCESS_DETACH ) - { -#ifdef DBG -// DbgPrintf("H ProcessDetach:%8.8x\r\n", GetCurrentProcessId()); -#endif - if (monitor_hwnd) - SendMessage(monitor_hwnd, WM_DESTROY, 0, 0); - if (is_subclassed) - SendMessage(hwtty, hookwndmsg, 0, (LPARAM)hwtty); - if (hmodHook) - { - if (hhkGetMessage) { - UnhookWindowsHookEx(hhkGetMessage); - hhkGetMessage = NULL; - } - //if (hhkCallWndProc) { - // UnhookWindowsHookEx(hhkCallWndProc); - // hhkCallWndProc = NULL; - //} - FreeLibrary(hmodHook); - hmodHook = NULL; - } - if (is_service) - RegisterWindows9xService(FALSE); - if (hookwndmsg) { - GlobalDeleteAtom((ATOM)origwndprop); - GlobalDeleteAtom((ATOM)hookwndprop); - hookwndmsg = 0; - } - } - return TRUE; -} - - -/* This group of functions are provided for the service/console app - * to register itself a HandlerRoutine to accept tty or service messages - */ - - -/* Exported function that creates a Win9x 'service' via a hidden window, - * that notifies the process via the HandlerRoutine messages. - */ -BOOL __declspec(dllexport) WINAPI Windows9xServiceCtrlHandler( - PHANDLER_ROUTINE phandler, - LPCSTR name) -{ - /* If we have not yet done so */ - FreeConsole(); - - if (name) - { - DWORD tid; - HANDLE hThread; - /* NOTE: this is static so the module can continue to - * access these args while we go on to other things - */ - static tty_info tty; - tty.instance = GetModuleHandle(NULL); - tty.phandler = phandler; - tty.parent = NULL; - tty.name = name; - tty.type = 2; - RegisterWindows9xService(TRUE); - hThread = CreateThread(NULL, 0, ttyConsoleCtrlThread, - (LPVOID)&tty, 0, &tid); - if (hThread) - { - CloseHandle(hThread); - return TRUE; - } - } - else /* remove */ - { - if (monitor_hwnd) - SendMessage(monitor_hwnd, WM_DESTROY, 0, 0); - RegisterWindows9xService(FALSE); - return TRUE; - } - return FALSE; -} - - -/* Exported function that registers a HandlerRoutine to accept missing - * Win9x CTRL_EVENTs from the tty window, as NT does without a hassle. - * If add is 1 or 2, register the handler, if 2 also mark it as a service. - * If add is 0 deregister the handler, and unmark if a service - */ -BOOL __declspec(dllexport) WINAPI FixConsoleCtrlHandler( - PHANDLER_ROUTINE phandler, - INT add) -{ - HWND parent; - - if (add) - { - HANDLE hThread; - DWORD tid; - /* NOTE: this is static so the module can continue to - * access these args while we go on to other things - */ - static tty_info tty; - EnumWindows(EnumttyWindow, (LPARAM)&parent); - if (!parent) { -#ifdef DBG - DbgPrintf("A EnumttyWindow failed (%d)\r\n", GetLastError()); -#endif - return FALSE; - } - tty.instance = GetModuleHandle(NULL); - tty.phandler = phandler; - tty.parent = parent; - tty.type = add; - if (add == 2) { - tty.name = "ttyService"; - RegisterWindows9xService(TRUE); - } - else - tty.name = "ttyMonitor"; - hThread = CreateThread(NULL, 0, ttyConsoleCtrlThread, - (LPVOID)&tty, 0, &tid); - if (!hThread) - return FALSE; - CloseHandle(hThread); - 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); - } - return TRUE; - } - else /* remove */ - { - if (monitor_hwnd) { - SendMessage(monitor_hwnd, WM_DESTROY, 0, 0); - } - if (hmodHook) - { - if (hhkGetMessage) { - UnhookWindowsHookEx(hhkGetMessage); - hhkGetMessage = NULL; - } - //if (hhkCallWndProc) { - // UnhookWindowsHookEx(hhkCallWndProc); - // hhkCallWndProc = NULL; - //} - FreeLibrary(hmodHook); - hmodHook = NULL; - } - if (is_service) - RegisterWindows9xService(FALSE); - return TRUE; - } - return FALSE; -} - - -/* The following internal helpers are only used within the app's context - */ - -/* ttyConsoleCreateThread is the process that runs within the user app's - * context. It creates and pumps the messages of a hidden monitor window, - * watching for messages from the system, or the associated subclassed tty - * window. Things can happen in our context that can't be done from the - * tty's context, and visa versa, so the subclass procedure and this hidden - * window work together to make it all happen. - */ -static DWORD WINAPI ttyConsoleCtrlThread(LPVOID tty) -{ - WNDCLASS wc; - 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; - if (((tty_info*)tty)->parent) - wc.lpszClassName = "ttyConHookChild"; - else - wc.lpszClassName = "ApacheWin95ServiceMonitor"; - - if (!RegisterClass(&wc)) { -#ifdef DBG - DbgPrintf("A proc %8.8x Error creating class %s (%d)\r\n", - GetCurrentProcessId(), wc.lpszClassName, GetLastError()); -#endif - return 0; - } - - /* Create an invisible window */ - monitor_hwnd = CreateWindow(wc.lpszClassName, ((tty_info*)tty)->name, - WS_OVERLAPPED & ~WS_VISIBLE, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - NULL, NULL, - ((tty_info*)tty)->instance, tty); - - if (!monitor_hwnd) { -#ifdef DBG - DbgPrintf("A proc %8.8x Error creating window %s %s (%d)\r\n", - GetCurrentProcessId(), wc.lpszClassName, - ((tty_info*)tty)->name, GetLastError()); -#endif - return 0; - } - - while (GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - /* Tag again as deleted, just in case we missed WM_DESTROY */ - monitor_hwnd = NULL; - return 0; -} - - -/* This is the WndProc procedure for our invisible window. - * When our subclasssed tty window receives the WM_CLOSE, WM_ENDSESSION, - * or WM_QUERYENDSESSION messages, the message is dispatched to our hidden - * window (this message process), and we call the installed HandlerRoutine - * that was registered by the app. - */ -static 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("A proc %8.8x created %8.8x %s for tty wnd %8.8x\r\n", - GetCurrentProcessId(), hwnd, - tty->name, tty->parent); -#endif - if (tty->parent) { - SetProp(tty->parent, hookwndprop, hwnd); - PostMessage(tty->parent, hookwndmsg, - tty->type, (LPARAM)tty->parent); - } - return 0; - } - else if (msg == WM_DESTROY) - { - HWND parent = (HWND)GetWindowLong(hwnd, gwltty_ttywnd); -#ifdef DBG - DbgPrintf("A proc %8.8x destroyed %8.8x ttyConHookChild\r\n", - GetCurrentProcessId(), hwnd); -#endif - if (parent) { - RemoveProp(parent, hookwndprop); - SendMessage(parent, hookwndmsg, 0, (LPARAM)parent); - } - monitor_hwnd = NULL; - } - else if (msg == WM_CLOSE) - { - PHANDLER_ROUTINE phandler = - (PHANDLER_ROUTINE)GetWindowLong(hwnd, gwltty_phandler); - LRESULT rv = phandler(CTRL_CLOSE_EVENT); -#ifdef DBG - DbgPrintf("A proc %8.8x invoked CTRL_CLOSE_EVENT " - "returning %d\r\n", - GetCurrentProcessId(), rv); -#endif - if (rv) - return !rv; - } - else if ((msg == WM_QUERYENDSESSION) || (msg == WM_ENDSESSION)) - { - if (lParam & ENDSESSION_LOGOFF) - { - PHANDLER_ROUTINE phandler = - (PHANDLER_ROUTINE)GetWindowLong(hwnd, gwltty_phandler); - LRESULT rv = phandler(CTRL_LOGOFF_EVENT); -#ifdef DBG - DbgPrintf("A proc %8.8x invoked CTRL_LOGOFF_EVENT " - "returning %d\r\n", - GetCurrentProcessId(), rv); -#endif - if (rv) - return ((msg == WM_QUERYENDSESSION) ? rv : !rv); - } - else - { - PHANDLER_ROUTINE phandler = - (PHANDLER_ROUTINE)GetWindowLong(hwnd, gwltty_phandler); - LRESULT rv = phandler(CTRL_SHUTDOWN_EVENT); -#ifdef DBG - DbgPrintf("A proc %8.8x invoked CTRL_SHUTDOWN_EVENT " - "returning %d\r\n", GetCurrentProcessId(), rv); -#endif - if (rv) - return ((msg == WM_QUERYENDSESSION) ? rv : !rv); - } - } - return (DefWindowProc(hwnd, msg, wParam, lParam)); -} - - -/* The following internal helpers are invoked by the hooked tty and our app - */ - - -/* Register or deregister the current process as a Windows9x style service. - * Experience shows this call is ignored across processes, so the second - * arg to RegisterServiceProcess (process group id) is effectively useless. - */ -static LRESULT WINAPI RegisterWindows9xService(BOOL set_service) -{ - static HINSTANCE hkernel; - static DWORD (WINAPI *register_service_process)(DWORD, DWORD) = NULL; - BOOL rv; - - if (set_service == is_service) - return 1; - -#ifdef DBG - DbgPrintf("R %s proc %8.8x as a service\r\n", - set_service ? "installing" : "removing", - GetCurrentProcessId()); -#endif - - if (!register_service_process) - { - /* Obtain a handle to the kernel library */ - hkernel = LoadLibrary("KERNEL32.DLL"); - if (!hkernel) - return 0; - - /* Find the RegisterServiceProcess function */ - register_service_process = (DWORD (WINAPI *)(DWORD, DWORD)) - GetProcAddress(hkernel, "RegisterServiceProcess"); - if (register_service_process == NULL) { - FreeLibrary(hkernel); - return 0; - } - } - - /* Register this process as a service */ - rv = register_service_process(0, set_service != FALSE); - if (rv) - is_service = set_service; - - if (!is_service) - { - /* Unload the kernel library */ - FreeLibrary(hkernel); - register_service_process = NULL; - } - return rv; -} - - -/* - * 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[8]; - 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; -} - - -/* The remaining code all executes --in the tty's own process context-- - * - * That means special attention must be paid to what it's doing... - */ - -/* Subclass message process for the tty window - * - * This code -handles- WM_CLOSE, WM_ENDSESSION and WM_QUERYENDSESSION - * by dispatching them to the window identified by the hookwndprop - * property atom set against our window. Messages are then dispatched - * to origwndprop property atom we set against the window when we - * injected this subclass. This trick did not work with simply a hook. - */ -static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam) -{ - WNDPROC origproc = (WNDPROC) GetProp(hwnd, origwndprop); - if (!origproc) - return 0; - - if (msg == WM_NCDESTROY - || (msg == hookwndmsg && !LOWORD(wParam) && (HWND)lParam == hwnd)) - { - if (is_subclassed) { -#ifdef DBG - DbgPrintf("W proc %08x hwnd:%08x Subclass removed\r\n", - GetCurrentProcessId(), hwnd); -#endif - if (is_service) - RegisterWindows9xService(FALSE); - SetWindowLong(hwnd, GWL_WNDPROC, (LONG)origproc); - RemoveProp(hwnd, origwndprop); - RemoveProp(hwnd, hookwndprop); - is_subclassed = FALSE; - //if (hmodLock) - // FreeLibrary(hmodLock); - //hmodLock = NULL; - } - } - else if (msg == WM_CLOSE || msg == WM_ENDSESSION - || msg == WM_QUERYENDSESSION) - { - HWND child = (HWND)GetProp(hwnd, hookwndprop); - if (child) { -#ifdef DBG - DbgPrintf("W proc %08x hwnd:%08x forwarded msg:%d\r\n", - GetCurrentProcessId(), hwnd, msg); -#endif - return SendMessage(child, msg, wParam, lParam); - } - } - return CallWindowProc(origproc, hwnd, msg, wParam, lParam); -} - - -/* HookProc, once installed, is responsible for subclassing the system - * tty windows. It generally does nothing special itself, since - * research indicates that it cannot deal well with the messages we are - * interested in, that is, WM_CLOSE, WM_QUERYSHUTDOWN and WM_SHUTDOWN - * of the tty process. - * - * Respond and subclass only when a WM_NULL is received by the window. - */ -int HookProc(int hc, HWND *hwnd, UINT *msg, WPARAM *wParam, LPARAM *lParam) -{ - if (is_tty == -1 && *hwnd) - { - char ttybuf[8]; - HWND htty; - hwtty = *hwnd; - while (htty = GetParent(hwtty)) - hwtty = htty; - is_tty = (GetClassName(hwtty, ttybuf, sizeof(ttybuf)) - && !strcmp(ttybuf, "tty")); -#ifdef DBG - if (is_tty) - DbgPrintf("H proc %08x tracking hwnd %08x\r\n", - GetCurrentProcessId(), hwtty); -#endif - } - - if (*msg == hookwndmsg && *wParam && *lParam == (LPARAM)hwtty && is_tty) - { - WNDPROC origproc = (WNDPROC)GetWindowLong(hwtty, GWL_WNDPROC); - //char myname[MAX_PATH]; - //if (GetModuleFileName(hmodThis, myname, sizeof(myname))) - // hmodLock = LoadLibrary(myname); - SetProp(hwtty, origwndprop, origproc); - SetWindowLong(hwtty, GWL_WNDPROC, (LONG)WndProc); - is_subclassed = TRUE; -#ifdef DBG - DbgPrintf("H proc %08x hwnd:%08x Subclassed\r\n", - GetCurrentProcessId(), hwtty); -#endif - if (LOWORD(*wParam) == 2) - RegisterWindows9xService(TRUE); - } - - 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->wParam, &pmsg->lParam); - 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, - ... - ) -{ - static HANDLE mutex; - va_list marker; - TCHAR szBuf[256]; - DWORD t; - HANDLE gDbgOut; - - va_start(marker, fmt); - wvsprintf(szBuf, fmt, marker); - va_end(marker); - - if (!mutex) - mutex = CreateMutex(NULL, FALSE, "Win9xConHookDbgOut"); - WaitForSingleObject(mutex, INFINITE); - gDbgOut = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, - NULL, OPEN_EXISTING, FILE_FLAG_WRITE_THROUGH, NULL); - WriteFile(gDbgOut, szBuf, strlen(szBuf), &t, NULL); - CloseHandle(gDbgOut); - ReleaseMutex(mutex); -} -#endif - -#endif /* WIN32 */ diff --git a/server/mpm/winnt/Win9xConHook.def b/server/mpm/winnt/Win9xConHook.def deleted file mode 100644 index 85ec166404..0000000000 --- a/server/mpm/winnt/Win9xConHook.def +++ /dev/null @@ -1,10 +0,0 @@ -LIBRARY Win9xConHook - -EXETYPE WINDOWS - -EXPORTS - DllMain - GetMsgProc - CallWndProc - FixConsoleCtrlHandler - Windows9xServiceCtrlHandler diff --git a/server/mpm/winnt/Win9xConHook.dsp b/server/mpm/winnt/Win9xConHook.dsp deleted file mode 100644 index 56ad1180a9..0000000000 --- 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 "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 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /Fd"Release\Win9xConHook" /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 /nologo /subsystem:windows /dll /incremental:no /map /machine:I386 /base:"0x1c0f0000" -# ADD LINK32 kernel32.lib user32.lib gdi32.lib /nologo /subsystem:windows /dll /incremental:no /map /machine:I386 /base:"0x1c0f0000" - -!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 "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 /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /Fd"Debug\Win9xConHook" /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 /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /base:"0x1c0f0000" -# ADD LINK32 kernel32.lib user32.lib gdi32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /base:"0x1c0f0000" - -!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 312e82cd2d..0000000000 --- a/server/mpm/winnt/Win9xConHook.h +++ /dev/null @@ -1,99 +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 - * <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 AP_WIN9XCONHOOK_H -#define AP_WIN9XCONHOOK_H - -#ifdef WIN32 - -/* Windows9xServiceCtrlHandler registers a handler routine, frees the - * console window, and registers this process as a service in Win9x. - * It creats a hidden window of class "ApacheWin95ServiceMonitor" - * and titled by the name passed, which passes the WM_SHUTDOWN message - * through the given HandlerRoutine's CTRL_SHUTDOWN event. - * Call with name of NULL to remove the Service handler. - */ -BOOL WINAPI Windows9xServiceCtrlHandler(PHANDLER_ROUTINE phandler, LPCSTR name); - - -/* FixConsoleControlHandler registers a handler routine with the - * Win9xConHook.dll, creating a hidden window and forwarding the - * WM_ENDSESSION and WM_CLOSE messages to the given HandlerRoutine - * as CTRL_SHUTDOWN_EVENT, CTRL_LOGOFF_EVENT and CTRL_CLOSE_EVENT. - * The application should still use SetConsoleCtrlHandler to grab - * the CTRL_BREAK_EVENT and CTRL_C_EVENT, if desired. - */ -BOOL WINAPI FixConsoleCtrlHandler(PHANDLER_ROUTINE phandler, BOOL add); - - -/* - * Exported PostMessage Hook, never use this directly: - * - * LRESULT CALLBACK GetMsgProc(INT hc, WPARAM wParam, LPARAM lParam); - */ - - -/* - * Exported SendMessage Hook, never use this directly: - * - * LRESULT CALLBACK CallWndProc(INT hc, WPARAM wParam, LPARAM lParam); - */ - -#endif /* WIN32 */ - -#endif AP_WIN9XCONHOOK_H \ No newline at end of file diff --git a/server/mpm/winnt/mpm.h b/server/mpm/winnt/mpm.h deleted file mode 100644 index 4c17b8a55f..0000000000 --- a/server/mpm/winnt/mpm.h +++ /dev/null @@ -1,71 +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 APACHE_MPM_H -#define APACHE_MPM_H - -/* mpm.h is the place to make declarations that are MPM specific but that must be - * shared with non-mpm specific code in the server. Hummm, perhaps we can - * move most of this stuff to mpm_common.h? - */ - -#define MPM_NAME "WinNT" - -extern int ap_threads_per_child; - -#endif /* APACHE_MPM_H */ diff --git a/server/mpm/winnt/mpm_default.h b/server/mpm/winnt/mpm_default.h deleted file mode 100644 index 876503a47d..0000000000 --- a/server/mpm/winnt/mpm_default.h +++ /dev/null @@ -1,135 +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 APACHE_MPM_DEFAULT_H -#define APACHE_MPM_DEFAULT_H - -/* AP_CHILD_THREAD_FROM_ID is used by the scoreboard. */ -#define AP_CHILD_THREAD_FROM_ID(i) 0, i - -/* 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 4096 -#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. - */ -#define HARD_SERVER_LIMIT 1 - -/* 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/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c deleted file mode 100644 index 921e362ddd..0000000000 --- a/server/mpm/winnt/mpm_winnt.c +++ /dev/null @@ -1,2114 +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. - */ - -#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 "apr_portable.h" -#include "apr_getopt.h" -#include "apr_strings.h" -#include "apr_lib.h" -#include "ap_mpm.h" -#include "ap_config.h" -#include "ap_listen.h" -#include "mpm_default.h" -#include "mpm_winnt.h" -#include "mpm_common.h" -#include "scoreboard.h" - - -typedef HANDLE thread; -#ifdef CONTAINING_RECORD -#undef CONTAINING_RECORD -#endif -#define CONTAINING_RECORD(address, type, field) ((type *)( \ - (PCHAR)(address) - \ - (PCHAR)(&((type *)0)->field))) -#define PADDED_ADDR_SIZE sizeof(SOCKADDR_IN)+16 - -typedef struct CompContext { - struct CompContext *next; - OVERLAPPED Overlapped; - apr_socket_t *sock; - SOCKET accept_socket; - char buff[2*PADDED_ADDR_SIZE]; - struct sockaddr *sa_server; - int sa_server_len; - struct sockaddr *sa_client; - int sa_client_len; - apr_pool_t *ptrans; -} COMP_CONTEXT, *PCOMP_CONTEXT; - -typedef enum { - IOCP_CONNECTION_ACCEPTED = 1, - IOCP_WAIT_FOR_RECEIVE = 2, - IOCP_WAIT_FOR_TRANSMITFILE = 3, - IOCP_SHUTDOWN = 4 -} io_state_e; - -/* Queue for managing the passing of COMP_CONTEXTs from - * the accept thread to the worker threads and back again - */ -apr_lock_t *qlock; -COMP_CONTEXT *qhead = NULL; -COMP_CONTEXT *qtail = NULL; - -static HANDLE ThreadDispatchIOCP = NULL; - -/* Definitions of WINNT MPM specific config globals */ -static server_rec *server_conf; -static apr_pool_t *pconf; -static apr_pool_t *pchild = NULL; -static int workers_may_exit = 0; -static int shutdown_in_progress = 0; -static unsigned int g_blocked_threads = 0; -static int ap_max_requests_per_child=0; - -static char *ap_pid_fname = NULL; - -static HANDLE shutdown_event; /* used to signal the parent to shutdown */ -static HANDLE restart_event; /* used to signal the parent to restart */ -static HANDLE exit_event; /* used by parent to signal the child to exit */ -static HANDLE maintenance_event; - -static char ap_coredump_dir[MAX_STRING_LEN]; - -static int one_process = 0; -static char const* signal_arg; - -OSVERSIONINFO osver; /* VER_PLATFORM_WIN32_NT */ - -apr_lock_t *start_mutex; -static DWORD my_pid; -static DWORD parent_pid; - -int ap_threads_per_child = 0; -int ap_daemons_to_start=0; - -/* ap_get_max_daemons and ap_my_generation are used by the scoreboard - * code - */ -ap_generation_t volatile ap_my_generation=0; /* Used by the scoreboard */ - -/* This is the helper code to resolve late bound entry points - * missing from one or more releases of the Win32 API... - * but it sure would be nice if we didn't duplicate this code - * from the APR ;-) - */ -static const char* const lateDllName[DLL_defined] = { - "kernel32", "advapi32", "mswsock", "ws2_32" }; -static HMODULE lateDllHandle[DLL_defined] = { - NULL, NULL, NULL, NULL }; - -FARPROC ap_load_dll_func(ap_dlltoken_e fnLib, char* fnName, int ordinal) -{ - if (!lateDllHandle[fnLib]) { - lateDllHandle[fnLib] = LoadLibrary(lateDllName[fnLib]); - if (!lateDllHandle[fnLib]) - return NULL; - } - if (ordinal) - return GetProcAddress(lateDllHandle[fnLib], (char *) ordinal); - else - return GetProcAddress(lateDllHandle[fnLib], fnName); -} - -/* 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; - } - apr_set_os_error(0); - if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION) - || apr_get_os_error()) { - LocalFree( pSD ); - LocalFree( sa ); - return NULL; - } - if (!SetSecurityDescriptorDacl(pSD, TRUE, (PACL) NULL, FALSE) - || apr_get_os_error()) { - 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 ); - } -} - -/* - * 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; -} - -/* - * 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. - */ -/* - * 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]; -void setup_signal_names(char *prefix) -{ - apr_snprintf(signal_name_prefix, sizeof(signal_name_prefix), prefix); - apr_snprintf(signal_shutdown_name, sizeof(signal_shutdown_name), - "%s_shutdown", signal_name_prefix); - apr_snprintf(signal_restart_name, sizeof(signal_restart_name), - "%s_restart", signal_name_prefix); -} - -void signal_parent(int type) -{ - HANDLE e; - char *signal_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; - } - 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, apr_get_os_error(), server_conf, - "OpenEvent on %s event", signal_name); - return; - } - if (SetEvent(e) == 0) { - /* Same problem as above */ - ap_log_error(APLOG_MARK, APLOG_EMERG, apr_get_os_error(), server_conf, - "SetEvent on %s event", signal_name); - CloseHandle(e); - return; - } - CloseHandle(e); -} - -static int volatile is_graceful = 0; - -AP_DECLARE(int) ap_graceful_stop_signalled(void) -{ - return is_graceful; -} - -AP_DECLARE(void) ap_start_shutdown(void) -{ - signal_parent(0); -} - -AP_DECLARE(void) ap_start_restart(int gracefully) -{ - is_graceful = gracefully; - signal_parent(1); -} - - -/* - * find_ready_listener() - * Only used by Win9* and should go away when the win9*_accept() function is - * reimplemented using apr_poll(). - */ -static ap_listen_rec *head_listener; -static APR_INLINE ap_listen_rec *find_ready_listener(fd_set * main_fds) -{ - ap_listen_rec *lr; - SOCKET nsd; - - for (lr = head_listener; lr ; lr = lr->next) { - apr_os_sock_get(&nsd, lr->sd); - if (FD_ISSET(nsd, main_fds)) { - head_listener = lr->next; - if (head_listener == NULL) - head_listener = ap_listeners; - - return (lr); - } - } - return NULL; -} - -/* - * get_listeners_from_parent() - * The listen sockets are opened in the parent. This function, which runs - * exclusively in the child process, receives them from the parent and - * makes them availeble in the child. - */ -static int get_listeners_from_parent(server_rec *s) -{ - WSAPROTOCOL_INFO WSAProtocolInfo; - HANDLE pipe; - ap_listen_rec *lr; - DWORD BytesRead; - int num_listeners = 0; - SOCKET nsd; - - /* Set up a default listener if necessary */ - if (ap_listeners == NULL) { - ap_listen_rec *lr; - lr = apr_palloc(s->process->pool, sizeof(ap_listen_rec)); - if (!lr) - return 0; - lr->sd = NULL; - lr->next = ap_listeners; - ap_listeners = lr; - } - - /* 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); - for (lr = ap_listeners; lr; lr = lr->next) { - if (!ReadFile(pipe, &WSAProtocolInfo, sizeof(WSAPROTOCOL_INFO), - &BytesRead, (LPOVERLAPPED) NULL)) { - ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf, - "setup_inherited_listeners: Unable to read socket data from parent"); - signal_parent(0); /* tell parent to die */ - exit(1); - } - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, APR_SUCCESS, server_conf, - "Child %d: setup_inherited_listener() read = %d bytes of WSAProtocolInfo.", my_pid); - nsd = WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, - &WSAProtocolInfo, 0, 0); - if (nsd == INVALID_SOCKET) { - ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_netos_error(), server_conf, - "Child %d: setup_inherited_listeners(), WSASocket failed to open the inherited socket.", my_pid); - signal_parent(0); /* tell parent to die */ - exit(1); - } - apr_os_sock_put(&lr->sd, &nsd, pconf); - num_listeners++; - } - - CloseHandle(pipe); - - return num_listeners; -} - - -/* Windows 9x specific code... - * Accept processing for on Windows 95/98 uses a producer/consumer queue - * model. A single thread accepts connections and queues the accepted socket - * to the accept queue for consumption by a pool of worker threads. - * - * win9x_accept() - * The accept threads runs this function, which accepts connections off - * the network and calls add_job() to queue jobs to the accept_queue. - * 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. - * win9x_get_connection() - * Calls remove_job() to pull a job from the accept queue. All the worker - * threads block on remove_job. - */ - -typedef struct joblist_s { - struct joblist_s *next; - int sock; -} joblist; - -typedef struct globals_s { - HANDLE jobsemaphore; - joblist *jobhead; - joblist *jobtail; - apr_lock_t *jobmutex; - int jobcount; -} globals; - -globals allowed_globals = {NULL, NULL, NULL, NULL, 0}; -#define MAX_SELECT_ERRORS 100 - -static void add_job(int sock) -{ - joblist *new_job; - - new_job = (joblist *) malloc(sizeof(joblist)); - if (new_job == NULL) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Ouch! Out of memory in add_job()!"); - return; - } - new_job->next = NULL; - new_job->sock = sock; - - apr_lock_acquire(allowed_globals.jobmutex); - - 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++; - ReleaseSemaphore(allowed_globals.jobsemaphore, 1, NULL); - - apr_lock_release(allowed_globals.jobmutex); -} - -static int remove_job(void) -{ - joblist *job; - int sock; - - WaitForSingleObject(allowed_globals.jobsemaphore, INFINITE); - apr_lock_acquire(allowed_globals.jobmutex); - - if (shutdown_in_progress && !allowed_globals.jobhead) { - apr_lock_release(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; - apr_lock_release(allowed_globals.jobmutex); - sock = job->sock; - free(job); - - return (sock); -} - -static void win9x_accept(void * dummy) -{ - int requests_this_child = 0; - struct timeval tv; - fd_set main_fds; - int wait_time = 1; - int csd; - SOCKET nsd = INVALID_SOCKET; - struct sockaddr_in sa_client; - int count_select_errors = 0; - int rc; - int clen; - ap_listen_rec *lr; - struct fd_set listenfds; - SOCKET listenmaxfd = INVALID_SOCKET; - - /* Setup the listeners - * ToDo: Use apr_poll() - */ - FD_ZERO(&listenfds); - for (lr = ap_listeners; lr; lr = lr->next) { - if (lr->sd != NULL) { - apr_os_sock_get(&nsd, lr->sd); - FD_SET(nsd, &listenfds); - if (listenmaxfd == INVALID_SOCKET || nsd > listenmaxfd) { - listenmaxfd = nsd; - } - } - } - head_listener = ap_listeners; - - while (!shutdown_in_progress) { - if (ap_max_requests_per_child && (requests_this_child > ap_max_requests_per_child)) { - break; - } - - tv.tv_sec = wait_time; - tv.tv_usec = 0; - memcpy(&main_fds, &listenfds, sizeof(fd_set)); - - rc = select(listenmaxfd + 1, &main_fds, NULL, NULL, &tv); - - if (rc == 0 || (rc == SOCKET_ERROR && APR_STATUS_IS_EINTR(apr_get_netos_error()))) { - count_select_errors = 0; /* reset count of errors */ - continue; - } - else if (rc == SOCKET_ERROR) { - /* 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_INFO, apr_get_netos_error(), server_conf, - "select failed with error %d", apr_get_netos_error()); - count_select_errors++; - if (count_select_errors > MAX_SELECT_ERRORS) { - shutdown_in_progress = 1; - ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_netos_error(), server_conf, - "Too many errors in select loop. Child process exiting."); - break; - } - } else { - ap_listen_rec *lr; - - lr = find_ready_listener(&main_fds); - if (lr != NULL) { - /* fetch the native socket descriptor */ - apr_os_sock_get(&nsd, lr->sd); - } - } - - do { - clen = sizeof(sa_client); - csd = accept(nsd, (struct sockaddr *) &sa_client, &clen); - if (csd == INVALID_SOCKET) { - csd = -1; - } - } while (csd < 0 && APR_STATUS_IS_EINTR(apr_get_netos_error())); - - if (csd < 0) { - if (APR_STATUS_IS_ECONNABORTED(apr_get_netos_error())) { - ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_netos_error(), server_conf, - "accept: (client socket)"); - } - } - else { - add_job(csd); - requests_this_child++; - } - } - SetEvent(exit_event); -} - -static PCOMP_CONTEXT win9x_get_connection(PCOMP_CONTEXT context) -{ - int len; - - if (context == NULL) { - /* allocate the completion context and the transaction pool */ - context = apr_pcalloc(pconf, sizeof(COMP_CONTEXT)); - if (!context) { - ap_log_error(APLOG_MARK,APLOG_ERR, apr_get_os_error(), server_conf, - "win9x_get_connection: apr_pcalloc() failed. Process will exit."); - return NULL; - } - apr_pool_create(&context->ptrans, pconf); - } - - - while (1) { - apr_pool_clear(context->ptrans); - context->accept_socket = remove_job(); - if (context->accept_socket == -1) { - return NULL; - } - len = sizeof(struct sockaddr); - context->sa_server = apr_palloc(context->ptrans, len); - if (getsockname(context->accept_socket, - context->sa_server, &len)== SOCKET_ERROR) { - ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_netos_error(), server_conf, - "getsockname failed"); - continue; - } - len = sizeof(struct sockaddr); - context->sa_client = apr_palloc(context->ptrans, len); - if ((getpeername(context->accept_socket, - context->sa_client, &len)) == SOCKET_ERROR) { - ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_netos_error(), server_conf, - "getpeername failed"); - memset(&context->sa_client, '\0', sizeof(context->sa_client)); - } - - /* do we NEED_DUPPED_CSD ?? */ - - return context; - } -} -/* Windows NT/2000 specific code... - * Accept processing for on Windows NT uses a producer/consumer queue - * model. An accept thread accepts connections off the network then issues - * PostQueuedCompletionStatus() to awake a thread blocked on the ThreadDispatch - * IOCompletionPort. - * - * winnt_accept() - * One or more accept threads run in this function, each of which accepts - * connections off the network and calls PostQueuedCompletionStatus() to - * queue an io completion packet to the ThreadDispatch IOCompletionPort. - * winnt_get_connection() - * Worker threads block on the ThreadDispatch IOCompletionPort awaiting - * connections to service. - */ -static void winnt_accept(void *listen_socket) -{ - static int num_completion_contexts = 0; - static int requests_this_child = 0; - PCOMP_CONTEXT pCompContext; - DWORD BytesRead; - SOCKET nlsd; - int lasterror; - - nlsd = (SOCKET) listen_socket; - - while (!shutdown_in_progress) { - if (ap_max_requests_per_child && (requests_this_child > ap_max_requests_per_child)) { - break; - } - pCompContext = NULL; - /* Grab a context off the queue */ - apr_lock_acquire(qlock); - if (qhead) { - pCompContext = qhead; - qhead = qhead->next; - if (!qhead) - qtail = NULL; - } - apr_lock_release(qlock); - - /* If we failed to grab a context off the queue, alloc one out of - * the child pool. There may be up to ap_threads_per_child contexts - * in the system at once. - */ - if (!pCompContext) { - if (num_completion_contexts >= ap_threads_per_child) { - static int reported = 0; - if (!reported) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, server_conf, - "Server ran out of threads to serve requests. Consider " - "raising the ThreadsPerChild setting"); - reported = 1; - } - Sleep(500); - continue; - } - pCompContext = (PCOMP_CONTEXT) apr_pcalloc(pchild, sizeof(COMP_CONTEXT)); - - pCompContext->Overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - if (pCompContext->Overlapped.hEvent == NULL) { - ap_log_error(APLOG_MARK,APLOG_ERR, apr_get_os_error(), server_conf, - "winnt_accept: CreateEvent failed. Process will exit."); - // return -1; - } - pCompContext->accept_socket = INVALID_SOCKET; - num_completion_contexts++; - } - - again: - /* Create and initialize the accept socket */ - if (pCompContext->accept_socket == INVALID_SOCKET) { - pCompContext->accept_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - - if (pCompContext->accept_socket == INVALID_SOCKET) { - ap_log_error(APLOG_MARK,APLOG_ERR, apr_get_netos_error(), server_conf, - "winnt_accept: socket() failed. Process will exit."); - // return -1; - } - - /* SO_UPDATE_ACCEPT_CONTEXT is required for shutdown() to work */ - if (setsockopt(pCompContext->accept_socket, SOL_SOCKET, - SO_UPDATE_ACCEPT_CONTEXT, (char *)&nlsd, - sizeof(nlsd))) { - ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_netos_error(), server_conf, - "setsockopt(SO_UPDATE_ACCEPT_CONTEXT) failed."); - /* Not a failure condition. Keep running. */ - } - } - - /* AcceptEx on the completion context. The completion context will be - * signaled when a connection is accepted. - */ - if (!AcceptEx(nlsd, pCompContext->accept_socket, - pCompContext->buff, - 0, - PADDED_ADDR_SIZE, - PADDED_ADDR_SIZE, - &BytesRead, - &pCompContext->Overlapped)) { - lasterror = apr_get_netos_error(); - if (lasterror == APR_FROM_OS_ERROR(WSAEINVAL)) { - /* Hack alert. Occasionally, TransmitFile will not recycle the - * accept socket (usually when the client disconnects early). - * Get a new socket and try the call again. - */ - pCompContext->accept_socket = INVALID_SOCKET; - ap_log_error(APLOG_MARK, APLOG_DEBUG, lasterror, server_conf, - "winnt_accept: AcceptEx failed. Reallocate the accept socket and try again."); - if (shutdown_in_progress) - break; - else - goto again; - } - else if (lasterror != APR_FROM_OS_ERROR(ERROR_IO_PENDING)) { - ap_log_error(APLOG_MARK,APLOG_ERR, lasterror, server_conf, - "winnt_accept: AcceptEx failed. Process will exit."); - // return -1; - } - - /* Wait for pending i/o */ - WaitForSingleObject(pCompContext->Overlapped.hEvent, INFINITE); - } - - /* When a connection is received, send an io completion notification to - * the ThreadDispatchIOCP - */ - PostQueuedCompletionStatus(ThreadDispatchIOCP, 0, IOCP_CONNECTION_ACCEPTED, - &pCompContext->Overlapped); - requests_this_child++; - } - - if (!shutdown_in_progress) { - /* Yow, hit an irrecoverable error! Tell the child to die. */ - SetEvent(exit_event); - } -} -static PCOMP_CONTEXT winnt_get_connection(PCOMP_CONTEXT pCompContext) -{ - int requests_this_child = 0; - int rc; - DWORD BytesRead; - DWORD CompKey; - LPOVERLAPPED pol; - - /* Recycle the completion context. - * - destroy the ptrans pool - * - put the context on the queue to be consumed by the accept thread - * Note: pCompContext->accept_socket may be in a disconnected - * but reusable state so -don't- close it. - */ - if (pCompContext) { - apr_pool_clear(pCompContext->ptrans); - apr_pool_destroy(pCompContext->ptrans); - pCompContext->ptrans = NULL; - pCompContext->next = NULL; - apr_lock_acquire(qlock); - if (qtail) - qtail->next = pCompContext; - else - qhead = pCompContext; - qtail = pCompContext; - apr_lock_release(qlock); - } - - g_blocked_threads++; - while (1) { - if (workers_may_exit) { - g_blocked_threads--; - return NULL; - } - rc = GetQueuedCompletionStatus(ThreadDispatchIOCP, &BytesRead, &CompKey, - &pol, INFINITE); - if (!rc) { - rc = apr_get_os_error(); - ap_log_error(APLOG_MARK,APLOG_DEBUG, rc, server_conf, - "Child %d: GetQueuedComplationStatus returned %d", my_pid, rc); - continue; - } - - switch (CompKey) { - case IOCP_CONNECTION_ACCEPTED: - pCompContext = CONTAINING_RECORD(pol, COMP_CONTEXT, Overlapped); - break; - case IOCP_SHUTDOWN: - g_blocked_threads--; - return NULL; - default: - g_blocked_threads--; - return NULL; - } - break; - } - - g_blocked_threads--; - - if ((rc = apr_pool_create(&pCompContext->ptrans, NULL)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK,APLOG_DEBUG, rc, server_conf, - "Child %d: apr_pool_create failed with rc %d", my_pid, rc); - } - - /* Get the local & remote address */ - GetAcceptExSockaddrs(pCompContext->buff, - 0, - PADDED_ADDR_SIZE, - PADDED_ADDR_SIZE, - &pCompContext->sa_server, - &pCompContext->sa_server_len, - &pCompContext->sa_client, - &pCompContext->sa_client_len); - - return pCompContext; - -} - -/* - * worker_main() - * Main entry point for the worker threads. Worker threads block in - * win*_get_connection() awaiting a connection to service. - */ -static void worker_main(int thread_num) -{ - PCOMP_CONTEXT context = NULL; - apr_os_sock_info_t sockinfo; - - while (1) { - conn_rec *c; - apr_int32_t disconnected; - - ap_update_child_status(0, thread_num, SERVER_READY, - (request_rec *) NULL); - - /* Grab a connection off the network */ - if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { - context = win9x_get_connection(context); - } - else { - context = winnt_get_connection(context); - } - - if (!context) - break; - - sockinfo.os_sock = &context->accept_socket; - sockinfo.local = context->sa_server; - sockinfo.remote = context->sa_client; - sockinfo.family = APR_INET; - sockinfo.type = SOCK_STREAM; - apr_os_sock_make(&context->sock, &sockinfo, context->ptrans); - - c = ap_new_connection(context->ptrans, server_conf, context->sock, - thread_num); - - if (c) { - ap_process_connection(c); - apr_getsocketopt(context->sock, APR_SO_DISCONNECTED, &disconnected); - if (!disconnected) { - context->accept_socket = INVALID_SOCKET; - ap_lingering_close(c); - } - } - else { - /* ap_new_connection closes the socket on failure */ - context->accept_socket = INVALID_SOCKET; - } - } - - ap_update_child_status(0, thread_num, SERVER_DEAD, (request_rec *) NULL); - - ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, server_conf, - "Child %d: Thread exiting.", my_pid); -} - -static void cleanup_thread(thread *handles, int *thread_cnt, int thread_to_clean) -{ - int i; - - CloseHandle(handles[thread_to_clean]); - for (i = thread_to_clean; i < ((*thread_cnt) - 1); i++) - handles[i] = handles[i + 1]; - (*thread_cnt)--; -} - -/* - * child_main() - * Entry point for the main control thread for the child process. - * This thread creates the accept thread, worker threads and - * monitors the child process for maintenance and shutdown - * events. - */ -static void child_main() -{ - apr_status_t status; - HANDLE child_events[2]; - char* exit_event_name; - int nthreads = ap_threads_per_child; - int tid; - thread *child_handles; - int rv; - time_t end_time; - int i; - int cld; - - /* This is the child process or we are running in single process mode. */ - exit_event_name = apr_psprintf(pconf, "apC%d", my_pid); - setup_signal_names(apr_psprintf(pconf,"ap%d", parent_pid)); - - if (one_process) { - /* Single process mode */ - apr_lock_create(&start_mutex, APR_MUTEX, APR_CROSS_PROCESS, - signal_name_prefix, pconf); - exit_event = CreateEvent(NULL, TRUE, FALSE, exit_event_name); - } - else { - /* Child process mode */ - apr_lock_child_init(&start_mutex, signal_name_prefix, pconf); - exit_event = OpenEvent(EVENT_ALL_ACCESS, FALSE, exit_event_name); - ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, server_conf, - "Child %d: exit_event_name = %s", my_pid, exit_event_name); - } - - /* Initialize the child_events */ - maintenance_event = CreateEvent(NULL, TRUE, FALSE, NULL); - child_events[0] = exit_event; - child_events[1] = maintenance_event; - - ap_assert(start_mutex); - ap_assert(exit_event); - ap_assert(maintenance_event); - - apr_pool_create(&pchild, pconf); - allowed_globals.jobsemaphore = CreateSemaphore(NULL, 0, 1000000, NULL); - apr_lock_create(&allowed_globals.jobmutex, APR_MUTEX, APR_INTRAPROCESS, NULL, pchild); - - /* - * 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. - */ - status = apr_lock_acquire(start_mutex); - if (status != APR_SUCCESS) { - ap_log_error(APLOG_MARK,APLOG_ERR, status, server_conf, - "Child %d: Failed to acquire the start_mutex. Process will exit.", my_pid); - signal_parent(0); /* tell parent to die */ - exit(0); - } - ap_log_error(APLOG_MARK,APLOG_INFO, APR_SUCCESS, server_conf, - "Child %d: Acquired the start mutex.", my_pid); - - /* - * Create the worker thread dispatch IOCompletionPort - * on Windows NT/2000 - */ - if (osver.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS) { - /* Create the worker thread dispatch IOCP */ - ThreadDispatchIOCP = CreateIoCompletionPort(INVALID_HANDLE_VALUE, - NULL, - 0, - 0); /* CONCURRENT ACTIVE THREADS */ - apr_lock_create(&qlock, APR_MUTEX, APR_INTRAPROCESS, NULL, pchild); - } - - /* - * Create the pool of worker threads - */ - ap_log_error(APLOG_MARK,APLOG_INFO, APR_SUCCESS, server_conf, - "Child %d: Starting %d worker threads.", my_pid, nthreads); - child_handles = (thread) alloca(nthreads * sizeof(int)); - for (i = 0; i < nthreads; i++) { - ap_update_child_status(0, i, SERVER_STARTING, (request_rec *) NULL); - child_handles[i] = (thread) _beginthreadex(NULL, 0, (LPTHREAD_START_ROUTINE) worker_main, - (void *) i, 0, &tid); - } - - /* - * Start the accept thread - */ - if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { - _beginthreadex(NULL, 0, (LPTHREAD_START_ROUTINE) win9x_accept, - (void *) i, 0, &tid); - } else { - /* Start an accept thread per listener */ - SOCKET nlsd; /* native listening sock descriptor */ - ap_listen_rec *lr; - for (lr = ap_listeners; lr; lr = lr->next) { - if (lr->sd != NULL) { - apr_os_sock_get(&nlsd, lr->sd); - _beginthreadex(NULL, 1000, (LPTHREAD_START_ROUTINE) winnt_accept, - (void *) nlsd, 0, &tid); - } - } - } - - /* Wait for one of three events: - * exit_event: - * The exit_event is signaled by the parent process to notify - * the child that it is time to exit. - * - * maintenance_event: - * This event is signaled by the worker thread pool to direct - * this thread to create more completion contexts. - * - * TIMEOUT: - * To do periodic maintenance on the server (check for thread exits, - * number of completion contexts, etc.) - */ - while (1) { - rv = WaitForMultipleObjects(2, (HANDLE *) child_events, FALSE, INFINITE); - cld = rv - WAIT_OBJECT_0; - if (rv == WAIT_FAILED) { - /* Something serious is wrong */ - ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf, - "Child %d: WAIT_FAILED -- shutting down server"); - break; - } - else if (rv == WAIT_TIMEOUT) { - /* Hey, this cannot happen */ - ap_log_error(APLOG_MARK, APLOG_CRIT, APR_SUCCESS, server_conf, - "Child %d: WAIT_TIMEOUT -- shutting down server", my_pid); - break; - } - else if (cld == 0) { - /* Exit event was signaled */ - ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, server_conf, - "Child %d: Exit event signaled. Child process is ending.", my_pid); - break; - } - else { - /* Child maintenance event signaled */ - ResetEvent(maintenance_event); - ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, server_conf, - "Child %d: Child maintenance event signaled.", my_pid); - } - } - - /* Setting is_graceful will cause keep-alive connections to be closed - * rather than block on the next network read. - */ - is_graceful = 1; - - /* Setting shutdown_in_progress prevents new connections from - * being accepted but allows the worker threads to continue - * handling connections that have already been accepted. - */ - shutdown_in_progress = 1; - - /* Close the listening sockets */ - { - ap_listen_rec *lr; - for (lr = ap_listeners; lr ; lr = lr->next) { - apr_socket_close(lr->sd); - } - } - - /* Give the worker threads time to handle already accepted connections */ - Sleep(1000); - - /* Release the start_mutex to let the new process (in the restart - * scenario) a chance to begin accepting and servicing requests - */ - ap_log_error(APLOG_MARK,APLOG_INFO, APR_SUCCESS, server_conf, - "Child %d: Releasing the start mutex", my_pid); - apr_lock_release(start_mutex); - - /* Tell the worker threads they may exit when done handling - * a connection. - */ - workers_may_exit = 1; - - /* Shutdown the worker threads */ - if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { - for (i = 0; i < nthreads; i++) { - add_job(-1); - } - } - else { /* Windows NT/2000 */ - /* Post worker threads blocked on the ThreadDispatch IOCompletion port */ - while (g_blocked_threads > 0) { - ap_log_error(APLOG_MARK,APLOG_INFO, APR_SUCCESS, server_conf, - "Child %d: %d threads blocked on the completion port", my_pid, g_blocked_threads); - for (i=g_blocked_threads; i > 0; i--) { - PostQueuedCompletionStatus(ThreadDispatchIOCP, 0, IOCP_SHUTDOWN, NULL); - } - Sleep(1000); - } - /* Empty the accept queue of completion contexts */ - apr_lock_acquire(qlock); - while (qhead) { - CloseHandle(qhead->Overlapped.hEvent); - closesocket(qhead->accept_socket); - qhead = qhead->next; - } - apr_lock_release(qlock); - } - - /* Give busy worker threads a chance to service their connections */ - ap_log_error(APLOG_MARK,APLOG_INFO, APR_SUCCESS, server_conf, - "Child %d: Waiting for %d threads to die.", my_pid, nthreads); - 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; - } - - /* Kill remaining threads off the hard way */ - for (i = 0; i < nthreads; i++) { - TerminateThread(child_handles[i], 1); - CloseHandle(child_handles[i]); - } - ap_log_error(APLOG_MARK,APLOG_INFO, APR_SUCCESS, server_conf, - "Child %d: All worker threads have ended.", my_pid); - - CloseHandle(allowed_globals.jobsemaphore); - apr_lock_destroy(allowed_globals.jobmutex); - apr_lock_destroy(qlock); - - apr_pool_destroy(pchild); - CloseHandle(exit_event); -} - -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)--; -} - -static int create_process(apr_pool_t *p, HANDLE *handles, HANDLE *events, int *processes) -{ - int rv; - char buf[1024]; - char *pCommand; - char *pEnvVar; - char *pEnvBlock; - int i; - int iEnvBlockLen; - STARTUPINFO si; /* Filled in prior to call to CreateProcess */ - PROCESS_INFORMATION pi; /* filled in on call to CreateProcess */ - - ap_listen_rec *lr; - DWORD BytesWritten; - HANDLE hPipeRead = NULL; - HANDLE hPipeWrite = NULL; - SECURITY_ATTRIBUTES sa = {0}; - - HANDLE kill_event; - LPWSAPROTOCOL_INFO lpWSAProtocolInfo; - - 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_CRIT, ERROR_BAD_PATHNAME, server_conf, - "Parent: Path to Apache process too long"); - return -1; - } else if (rv == 0) { - ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf, - "Parent: GetModuleFileName() returned NULL for current process."); - return -1; - } - - /* Build the command line */ - pCommand = apr_psprintf(p, "\"%s\"", buf); - for (i = 1; i < server_conf->process->argc; i++) { - pCommand = apr_pstrcat(p, pCommand, " \"", server_conf->process->argv[i], "\"", NULL); - } - - /* Build the environment, since Win9x disrespects the active env */ - pEnvVar = apr_psprintf(p, "AP_PARENT_PID=%i", parent_pid); - /* - * 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 (_environ[i]) { - iEnvBlockLen += strlen(_environ[i]) + 1; - i++; - } - - pEnvBlock = (char *)apr_pcalloc(p, iEnvBlockLen + strlen(pEnvVar) + 1); - strcpy(pEnvBlock, pEnvVar); - pEnvVar = strchr(pEnvBlock, '\0') + 1; - - i = 0; - while (_environ[i]) { - strcpy(pEnvVar, _environ[i]); - pEnvVar = strchr(pEnvVar, '\0') + 1; - i++; - } - pEnvVar = '\0'; - /* Create a pipe to send socket info to the child */ - if (!CreatePipe(&hPipeRead, &hPipeWrite, &sa, 0)) { - ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf, - "Parent: Unable to create pipe to child process."); - return -1; - } - - /* Give the read end 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 */ - CREATE_SUSPENDED, /* Creation flags */ - pEnvBlock, /* Environment block */ - NULL, - &si, &pi)) { - ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), 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; - } - - ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, server_conf, - "Parent: Created child process %d", pi.dwProcessId); - - SetEnvironmentVariable("AP_PARENT_PID",NULL); - - /* Create the exit_event, apCchild_pid */ - sa.nLength = sizeof(sa); - sa.bInheritHandle = TRUE; - sa.lpSecurityDescriptor = NULL; - kill_event = CreateEvent(&sa, TRUE, FALSE, apr_psprintf(pconf,"apC%d", pi.dwProcessId)); - if (!kill_event) { - ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf, - "Parent: Could not create exit event for child process"); - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - return -1; - } - - /* 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. */ - ResumeThread(pi.hThread); - 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. - */ - for (lr = ap_listeners; lr; lr = lr->next) { - int nsd; - lpWSAProtocolInfo = apr_pcalloc(p, sizeof(WSAPROTOCOL_INFO)); - apr_os_sock_get(&nsd,lr->sd); - ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, server_conf, - "Parent: Duplicating socket %d and sending it to child process %d", nsd, pi.dwProcessId); - if (WSADuplicateSocket(nsd, pi.dwProcessId, - lpWSAProtocolInfo) == SOCKET_ERROR) { - ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_netos_error(), server_conf, - "Parent: WSADuplicateSocket failed for socket %d. Check the FAQ.", lr->sd ); - return -1; - } - - if (!WriteFile(hPipeWrite, lpWSAProtocolInfo, (DWORD) sizeof(WSAPROTOCOL_INFO), - &BytesWritten, - (LPOVERLAPPED) NULL)) { - ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf, - "Parent: Unable to write duplicated socket %d to the child.", lr->sd ); - return -1; - } - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, APR_SUCCESS, server_conf, - "Parent: BytesWritten = %d WSAProtocolInfo = %x20", BytesWritten, *lpWSAProtocolInfo); - } - - CloseHandle(hPipeRead); - CloseHandle(hPipeWrite); - - return 0; -} - -/********************************************************************** - * master_main() - * This is the parent process. master_main() creates a multithreaded - * child process to handle connections, then blocks waiting to receive - * a shutdown, restart event or child exit event. - * - * restart_event - * - Child is signaled to die gracefully - * shutdown_event - * - Child is signaled to die gracefully - * child_exit_event - * - Child has died, either normally (max_request_per_child) - * or abnormally (seg fault, irrecoverable error condition detected by the - * child) - **********************************************************************/ -#define MAX_PROCESSES 50 /* must be < MAX_WAIT_OBJECTS-1 */ -static int master_main(server_rec *s, HANDLE shutdown_event, HANDLE restart_event) -{ - int remaining_children_to_start = ap_daemons_to_start; - int i; - int rv, cld; - int child_num = 0; - int restart_pending = 0; - int shutdown_pending = 0; - int current_live_processes = 0; /* number of child process we know about */ - - HANDLE process_handles[MAX_PROCESSES]; - HANDLE process_kill_events[MAX_PROCESSES]; - - - /* 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) < 0) { - ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf, - "master_main: create child process failed. Exiting."); - shutdown_pending = 1; - goto die_now; - } - } - - restart_pending = shutdown_pending = 0; - - if (!strcasecmp(signal_arg, "runservice")) - mpm_service_started(); - - /* 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); - cld = rv - WAIT_OBJECT_0; - if (rv == WAIT_FAILED) { - /* Something serious is wrong */ - ap_log_error(APLOG_MARK,APLOG_CRIT, apr_get_os_error(), server_conf, - "master_main: WaitForMultipeObjects WAIT_FAILED -- doing server shutdown"); - shutdown_pending = 1; - } - else if (rv == WAIT_TIMEOUT) { - /* Hey, this cannot happen */ - ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_os_error(), s, - "master_main: WaitForMultipeObjects with INFINITE wait exited with WAIT_TIMEOUT"); - shutdown_pending = 1; - } - else if (cld == current_live_processes) { - /* shutdown_event signalled */ - shutdown_pending = 1; - printf("shutdown event signaled\n"); - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, APR_SUCCESS, s, - "Parent: SHUTDOWN EVENT SIGNALED -- Shutting down the server."); - if (ResetEvent(shutdown_event) == 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_os_error(), s, - "ResetEvent(shutdown_event)"); - } - - } - 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_INFO, APR_SUCCESS, s, - "Parent: RESTART EVENT SIGNALED -- Restarting the server."); - if (ResetEvent(restart_event) == 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_os_error(), s, - "master_main: ResetEvent(restart_event) failed."); - } - /* Signal each child process to die - * We are making a big assumption here that the child process, once signaled, - * will REALLY go away. Since this is a restart, we do not want to hold the - * new child process up waiting for the old child to die. Remove the old - * child out of the process_handles apr_table_t and hope for the best... - */ - for (i = 0; i < children_to_kill; i++) { - if (SetEvent(process_kill_events[i]) == 0) - ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_os_error(), s, - "master_main: SetEvent for child process in slot #%d failed", i); - cleanup_process(process_handles, process_kill_events, i, ¤t_live_processes); - } - } - else { - /* A child process must have exited because of a fatal error condition (seg fault, etc.). - * Remove the dead process - * from the process_handles and process_kill_events apr_table_t and create a new - * child process. - * TODO: Consider restarting the child immediately without looping through http_main - * and without rereading the configuration. Will need this if we ever support multiple - * children. One option, create a parent thread which waits on child death and restarts it. - * Consider, however, that if the user makes httpd.conf invalid, we want to die before - * our child tries it... otherwise we have a nasty loop. - */ - restart_pending = 1; - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, APR_SUCCESS, server_conf, - "Parent: CHILD PROCESS FAILED -- 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); */ - /* restart_child(process_hancles, process_kill_events, cld, ¤t_live_processes); */ - } - -die_now: - if (shutdown_pending) - { - int tmstart = time(NULL); - - if (strcasecmp(signal_arg, "runservice")) { - mpm_service_stopping(); - } - /* Signal each child processes to die */ - for (i = 0; i < current_live_processes; i++) { - printf("SetEvent handle = %d\n", process_kill_events[i]); - if (SetEvent(process_kill_events[i]) == 0) - ap_log_error(APLOG_MARK,APLOG_ERR, apr_get_os_error(), server_conf, - "master_main: SetEvent for child process in slot #%d failed", i); - } - - 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); - 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, APR_SUCCESS, server_conf, - "Parent: Forcing termination of child #%d (handle %d)", i, process_handles[i]); - TerminateProcess((HANDLE) process_handles[i], 1); - } - return 0; /* Tell the caller we do not want to restart */ - } - - return 1; /* Tell the caller we want a restart */ -} - - -/* service_nt_main_fn needs to append the StartService() args - * outside of our call stack and thread as the service starts... - */ -apr_array_header_t *mpm_new_argv; - -/* Remember service_to_start failures to log and fail in pre_config. - * Remember inst_argc and inst_argv for installing or starting the - * service after we preflight the config. - */ - -AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result) -{ - switch(query_code){ - case AP_MPMQ_MAX_DAEMONS: - *result = MAXIMUM_WAIT_OBJECTS; - return APR_SUCCESS; - case AP_MPMQ_IS_THREADED: - *result = AP_MPMQ_STATIC; - 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_MAX_THREADS: - *result = ap_threads_per_child; - return APR_SUCCESS; - } - return APR_ENOTIMPL; -} - -#define SERVICE_UNSET (-1) -static apr_status_t service_set = SERVICE_UNSET; -static apr_status_t service_to_start_success; -static int inst_argc; -static const char * const *inst_argv; -static char *service_name = NULL; - -void winnt_rewrite_args(process_rec *process) -{ - /* Handle the following SCM aspects in this phase: - * - * -k runservice [transition for WinNT, nothing for Win9x] - * -k (!)install [error out if name is not installed] - * - * We can't leave this phase until we know our identity - * and modify the command arguments appropriately. - */ - apr_status_t rv; - char *def_server_root; - char fnbuf[MAX_PATH]; - char optbuf[3]; - const char *optarg; - int fixed_args; - char *pid; - apr_getopt_t *opt; - int running_as_service = 1; - - osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&osver); - - /* AP_PARENT_PID is only valid in the child */ - pid = getenv("AP_PARENT_PID"); - if (pid) - { - /* This is the child */ - my_pid = GetCurrentProcessId(); - parent_pid = (DWORD) atol(pid); - - /* The parent is responsible for providing the - * COMPLETE ARGUMENTS REQUIRED to the child. - * - * No further argument parsing is needed, but - * for good measure we will provide a simple - * signal string for later testing. - */ - signal_arg = "runchild"; - return; - } - - /* This is the parent, we have a long way to go :-) */ - parent_pid = my_pid = GetCurrentProcessId(); - - /* Rewrite process->argv[]; - * - * strip out -k signal into signal_arg - * strip out -n servicename and set the names - * add default -d serverroot from the path of this executable - * - * The end result will look like: - * - * The invocation command (%0) - * The -d serverroot default from the running executable - * The requested service's (-n) registry ConfigArgs - * The WinNT SCM's StartService() args - */ - if (!GetModuleFileName(NULL, fnbuf, sizeof(fnbuf))) { - rv = apr_get_os_error(); - ap_log_error(APLOG_MARK,APLOG_ERR, rv, NULL, - "Failed to get the path of Apache.exe"); - exit(1); - } - /* WARNING: There is an implict assumption here that the - * executable resides in ServerRoot or ServerRoot\bin - */ - def_server_root = (char *) apr_filename_of_pathname(fnbuf); - if (def_server_root > fnbuf) { - *(def_server_root - 1) = '\0'; - def_server_root = (char *) apr_filename_of_pathname(fnbuf); - if (!strcasecmp(def_server_root, "bin")) - *(def_server_root - 1) = '\0'; - } - def_server_root = ap_os_canonical_filename(process->pool, fnbuf); - - /* 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; - - fixed_args = mpm_new_argv->nelts; - - optbuf[0] = '-'; - optbuf[2] = '\0'; - apr_getopt_init(&opt, process->pool, process->argc, (char**) process->argv); - while (apr_getopt(opt, "n:k:iu" AP_SERVER_BASEARGS, - optbuf + 1, &optarg) == APR_SUCCESS) { - switch (optbuf[1]) { - case 'n': - service_set = mpm_service_set_name(process->pool, &service_name, - optarg); - break; - case 'k': - signal_arg = optarg; - break; - case 'i': - ap_log_error(APLOG_MARK,APLOG_WARNING, 0, NULL, - "-i is deprecated. Use -k install."); - signal_arg = "install"; - break; - case 'u': - ap_log_error(APLOG_MARK,APLOG_WARNING, 0, NULL, - "-u is deprecated. Use -k uninstall."); - signal_arg = "uninstall"; - break; - 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; - } - } - - /* Track the number of args actually entered by the user */ - inst_argc = mpm_new_argv->nelts - fixed_args; - - /* Provide a default 'run' -k arg to simplify signal_arg tests */ - if (!signal_arg) - { - signal_arg = "run"; - running_as_service = 0; - } - - if (!strcasecmp(signal_arg, "runservice")) - { - /* Start the NT Service _NOW_ because the WinNT SCM is - * expecting us to rapidly assume control of our own - * process, the SCM will tell us our service name, and - * may have extra StartService() command arguments to - * add for us. - * - * Any other process has a console, so we don't to begin - * a Win9x service until the configuration is parsed and - * any command line errors are reported. - * - * We hold the return value so that we can die in pre_config - * after logging begins, and the failure can land in the log. - */ - if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) { - service_to_start_success = mpm_service_to_start(&service_name); - if (service_to_start_success == APR_SUCCESS) - service_set = APR_SUCCESS; - } - } - - if (service_set == SERVICE_UNSET && running_as_service) { - service_set = mpm_service_set_name(process->pool, &service_name, - DEFAULT_SERVICE_NAME); - } - - if (!strcasecmp(signal_arg, "install")) /* -k install */ - { - if (service_set == APR_SUCCESS) - { - ap_log_error(APLOG_MARK,APLOG_ERR, 0, NULL, - "%s: Service is already installed.", service_name); - exit(1); - } - } - else if (running_as_service) - { - if (service_set == APR_SUCCESS) - { - rv = mpm_merge_service_args(process->pool, mpm_new_argv, - fixed_args); - if (rv == APR_SUCCESS) { - ap_log_error(APLOG_MARK,APLOG_NOERRNO|APLOG_INFO, 0, NULL, - "Using ConfigArgs of the installed service " - "\"%s\".", service_name); - } - else { - ap_log_error(APLOG_MARK,APLOG_INFO, rv, NULL, - "No installed ConfigArgs for the service " - "\"%s\", using Apache defaults.", service_name); - } - } - else - { - ap_log_error(APLOG_MARK,APLOG_INFO|APLOG_NOERRNO, 0, NULL, - "No installed service named \"%s\".", service_name); - exit(1); - } - } - - /* Track the args actually entered by the user. - * These will be used for the -k install parameters, as well as - * for the -k start service override arguments. - */ - inst_argv = (const char * const *)mpm_new_argv->elts - + mpm_new_argv->nelts - inst_argc; - - process->argc = mpm_new_argv->nelts; - process->argv = (const char * const *) mpm_new_argv->elts; -} - - -static void winnt_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp) -{ - /* Handle the following SCM aspects in this phase: - * - * -k runservice [WinNT errors logged from rewrite_args] - * -k uninstall - * -k stop - * - * in these cases we -don't- care if httpd.conf has config errors! - */ - apr_status_t rv; - - if (ap_exists_config_define("ONE_PROCESS")) - one_process = -1; - - if (ap_exists_config_define("ONE_PROCESS")) - one_process = -1; - - if (!strcasecmp(signal_arg, "runservice") - && (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) - && (service_to_start_success != APR_SUCCESS)) { - ap_log_error(APLOG_MARK,APLOG_ERR, service_to_start_success, NULL, - "%s: Unable to start the service manager.", - service_name); - exit(1); - } - - if (!strcasecmp(signal_arg, "uninstall")) { - rv = mpm_service_uninstall(); - exit(rv); - } - - if (!strcasecmp(signal_arg, "stop")) { - mpm_signal_service(ptemp, 0); - exit(0); - } - - ap_listen_pre_config(); - ap_daemons_to_start = DEFAULT_NUM_DAEMON; - ap_threads_per_child = DEFAULT_START_THREAD; - ap_pid_fname = DEFAULT_PIDLOG; - ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; - - apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir)); -} - -static void winnt_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec* server) -{ - static int restart_num = 0; - apr_status_t rv = 0; - - server_conf = server; - - /* Handle the following SCM aspects in this phase: - * - * -k install - * -k start - * -k restart - * -k runservice [Win95, only once - after we parsed the config] - * - * because all of these signals are useful _only_ if there - * is a valid conf\httpd.conf environment to start. - * - * We reached this phase by avoiding errors that would cause - * these options to fail unexpectedly in another process. - */ - - if (!strcasecmp(signal_arg, "install")) { - rv = mpm_service_install(ptemp, inst_argc, inst_argv); - exit (rv); - } - - if (!strcasecmp(signal_arg, "start")) { - rv = mpm_service_start(ptemp, inst_argc, inst_argv); - exit (rv); - } - - if (!strcasecmp(signal_arg, "restart")) { - mpm_signal_service(ptemp, 1); - exit (rv); - } - - if (parent_pid == my_pid) - { - if (restart_num++ == 1) - { - /* This code should be run once in the parent and not run - * across a restart - */ - PSECURITY_ATTRIBUTES sa = GetNullACL(); /* returns NULL if invalid (Win95?) */ - setup_signal_names(apr_psprintf(pconf,"ap%d", parent_pid)); - - ap_log_pid(pconf, ap_pid_fname); - - /* Create shutdown event, apPID_shutdown, where PID is the parent - * Apache process ID. Shutdown is signaled by 'apache -k shutdown'. - */ - shutdown_event = CreateEvent(sa, FALSE, FALSE, signal_shutdown_name); - if (!shutdown_event) { - ap_log_error(APLOG_MARK, APLOG_EMERG, apr_get_os_error(), server_conf, - "Parent: 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, FALSE, FALSE, signal_restart_name); - if (!restart_event) { - CloseHandle(shutdown_event); - ap_log_error(APLOG_MARK, APLOG_EMERG, apr_get_os_error(), server_conf, - "Parent: Cannot create restart event %s", signal_restart_name); - CleanNullACL((void *)sa); - exit(1); - } - CleanNullACL((void *)sa); - - /* Now that we are flying at 15000 feet... - * wipe out the Win95 service console, - * signal the SCM the WinNT service started, or - * if not a service, setup console handlers instead. - */ - if (!strcasecmp(signal_arg, "runservice")) - { - if (osver.dwPlatformId != VER_PLATFORM_WIN32_NT) - { - rv = mpm_service_to_start(&service_name); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK,APLOG_ERR, rv, server_conf, - "%s: Unable to start the service manager.", - service_name); - exit(1); - } - } - } - else /* ! -k runservice */ - { - mpm_start_console_handler(); - } - - /* 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. - */ - apr_lock_create(&start_mutex,APR_MUTEX, APR_CROSS_PROCESS, signal_name_prefix, - server_conf->process->pool); - } - } - else /* parent_pid != my_pid */ - { - mpm_start_child_console_handler(); - } -} - -AP_DECLARE(int) ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s ) -{ - static int restart = 0; /* Default is "not a restart" */ - - pconf = _pconf; - server_conf = s; - - if ((parent_pid != my_pid) || one_process) { - /* Child process or in one_process (debug) mode */ - ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, server_conf, - "Child %d: Child process is running", my_pid); - - /* Set up the scoreboard. The scoreboard in this MPM only applies to the - * child process and is not shared across processes - */ - ap_create_scoreboard(pconf, SB_NOT_SHARED); - - if (one_process) { - if (ap_setup_listeners(server_conf) < 1) { - return 1; - } - } - else { - get_listeners_from_parent(server_conf); - } - - child_main(); - - ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, server_conf, - "Child %d: Child process is exiting", my_pid); - - return 1; - } - else { - /* Parent process */ - if (ap_setup_listeners(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(server_conf, shutdown_event, restart_event); - - if (!restart) { - /* Shutting down. Clean up... */ - const char *pidfile = ap_server_root_relative (pconf, ap_pid_fname); - - if (pidfile != NULL && unlink(pidfile) == 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, APR_SUCCESS, - server_conf, "removed PID file %s (pid=%ld)", - pidfile, GetCurrentProcessId()); - } - apr_lock_destroy(start_mutex); - - CloseHandle(restart_event); - CloseHandle(shutdown_event); - - return 1; - } - } /* Parent process */ - - return 0; /* Restart */ -} - -static void winnt_hooks(apr_pool_t *p) -{ - ap_hook_pre_config(winnt_pre_config, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_post_config(winnt_post_config, NULL, NULL, 0); -} - -/* - * 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 <VirtualHost>"; - } - ap_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) { - 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 define in %s.", - HARD_THREAD_LIMIT, 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, 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) -{ - 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; -} - -/* Stub functions until this MPM supports the connection status API */ - -AP_DECLARE(void) ap_update_connection_status(long conn_id, const char *key, \ - const char *value) -{ - /* NOP */ -} - -AP_DECLARE(void) ap_reset_connection_status(long conn_id) -{ - /* NOP */ -} - -AP_DECLARE(apr_array_header_t *) ap_get_status_table(apr_pool_t *p) -{ - /* NOP */ - 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"}, -{ "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 } -}; - -AP_MODULE_DECLARE_DATA module mpm_winnt_module = { - MPM20_MODULE_STUFF, - winnt_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 */ - winnt_cmds, /* command apr_table_t */ - winnt_hooks /* register_hooks */ -}; diff --git a/server/mpm/winnt/mpm_winnt.h b/server/mpm/winnt/mpm_winnt.h deleted file mode 100644 index cec0a64ce4..0000000000 --- a/server/mpm/winnt/mpm_winnt.h +++ /dev/null @@ -1,159 +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 APACHE_MPM_WINNT_H -#define APACHE_MPM_WINNT_H - -#include "ap_listen.h" - -/* From registry.c: */ - -apr_status_t ap_registry_create_key(const char *key); -apr_status_t ap_registry_delete_key(const char *key); - -apr_status_t ap_registry_store_value(const char *key, const char *name, - const char *value); -apr_status_t ap_registry_get_value(apr_pool_t *p, const char *key, - const char *name, char **ppValue); -apr_status_t ap_registry_store_array(apr_pool_t *p, const char *key, - const char *name, int nelts, - char const* const* elts); -apr_status_t ap_registry_get_array(apr_pool_t *p, const char *key, - const char *name, - apr_array_header_t **parray); -apr_status_t ap_registry_delete_value(const char *key, const char *name); - - -/* From service.c: */ - -#define SERVICE_APACHE_RESTART 128 - -#define DEFAULT_SERVICE_NAME AP_SERVER_BASEPRODUCT -#define SERVICECONFIG9X "Software\\Microsoft\\Windows\\CurrentVersion\\RunServices" -#define SERVICECONFIG "System\\CurrentControlSet\\Services\\%s" -#define SERVICEPARAMS "System\\CurrentControlSet\\Services\\%s\\Parameters" - -apr_status_t mpm_service_set_name(apr_pool_t *p, const char **display_name, - const char *set_name); -apr_status_t mpm_merge_service_args(apr_pool_t *p, apr_array_header_t *args, - int fixed_args); - -apr_status_t mpm_service_to_start(const char **display_name); -apr_status_t mpm_service_started(void); -apr_status_t mpm_service_install(apr_pool_t *ptemp, int argc, - char const* const* argv); -apr_status_t mpm_service_uninstall(void); - -apr_status_t mpm_service_start(apr_pool_t *ptemp, int argc, - char const* const* argv); - -void mpm_signal_service(apr_pool_t *ptemp, int signal); - -void mpm_service_stopping(void); - -void mpm_start_console_handler(void); -void mpm_start_child_console_handler(void); - -/* From winnt.c: */ - -extern OSVERSIONINFO osver; -extern int ap_max_requests_per_child; -extern void clean_child_exit(int); - -AP_DECLARE(void) ap_start_shutdown(void); -AP_DECLARE(void) ap_start_restart(int gracefully); - -void setup_signal_names(char *prefix); -void signal_parent(int type); - - -/* This code is stolen from the apr_private.h and misc/win32/misc.c - * Please see those sources for detailed documentation. - */ -typedef enum { - DLL_WINBASEAPI = 0, // kernel32 From WinBase.h - DLL_WINADVAPI = 1, // advapi32 From WinBase.h - DLL_WINSOCKAPI = 2, // mswsock From WinSock.h - DLL_WINSOCK2API = 3, // ws2_32 From WinSock2.h - DLL_defined = 4 // must define as last idx_ + 1 -} ap_dlltoken_e; - -FARPROC ap_load_dll_func(ap_dlltoken_e fnLib, char *fnName, int ordinal); - -#define AP_DECLARE_LATE_DLL_FUNC(lib, rettype, calltype, fn, ord, args, names) \ - typedef rettype (calltype *ap_winapi_fpt_##fn) args; \ - static ap_winapi_fpt_##fn ap_winapi_pfn_##fn = NULL; \ - __inline rettype ap_winapi_##fn args \ - { if (!ap_winapi_pfn_##fn) \ - ap_winapi_pfn_##fn = (ap_winapi_fpt_##fn) ap_load_dll_func(lib, #fn, ord); \ - return (*(ap_winapi_pfn_##fn)) names; }; \ - -/* WinNT kernel only */ -AP_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, CancelIo, 0, ( - IN HANDLE hFile), - (hFile)); -#define CancelIo ap_winapi_CancelIo - -/* Win9x kernel only */ -AP_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, DWORD, WINAPI, RegisterServiceProcess, 0, ( - DWORD dwProcessId, - DWORD dwType), - (dwProcessId, dwType)); -#define RegisterServiceProcess ap_winapi_RegisterServiceProcess - -#endif /* APACHE_MPM_WINNT_H */ diff --git a/server/mpm/winnt/registry.c b/server/mpm/winnt/registry.c deleted file mode 100644 index aa23e54a4d..0000000000 --- a/server/mpm/winnt/registry.c +++ /dev/null @@ -1,489 +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. - */ - -/* - * Functions to handle interacting with the Win32 registry - */ - -/* - * Apache registry key structure - * - * Apache's registry information is stored in the HKEY_LOCAL_MACHINE - * key, under - * - * HKLM\SOFTWARE\Apache Software Foundation\Apache\version - * - * These keys are defined in this file. The definition of the "version" part - * will need updating each time Apache moves from beta to non-beta or from a - * release to a development or beta version. - */ - -#include "httpd.h" -#include "http_log.h" -#include "mpm_winnt.h" -#include "apr_strings.h" - -/* bet you are looking to change revisions to roll the tarball... - * Guess what, you already did. Revised May '00 to save you from - * searching all over creation for every revision tag. - */ - -#define VENDOR AP_SERVER_BASEVENDOR -#define SOFTWARE AP_SERVER_BASEPRODUCT -#define VERSION AP_SERVER_BASEREVISION - -#define REGKEY "SOFTWARE\\" VENDOR "\\" SOFTWARE "\\" VERSION - -/* - * The Windows API registry key functions don't set the last error - * value (the windows equivalent of errno). So we need to set it - * with SetLastError() before calling the aplog_error() function. - * Because this is common, let's have a macro. - */ -#define return_error(rv) return (apr_set_os_error(APR_FROM_OS_ERROR(rv)),\ - APR_FROM_OS_ERROR(rv)); - -apr_status_t ap_registry_create_key(const char *key) -{ - HKEY hKey = HKEY_LOCAL_MACHINE; - HKEY hKeyNext; - char keystr[MAX_PATH + 1]; - char *parsekey = keystr; - char *nextkey = keystr; - DWORD result; - int rv; - - apr_cpystrn(keystr, key, sizeof(keystr) - 1); - - /* Walk the tree, creating at each stage if necessary */ - while (parsekey) { - if (nextkey = strchr(parsekey, '\\')) - *(nextkey++) = '\0'; - - rv = RegCreateKeyEx(hKey, - parsekey, /* subkey */ - 0, /* reserved */ - NULL, /* class */ - REG_OPTION_NON_VOLATILE, - KEY_WRITE, - NULL, - &hKeyNext, - &result); - - /* Close the old key */ - if (hKey != HKEY_LOCAL_MACHINE) - RegCloseKey(hKey); - hKey = hKeyNext; - - if (rv != ERROR_SUCCESS) - break; - - parsekey = nextkey; - } - - if (hKey != HKEY_LOCAL_MACHINE) - RegCloseKey(hKey); - - return_error(rv); -} - -apr_status_t ap_registry_delete_key(const char *key) -{ - apr_status_t rv; - HKEY hKey; - int nSize = 0; - char tempkey[MAX_PATH + 1]; - char *parsekey; - - apr_cpystrn(tempkey, key, sizeof(parsekey) - 1); - parsekey = strrchr(tempkey, '\\'); - - if (parsekey) { - *(parsekey++) = '\0'; - rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, - tempkey, - 0, - KEY_WRITE, - &hKey); - - if (rv != ERROR_SUCCESS) - return_error(rv); - } - else { - parsekey = tempkey; - hKey = HKEY_LOCAL_MACHINE; - } - - rv = RegDeleteKey(hKey, key); - - if (hKey != HKEY_LOCAL_MACHINE) - RegCloseKey(hKey); - - return_error(rv); -} - -/* Clean up a way over complicated process. - * - * The return value is APR_SUCCESS, APR_ENOENT, APR_NOTFOUND, or the OS error - */ - -apr_status_t ap_registry_get_value(apr_pool_t *p, const char *key, const char *name, char **ppValue) -{ - apr_status_t rv; - HKEY hKey; - int nSize = 0; - - rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, - key, - 0, - KEY_READ, - &hKey); - - if (rv != ERROR_SUCCESS) - return_error(rv); - - /* Find the size required for the data by passing NULL as the buffer - * pointer. On return nSize will contain the size required for the - * buffer if the return value is ERROR_SUCCESS. - */ - rv = RegQueryValueEx(hKey, - name, /* key name */ - NULL, /* reserved */ - NULL, /* type */ - NULL, /* for value */ - &nSize); /* for size of "value" */ - - if (rv != ERROR_SUCCESS) - return_error(rv); - - *ppValue = apr_palloc(p, nSize); - rv = RegQueryValueEx(hKey, - name, /* key name */ - NULL, /* reserved */ - NULL, /* type */ - *ppValue, /* for value */ - &nSize); /* for size of "value" */ - - RegCloseKey(hKey); - - return_error(rv); -} - -apr_status_t ap_registry_get_array(apr_pool_t *p, const char *key, const char *name, apr_array_header_t **parray) -{ - char *pValue; - char *tmp; - char **newelem; - apr_status_t rv; - HKEY hKey; - int nSize = 0; - - rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, - key, - 0, - KEY_READ, - &hKey); - - if (rv != ERROR_SUCCESS) - return_error(rv); - - /* Find the size required for the data by passing NULL as the buffer - * pointer. On return nSize will contain the size required for the - * buffer if the return value is ERROR_SUCCESS. - */ - rv = RegQueryValueEx(hKey, - name, /* key name */ - NULL, /* reserved */ - NULL, /* type */ - NULL, /* for value */ - &nSize); /* for size of "value" */ - - if (rv != ERROR_SUCCESS) { - return_error(rv); - } - else - { - pValue = apr_palloc(p, nSize); - rv = RegQueryValueEx(hKey, - name, /* key name */ - NULL, /* reserved */ - NULL, /* type */ - pValue, /* for value */ - &nSize); /* for size of "value" */ - - nSize = 1; /* Element Count */ - tmp = pValue; - while (tmp[0] || tmp[1]) - { - if (!tmp[0]) - ++nSize; - ++tmp; - } - - *parray = apr_array_make(p, nSize, sizeof(char *)); - tmp = pValue; - newelem = (char **) apr_array_push(*parray); - *newelem = tmp; - while (tmp[0] || tmp[1]) - { - if (!tmp[0]) { - newelem = (char **) apr_array_push(*parray); - *newelem = tmp + 1; - } - ++tmp; - } - } - - RegCloseKey(hKey); - - return_error(rv); -} - -/* - * ap_registry_store_key_value() stores a value name and value under the - * Apache registry key. If the Apache key does not exist it is created - * first. This function is intended to be called from a wrapper function - * in this file to set particular data values, such as - * ap_registry_set_server_root() below. - * - * Returns 0 if the value name and data was stored successfully, or - * returns -1 if the Apache key does not exist (since we try to create - * this key, this should never happen), or -4 if any other error occurred - * (these values are consistent with ap_registry_get_key_value()). - * If the return value is negative then the error will already have been - * logged via aplog_error(). - */ - -apr_status_t ap_registry_store_value(const char *key, const char *name, const char *value) -{ - long rv; - HKEY hKey; - - rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, - key, - 0, - KEY_WRITE, - &hKey); - - if (rv == ERROR_FILE_NOT_FOUND) - { - rv = ap_registry_create_key(key); - - if (rv != APR_SUCCESS) - return_error(rv); - - rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, - key, - 0, - KEY_WRITE, - &hKey); - } - - if (rv != ERROR_SUCCESS) - return_error(rv); - - /* Now set the value and data */ - rv = RegSetValueEx(hKey, - name, /* value key name */ - 0, /* reserved */ - REG_SZ, /* type */ - value, /* value data */ - (DWORD) strlen(value) + 1); /* for size of "value" */ - - if (rv == ERROR_SUCCESS) { - ap_log_error(APLOG_MARK,APLOG_INFO|APLOG_NOERRNO,rv,NULL, - "Registry stored HKLM\\" REGKEY "\\%s value %s", key, value); - } - - /* Make sure we close the key even if there was an error storing - * the data - */ - RegCloseKey(hKey); - - return_error(rv); -} - -apr_status_t ap_registry_store_array(apr_pool_t *p, - const char *key, const char *name, - int nelts, const char * const * elts) -{ - int bufsize, i; - char *buf, *tmp; - long rv; - HKEY hKey; - - rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, - key, - 0, - KEY_WRITE, - &hKey); - - if (rv == ERROR_FILE_NOT_FOUND) - { - rv = ap_registry_create_key(key); - - if (rv != APR_SUCCESS) - return_error(rv); - - rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, - key, - 0, - KEY_WRITE, - &hKey); - } - - if (rv != ERROR_SUCCESS) - return_error(rv); - - bufsize = 1; /* For trailing second null */ - for (i = 0; i < nelts; ++i) - { - bufsize += strlen(elts[i]) + 1; - } - if (!nelts) - ++bufsize; - - buf = apr_palloc(p, bufsize); - tmp = buf; - for (i = 0; i < nelts; ++i) - { - strcpy(tmp, elts[i]); - tmp += strlen(elts[i]) + 1; - } - if (!nelts) - (*tmp++) = '\0'; - *tmp = '\0'; /* Trailing second null */ - - /* Now set the value and data */ - rv = RegSetValueEx(hKey, - name, /* value key name */ - 0, /* reserved */ - REG_MULTI_SZ, /* type */ - buf, /* value data */ - (DWORD) bufsize); /* for size of "value" */ - - if (rv == ERROR_SUCCESS) { - ap_log_error(APLOG_MARK,APLOG_INFO|APLOG_NOERRNO,rv,NULL, - "Registry stored HKLM\\" REGKEY "\\%s", key); - } - - /* Make sure we close the key even if there was an error storing - * the data - */ - RegCloseKey(hKey); - - return_error(rv); -} - -/* A key or value that does not exist is _not_ an error while deleting. */ - -apr_status_t ap_registry_delete_value(const char *key, const char *name) -{ - apr_status_t rv; - HKEY hKey; - - rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, - key, - 0, - KEY_WRITE, - &hKey); - - if (rv == ERROR_FILE_NOT_FOUND) - return APR_SUCCESS; - - if (rv != ERROR_SUCCESS) - return_error(rv); - - rv = RegDeleteValue(hKey, name); - - if (rv == ERROR_FILE_NOT_FOUND) - rv = APR_SUCCESS; - - RegCloseKey(hKey); - return_error(rv); -} - -/* - * Get the server root from the registry into 'dir' which is - * size bytes long. Returns 0 if the server root was found - * or if the serverroot key does not exist (in which case - * dir will contain an empty string), or -1 if there was - * an error getting the key. - */ -apr_status_t ap_registry_get_server_root(apr_pool_t *p, char **buf) -{ - apr_status_t rv; - - rv = ap_registry_get_value(p, REGKEY, "ServerRoot", buf); - if (rv) - *buf = NULL; - - return rv; -} - - -/* - * Sets the serverroot value within the registry. Returns 0 on success - * or -1 on error. If -1 is return the error will already have been - * logged via aplog_error(). - */ - -apr_status_t ap_registry_set_server_root(char *dir) -{ - return ap_registry_store_value(REGKEY, "ServerRoot", dir); -} diff --git a/server/mpm/winnt/service.c b/server/mpm/winnt/service.c deleted file mode 100644 index ac88e236c4..0000000000 --- a/server/mpm/winnt/service.c +++ /dev/null @@ -1,1292 +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. - */ - -/* This module ALONE requires the window message API from user.h - * and the default APR include of windows.h will omit it, so - * preload the API symbols now... - */ - -#define CORE_PRIVATE -#define _WINUSER_ - -#include "httpd.h" -#include "http_log.h" -#include "mpm_winnt.h" -#include "apr_strings.h" -#include "apr_lib.h" - -#ifdef NOUSER -#undef NOUSER -#endif -#undef _WINUSER_ -#include <winuser.h> - -static char *mpm_service_name = NULL; -static char *mpm_display_name = NULL; - -static struct -{ - HANDLE mpm_thread; /* primary thread handle of the apache server */ - HANDLE service_thread; /* thread service/monitor handle */ - DWORD service_thread_id;/* thread service/monitor ID */ - HANDLE signal_monitor; /* service monitor thread signal event */ - SERVICE_STATUS ssStatus; - SERVICE_STATUS_HANDLE hServiceStatus; -} globdat; - -static int ReportStatusToSCMgr(int currentState, int exitCode, int waitHint); - -/* The service configuration's is stored under the following trees: - * - * HKLM\System\CurrentControlSet\Services\[service name] - * - * \DisplayName - * \ImagePath (NT Only) - * \Parameters\ConfigArgs - * - * For Win9x, the launch service command is stored under: - * - * HKLM\Software\Microsoft\Windows\CurrentVersion\RunServices\[service name] - */ - - -/* exit() for Win32 is macro mapped (horrible, we agree) that allows us - * to catch the non-zero conditions and inform the console process that - * the application died, and hang on to the console a bit longer. - * - * The macro only maps for http_main.c and other sources that include - * the service.h header, so we best assume it's an error to exit from - * _any_ other module. - * - * If real_exit_code is reset to 0, it will not be set or trigger this - * behavior on exit. All service and child processes are expected to - * reset this flag to zero to avoid undesireable side effects. - */ -int real_exit_code = 1; - -void hold_console_open_on_error(void) -{ - HANDLE hConIn; - HANDLE hConErr; - DWORD result; - time_t start; - time_t remains; - char *msg = "Note the errors or messages above, " - "and press the <ESC> key to exit. "; - CONSOLE_SCREEN_BUFFER_INFO coninfo; - INPUT_RECORD in; - char count[16]; - - if (!real_exit_code) - return; - hConIn = GetStdHandle(STD_INPUT_HANDLE); - hConErr = GetStdHandle(STD_ERROR_HANDLE); - if ((hConIn == INVALID_HANDLE_VALUE) || (hConErr == INVALID_HANDLE_VALUE)) - return; - if (!WriteConsole(hConErr, msg, strlen(msg), &result, NULL) || !result) - return; - if (!GetConsoleScreenBufferInfo(hConErr, &coninfo)) - return; - if (!SetConsoleMode(hConIn, ENABLE_MOUSE_INPUT | 0x80)) - return; - - start = time(NULL); - do - { - while (PeekConsoleInput(hConIn, &in, 1, &result) && result) - { - if (!ReadConsoleInput(hConIn, &in, 1, &result) || !result) - return; - if ((in.EventType == KEY_EVENT) && in.Event.KeyEvent.bKeyDown - && (in.Event.KeyEvent.uChar.AsciiChar == 27)) - return; - if (in.EventType == MOUSE_EVENT - && (in.Event.MouseEvent.dwEventFlags == DOUBLE_CLICK)) - return; - } - remains = ((start + 30) - time(NULL)); - sprintf (count, "%d...", remains); - if (!SetConsoleCursorPosition(hConErr, coninfo.dwCursorPosition)) - return; - if (!WriteConsole(hConErr, count, strlen(count), &result, NULL) - || !result) - return; - } - while ((remains > 0) && WaitForSingleObject(hConIn, 1000) != WAIT_FAILED); -} - -static BOOL die_on_logoff = FALSE; - -static LRESULT CALLBACK monitor_service_9x_proc(HWND hWnd, UINT msg, - WPARAM wParam, LPARAM lParam) -{ -/* This is the WndProc procedure for our invisible window. - * When the user shuts down the system, this window is sent - * a signal WM_ENDSESSION. We clean up by signaling Apache - * to shut down, and idle until Apache's primary thread quits. - */ - if ((msg == WM_ENDSESSION) - && (die_on_logoff || (lParam != ENDSESSION_LOGOFF))) - { - signal_parent(0); - if (wParam) - /* Don't leave this message until we are dead! */ - WaitForSingleObject(globdat.mpm_thread, 30000); - return 0; - } - return (DefWindowProc(hWnd, msg, wParam, lParam)); -} - -static DWORD WINAPI monitor_service_9x_thread(void *service_name) -{ - /* When running as a service under Windows 9x, there is no console - * window present, and no ConsoleCtrlHandler to call when 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 hwndMain; - MSG msg; - - wc.style = CS_GLOBALCLASS; - wc.lpfnWndProc = monitor_service_9x_proc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = NULL; - wc.hIcon = NULL; - wc.hCursor = NULL; - wc.hbrBackground = NULL; - wc.lpszMenuName = NULL; - if (service_name) - wc.lpszClassName = "ApacheWin95ServiceMonitor"; - else - wc.lpszClassName = "ApacheWin95SystemMonitor"; - - die_on_logoff = service_name ? FALSE : TRUE; - - if (!RegisterClass(&wc)) - { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), - NULL, "Could not register window class for WatchWindow"); - SetEvent(globdat.signal_monitor); - globdat.service_thread_id = 0; - return 0; - } - - /* Create an invisible window */ - hwndMain = CreateWindow(wc.lpszClassName, - service_name ? (char *) service_name : "Apache", - WS_OVERLAPPEDWINDOW & ~WS_VISIBLE, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, NULL, NULL, NULL, NULL); - - if (!hwndMain) - { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), - NULL, "Could not create WatchWindow"); - SetEvent(globdat.signal_monitor); - globdat.service_thread_id = 0; - return 0; - } - - /* If we succeed, eliminate the console window. - * Signal the parent we are all set up, and - * watch the message queue while the window lives. - */ - FreeConsole(); - SetEvent((HANDLE) globdat.signal_monitor); - while (GetMessage(&msg, NULL, 0, 0)) - { - if (msg.message == WM_CLOSE) - DestroyWindow(hwndMain); - else { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - globdat.service_thread_id = 0; - return 0; -} - - -static BOOL CALLBACK console_control_handler(DWORD ctrl_type) -{ - switch (ctrl_type) - { - case CTRL_BREAK_EVENT: - fprintf(stderr, "Apache server restarting...\n"); - signal_parent(1); - return TRUE; - case CTRL_C_EVENT: - fprintf(stderr, "Apache server interrupted...\n"); - /* for Interrupt signals, shut down the server. - * Tell the system we have dealt with the signal - * without waiting for Apache to terminate. - */ - signal_parent(0); - return TRUE; - - case CTRL_CLOSE_EVENT: - case CTRL_LOGOFF_EVENT: - case CTRL_SHUTDOWN_EVENT: - /* for Terminate signals, shut down the server. - * Wait for Apache to terminate, but respond - * after a reasonable time to tell the system - * that we did attempt to shut ourself down. - * THESE EVENTS WILL NOT OCCUR UNDER WIN9x! - */ - fprintf(stderr, "Apache server shutdown initiated...\n"); - signal_parent(0); - Sleep(30000); - return TRUE; - } - - /* We should never get here, but this is (mostly) harmless */ - return FALSE; -} - - -static void stop_console_handler(void) -{ - SetConsoleCtrlHandler(console_control_handler, FALSE); -} - - -void mpm_start_console_handler(void) -{ - SetConsoleCtrlHandler(console_control_handler, TRUE); - atexit(stop_console_handler); -} - - -/* Special situation - children of services need to mind their - * P's & Q's and wait quietly, ignoring the mean OS signaling - * shutdown and other horrors, to kill them gracefully... - */ - -static BOOL CALLBACK child_control_handler(DWORD ctrl_type) -{ - switch (ctrl_type) - { - case CTRL_C_EVENT: - case CTRL_BREAK_EVENT: - /* for Interrupt signals, ignore them. - * The system will also signal the parent process, - * which will terminate Apache. - */ - return TRUE; - - case CTRL_CLOSE_EVENT: - case CTRL_LOGOFF_EVENT: - case CTRL_SHUTDOWN_EVENT: - /* for Shutdown signals, ignore them, but... . - * The system will also signal the parent process, - * which will terminate Apache, so we need to wait. - */ - Sleep(30000); - return TRUE; - } - - /* We should never get here, but this is (mostly) harmless */ - return FALSE; -} - - -static void stop_child_console_handler(void) -{ - SetConsoleCtrlHandler(child_control_handler, FALSE); -} - - -void mpm_start_child_console_handler(void) -{ - if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) { - FreeConsole(); - } - else - { - SetConsoleCtrlHandler(child_control_handler, TRUE); - atexit(stop_child_console_handler); - } -} - - -/********************************** - WinNT service control management - **********************************/ - -static int ReportStatusToSCMgr(int currentState, int exitCode, int waitHint) -{ - static int checkPoint = 1; - int rv = APR_SUCCESS; - - if (globdat.hServiceStatus) - { - if (currentState == SERVICE_RUNNING) - globdat.ssStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; - else - globdat.ssStatus.dwControlsAccepted = 0; - - globdat.ssStatus.dwCurrentState = currentState; - globdat.ssStatus.dwWin32ExitCode = exitCode; - - if ( ( currentState == SERVICE_RUNNING ) || - ( currentState == SERVICE_STOPPED ) ) - { - globdat.ssStatus.dwWaitHint = 0; - globdat.ssStatus.dwCheckPoint = 0; - } - else - { - if(waitHint) - globdat.ssStatus.dwWaitHint = waitHint; - globdat.ssStatus.dwCheckPoint = ++checkPoint; - } - rv = SetServiceStatus(globdat.hServiceStatus, &globdat.ssStatus); - } - return(rv); -} - - -/* handle the SCM's ControlService() callbacks to our service */ - -static VOID WINAPI service_nt_ctrl(DWORD dwCtrlCode) -{ - if (dwCtrlCode == SERVICE_CONTROL_STOP) - { - ap_start_shutdown(); - globdat.ssStatus.dwCurrentState = SERVICE_STOP_PENDING; - ReportStatusToSCMgr(SERVICE_STOP_PENDING, NO_ERROR, 3000); - return; - } - if (dwCtrlCode == SERVICE_APACHE_RESTART) - { - ap_start_restart(1); - globdat.ssStatus.dwCurrentState = SERVICE_START_PENDING; - ReportStatusToSCMgr(SERVICE_START_PENDING, NO_ERROR, 3000); - return; - } - - ReportStatusToSCMgr(globdat.ssStatus.dwCurrentState, NO_ERROR, 0); -} - - -long __stdcall service_stderr_thread(LPVOID hPipe) -{ - HANDLE hPipeRead = (HANDLE) hPipe; - HANDLE hEventSource; - char errbuf[256]; - char *errmsg = errbuf; - const char *errarg[9]; - DWORD errlen = 0; - DWORD errres; - HKEY hk; - - errarg[0] = "The Apache service named"; - errarg[1] = mpm_display_name; - errarg[2] = "reported the following error:\r\n>>>"; - errarg[3] = errmsg; - errarg[4] = "<<<\r\n before the error.log file could be opened.\r\n"; - errarg[5] = "More information may be available in the error.log file."; - 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"); - - while (ReadFile(hPipeRead, errmsg, 1, &errres, NULL) && (errres == 1)) - { - if ((errmsg > errbuf) || !isspace(*errmsg)) - { - ++errlen; - ++errmsg; - if ((*(errmsg - 1) == '\n') || (errlen == sizeof(errbuf) - 1)) - { - while (errlen && isspace(errbuf[errlen - 1])) - --errlen; - errbuf[errlen] = '\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; - errlen = 0; - } - } - } - - CloseHandle(hPipeRead); - return 0; -} - - -/* service_nt_main_fn is outside of the call stack and outside of the - * primary server thread... so now we _really_ need a placeholder! - * The winnt_rewrite_args has created and shared mpm_new_argv with us. - */ -extern apr_array_header_t *mpm_new_argv; - -static void __stdcall service_nt_main_fn(DWORD argc, LPTSTR *argv) -{ - HANDLE waitfor[2]; - HANDLE hCurrentProcess; - HANDLE hPipeRead = NULL; - HANDLE hPipeWrite = NULL; - HANDLE hPipeReadDup; - HANDLE thread; - DWORD threadid; - SECURITY_ATTRIBUTES sa = {0}; - const char *ignored; - - /* args and service names live in the same pool */ - mpm_service_set_name(mpm_new_argv->cont, &ignored, argv[0]); - - globdat.ssStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; - globdat.ssStatus.dwCurrentState = SERVICE_START_PENDING; - globdat.ssStatus.dwServiceSpecificExitCode = 0; - globdat.ssStatus.dwCheckPoint = 1; - - if (!(globdat.hServiceStatus = RegisterServiceCtrlHandler(argv[0], service_nt_ctrl))) - { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), - NULL, "Failure registering service handler"); - PulseEvent(globdat.signal_monitor); - return; - } - - ReportStatusToSCMgr(globdat.ssStatus.dwCurrentState, // service state - NO_ERROR, // exit code - 3000); // wait hint, 3 seconds more - - /* Create a pipe to send stderr messages to the system error log */ - hCurrentProcess = GetCurrentProcess(); - if (CreatePipe(&hPipeRead, &hPipeWrite, &sa, 0)) - { - if (DuplicateHandle(hCurrentProcess, hPipeRead, hCurrentProcess, - &hPipeReadDup, 0, FALSE, DUPLICATE_SAME_ACCESS)) - { - CloseHandle(hPipeRead); - hPipeRead = hPipeReadDup; - thread = CreateThread(NULL, 0, service_stderr_thread, - (LPVOID) hPipeRead, 0, &threadid); - if (thread) - { - int fh; - FILE *fl; - CloseHandle(thread); - fflush(stderr); - SetStdHandle(STD_ERROR_HANDLE, hPipeWrite); - - fh = _open_osfhandle((long) STD_ERROR_HANDLE, - _O_WRONLY | _O_BINARY); - dup2(fh, STDERR_FILENO); - fl = _fdopen(STDERR_FILENO, "wcb"); - memcpy(stderr, fl, sizeof(FILE)); - } - else - { - CloseHandle(hPipeRead); - CloseHandle(hPipeWrite); - hPipeWrite = NULL; - } - } - else - { - CloseHandle(hPipeRead); - CloseHandle(hPipeWrite); - hPipeWrite = NULL; - } - } - - /* We need to append all the command arguments passed via StartService() - * to our running service... which just got here via the SCM... - * but we hvae no interest in argv[0] for the mpm_new_argv list. - */ - if (argc > 1) - { - char **cmb_data; - - mpm_new_argv->nalloc = mpm_new_argv->nelts + argc - 1; - cmb_data = apr_palloc(mpm_new_argv->cont, - mpm_new_argv->nalloc * sizeof(const char *)); - - /* mpm_new_argv remains first (of lower significance) */ - memcpy (cmb_data, mpm_new_argv->elts, - mpm_new_argv->elt_size * mpm_new_argv->nelts); - - /* Service args follow from StartService() invocation */ - memcpy (cmb_data + mpm_new_argv->nelts, argv + 1, - mpm_new_argv->elt_size * (argc - 1)); - - /* The replacement arg list is complete */ - mpm_new_argv->elts = (char *)cmb_data; - mpm_new_argv->nelts = mpm_new_argv->nalloc; - } - - /* Let the main thread continue now... but hang on to the - * signal_monitor event so we can take further action - */ - SetEvent(globdat.signal_monitor); - - waitfor[0] = globdat.signal_monitor; - waitfor[1] = globdat.mpm_thread; - WaitForMultipleObjects(2, waitfor, FALSE, INFINITE); - /* The process is ready to terminate, or already has */ - - CloseHandle(hPipeWrite); -} - - -DWORD WINAPI service_nt_dispatch_thread(LPVOID nada) -{ - apr_status_t rv = APR_SUCCESS; - - SERVICE_TABLE_ENTRY dispatchTable[] = - { - { "", service_nt_main_fn }, - { NULL, NULL } - }; - - if (!StartServiceCtrlDispatcher(dispatchTable)) - { - /* This is a genuine failure of the SCM. */ - rv = apr_get_os_error(); - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, - "Error starting service control dispatcher"); - } - - globdat.service_thread_id = 0; - return (rv); -} - - -apr_status_t mpm_service_set_name(apr_pool_t *p, const char **display_name, - const char *set_name) -{ - char *key_name; - apr_status_t rv; - - /* ### Needs improvement, on Win2K the user can _easily_ - * change the display name to a string that doesn't reflect - * the internal service name + whitespace! - */ - mpm_service_name = apr_palloc(p, strlen(set_name) + 1); - apr_collapse_spaces((char*) mpm_service_name, set_name); - key_name = apr_psprintf(p, SERVICECONFIG, mpm_service_name); - rv = ap_registry_get_value(p, key_name, "DisplayName", &mpm_display_name); - if (rv != APR_SUCCESS) { - /* Take the given literal name if there is no service entry */ - mpm_display_name = apr_pstrdup(p, set_name); - } - *display_name = mpm_display_name; - return rv; -} - - -apr_status_t mpm_merge_service_args(apr_pool_t *p, - apr_array_header_t *args, - int fixed_args) -{ - apr_array_header_t *svc_args = NULL; - char conf_key[MAX_PATH]; - char **cmb_data; - apr_status_t rv; - - apr_snprintf(conf_key, sizeof(conf_key), SERVICEPARAMS, mpm_service_name); - rv = ap_registry_get_array(p, conf_key, "ConfigArgs", &svc_args); - if (rv != APR_SUCCESS) { - if (rv == ERROR_FILE_NOT_FOUND) { - ap_log_error(APLOG_MARK, APLOG_INFO|APLOG_NOERRNO, 0, NULL, - "No ConfigArgs registered for %s, perhaps " - "this service is not installed?", - mpm_service_name); - return APR_SUCCESS; - } - else - return (rv); - } - - if (!svc_args || svc_args->nelts == 0) { - return (APR_SUCCESS); - } - - /* Now we have the mpm_service_name arg, and the mpm_runservice_nt() - * call appended the arguments passed by StartService(), so it's - * time to _prepend_ the default arguments for the server from - * the service's default arguments (all others override them)... - */ - args->nalloc = args->nelts + svc_args->nelts; - cmb_data = apr_palloc(p, args->nalloc * sizeof(const char *)); - - /* First three args (argv[0], -f, path) remain first */ - memcpy(cmb_data, args->elts, args->elt_size * fixed_args); - - /* Service args follow from service registry array */ - memcpy(cmb_data + fixed_args, svc_args->elts, - svc_args->elt_size * svc_args->nelts); - - /* Remaining new args follow */ - memcpy(cmb_data + fixed_args + svc_args->nelts, - (const char **)args->elts + fixed_args, - args->elt_size * (args->nelts - fixed_args)); - - args->elts = (char *)cmb_data; - args->nelts = args->nalloc; - - return APR_SUCCESS; -} - - -void service_stopped(void) -{ - /* Still have a thread & window to clean up, so signal now */ - if (globdat.service_thread_id) - { - if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) - { - ReportStatusToSCMgr(SERVICE_STOPPED, // service state - NO_ERROR, // exit code - 0); // wait hint - - /* Cause the service_nt_main_fn to complete */ - SetEvent(globdat.signal_monitor); - } - else /* osver.dwPlatformId != VER_PLATFORM_WIN32_NT */ - { - RegisterServiceProcess(0, 0); - PostThreadMessage(globdat.service_thread_id, WM_CLOSE, 0, 0); - } - - WaitForSingleObject(globdat.service_thread, 5000); - CloseHandle(globdat.service_thread); - } -} - - -apr_status_t mpm_service_to_start(const char **display_name) -{ - HANDLE waitfor[2]; - - globdat.mpm_thread = GetCurrentThread(); - - if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) - { - globdat.signal_monitor = CreateEvent(NULL, FALSE, FALSE, NULL); - if (globdat.signal_monitor) - globdat.service_thread = CreateThread(NULL, 0, - service_nt_dispatch_thread, - NULL, 0, - &globdat.service_thread_id); - } - else /* osver.dwPlatformId != VER_PLATFORM_WIN32_NT */ - { - if (!RegisterServiceProcess(0, 1)) - return GetLastError(); - - globdat.signal_monitor = CreateEvent(NULL, FALSE, FALSE, NULL); - if (globdat.signal_monitor) - globdat.service_thread = CreateThread(NULL, 0, - monitor_service_9x_thread, - (LPVOID) mpm_service_name, 0, - &globdat.service_thread_id); - } - - if (globdat.signal_monitor && globdat.service_thread) - { - waitfor[0] = globdat.signal_monitor; - waitfor[1] = globdat.service_thread; - - /* SetEvent(globdat.signal_monitor) to clean up the SCM thread */ - if (WaitForMultipleObjects(2, waitfor, FALSE, 10000) != WAIT_OBJECT_0) { - CloseHandle(globdat.service_thread); - return APR_ENOTHREAD; - } - } - - if (globdat.service_thread_id) - atexit(service_stopped); - else if (globdat.service_thread) - CloseHandle(globdat.service_thread); - - *display_name = mpm_display_name; - return APR_SUCCESS; -} - - -apr_status_t mpm_service_started(void) -{ - if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) - { - ReportStatusToSCMgr(SERVICE_RUNNING, // service state - NO_ERROR, // exit code - 0); // wait hint - } - return APR_SUCCESS; -} - - -void mpm_service_stopping(void) -{ - if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) - ReportStatusToSCMgr(SERVICE_STOP_PENDING, // service state - NO_ERROR, // exit code - 3000); // wait hint -} - - -apr_status_t mpm_service_install(apr_pool_t *ptemp, int argc, - const char * const * argv) -{ - char key_name[MAX_PATH]; - char exe_path[MAX_PATH]; - char *launch_cmd; - apr_status_t(rv); - - printf("Installing the %s service\n", mpm_display_name); - - if (GetModuleFileName(NULL, exe_path, sizeof(exe_path)) == 0) - { - apr_status_t rv = apr_get_os_error(); - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, - "GetModuleFileName failed"); - return rv; - } - - if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) - { - SC_HANDLE schService; - SC_HANDLE schSCManager; - - // TODO: Determine the minimum permissions required for security - schSCManager = OpenSCManager(NULL, NULL, /* local, default database */ - SC_MANAGER_ALL_ACCESS); - if (!schSCManager) { - rv = apr_get_os_error(); - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, - "Failed to open the WinNT service manager"); - return (rv); - } - - launch_cmd = apr_psprintf(ptemp, "\"%s\" -k runservice", exe_path); - - /* RPCSS is the Remote Procedure Call (RPC) Locator required for DCOM - * communication pipes. I am far from convinced we should add this to - * the default service dependencies, but be warned that future apache - * modules or ISAPI dll's may depend on it. - */ - schService = CreateService(schSCManager, // SCManager database - mpm_service_name, // name of service - mpm_display_name, // name to display - SERVICE_ALL_ACCESS, // access required - SERVICE_WIN32_OWN_PROCESS, // service type - SERVICE_AUTO_START, // start type - SERVICE_ERROR_NORMAL, // error control type - launch_cmd, // service's binary - NULL, // no load svc group - NULL, // no tag identifier - "Tcpip\0Afd\0", // dependencies - NULL, // use SYSTEM account - NULL); // no password - - if (!schService) - { - rv = apr_get_os_error(); - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, - "Failed to create WinNT Service Profile"); - CloseServiceHandle(schSCManager); - return (rv); - } - - CloseServiceHandle(schService); - CloseServiceHandle(schSCManager); - } - else /* osver.dwPlatformId != VER_PLATFORM_WIN32_NT */ - { - /* Store the launch command in the registry */ - launch_cmd = apr_psprintf(ptemp, "\"%s\" -n %s -k runservice", - exe_path, mpm_service_name); - rv = ap_registry_store_value(SERVICECONFIG9X, mpm_service_name, launch_cmd); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, - "%s: Failed to add the RunServices registry entry.", - mpm_display_name); - return (rv); - } - - apr_snprintf(key_name, sizeof(key_name), SERVICECONFIG, mpm_service_name); - rv = ap_registry_store_value(key_name, "DisplayName", mpm_display_name); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, - "%s: Failed to store DisplayName in the registry.", - mpm_display_name); - return (rv); - } - } - - /* For both WinNT & Win9x store the service ConfigArgs in the registry... - */ - apr_snprintf(key_name, sizeof(key_name), SERVICEPARAMS, mpm_service_name); - rv = ap_registry_store_array(ptemp, key_name, "ConfigArgs", argc, argv); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, - "%s: Failed to store the ConfigArgs in the registry.", - mpm_display_name); - return (rv); - } - printf("The %s service is successfully installed.\n", mpm_display_name); -} - - -apr_status_t mpm_service_uninstall(void) -{ - char key_name[MAX_PATH]; - apr_status_t rv; - - if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) - { - SC_HANDLE schService; - SC_HANDLE schSCManager; - - printf("Removing the %s service\n", mpm_display_name); - - // TODO: Determine the minimum permissions required for security - schSCManager = OpenSCManager(NULL, NULL, /* local, default database */ - SC_MANAGER_ALL_ACCESS); - if (!schSCManager) { - rv = apr_get_os_error(); - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, - "Failed to open the WinNT service manager."); - return (rv); - } - - schService = OpenService(schSCManager, mpm_service_name, SERVICE_ALL_ACCESS); - - if (!schService) { - rv = apr_get_os_error(); - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, - "%s: OpenService failed", mpm_display_name); - return (rv); - } - - /* assure the service is stopped before continuing - * - * This may be out of order... we might not be able to be - * granted all access if the service is running anyway. - * - * And do we want to make it *this easy* for them - * to uninstall their service unintentionally? - */ - // ap_stop_service(schService); - - if (DeleteService(schService) == 0) { - rv = apr_get_os_error(); - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, - "%s: Failed to delete the service.", mpm_display_name); - return (rv); - } - - CloseServiceHandle(schService); - CloseServiceHandle(schSCManager); - } - else /* osver.dwPlatformId != VER_PLATFORM_WIN32_NT */ - { - printf("Removing the %s service\n", mpm_display_name); - - /* TODO: assure the service is stopped before continuing */ - - if (ap_registry_delete_value(SERVICECONFIG9X, mpm_service_name)) { - rv = apr_get_os_error(); - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, - "%s: Failed to remove the RunServices registry " - "entry.", mpm_display_name); - return (rv); - } - - /* we blast Services/us, not just the Services/us/Parameters branch */ - apr_snprintf(key_name, sizeof(key_name), SERVICECONFIG, mpm_service_name); - if (ap_registry_delete_key(key_name)) - { - rv = apr_get_os_error(); - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, - "%s: Failed to remove the service config from the " - "registry.", mpm_display_name); - return (rv); - } - } - printf("The %s service has been removed successfully.\n", mpm_display_name); - return APR_SUCCESS; -} - - -/* signal_service_transition is a simple thunk to signal the service - * and monitor it's successful transition. If the signal passed is 0, - * then the caller is assumed to already have performed some service - * operation to be monitored (such as StartService), and no actual - * ControlService signal is sent. - */ - -static int signal_service_transition(SC_HANDLE schService, DWORD signal, DWORD pending, DWORD complete) -{ - if (signal && !ControlService(schService, signal, &globdat.ssStatus)) - return FALSE; - - do { - Sleep(1000); - if (!QueryServiceStatus(schService, &globdat.ssStatus)) - return FALSE; - } while (globdat.ssStatus.dwCurrentState == pending); - - return (globdat.ssStatus.dwCurrentState == complete); -} - - -apr_status_t mpm_service_start(apr_pool_t *ptemp, int argc, - const char * const * argv) -{ - apr_status_t rv; - - printf("Starting the %s service\n", mpm_display_name); - - if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) - { - char **start_argv; - SC_HANDLE schService; - SC_HANDLE schSCManager; - - // TODO: Determine the minimum permissions required for security - schSCManager = OpenSCManager(NULL, NULL, /* local, default database */ - SC_MANAGER_ALL_ACCESS); - if (!schSCManager) { - rv = apr_get_os_error(); - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, - "Failed to open the WinNT service manager"); - return (rv); - } - - schService = OpenService(schSCManager, mpm_service_name, - SERVICE_START | SERVICE_QUERY_STATUS); - if (!schService) { - rv = apr_get_os_error(); - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, - "%s: Failed to open the service.", mpm_display_name); - CloseServiceHandle(schSCManager); - return (rv); - } - - if (QueryServiceStatus(schService, &globdat.ssStatus) - && (globdat.ssStatus.dwCurrentState == SERVICE_RUNNING)) { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, 0, NULL, - "Service %s is already started!", mpm_display_name); - CloseServiceHandle(schService); - CloseServiceHandle(schSCManager); - return 0; - } - - argc += 1; - start_argv = apr_palloc(ptemp, argc * sizeof(const char **)); - start_argv[0] = mpm_service_name; - if (argc > 1) - memcpy(start_argv + 1, argv, (argc - 1) * sizeof(const char **)); - - rv = APR_EINIT; - if (StartService(schService, argc, start_argv) - && signal_service_transition(schService, 0, /* test only */ - SERVICE_START_PENDING, - SERVICE_RUNNING)) - rv = APR_SUCCESS; - - if (rv != APR_SUCCESS) - rv = apr_get_os_error(); - - CloseServiceHandle(schService); - CloseServiceHandle(schSCManager); - } - else /* osver.dwPlatformId != VER_PLATFORM_WIN32_NT */ - { - STARTUPINFO si; /* Filled in prior to call to CreateProcess */ - PROCESS_INFORMATION pi; /* filled in on call to CreateProcess */ - char exe_path[MAX_PATH]; - char *pCommand; - int i; - - /* Locate the active top level window named service_name - * provided the class is ApacheWin95ServiceMonitor - */ - if (FindWindow("ApacheWin95ServiceMonitor", mpm_service_name)) { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, 0, NULL, - "Service %s is already started!", mpm_display_name); - return 0; - } - - /* This may not appear intuitive, but Win9x will not allow a process - * to detach from the console without releasing the entire console. - * Ergo, we must spawn a new process for the service to get back our - * console window. - * The config is pre-flighted, so there should be no danger of failure. - */ - - if (GetModuleFileName(NULL, exe_path, sizeof(exe_path)) == 0) - { - apr_status_t rv = apr_get_os_error(); - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, - "GetModuleFileName failed"); - return rv; - } - - pCommand = apr_psprintf(ptemp, "\"%s\" -n %s -k runservice", - exe_path, mpm_service_name); - for (i = 0; i < argc; ++i) { - pCommand = apr_pstrcat(ptemp, pCommand, - " \"", argv[i], "\"", NULL); - } - - memset(&si, 0, sizeof(si)); - memset(&pi, 0, sizeof(pi)); - si.cb = sizeof(si); - si.dwFlags = STARTF_USESHOWWINDOW; - si.wShowWindow = SW_HIDE; /* This might be redundant */ - - rv = APR_EINIT; - if (CreateProcess(NULL, pCommand, NULL, NULL, FALSE, - DETACHED_PROCESS, /* Creation flags */ - NULL, NULL, &si, &pi)) - { - DWORD code; - while (GetExitCodeProcess(pi.hProcess, &code) == STILL_ACTIVE) { - if (FindWindow("ApacheWin95ServiceMonitor", mpm_service_name)) { - rv = APR_SUCCESS; - break; - } - Sleep (1000); - } - } - - if (rv != APR_SUCCESS) - rv = apr_get_os_error(); - - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - } - - if (rv == APR_SUCCESS) - printf("The %s service is running.\n", mpm_display_name); - else - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "%s: Failed to start the service process.", - mpm_display_name); - - return rv; -} - - -/* signal is zero to stop, non-zero for restart */ - -void mpm_signal_service(apr_pool_t *ptemp, int signal) -{ - int success = FALSE; - - if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) - { - SC_HANDLE schService; - SC_HANDLE schSCManager; - - schSCManager = OpenSCManager(NULL, NULL, // default machine & database - SC_MANAGER_ALL_ACCESS); - - if (!schSCManager) { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), NULL, - "Failed to open the NT Service Manager"); - return; - } - - schService = OpenService(schSCManager, mpm_service_name, - SERVICE_ALL_ACCESS); - - if (schService == NULL) { - /* Could not open the service */ - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), NULL, - "Failed to open the %s Service", mpm_display_name); - CloseServiceHandle(schSCManager); - return; - } - - if (!QueryServiceStatus(schService, &globdat.ssStatus)) { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), NULL, - "Query of Service %s failed", mpm_display_name); - CloseServiceHandle(schService); - CloseServiceHandle(schSCManager); - return; - } - - if (!signal && (globdat.ssStatus.dwCurrentState == SERVICE_STOPPED)) { - printf("The %s service is not started.\n", mpm_display_name); - CloseServiceHandle(schService); - CloseServiceHandle(schSCManager); - return; - } - - printf("The %s service is %s.\n", mpm_display_name, - signal ? "restarting" : "stopping"); - - if (!signal) - success = signal_service_transition(schService, - SERVICE_CONTROL_STOP, - SERVICE_STOP_PENDING, - SERVICE_STOPPED); - else if (globdat.ssStatus.dwCurrentState == SERVICE_STOPPED) { - mpm_service_start(ptemp, 0, NULL); - CloseServiceHandle(schService); - CloseServiceHandle(schSCManager); - return; - } - else - success = signal_service_transition(schService, - SERVICE_APACHE_RESTART, - SERVICE_START_PENDING, - SERVICE_RUNNING); - - CloseServiceHandle(schService); - CloseServiceHandle(schSCManager); - } - else /* !isWindowsNT() */ - { - DWORD service_pid; - HANDLE hwnd; - char prefix[20]; - /* Locate the active top level window named service_name - * provided the class is ApacheWin95ServiceMonitor - */ - hwnd = FindWindow("ApacheWin95ServiceMonitor", mpm_service_name); - if (hwnd && GetWindowThreadProcessId(hwnd, &service_pid)) - globdat.ssStatus.dwCurrentState = SERVICE_RUNNING; - else - { - globdat.ssStatus.dwCurrentState = SERVICE_STOPPED; - if (!signal) { - printf("The %s service is not started.\n", mpm_display_name); - return; - } - } - - printf("The %s service is %s.\n", mpm_display_name, - signal ? "restarting" : "stopping"); - - apr_snprintf(prefix, sizeof(prefix), "ap%ld", (long)service_pid); - setup_signal_names(prefix); - - if (!signal) - { - int ticks = 60; - ap_start_shutdown(); - while (--ticks) - { - if (!IsWindow(hwnd)) { - success = TRUE; - break; - } - Sleep(1000); - } - } - else /* !stop */ - { - /* TODO: Aught to add a little test to the restart logic, and - * store the restart counter in the window's user dword. - * Then we can hang on and report a successful restart. But - * that's a project for another day. - */ - if (globdat.ssStatus.dwCurrentState == SERVICE_STOPPED) { - mpm_service_start(ptemp, 0, NULL); - return; - } - else { - success = TRUE; - ap_start_restart(1); - } - } - } - - if (success) - printf("The %s service has %s.\n", mpm_display_name, - signal ? "restarted" : "stopped"); - else - printf("Failed to %s the %s service.\n", - signal ? "restart" : "stop", mpm_display_name); -} diff --git a/server/mpm_common.c b/server/mpm_common.c deleted file mode 100644 index d024c24978..0000000000 --- a/server/mpm_common.c +++ /dev/null @@ -1,344 +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. - */ - -/* 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.h" -#include "apr_thread_proc.h" -#include "apr_signal.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" - -#ifdef HAVE_PWD_H -#include <pwd.h> -#endif -#ifdef HAVE_GRP_H -#include <grp.h> -#endif - -#ifdef AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES -void ap_reclaim_child_processes(int terminate) -{ - int i; - long int waittime = 1024 * 16; /* in usecs */ - apr_status_t waitret; - int tries; - int not_dead_yet; - int max_daemons; - - ap_mpm_query(AP_MPMQ_MAX_DAEMONS, &max_daemons); - MPM_SYNC_CHILD_TABLE(); - - 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. - */ - waittime = waittime * 4; - apr_sleep(waittime); - - /* now see who is done */ - not_dead_yet = 0; - for (i = 0; i < max_daemons; ++i) { - pid_t pid = MPM_CHILD_PID(i); - apr_proc_t proc; - - if (pid == 0) - continue; - - proc.pid = pid; - waitret = apr_proc_wait(&proc, APR_NOWAIT); - if (waitret != APR_CHILD_NOTDONE) { - MPM_NOTE_CHILD_KILLED(i); - continue; - } - ++not_dead_yet; - switch (tries) { - case 1: /* 16ms */ - case 2: /* 82ms */ - case 3: /* 344ms */ - case 4: /* 16ms */ - break; - 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 %ld still did not exit, sending a SIGTERM", - (long)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 %ld still did not exit, sending a SIGKILL", - (long)pid); -#ifndef BEOS - kill(pid, SIGKILL); -#else - /* sending a SIGKILL kills the entire team on BeOS, and as - * httpd thread is part of that team it removes any chance - * of ever doing a restart. To counter this I'm changing to - * use a kinder, gentler way of killing a specific thread - * that is just as effective. - */ - kill_thread(pid); -#endif - 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 %ld exit, " - "attempting to continue anyway", (long)pid); - break; - } - } -#if APR_HAS_OTHER_CHILD - apr_proc_other_child_check(); -#endif - if (!not_dead_yet) { - /* nothing left to wait for */ - break; - } - } -} -#endif /* NEED_RECLAIM_CHILD_PROCESSES */ - -/* 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; - -void ap_wait_or_timeout(apr_wait_t *status, apr_proc_t *ret, apr_pool_t *p) -{ - apr_status_t rv; - - ++wait_or_timeout_counter; - if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) { - wait_or_timeout_counter = 0; -#if APR_HAS_OTHER_CHILD - apr_proc_probe_writable_fds(); -#endif - } - rv = apr_proc_wait_all_procs(ret, status, APR_NOWAIT, p); - if (APR_STATUS_IS_EINTR(rv)) { - ret->pid = -1; - return; - } - if (APR_STATUS_IS_CHILD_DONE(rv)) { - return; - } -#ifdef NEED_WAITPID - if ((ret = reap_children(status)) > 0) { - return; - } -#endif - apr_sleep(SCOREBOARD_MAINTENANCE_INTERVAL); - ret->pid = -1; - return; -} - -void ap_process_child_status(apr_proc_t *pid, apr_wait_t status) -{ - int signum = WTERMSIG(status); - const char *sigdesc = apr_signal_get_description(signum); - - /* 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, 0, ap_server_conf, - "Child %ld returned a Fatal error..." APR_EOL_STR - "Apache is exiting!", - (long)pid->pid); - exit(APEXIT_CHILDFATAL); - } - - if (WIFSIGNALED(status)) { - switch (signum) { - case SIGTERM: - case SIGHUP: - case SIGWINCH: - case SIGKILL: - break; - default: -#ifdef WCOREDUMP - if (WCOREDUMP(status)) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, - 0, ap_server_conf, - "child pid %ld exit signal %s (%d), " - "possible coredump in %s", - (long)pid->pid, sigdesc, signum, - ap_coredump_dir); - } - else -#endif - { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, - 0, ap_server_conf, - "child pid %ld exit signal %s (%d)", - (long)pid->pid, sigdesc, signum); - } - } - } -} - -#if defined(TCP_NODELAY) && !defined(MPE) && !defined(TPF) -void ap_sock_disable_nagle(apr_socket_t *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. - */ - apr_status_t status = apr_setsocketopt(s, APR_TCP_NODELAY, 1); - - if (status != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_WARNING, status, ap_server_conf, - "setsockopt: (TCP_NODELAY)"); - } -} -#endif - -AP_DECLARE(uid_t) ap_uname2id(const char *name) -{ - struct passwd *ent; - - if (name[0] == '#') - return (atoi(&name[1])); - - if (!(ent = getpwnam(name))) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "%s: bad user name %s", ap_server_argv0, name); - exit(1); - } - return (ent->pw_uid); -} - -AP_DECLARE(gid_t) ap_gname2id(const char *name) -{ - struct group *ent; - - if (name[0] == '#') - return (atoi(&name[1])); - - if (!(ent = getgrnam(name))) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "%s: bad group name %s", ap_server_argv0, name); exit(1); - } - return (ent->gr_gid); -} - -#ifndef HAVE_INITGROUPS -int initgroups(const char *name, gid_t basegid) -{ -#if defined(QNX) || defined(MPE) || defined(BEOS) || defined(_OSD_POSIX) || defined(TPF) || defined(__TANDEM) || defined(OS2) || defined(WIN32) -/* 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 */ - - diff --git a/server/protocol.c b/server/protocol.c deleted file mode 100644 index 93db7c32d0..0000000000 --- a/server/protocol.c +++ /dev/null @@ -1,1176 +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. - */ - -/* - * 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 <stdarg.h> -#endif -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#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 - */ -AP_DECLARE(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; -} - -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; -} - -/* 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 zero = 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 ((retval = ap_get_brigade(c->input_filters, b, AP_MODE_BLOCKING, &zero)) != APR_SUCCESS || - APR_BRIGADE_EMPTY(b)) { - apr_brigade_destroy(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) { - apr_brigade_destroy(b); - ap_log_rerror(APLOG_MARK, APLOG_ERR, retval, r, "apr_bucket_read() failed"); - if (total) { - break; /* report previously-read data to caller, do ap_xlate_proto_to_ascii() */ - } - else { - return -1; - } - } - - 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; - const char *pro; - -#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; - } - - if (ll[0]) { - r->assbackwards = 0; - pro = ll; - len = strlen(ll); - } else { - r->assbackwards = 1; - pro = "HTTP/0.9"; - len = 8; - } - r->protocol = apr_pstrndup(r->pool, pro, len); - - /* XXX ap_update_connection_status(conn->id, "Protocol", r->protocol); */ - - /* Avoid sscanf in the common case */ - if (len == 8 && - pro[0] == 'H' && pro[1] == 'T' && pro[2] == 'T' && pro[3] == 'P' && - pro[4] == '/' && apr_isdigit(pro[5]) && pro[6] == '.' && - apr_isdigit(pro[7])) { - r->proto_num = HTTP_VERSION(pro[5] - '0', pro[7] - '0'); - } else 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.<P>\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.<P>\n" - "<PRE>\n", - ap_escape_html(r->pool, field), - "</PRE>\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.<P>\n" - "<PRE>\n", - ap_escape_html(r->pool, copy), - "</PRE>\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, keptalive; - - apr_pool_create(&p, conn->pool); - r = apr_pcalloc(p, sizeof(request_rec)); - r->pool = p; - r->connection = conn; - r->server = conn->base_server; - - 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); - ap_run_create_request(r); - 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)(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 (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; - - 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, - (PROXYREQ_PROXY == 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, - (PROXYREQ_PROXY == 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, - (PROXYREQ_PROXY == 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: - * The protocol is < 1.1 - * and We can not chunk - * and this is a keepalive request. - * or 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. - */ - 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); -} - -/* - * 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 { - apr_bucket_brigade *bb; -} 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->bb != 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_BRIGADE_CONCAT(ctx->bb, bb); - } - - return ap_pass_brigade(f->next, ctx->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; - - 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); - f = r->output_filters; - } - - /* if the first filter is not our buffering filter, then we have to - * deliver the content through the normal filter chain */ - if (f != r->output_filters) { - 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 (ctx->bb == NULL) { - ctx->bb = apr_brigade_create(r->pool); - } - - ap_fwrite(f->next, ctx->bb, str, len); - - 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; -} - -/* - * 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. - */ -AP_DECLARE(void) ap_set_last_modified(request_rec *r) -{ - apr_time_t mod_time = ap_rationalize_mtime(r, r->mtime); - char *datestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN); - apr_rfc822_date(datestr, mod_time); - apr_table_setn(r->headers_out, "Last-Modified", datestr); -} - -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 b015def039..0000000000 --- a/server/request.c +++ /dev/null @@ -1,1133 +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. - */ - -/* - * 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 <stdarg.h> -#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) - APR_HOOK_LINK(create_request) -) - -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)) -AP_IMPLEMENT_HOOK_RUN_ALL(int,create_request,(request_rec *r),(r),OK,DECLINED) - -/***************************************************************** - * - * 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 <Directory> 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 - * <Directory /> 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 <Directory> 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); - - 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); - - /* We have to run this after ap_set_sub_req_protocol, or the r->main - * pointer won't be setup - */ - ap_run_create_request(rnew); - - /* 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); - - 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); - - /* We have to run this after ap_set_sub_req_protocol, or the r->main - * pointer won't be setup - */ - ap_run_create_request(rnew); - - 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/rfc1413.c b/server/rfc1413.c deleted file mode 100644 index 40d221bc10..0000000000 --- a/server/rfc1413.c +++ /dev/null @@ -1,288 +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. - */ - -/* TODO - put timeouts back in */ -/* - * rfc1413() speaks a common subset of the RFC 1413, AUTH, TAP and IDENT - * protocols. The code queries an RFC 1413 etc. compatible daemon on a remote - * host to look up the owner of a connection. The information should not be - * used for authentication purposes. This routine intercepts alarm signals. - * - * Diagnostics are reported through syslog(3). - * - * Author: Wietse Venema, Eindhoven University of Technology, - * The Netherlands. - */ - -/* Some small additions for Apache --- ditch the "sccsid" var if - * compiling with gcc (it *has* changed), include ap_config.h for the - * prototypes it defines on at least one system (SunlOSs) which has - * them missing from the standard header files, and one minor change - * below (extra parens around assign "if (foo = bar) ..." to shut up - * gcc -Wall). - */ - -/* Rewritten by David Robinson */ - -#include "apr.h" -#include "apr_network_io.h" -#include "apr_strings.h" -#include "apr_lib.h" - -#define APR_WANT_STDIO -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "ap_config.h" -#include "httpd.h" /* for server_rec, conn_rec, etc. */ -#include "http_log.h" /* for aplog_error */ -#include "rfc1413.h" -#include "http_main.h" /* set_callback_and_alarm */ -#include "util_ebcdic.h" - -/* Local stuff. */ -/* Semi-well-known port */ -#define RFC1413_PORT 113 -/* maximum allowed length of userid */ -#define RFC1413_USERLEN 512 -/* rough limit on the amount of data we accept. */ -#define RFC1413_MAXDATA 1000 - -#ifndef RFC1413_TIMEOUT -#define RFC1413_TIMEOUT 30 -#endif -#define FROM_UNKNOWN "unknown" - -int ap_rfc1413_timeout = RFC1413_TIMEOUT; /* Global so it can be changed */ - -static apr_status_t rfc1413_connect(apr_socket_t **newsock, conn_rec *conn, - server_rec *srv) -{ - apr_status_t rv; - apr_sockaddr_t *localsa, *destsa; - - if ((rv = apr_sockaddr_info_get(&localsa, conn->local_ip, APR_UNSPEC, - 0, /* ephemeral port */ - 0, conn->pool)) != APR_SUCCESS) { - /* This should not fail since we have a numeric address string - * as the host. */ - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, srv, - "rfc1413: apr_sockaddr_info_get(%s) failed", - conn->local_ip); - return rv; - } - - if ((rv = apr_sockaddr_info_get(&destsa, conn->remote_ip, - localsa->sa.sin.sin_family, /* has to match */ - RFC1413_PORT, 0, conn->pool)) != APR_SUCCESS) { - /* This should not fail since we have a numeric address string - * as the host. */ - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, srv, - "rfc1413: apr_sockaddr_info_get(%s) failed", - conn->remote_ip); - return rv; - } - - if ((rv = apr_socket_create(newsock, - localsa->sa.sin.sin_family, /* has to match */ - SOCK_STREAM, conn->pool)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, srv, - "rfc1413: error creating query socket"); - return rv; - } - - if ((rv = apr_setsocketopt(*newsock, APR_SO_TIMEOUT, - (apr_int32_t)(ap_rfc1413_timeout - * APR_USEC_PER_SEC))) - != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, srv, - "rfc1413: error setting query socket timeout"); - apr_socket_close(*newsock); - return rv; - } - -/* - * Bind the local and remote ends of the query socket to the same - * IP addresses as the connection under investigation. We go - * through all this trouble because the local or remote system - * might have more than one network address. The RFC1413 etc. - * client sends only port numbers; the server takes the IP - * addresses from the query socket. - */ - - if ((rv = apr_bind(*newsock, localsa)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, srv, - "rfc1413: Error binding query socket to local port"); - apr_socket_close(*newsock); - return rv; - } - -/* - * errors from connect usually imply the remote machine doesn't support - * the service; don't log such an error - */ - if ((rv = apr_connect(*newsock, destsa)) != APR_SUCCESS) { - apr_socket_close(*newsock); - return rv; - } - - return APR_SUCCESS; -} - -static apr_status_t rfc1413_query(apr_socket_t *sock, conn_rec *conn, - server_rec *srv) -{ - apr_port_t rmt_port, our_port; - apr_port_t sav_rmt_port, sav_our_port; - apr_size_t i; - char *cp; - char buffer[RFC1413_MAXDATA + 1]; - char user[RFC1413_USERLEN + 1]; /* XXX */ - apr_size_t buflen; - apr_sockaddr_t *localsa; - - apr_socket_addr_get(&localsa, APR_LOCAL, sock); - apr_sockaddr_port_get(&sav_our_port, localsa); - sav_rmt_port = RFC1413_PORT; - - /* send the data */ - buflen = apr_snprintf(buffer, sizeof(buffer), "%hu,%hu\r\n", sav_rmt_port, - sav_our_port); - ap_xlate_proto_to_ascii(buffer, buflen); - - /* send query to server. Handle short write. */ - i = 0; - while (i < buflen) { - apr_size_t j = strlen(buffer + i); - apr_status_t status; - status = apr_send(sock, buffer+i, &j); - if (status != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_CRIT, status, srv, - "write: rfc1413: error sending request"); - return status; - } - else if (j > 0) { - i+=j; - } - } - - /* - * Read response from server. - the response should be newline - * terminated according to rfc - make sure it doesn't stomp its - * way out of the buffer. - */ - - i = 0; - memset(buffer, '\0', sizeof(buffer)); - /* - * Note that the strchr function below checks for \012 instead of '\n' - * this allows it to work on both ASCII and EBCDIC machines. - */ - while((cp = strchr(buffer, '\012')) == NULL && i < sizeof(buffer) - 1) { - apr_size_t j = sizeof(buffer) - 1 - i; - apr_status_t status; - status = apr_recv(sock, buffer+i, &j); - if (status != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_CRIT, status, srv, - "read: rfc1413: error reading response"); - return status; - } - else if (j > 0) { - i+=j; - } - else if (status == APR_SUCCESS && j == 0) { - /* Oops... we ran out of data before finding newline */ - return APR_EINVAL; - } - } - -/* RFC1413_USERLEN = 512 */ - ap_xlate_proto_from_ascii(buffer, i); - if (sscanf(buffer, "%hu , %hu : USERID :%*[^:]:%512s", &rmt_port, &our_port, - user) != 3 || sav_rmt_port != rmt_port - || sav_our_port != our_port) - return APR_EINVAL; - - /* - * Strip trailing carriage return. It is part of the - * protocol, not part of the data. - */ - - if ((cp = strchr(user, '\r'))) - *cp = '\0'; - - conn->remote_logname = apr_pstrdup(conn->pool, user); - - return APR_SUCCESS; -} - -char *ap_rfc1413(conn_rec *conn, server_rec *srv) -{ - apr_socket_t *sock; - apr_status_t rv; - - rv = rfc1413_connect(&sock, conn, srv); - if (rv == APR_SUCCESS) { - rv = rfc1413_query(sock, conn, srv); - apr_socket_close(sock); - } - if (rv != APR_SUCCESS) { - conn->remote_logname = FROM_UNKNOWN; - } - return conn->remote_logname; -} diff --git a/server/scoreboard.c b/server/scoreboard.c deleted file mode 100644 index d93a84aaec..0000000000 --- a/server/scoreboard.c +++ /dev/null @@ -1,340 +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. - */ - -#include "apr.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_lib.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if APR_HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -#include "ap_config.h" -#include "httpd.h" -#include "http_log.h" -#include "http_main.h" -#include "http_core.h" -#include "http_config.h" -#include "ap_mpm.h" - -#include "mpm.h" -#include "scoreboard.h" - -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; -#endif -/* - * ToDo: - * This function should be renamed to cleanup_shared - * and it should handle cleaning up a scoreboard shared - * between processes using any form of IPC (file, shared memory - * segment, etc.). Leave it as is now because it is being used - * by various MPMs. - */ -static apr_status_t ap_cleanup_shared_mem(void *d) -{ -#if APR_HAS_SHARED_MEMORY - apr_shm_free(scoreboard_shm, ap_scoreboard_image); - ap_scoreboard_image = NULL; - apr_shm_destroy(scoreboard_shm); -#endif - return APR_SUCCESS; -} - -/* ToDo: This function should be made to handle setting up - * a scoreboard shared between processes using any IPC technique, - * not just a shared memory segment - */ -static void setup_shared(apr_pool_t *p) -{ -#if APR_HAS_SHARED_MEMORY - 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); - } - ap_scoreboard_image->global.running_generation = 0; -#endif -} - -AP_DECLARE(void) reopen_scoreboard(apr_pool_t *p) -{ -} - -/* ap_cleanup_scoreboard - * - */ -apr_status_t ap_cleanup_scoreboard(void *d) { - if (ap_scoreboard_image == NULL) - return APR_SUCCESS; - if (ap_scoreboard_image->global.sb_type == SB_SHARED) { - ap_cleanup_shared_mem(NULL); - } - else { - free(ap_scoreboard_image); - ap_scoreboard_image = NULL; - } - return APR_SUCCESS; -} - -/* ap_create_scoreboard(apr_pool_t*, ap_scoreboard_e t) - * - * Create or reinit an existing scoreboard. The MPM can control whether - * the scoreboard is shared across multiple processes or not - */ -AP_DECLARE(void) ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type) -{ - int running_gen = 0; - if (ap_scoreboard_image) - running_gen = ap_scoreboard_image->global.running_generation; - if (ap_scoreboard_image == NULL) { - if (sb_type == SB_SHARED) { - setup_shared(p); - } - else { - /* A simple malloc will suffice */ - char buf[512]; - ap_scoreboard_image = (scoreboard *) malloc(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 */ - exit(APEXIT_INIT); - } - } - } - memset(ap_scoreboard_image, 0, SCOREBOARD_SIZE); - ap_scoreboard_image->global.sb_type = sb_type; - ap_scoreboard_image->global.running_generation = running_gen; - ap_restart_time = apr_time_now(); - apr_pool_cleanup_register(p, NULL, ap_cleanup_scoreboard, apr_pool_cleanup_null); -} - -/* 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. - */ - -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 -} - -AP_DECLARE(void) ap_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_mpm_query(AP_MPMQ_MAX_DAEMONS, &max_daemons_limit); - - 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, NULL), 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_time_now(); - } - else if (status == STOP_PREQUEST) { - ss->stop_time = apr_time_now(); - } - put_scoreboard_info(child_num, thread_num, ss); -} - diff --git a/server/util.c b/server/util.c deleted file mode 100644 index 7ff05caa6e..0000000000 --- a/server/util.c +++ /dev/null @@ -1,1907 +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. - */ - -/* - * util.c: string utility things - * - * 3/21/93 Rob McCool - * 1995-96 Many changes by the Apache Software Foundation - * - */ - -/* 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 "apr.h" -#include "apr_strings.h" -#include "apr_lib.h" - -#define APR_WANT_STDIO -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#endif -#if APR_HAVE_NETDB_H -#include <netdb.h> /* for gethostbyname() */ -#endif - -#define CORE_PRIVATE - -#include "ap_config.h" -#include "apr_base64.h" -#include "httpd.h" -#include "http_main.h" -#include "http_log.h" -#include "http_protocol.h" -#include "http_config.h" -#include "util_ebcdic.h" - -#ifdef HAVE_PWD_H -#include <pwd.h> -#endif -#ifdef HAVE_GRP_H -#include <grp.h> -#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)) - -/* - * 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. - */ -AP_DECLARE(char *) ap_field_noparam(apr_pool_t *p, const char *intype) -{ - const char *semi; - - if (intype == NULL) return NULL; - - semi = ap_strchr_c(intype, ';'); - if (semi == NULL) { - return apr_pstrdup(p, intype); - } - else { - while ((semi > intype) && apr_isspace(semi[-1])) { - semi--; - } - return apr_pstrndup(p, intype, semi - intype); - } -} - -AP_DECLARE(char *) ap_ht_time(apr_pool_t *p, apr_time_t t, const char *fmt, int gmt) -{ - apr_size_t retcode; - char ts[MAX_STRING_LEN]; - char tf[MAX_STRING_LEN]; - apr_exploded_time_t xt; - - if (gmt) { - const char *f; - char *strp; - - apr_explode_gmt(&xt, t); - /* 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. - */ - 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; - } - else { - apr_explode_localtime(&xt, t); - } - - /* check return code? */ - apr_strftime(ts, &retcode, MAX_STRING_LEN, fmt, &xt); - ts[MAX_STRING_LEN - 1] = '\0'; - return apr_pstrdup(p, ts); -} - -/* 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? - */ -AP_DECLARE(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'); -} - -AP_DECLARE(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] != '?') && (apr_tolower(str[x]) != apr_tolower(exp[y]))) - return 1; - } - return (str[x] != '\0'); -} - -AP_DECLARE(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; -} - -/* - * Here's a pool-based interface to POSIX regex's regcomp(). - * Note that we return regex_t instead of being passed one. - * The reason is that if you use an already-used regex_t structure, - * the memory that you've already allocated gets forgotten, and - * regfree() doesn't clear it. So we don't allow it. - */ - -static apr_status_t regex_cleanup(void *preg) -{ - regfree((regex_t *) preg); - return APR_SUCCESS; -} - -AP_DECLARE(regex_t *) ap_pregcomp(apr_pool_t *p, const char *pattern, - int cflags) -{ - regex_t *preg = apr_palloc(p, sizeof(regex_t)); - - if (regcomp(preg, pattern, cflags)) { - return NULL; - } - - apr_pool_cleanup_register(p, (void *) preg, regex_cleanup, regex_cleanup); - - return preg; -} - -AP_DECLARE(void) ap_pregfree(apr_pool_t *p, regex_t * reg) -{ - regfree(reg); - apr_pool_cleanup_kill(p, (void *) reg, regex_cleanup); -} - -/* - * Similar to standard strstr() but we ignore case in this version. - * Based on the strstr() implementation further below. - */ -AP_DECLARE(char *) ap_strcasestr(const char *s1, const char *s2) -{ - char *p1, *p2; - if (*s2 == '\0') { - /* an empty s2 */ - return((char *)s1); - } - while(1) { - for ( ; (*s1 != '\0') && (apr_tolower(*s1) != apr_tolower(*s2)); s1++); - if (*s1 == '\0') return(NULL); - /* found first character of s2, see if the rest matches */ - p1 = (char *)s1; - p2 = (char *)s2; - while (apr_tolower(*++p1) == apr_tolower(*++p2)) { - if (*p1 == '\0') { - /* both strings ended together */ - return((char *)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((char *)s1); -} - -/* - * Returns an offsetted pointer in bigstring immediately after - * prefix. Returns bigstring if bigstring doesn't start with - * prefix or if prefix is longer than bigstring while still matching. - * NOTE: pointer returned is relative to bigstring, so we - * can use standard pointer comparisons in the calling function - * (eg: test if ap_stripprefix(a,b) == a) - */ -AP_DECLARE(const char *) ap_stripprefix(const char *bigstring, - const char *prefix) -{ - const char *p1; - - if (*prefix == '\0') - return bigstring; - - p1 = bigstring; - while (*p1 && *prefix) { - if (*p1++ != *prefix++) - return bigstring; - } - if (*prefix == '\0') - return p1; - - /* hit the end of bigstring! */ - return bigstring; -} - -/* - * 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! - */ -AP_DECLARE(int) ap_regexec(regex_t *preg, const char *string, - size_t nmatch, regmatch_t pmatch[], int eflags) -{ - return regexec(preg, string, nmatch, pmatch, eflags); -} - -AP_DECLARE(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. - */ - -AP_DECLARE(char *) ap_pregsub(apr_pool_t *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 apr_pstrdup(p, src); - - /* First pass, find the size */ - - len = 0; - - while ((c = *src++) != '\0') { - if (c == '&') - no = 0; - else if (c == '$' && apr_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 = apr_pcalloc(p, len + 1); - - /* Now actually fill in the string */ - - src = input; - - while ((c = *src++) != '\0') { - if (c == '&') - no = 0; - else if (c == '$' && apr_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 - */ -AP_DECLARE(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'; - } -} - -AP_DECLARE(void) ap_no2slash(char *name) -{ - char *d, *s; - - s = d = name; - -#ifdef HAVE_UNC_PATHS - /* 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 - * - * MODIFIED FOR HAVE_DRIVE_LETTERS and NETWARE environments, - * so that if n == 0, "/" is returned in d with n == 1 - * and s == "e:/test.html", "e:/" is returned in d - * *** See also directory_walk in modules/http/http_request.c - - * examples: - * /a/b, 0 ==> / (true for all platforms) - * /a/b, 1 ==> / - * /a/b, 2 ==> /a/ - * /a/b, 3 ==> /a/b/ - * /a/b, 4 ==> /a/b/ - * - * c:/a/b 0 ==> / - * c:/a/b 1 ==> c:/ - * c:/a/b 2 ==> c:/a/ - * c:/a/b 3 ==> c:/a/b - * c:/a/b 4 ==> c:/a/b - */ -AP_DECLARE(char *) ap_make_dirstr_prefix(char *d, const char *s, int n) -{ - if (n < 1) { - *d = '/'; - *++d = '\0'; - return (d); - } - - for (;;) { - if (*s == '\0' || (*s == '/' && (--n) == 0)) { - *d = '/'; - break; - } - *d++ = *s++; - } - *++d = 0; - return (d); -} - - -/* - * return the parent directory name including trailing / of the file s - */ -AP_DECLARE(char *) ap_make_dirstr_parent(apr_pool_t *p, const char *s) -{ - const char *last_slash = ap_strrchr_c(s, '/'); - char *d; - int l; - - if (last_slash == NULL) { - /* XXX: well this is really broken if this happens */ - return (apr_pstrdup(p, "/")); - } - l = (last_slash - s) + 1; - d = apr_palloc(p, l + 1); - memcpy(d, s, l); - d[l] = 0; - return (d); -} - - -AP_DECLARE(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; -} - -AP_DECLARE(char *) ap_getword_nc(apr_pool_t *atrans, char **line, char stop) -{ - return ap_getword(atrans, (const char **) line, stop); -} - -AP_DECLARE(char *) ap_getword(apr_pool_t *atrans, const char **line, char stop) -{ - const char *pos = ap_strchr_c(*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; -} - -AP_DECLARE(char *) ap_getword_white_nc(apr_pool_t *atrans, char **line) -{ - return ap_getword_white(atrans, (const char **) line); -} - -AP_DECLARE(char *) ap_getword_white(apr_pool_t *atrans, const char **line) -{ - int pos = -1, x; - char *res; - - for (x = 0; (*line)[x]; x++) { - if (apr_isspace((*line)[x])) { - pos = x; - break; - } - } - - if (pos == -1) { - res = apr_pstrdup(atrans, *line); - *line += strlen(*line); - return res; - } - - res = apr_palloc(atrans, pos + 1); - apr_cpystrn(res, *line, pos + 1); - - while (apr_isspace((*line)[pos])) - ++pos; - - *line += pos; - - return res; -} - -AP_DECLARE(char *) ap_getword_nulls_nc(apr_pool_t *atrans, char **line, char stop) -{ - return ap_getword_nulls(atrans, (const char **) line, stop); -} - -AP_DECLARE(char *) ap_getword_nulls(apr_pool_t *atrans, const char **line, char stop) -{ - const char *pos = ap_strchr_c(*line, stop); - char *res; - - if (!pos) { - res = apr_pstrdup(atrans, *line); - *line += strlen(*line); - return res; - } - - res = apr_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(apr_pool_t *p, const char *start, int len, char quote) -{ - char *result = apr_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'; -#if RESOLVE_ENV_PER_TOKEN - return ap_resolve_env(p,result); -#else - return result; -#endif -} - -AP_DECLARE(char *) ap_getword_conf_nc(apr_pool_t *p, char **line) -{ - return ap_getword_conf(p, (const char **) line); -} - -AP_DECLARE(char *) ap_getword_conf(apr_pool_t *p, const char **line) -{ - const char *str = *line, *strend; - char *res; - char quote; - - while (*str && apr_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 && !apr_isspace(*strend)) - ++strend; - - res = substring_conf(p, str, strend - str, 0); - } - - while (*strend && apr_isspace(*strend)) - ++strend; - *line = strend; - return res; -} - -/* Check a string for any ${ENV} environment variable - * construct and replace each them by the value of - * that environment variable, if it exists. If the - * environment value does not exist, leave the ${ENV} - * construct alone; it means something else. - */ -AP_DECLARE(const char *) ap_resolve_env(apr_pool_t *p, const char * word) -{ - char tmp[ MAX_STRING_LEN ]; - const char *s, *e; - tmp[0] = '\0'; - - if (!(s=ap_strchr_c(word,'$'))) - return word; - - do { - /* XXX - relies on strncat() to add '\0' - */ - strncat(tmp,word,s - word); - if ((s[1] == '{') && (e=ap_strchr_c(s,'}'))) { - const char *e2 = e; - word = e + 1; - e = getenv(s+2); - if (e) { - strcat(tmp,e); - } else { - strncat(tmp, s, e2-s); - strcat(tmp,"}"); - } - } else { - /* ignore invalid strings */ - word = s+1; - strcat(tmp,"$"); - }; - } while ((s=ap_strchr_c(word,'$'))); - strcat(tmp,word); - - return apr_pstrdup(p,tmp); -} -AP_DECLARE(int) ap_cfg_closefile(ap_configfile_t *cfp) -{ -#ifdef DEBUG - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL, - "Done with config file %s", cfp->name); -#endif - return (cfp->close == NULL) ? 0 : cfp->close(cfp->param); -} - -static apr_status_t cfg_close(void *param) -{ - apr_file_t *cfp = (apr_file_t *) param; - return (apr_file_close(cfp)); -} - -static int cfg_getch(void *param) -{ - char ch; - apr_file_t *cfp = (apr_file_t *) param; - if (apr_file_getc(&ch, cfp) == APR_SUCCESS) - return ch; - return (int)EOF; -} - -static void *cfg_getstr(void *buf, size_t bufsiz, void *param) -{ - apr_file_t *cfp = (apr_file_t *) param; - apr_status_t rv; - rv = apr_file_gets(buf, bufsiz, cfp); - if (rv == APR_SUCCESS || (rv == APR_EOF && strcmp(buf, ""))) - return buf; - return NULL; -} - -/* Open a ap_configfile_t as FILE, return open ap_configfile_t struct pointer */ -AP_DECLARE(apr_status_t) ap_pcfg_openfile(ap_configfile_t **ret_cfg, apr_pool_t *p, const char *name) -{ - ap_configfile_t *new_cfg; - apr_file_t *file = NULL; - apr_finfo_t finfo; - apr_status_t status; -#ifdef DEBUG - char buf[120]; -#endif - - if (name == NULL) { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, NULL, - "Internal error: pcfg_openfile() called with NULL filename"); - return APR_EBADF; - } - - /* ### We no longer need the test ap_os_is_filename_valid() here - * The directory was already walked on a segment by segment basis, - * so we should never be called with a bad path element, and device - * names as access file names never posed as security threats, since - * it was the admin's choice to assign the .htaccess file's name. - */ - - status = apr_file_open(&file, name, APR_READ | APR_BUFFERED, APR_OS_DEFAULT, p); -#ifdef DEBUG - ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, NULL, - "Opening config file %s (%s)", - name, (status != APR_SUCCESS) ? - apr_strerror(status, buf, sizeof(buf)) : "successful"); -#endif - if (status != APR_SUCCESS) - return status; - - status = apr_file_info_get(&finfo, APR_FINFO_TYPE, file); - if (status != APR_SUCCESS) - return status; - - if (finfo.filetype != APR_REG && -#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 */ - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, NULL, - "Access to file %s denied by server: not a regular file", - name); - apr_file_close(file); - return APR_EBADF; - } - - new_cfg = apr_palloc(p, sizeof(*new_cfg)); - new_cfg->param = file; - new_cfg->name = apr_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; - *ret_cfg = new_cfg; - return APR_SUCCESS; -} - - -/* Allocate a ap_configfile_t handle with user defined functions and params */ -AP_DECLARE(ap_configfile_t *) ap_pcfg_open_custom(apr_pool_t *p, const char *descr, - void *param, - int(*getch)(void *param), - void *(*getstr) (void *buf, size_t bufsiz, void *param), - int(*close_func)(void *param)) -{ - ap_configfile_t *new_cfg = apr_palloc(p, sizeof(*new_cfg)); -#ifdef DEBUG - ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, 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 */ -AP_DECLARE(int) ap_cfg_getc(ap_configfile_t *cfp) -{ - register int ch = cfp->getch(cfp->param); - if (ch == LF) - ++cfp->line_number; - return ch; -} - -/* Read one line from open ap_configfile_t, strip LF, increase line number */ -/* If custom handler does not define a getstr() function, read char by char */ -AP_DECLARE(int) ap_cfg_getline(char *buf, size_t bufsize, ap_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 (apr_isspace(*src)) - ++src; - /* blast trailing whitespace */ - dst = &src[strlen(src)]; - while (--dst >= src && apr_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, 0, 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 && apr_isspace(buf[i - 1])) - --i; - buf[i] = '\0'; -#ifdef DEBUG_CFG_LINES - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, 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. - */ -AP_DECLARE(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 == ',' || apr_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 == ',' || apr_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. - */ -AP_DECLARE(char *) ap_get_list_item(apr_pool_t *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 = apr_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 - : apr_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. - */ -AP_DECLARE(int) ap_find_list_item(apr_pool_t *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 == ',' || apr_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++ == apr_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. - */ - -AP_DECLARE(char *) ap_get_token(apr_pool_t *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 && apr_isspace(*ptr)) - ++ptr; - - tok_start = ptr; - - /* find token end, skipping over quoted strings. - * (comments are already gone). - */ - - while (*ptr && (accept_white || !apr_isspace(*ptr)) - && *ptr != ';' && *ptr != ',') { - if (*ptr++ == '"') - while (*ptr) - if (*ptr++ == '"') - break; - } - - tok_len = ptr - tok_start; - token = apr_pstrndup(p, tok_start, tok_len); - - /* Advance accept_line pointer to the next non-white byte */ - - while (*ptr && apr_isspace(*ptr)) - ++ptr; - - *accept_line = ptr; - return token; -} - - -/* find http tokens, see the definition of token from RFC2068 */ -AP_DECLARE(int) ap_find_token(apr_pool_t *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; - } - } -} - - -AP_DECLARE(int) ap_find_last_token(apr_pool_t *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) && !(apr_isspace(line[lidx - 1]) || line[lidx - 1] == ','))) - return 0; - - return (strncasecmp(&line[lidx], tok, tlen) == 0); -} - -AP_DECLARE(char *) ap_escape_shell_cmd(apr_pool_t *p, const char *str) -{ - char *cmd; - unsigned char *d; - const unsigned char *s; - - cmd = apr_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; - -#if !APR_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 /*APR_CHARSET_EBCDIC*/ - char xstr[5]; - xstr[0]='0'; - xstr[1]='x'; - xstr[2]=what[0]; - xstr[3]=what[1]; - xstr[4]='\0'; - digit = apr_xlate_conv_byte(ap_hdrs_from_ascii, 0xFF & strtol(xstr, NULL, 16)); -#endif /*APR_CHARSET_EBCDIC*/ - return (digit); -} - -/* - * Unescapes a URL. - * Returns 0 on success, non-zero on error - * Failure is due to - * bad % escape returns HTTP_BAD_REQUEST - * - * decoding %00 -> \0 - * decoding %2f -> / (a special character) - * returns HTTP_NOT_FOUND - */ -AP_DECLARE(int) ap_unescape_url(char *url) -{ - register int badesc, badpath; - char *x, *y; - - badesc = 0; - badpath = 0; - /* Initial scan for first '%'. Don't bother writing values before - * seeing a '%' */ - y = strchr(url, '%'); - if (y == NULL) { - return OK; - } - for (x = y; *y; ++x, ++y) { - if (*y != '%') - *x = *y; - else { - if (!apr_isxdigit(*(y + 1)) || !apr_isxdigit(*(y + 2))) { - badesc = 1; - *x = '%'; - } - else { - *x = x2c(y + 1); - y += 2; - if (*x == '/' || *x == '\0') - badpath = 1; - } - } - } - *x = '\0'; - if (badesc) - return HTTP_BAD_REQUEST; - else if (badpath) - return HTTP_NOT_FOUND; - else - return OK; -} - -AP_DECLARE(char *) ap_construct_server(apr_pool_t *p, const char *hostname, - apr_port_t port, const request_rec *r) -{ - if (ap_is_default_port(port, r)) - return apr_pstrdup(p, hostname); - else { - return apr_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) first 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 APR_INLINE unsigned char *c2x(unsigned what, unsigned char *where) -{ -#if APR_CHARSET_EBCDIC - what = apr_xlate_conv_byte(ap_hdrs_to_ascii, (unsigned char)what); -#endif /*APR_CHARSET_EBCDIC*/ - *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 "./"). - */ - -AP_DECLARE(char *) ap_escape_path_segment(apr_pool_t *p, const char *segment) -{ - char *copy = apr_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; -} - -AP_DECLARE(char *) ap_os_escape_path(apr_pool_t *p, const char *path, int partial) -{ - char *copy = apr_palloc(p, 3 * strlen(path) + 3); - const unsigned char *s = (const unsigned char *)path; - unsigned char *d = (unsigned char *)copy; - unsigned c; - - if (!partial) { - const char *colon = ap_strchr_c(path, ':'); - const char *slash = ap_strchr_c(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 */ - -AP_DECLARE(char *) ap_escape_html(apr_pool_t *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 apr_pstrndup(p, s, i); - - x = apr_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; -} - -AP_DECLARE(int) ap_is_directory(apr_pool_t *p, const char *path) -{ - apr_finfo_t finfo; - - if (apr_stat(&finfo, path, APR_FINFO_TYPE, p) != APR_SUCCESS) - return 0; /* in error condition, just return no */ - - return (finfo.filetype == APR_DIR); -} - -AP_DECLARE(int) ap_is_rdirectory(apr_pool_t *p, const char *path) -{ - apr_finfo_t finfo; - - if (apr_lstat(&finfo, path, APR_FINFO_TYPE, p) != APR_SUCCESS) - return 0; /* in error condition, just return no */ - - return (finfo.filetype == APR_DIR); -} - -AP_DECLARE(char *) ap_make_full_path(apr_pool_t *a, const char *src1, - const char *src2) -{ - register int x; - - x = strlen(src1); - if (x == 0) - return apr_pstrcat(a, "/", src2, NULL); - - if (src1[x - 1] != '/') - return apr_pstrcat(a, src1, "/", src2, NULL); - else - return apr_pstrcat(a, src1, src2, NULL); -} - -/* - * Check for an absoluteURI syntax (see section 3.2 in RFC2068). - */ -AP_DECLARE(int) ap_is_url(const char *u) -{ - register int x; - - for (x = 0; u[x] != ':'; x++) { - if ((!u[x]) || - ((!apr_isalpha(u[x])) && (!apr_isdigit(u[x])) && - (u[x] != '+') && (u[x] != '-') && (u[x] != '.'))) { - return 0; - } - } - - return (x ? 1 : 0); /* If the first character is ':', it's broken, too */ -} - -AP_DECLARE(int) ap_ind(const char *s, char c) -{ - const char *p = ap_strchr_c(s, c); - - if (p == NULL) - return -1; - return p - s; -} - -AP_DECLARE(int) ap_rind(const char *s, char c) -{ - const char *p = ap_strrchr_c(s, c); - - if (p == NULL) - return -1; - return p - s; -} - -AP_DECLARE(void) ap_str_tolower(char *str) -{ - while (*str) { - *str = apr_tolower(*str); - ++str; - } -} - -static char *find_fqdn(apr_pool_t *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 apr_pstrdup(a, p->h_aliases[x]); - } - return NULL; - } - return apr_pstrdup(a, (void *) p->h_name); -} - -char *ap_get_local_host(apr_pool_t *a) -{ -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 256 -#endif - char str[MAXHOSTNAMELEN + 1]; - char *server_hostname = NULL; - struct hostent *p; - -#ifdef BEOS_R5 - if (gethostname(str, sizeof(str) - 1) == 0) -#else - if (gethostname(str, sizeof(str) - 1) != 0) -#endif - { - ap_log_perror(APLOG_MARK, APLOG_STARTUP | APLOG_WARNING, 0, a, - "%s: gethostname() failed to determine ServerName", - ap_server_argv0); - } - else - { - str[sizeof(str) - 1] = '\0'; - if ((!(p = gethostbyname(str))) - || (!(server_hostname = find_fqdn(a, p)))) { - /* Recovery - return the default servername by IP: */ - if (p && p->h_addr_list[0]) { - apr_snprintf(str, sizeof(str), "%pA", p->h_addr_list[0]); - server_hostname = apr_pstrdup(a, str); - /* We will drop through to report the IP-named server */ - } - } - else { - /* Since we found a fdqn, return it with no logged message. */ - return server_hostname; - } - } - - if (!server_hostname) - server_hostname = apr_pstrdup(a, "127.0.0.1"); - - ap_log_perror(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO|APLOG_STARTUP, 0, a, - "%s: Could not determine the server's fully qualified " - "domain name, using %s for ServerName", - ap_server_argv0, server_hostname); - - return server_hostname; -} - -/* simple 'pool' alloc()ing glue to apr_base64.c - */ -AP_DECLARE(char *) ap_pbase64decode(apr_pool_t *p, const char *bufcoded) -{ - char *decoded; - int l; - - decoded = (char *) apr_palloc(p, 1 + apr_base64_decode_len(bufcoded)); - l = apr_base64_decode(decoded, bufcoded); - decoded[l] = '\0'; /* make binary sequence into string */ - - return decoded; -} - -AP_DECLARE(char *) ap_pbase64encode(apr_pool_t *p, char *string) -{ - char *encoded; - int l = strlen(string); - - encoded = (char *) apr_palloc(p, 1 + apr_base64_encode_len(l)); - l = apr_base64_encode(encoded, string, l); - encoded[l] = '\0'; /* make binary sequence into string */ - - return encoded; -} - -/* 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 - */ -AP_DECLARE(void) ap_content_type_tolower(char *str) -{ - char *semi; - - semi = strchr(str, ';'); - if (semi) { - *semi = '\0'; - } - while (*str) { - *str = apr_tolower(*str); - ++str; - } - if (semi) { - *semi = ';'; - } -} - -/* - * Given a string, replace any bare " with \" . - */ -AP_DECLARE(char *) ap_escape_quotes (apr_pool_t *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 = apr_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 b8fcad6c9c..0000000000 --- a/server/util_cfgtree.c +++ /dev/null @@ -1,89 +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. - */ - -#define CORE_PRIVATE -#include "util_cfgtree.h" -#include <stdlib.h> - -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) { - (*parent)->first_child = toadd; - toadd->parent = *parent; - } - if (child) { - /* First item in config file or container is a container */ - *parent = toadd; - return NULL; - } - return toadd; - } - current->next = toadd; - toadd->parent = *parent; - if (child) { - /* switch parents, navigate into child */ - *parent = toadd; - return NULL; - } - return toadd; -} - - diff --git a/server/util_charset.c b/server/util_charset.c deleted file mode 100644 index f1833b94d6..0000000000 --- a/server/util_charset.c +++ /dev/null @@ -1,99 +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. - */ - -#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_RXLATE) it ensures that no translation is - * performed. - */ - -apr_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). - */ - -apr_xlate_t *ap_locale_to_ascii, *ap_locale_from_ascii; - -#endif /*APACHE_XLATE*/ diff --git a/server/util_date.c b/server/util_date.c deleted file mode 100644 index 89ceaa5d8d..0000000000 --- a/server/util_date.c +++ /dev/null @@ -1,306 +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. - */ - -/* - * util_date.c: date parsing utility routines - * These routines are (hopefully) platform independent. - * - * 27 Oct 1996 Roy Fielding - * Extracted (with many modifications) from mod_proxy.c and - * tested with over 50,000 randomly chosen valid date strings - * and several hundred variations of invalid date strings. - * - */ - -#include "apr.h" -#include "apr_lib.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if APR_HAVE_CTYPE_H -#include <ctype.h> -#endif - -#define CORE_PRIVATE - -#include "ap_config.h" -#include "util_date.h" - -/* - * Compare a string to a mask - * Mask characters (arbitrary maximum is 256 characters, just in case): - * @ - uppercase letter - * $ - lowercase letter - * & - hex digit - * # - digit - * ~ - digit or space - * * - swallow remaining characters - * <x> - exact match for any other character - */ -AP_DECLARE(int) ap_checkmask(const char *data, const char *mask) -{ - int i; - char d; - - for (i = 0; i < 256; i++) { - d = data[i]; - switch (mask[i]) { - case '\0': - return (d == '\0'); - - case '*': - return 1; - - case '@': - if (!apr_isupper(d)) - return 0; - break; - case '$': - if (!apr_islower(d)) - return 0; - break; - case '#': - if (!apr_isdigit(d)) - return 0; - break; - case '&': - if (!apr_isxdigit(d)) - return 0; - break; - case '~': - if ((d != ' ') && !apr_isdigit(d)) - return 0; - break; - default: - if (mask[i] != d) - return 0; - break; - } - } - return 0; /* We only get here if mask is corrupted (exceeds 256) */ -} - - -/* - * Parses an HTTP date in one of three standard forms: - * - * Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 - * Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 - * Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format - * - * and returns the time_t number of seconds since 1 Jan 1970 GMT, or - * 0 if this would be out of range or if the date is invalid. - * - * The restricted HTTP syntax is - * - * HTTP-date = rfc1123-date | rfc850-date | asctime-date - * - * rfc1123-date = wkday "," SP date1 SP time SP "GMT" - * rfc850-date = weekday "," SP date2 SP time SP "GMT" - * asctime-date = wkday SP date3 SP time SP 4DIGIT - * - * date1 = 2DIGIT SP month SP 4DIGIT - * ; day month year (e.g., 02 Jun 1982) - * date2 = 2DIGIT "-" month "-" 2DIGIT - * ; day-month-year (e.g., 02-Jun-82) - * date3 = month SP ( 2DIGIT | ( SP 1DIGIT )) - * ; month day (e.g., Jun 2) - * - * time = 2DIGIT ":" 2DIGIT ":" 2DIGIT - * ; 00:00:00 - 23:59:59 - * - * wkday = "Mon" | "Tue" | "Wed" - * | "Thu" | "Fri" | "Sat" | "Sun" - * - * weekday = "Monday" | "Tuesday" | "Wednesday" - * | "Thursday" | "Friday" | "Saturday" | "Sunday" - * - * month = "Jan" | "Feb" | "Mar" | "Apr" - * | "May" | "Jun" | "Jul" | "Aug" - * | "Sep" | "Oct" | "Nov" | "Dec" - * - * However, for the sake of robustness (and Netscapeness), we ignore the - * weekday and anything after the time field (including the timezone). - * - * This routine is intended to be very fast; 10x faster than using sscanf. - * - * Originally from Andrew Daviel <andrew@vancouver-webpages.com>, 29 Jul 96 - * but many changes since then. - * - */ -AP_DECLARE(apr_time_t) ap_parseHTTPdate(const char *date) -{ - apr_exploded_time_t ds; - apr_time_t result; - int mint, mon; - const char *monstr, *timstr; - static const int months[12] = - { - ('J' << 16) | ('a' << 8) | 'n', ('F' << 16) | ('e' << 8) | 'b', - ('M' << 16) | ('a' << 8) | 'r', ('A' << 16) | ('p' << 8) | 'r', - ('M' << 16) | ('a' << 8) | 'y', ('J' << 16) | ('u' << 8) | 'n', - ('J' << 16) | ('u' << 8) | 'l', ('A' << 16) | ('u' << 8) | 'g', - ('S' << 16) | ('e' << 8) | 'p', ('O' << 16) | ('c' << 8) | 't', - ('N' << 16) | ('o' << 8) | 'v', ('D' << 16) | ('e' << 8) | 'c'}; - - if (!date) - return BAD_DATE; - - while (*date && apr_isspace(*date)) /* Find first non-whitespace char */ - ++date; - - if (*date == '\0') - return BAD_DATE; - - if ((date = strchr(date, ' ')) == NULL) /* Find space after weekday */ - return BAD_DATE; - - ++date; /* Now pointing to first char after space, which should be */ - /* start of the actual date information for all 3 formats. */ - - if (ap_checkmask(date, "## @$$ #### ##:##:## *")) { /* RFC 1123 format */ - ds.tm_year = ((date[7] - '0') * 10 + (date[8] - '0') - 19) * 100; - if (ds.tm_year < 0) - return BAD_DATE; - - ds.tm_year += ((date[9] - '0') * 10) + (date[10] - '0'); - - ds.tm_mday = ((date[0] - '0') * 10) + (date[1] - '0'); - - monstr = date + 3; - timstr = date + 12; - } - else if (ap_checkmask(date, "##-@$$-## ##:##:## *")) { /* RFC 850 format */ - ds.tm_year = ((date[7] - '0') * 10) + (date[8] - '0'); - if (ds.tm_year < 70) - ds.tm_year += 100; - - ds.tm_mday = ((date[0] - '0') * 10) + (date[1] - '0'); - - monstr = date + 3; - timstr = date + 10; - } - else if (ap_checkmask(date, "@$$ ~# ##:##:## ####*")) { /* asctime format */ - ds.tm_year = ((date[16] - '0') * 10 + (date[17] - '0') - 19) * 100; - if (ds.tm_year < 0) - return BAD_DATE; - - ds.tm_year += ((date[18] - '0') * 10) + (date[19] - '0'); - - if (date[4] == ' ') - ds.tm_mday = 0; - else - ds.tm_mday = (date[4] - '0') * 10; - - ds.tm_mday += (date[5] - '0'); - - monstr = date; - timstr = date + 7; - } - else - return BAD_DATE; - - if (ds.tm_mday <= 0 || ds.tm_mday > 31) - return BAD_DATE; - - ds.tm_hour = ((timstr[0] - '0') * 10) + (timstr[1] - '0'); - ds.tm_min = ((timstr[3] - '0') * 10) + (timstr[4] - '0'); - ds.tm_sec = ((timstr[6] - '0') * 10) + (timstr[7] - '0'); - - if ((ds.tm_hour > 23) || (ds.tm_min > 59) || (ds.tm_sec > 61)) - return BAD_DATE; - - mint = (monstr[0] << 16) | (monstr[1] << 8) | monstr[2]; - for (mon = 0; mon < 12; mon++) - if (mint == months[mon]) - break; - if (mon == 12) - return BAD_DATE; - - if ((ds.tm_mday == 31) && (mon == 3 || mon == 5 || mon == 8 || mon == 10)) - return BAD_DATE; - - /* February gets special check for leapyear */ - - if ((mon == 1) && - ((ds.tm_mday > 29) - || ((ds.tm_mday == 29) - && ((ds.tm_year & 3) - || (((ds.tm_year % 100) == 0) - && (((ds.tm_year % 400) != 100))))))) - return BAD_DATE; - - ds.tm_mon = mon; - - /* ap_mplode_time uses tm_usec and tm_gmtoff fields, but they haven't - * been set yet. - * It should be safe to just zero out these values. - * tm_usec is the number of microseconds into the second. HTTP only - * cares about second granularity. - * tm_gmtoff is the number of seconds off of GMT the time is. By - * definition all times going through this function are in GMT, so this - * is zero. - */ - ds.tm_usec = 0; - ds.tm_gmtoff = 0; - if (apr_implode_time(&result, &ds) != APR_SUCCESS) - return BAD_DATE; - - return result; -} diff --git a/server/util_debug.c b/server/util_debug.c deleted file mode 100644 index f41f697d2d..0000000000 --- a/server/util_debug.c +++ /dev/null @@ -1,120 +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. - */ - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "httpd.h" -#include "http_config.h" - -#ifdef AP_DEBUG - -/* get rid of the macros we defined in httpd.h */ -#undef strchr -#undef strrchr -#undef strstr - -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); -} -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); -} -char *ap_strstr(char *s, char *c) -{ - return strstr(s,c); -} -const char *ap_strstr_c(const char *s, const char *c) -{ - return strstr(s,c); -} - - -AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv, - const module *m) -{ - return ((void **)cv)[m->module_index]; -} - -/** - * Generic accessors for other modules to set at their own module-specific - * data - * @param conf_vector The vector in which the modules configuration is stored. - * usually r->per_dir_config or s->module_config - * @param m The module to set the data for. - * @param val The module-specific data to set - * @deffunc void ap_set_module_config(ap_conf_vector_t *cv, const module *m, void *val) - */ -AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m, - void *val) -{ - ((void **)cv)[m->module_index] = val; -} - - -#endif /* AP_DEBUG */ diff --git a/server/util_ebcdic.c b/server/util_ebcdic.c deleted file mode 100644 index 75a1b7dd3d..0000000000 --- a/server/util_ebcdic.c +++ /dev/null @@ -1,168 +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. - */ - -#include "ap_config.h" - -#if APR_CHARSET_EBCDIC - -#include "apr_strings.h" -#include "httpd.h" -#include "http_log.h" -#include "http_core.h" -#include "util_ebcdic.h" - -apr_status_t ap_init_ebcdic(apr_pool_t *pool) -{ - apr_status_t rv; - char buf[80]; - - rv = apr_xlate_open(&ap_hdrs_to_ascii, "ISO8859-1", APR_DEFAULT_CHARSET, pool); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, - "apr_xlate_open() failed"); - return rv; - } - - rv = apr_xlate_open(&ap_hdrs_from_ascii, APR_DEFAULT_CHARSET, "ISO8859-1", pool); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, - "apr_xlate_open() failed"); - return rv; - } - - rv = apr_xlate_open(&ap_locale_to_ascii, "ISO8859-1", APR_LOCALE_CHARSET, pool); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, - "apr_xlate_open() failed"); - return rv; - } - - rv = apr_xlate_open(&ap_locale_from_ascii, APR_LOCALE_CHARSET, "ISO8859-1", pool); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, - "apr_xlate_open() failed"); - return rv; - } - - rv = apr_MD5InitEBCDIC(ap_hdrs_to_ascii); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, - "apr_MD5InitEBCDIC() failed"); - return rv; - } - - rv = apr_base64init_ebcdic(ap_hdrs_to_ascii, ap_hdrs_from_ascii); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, - "apr_base64init_ebcdic() failed"); - return rv; - } - - rv = apr_SHA1InitEBCDIC(ap_hdrs_to_ascii); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, - "apr_SHA1InitEBCDIC() failed"); - return rv; - } - - return APR_SUCCESS; -} - -void ap_xlate_proto_to_ascii(char *buffer, apr_size_t len) -{ - apr_size_t inbytes_left, outbytes_left; - - inbytes_left = outbytes_left = len; - apr_xlate_conv_buffer(ap_hdrs_to_ascii, buffer, &inbytes_left, - buffer, &outbytes_left); -} - -void ap_xlate_proto_from_ascii(char *buffer, apr_size_t len) -{ - apr_size_t inbytes_left, outbytes_left; - - inbytes_left = outbytes_left = len; - apr_xlate_conv_buffer(ap_hdrs_from_ascii, buffer, &inbytes_left, - buffer, &outbytes_left); -} - -int ap_rvputs_proto_in_ascii(request_rec *r, ...) -{ - va_list va; - const char *s; - char *ascii_s; - apr_size_t len; - apr_size_t written = 0; - - va_start(va, r); - while (1) { - s = va_arg(va, const char *); - if (s == NULL) - break; - len = strlen(s); - ascii_s = apr_pstrndup(r->pool, s, len); - ap_xlate_proto_to_ascii(ascii_s, len); - if (ap_rputs(ascii_s, r) < 0) - return -1; - written += len; - } - va_end(va); - - return written; -} -#endif /* APR_CHARSET_EBCDIC */ diff --git a/server/util_filter.c b/server/util_filter.c deleted file mode 100644 index 2291919eb9..0000000000 --- a/server/util_filter.c +++ /dev/null @@ -1,305 +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/>. - */ - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "httpd.h" -#include "http_log.h" -#include "util_filter.h" - -/* ### make this visible for direct manipulation? - * ### use a hash table - */ -static ap_filter_rec_t *registered_output_filters = NULL; -static ap_filter_rec_t *registered_input_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 apr_global_hook_pool -#include "apr_hooks.h" /* for apr_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)->frec->ftype > (f)->frec->ftype \ - || (before_this)->r != (f)->r) - - -static apr_status_t filter_cleanup(void *ctx) -{ - registered_output_filters = NULL; - registered_input_filters = NULL; - return APR_SUCCESS; -} - -static void register_filter(const char *name, - ap_filter_func filter_func, - ap_filter_type ftype, - ap_filter_rec_t **reg_filter_list) -{ - ap_filter_rec_t *frec = apr_palloc(FILTER_POOL, sizeof(*frec)); - - frec->name = name; - frec->filter_func = filter_func; - frec->ftype = ftype; - - frec->next = *reg_filter_list; - *reg_filter_list = frec; - - apr_pool_cleanup_register(FILTER_POOL, NULL, filter_cleanup, apr_pool_cleanup_null); -} - -AP_DECLARE(void) ap_register_input_filter(const char *name, - ap_in_filter_func filter_func, - ap_filter_type ftype) -{ - ap_filter_func f; - f.in_func = filter_func; - register_filter(name, f, ftype, ®istered_input_filters); -} - -AP_DECLARE(void) ap_register_output_filter(const char *name, - ap_out_filter_func filter_func, - ap_filter_type ftype) -{ - ap_filter_func f; - f.out_func = filter_func; - register_filter(name, f, ftype, ®istered_output_filters); -} - -static ap_filter_t *add_any_filter(const char *name, void *ctx, - request_rec *r, conn_rec *c, - ap_filter_rec_t *frec, - ap_filter_t **r_filters, - ap_filter_t **c_filters) -{ - for (; frec != NULL; frec = frec->next) { - if (!strcasecmp(name, frec->name)) { - apr_pool_t *p = r ? r->pool : c->pool; - ap_filter_t *f = apr_pcalloc(p, sizeof(*f)); - ap_filter_t **outf = r ? r_filters : c_filters; - - f->frec = frec; - f->ctx = ctx; - f->r = r; - f->c = c; - - if (INSERT_BEFORE(f, *outf)) { - f->next = *outf; - *outf = f; - } - else { - ap_filter_t *fscan = *outf; - while (!INSERT_BEFORE(f, fscan->next)) - fscan = fscan->next; - f->next = fscan->next; - fscan->next = f; - } - - return f; - } - } - - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL, - "an unknown filter was not added: %s", name); - return NULL; -} - -AP_DECLARE(ap_filter_t *) ap_add_input_filter(const char *name, void *ctx, - request_rec *r, conn_rec *c) -{ - return add_any_filter(name, ctx, r, c, registered_input_filters, - r ? &r->input_filters : NULL, &c->input_filters); -} - -AP_DECLARE(ap_filter_t *) ap_add_output_filter(const char *name, void *ctx, - request_rec *r, conn_rec *c) -{ - return add_any_filter(name, ctx, r, c, registered_output_filters, - r ? &r->output_filters : NULL, &c->output_filters); -} - -AP_DECLARE(void) ap_remove_output_filter(ap_filter_t *f) -{ - ap_filter_t *curr; - - curr = f->r ? f->r->output_filters : f->c->output_filters; - - if (curr == f) { - if (f->r) { - f->r->output_filters = f->r->output_filters->next; - } - else { - f->c->output_filters = f->c->output_filters->next; - } - return; - } - - while (curr->next != f) { - curr = curr->next; - if (curr == NULL) { - return; - } - } - curr->next = f->next; -} - -/* - * Read data from the next filter in the filter stack. Data should be - * modified in the bucket brigade that is passed in. The core allocates the - * bucket brigade, modules that wish to replace large chunks of data or to - * save data off to the side should probably create their own temporary - * brigade especially for that use. - */ -AP_DECLARE(apr_status_t) ap_get_brigade(ap_filter_t *next, apr_bucket_brigade *bb, - ap_input_mode_t mode, apr_size_t *readbytes) -{ - if (next) { - return next->frec->filter_func.in_func(next, bb, mode, readbytes); - } - return AP_NOBODY_READ; -} - -/* Pass the buckets to the next filter in the filter stack. If the - * current filter is a handler, we should get NULL passed in instead of - * the current filter. At that point, we can just call the first filter in - * the stack, or r->output_filters. - */ -AP_DECLARE(apr_status_t) ap_pass_brigade(ap_filter_t *next, apr_bucket_brigade *bb) -{ - if (next) { - apr_bucket *e; - if ((e = APR_BRIGADE_LAST(bb)) && APR_BUCKET_IS_EOS(e) && next->r) { - /* This is only safe because HTTP_HEADER filter is always in - * the filter stack. This ensures that there is ALWAYS a - * request-based filter that we can attach this to. If the - * HTTP_FILTER is removed, and another filter is not put in its - * place, then handlers like mod_cgi, which attach their own - * EOS bucket to the brigade will be broken, because we will - * get two EOS buckets on the same request. - */ - next->r->eos_sent = 1; - } - return next->frec->filter_func.out_func(next, bb); - } - return AP_NOBODY_WROTE; -} - -AP_DECLARE(apr_status_t) ap_save_brigade(ap_filter_t *f, apr_bucket_brigade **saveto, - apr_bucket_brigade **b) -{ - apr_bucket *e; - apr_pool_t *p = f->r ? f->r->pool : f->c->pool; - apr_status_t rv; - - /* If have never stored any data in the filter, then we had better - * create an empty bucket brigade so that we can concat. - */ - if (!(*saveto)) { - *saveto = apr_brigade_create(p); - } - - APR_RING_FOREACH(e, &(*b)->list, apr_bucket, link) { - rv = apr_bucket_setaside(e); - if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) { - return rv; - } - } - APR_BRIGADE_CONCAT(*saveto, *b); - return APR_SUCCESS; -} - -AP_DECLARE_NONSTD(apr_status_t) ap_filter_flush(apr_bucket_brigade *bb, void *ctx) -{ - ap_filter_t *f = ctx; - - return ap_pass_brigade(f, bb); -} - -AP_DECLARE(apr_status_t) ap_fflush(ap_filter_t *f, apr_bucket_brigade *bb) -{ - apr_bucket *b; - - b = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, b); - return ap_pass_brigade(f, bb); -} - -AP_DECLARE_NONSTD(int) ap_fputstrs(ap_filter_t *f, apr_bucket_brigade *bb, ...) -{ - va_list args; - int res; - - va_start(args, bb); - res = apr_brigade_vputstrs(bb, ap_filter_flush, f, args); - va_end(args); - return res; -} - -AP_DECLARE_NONSTD(int) ap_fprintf(ap_filter_t *f, apr_bucket_brigade *bb, const char *fmt, ...){ - va_list args; - int res; - - va_start(args, fmt); - res = apr_brigade_vprintf(bb, ap_filter_flush, f, fmt, args); - va_end(args); - return res; -} - diff --git a/server/util_md5.c b/server/util_md5.c deleted file mode 100644 index 9f19d62add..0000000000 --- a/server/util_md5.c +++ /dev/null @@ -1,215 +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. - */ - -/************************************************************************ - * 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 "ap_config.h" -#include "apr_portable.h" -#include "apr_strings.h" -#include "httpd.h" -#include "util_md5.h" -#include "util_ebcdic.h" - -AP_DECLARE(char *) ap_md5_binary(apr_pool_t *p, const unsigned char *buf, int length) -{ - const char *hex = "0123456789abcdef"; - apr_md5_ctx_t my_md5; - unsigned char hash[MD5_DIGESTSIZE]; - char *r, result[33]; - int i; - - /* - * Take the MD5 hash of the string argument. - */ - - apr_md5_init(&my_md5); -#if APR_CHARSET_EBCDIC - apr_md5_set_xlate(&my_md5, ap_hdrs_to_ascii); -#endif - apr_md5_update(&my_md5, buf, (unsigned int)length); - apr_md5_final(hash, &my_md5); - - for (i = 0, r = result; i < MD5_DIGESTSIZE; i++) { - *r++ = hex[hash[i] >> 4]; - *r++ = hex[hash[i] & 0xF]; - } - *r = '\0'; - - return apr_pstrdup(p, result); -} - -AP_DECLARE(char *) ap_md5(apr_pool_t *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+/"; - -AP_DECLARE(char *) ap_md5contextTo64(apr_pool_t *a, apr_md5_ctx_t *context) -{ - unsigned char digest[18]; - char *encodedDigest; - int i; - char *p; - - encodedDigest = (char *) apr_pcalloc(a, 25 * sizeof(char)); - - apr_md5_final(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; -} - -AP_DECLARE(char *) ap_md5digest(apr_pool_t *p, apr_file_t *infile) -{ - apr_md5_ctx_t context; - unsigned char buf[1000]; - long length = 0; - apr_size_t nbytes; - apr_off_t offset = 0L; - - apr_md5_init(&context); - nbytes = sizeof(buf); - while (apr_file_read(infile, buf, &nbytes) == APR_SUCCESS) { - length += nbytes; - apr_md5_update(&context, buf, nbytes); - } - apr_file_seek(infile, APR_SET, &offset); - return ap_md5contextTo64(p, &context); -} - diff --git a/server/util_script.c b/server/util_script.c deleted file mode 100644 index 875bec9c7a..0000000000 --- a/server/util_script.c +++ /dev/null @@ -1,652 +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. - */ - -#include "apr.h" -#include "apr_lib.h" -#include "apr_strings.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if APR_HAVE_STDLIB_H -#include <stdlib.h> -#endif - -#define CORE_PRIVATE -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_main.h" -#include "http_log.h" -#include "http_core.h" -#include "http_protocol.h" -#include "http_request.h" /* for sub_req_lookup_uri() */ -#include "util_script.h" -#include "util_date.h" /* For parseHTTPdate() */ -#include "util_ebcdic.h" - -#ifdef OS2 -#define INCL_DOS -#include <os2.h> -#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 - -static char *http2env(apr_pool_t *a, char *w) -{ - char *res = apr_pstrcat(a, "HTTP_", w, NULL); - char *cp = res; - - while (*++cp) { - if (!apr_isalnum(*cp) && *cp != '_') { - *cp = '_'; - } - else { - *cp = apr_toupper(*cp); - } - } - - return res; -} - -AP_DECLARE(char **) ap_create_environment(apr_pool_t *p, apr_table_t *t) -{ - apr_array_header_t *env_arr = apr_table_elts(t); - apr_table_entry_t *elts = (apr_table_entry_t *) env_arr->elts; - char **env = (char **) apr_palloc(p, (env_arr->nelts + 2) * sizeof(char *)); - int i, j; - char *tz; - char *whack; - - j = 0; - if (!apr_table_get(t, "TZ")) { - tz = getenv("TZ"); - if (tz != NULL) { - env[j++] = apr_pstrcat(p, "TZ=", tz, NULL); - } - } - for (i = 0; i < env_arr->nelts; ++i) { - if (!elts[i].key) { - continue; - } - env[j] = apr_pstrcat(p, elts[i].key, "=", elts[i].val, NULL); - whack = env[j]; - if (apr_isdigit(*whack)) { - *whack++ = '_'; - } - while (*whack != '=') { - if (!apr_isalnum(*whack) && *whack != '_') { - *whack = '_'; - } - ++whack; - } - ++j; - } - - env[j] = NULL; - return env; -} - -AP_DECLARE(void) ap_add_common_vars(request_rec *r) -{ - apr_table_t *e; - server_rec *s = r->server; - conn_rec *c = r->connection; - const char *rem_logname; - char *env_path; -#if defined(WIN32) || defined(OS2) - char *env_temp; -#endif - const char *host; - apr_array_header_t *hdrs_arr = apr_table_elts(r->headers_in); - apr_table_entry_t *hdrs = (apr_table_entry_t *) hdrs_arr->elts; - int i; - apr_port_t rport; - apr_sockaddr_t *remotesa; - - /* use a temporary apr_table_t which we'll overlap onto - * r->subprocess_env later - */ - e = apr_table_make(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")) { - apr_table_addn(e, "CONTENT_TYPE", hdrs[i].val); - } - else if (!strcasecmp(hdrs[i].key, "Content-length")) { - apr_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 { - apr_table_addn(e, http2env(r->pool, hdrs[i].key), hdrs[i].val); - } - } - - if (!(env_path = getenv("PATH"))) { - env_path = DEFAULT_PATH; - } - apr_table_addn(e, "PATH", apr_pstrdup(r->pool, env_path)); - -#ifdef WIN32 - if (env_temp = getenv("SystemRoot")) { - apr_table_addn(e, "SystemRoot", env_temp); - } - if (env_temp = getenv("COMSPEC")) { - apr_table_addn(e, "COMSPEC", env_temp); - } - if (env_temp = getenv("WINDIR")) { - apr_table_addn(e, "WINDIR", env_temp); - } -#endif - -#ifdef OS2 - if ((env_temp = getenv("COMSPEC")) != NULL) { - apr_table_addn(e, "COMSPEC", env_temp); - } - if ((env_temp = getenv("ETC")) != NULL) { - apr_table_addn(e, "ETC", env_temp); - } - if ((env_temp = getenv("DPATH")) != NULL) { - apr_table_addn(e, "DPATH", env_temp); - } - if ((env_temp = getenv("PERLLIB_PREFIX")) != NULL) { - apr_table_addn(e, "PERLLIB_PREFIX", env_temp); - } -#endif - - apr_table_addn(e, "SERVER_SIGNATURE", ap_psignature("", r)); - apr_table_addn(e, "SERVER_SOFTWARE", ap_get_server_version()); - apr_table_addn(e, "SERVER_NAME", ap_get_server_name(r)); - apr_table_addn(e, "SERVER_ADDR", r->connection->local_ip); /* Apache */ - apr_table_addn(e, "SERVER_PORT", - apr_psprintf(r->pool, "%u", ap_get_server_port(r))); - host = ap_get_remote_host(c, r->per_dir_config, REMOTE_HOST, NULL); - if (host) { - apr_table_addn(e, "REMOTE_HOST", host); - } - apr_table_addn(e, "REMOTE_ADDR", c->remote_ip); - apr_table_addn(e, "DOCUMENT_ROOT", ap_document_root(r)); /* Apache */ - apr_table_addn(e, "SERVER_ADMIN", s->server_admin); /* Apache */ - apr_table_addn(e, "SCRIPT_FILENAME", r->filename); /* Apache */ - - apr_socket_addr_get(&remotesa, APR_REMOTE, c->client_socket); - apr_sockaddr_port_get(&rport, remotesa); - apr_table_addn(e, "REMOTE_PORT", apr_psprintf(r->pool, "%d", rport)); - - if (r->user) { - apr_table_addn(e, "REMOTE_USER", r->user); - } - if (r->ap_auth_type) { - apr_table_addn(e, "AUTH_TYPE", r->ap_auth_type); - } - rem_logname = ap_get_remote_logname(r); - if (rem_logname) { - apr_table_addn(e, "REMOTE_IDENT", apr_pstrdup(r->pool, rem_logname)); - } - - /* Apache custom error responses. If we have redirected set two new vars */ - - if (r->prev) { - if (r->prev->args) { - apr_table_addn(e, "REDIRECT_QUERY_STRING", r->prev->args); - } - if (r->prev->uri) { - apr_table_addn(e, "REDIRECT_URL", r->prev->uri); - } - } - - apr_table_overlap(r->subprocess_env, e, APR_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. - */ - -AP_DECLARE(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; -} - -AP_DECLARE(void) ap_add_cgi_vars(request_rec *r) -{ - apr_table_t *e = r->subprocess_env; - - apr_table_setn(e, "GATEWAY_INTERFACE", "CGI/1.1"); - apr_table_setn(e, "SERVER_PROTOCOL", r->protocol); - apr_table_setn(e, "REQUEST_METHOD", r->method); - apr_table_setn(e, "QUERY_STRING", r->args ? r->args : ""); - apr_table_setn(e, "REQUEST_URI", r->unparsed_uri); - - /* 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")) { - apr_table_setn(e, "SCRIPT_NAME", r->uri); - if (r->path_info && *r->path_info) { - apr_table_setn(e, "PATH_INFO", r->path_info); - } - } - else if (!r->path_info || !*r->path_info) { - apr_table_setn(e, "SCRIPT_NAME", r->uri); - } - else { - int path_info_start = ap_find_path_info(r->uri, r->path_info); - - apr_table_setn(e, "SCRIPT_NAME", - apr_pstrndup(r->pool, r->uri, path_info_start)); - - apr_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, - NULL); - - if (pa_req->filename) { -#ifdef WIN32 - char buffer[HUGE_STRING_LEN]; -#endif - char *pt = apr_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); - apr_table_setn(e, "PATH_TRANSLATED", apr_pstrdup(r->pool, buffer)); -#else - apr_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) -{ - apr_table_addn(v, key, val); - return 1; -} - -AP_DECLARE(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; - apr_table_t *merge; - apr_table_t *cookie_table; - - if (buffer) { - *buffer = '\0'; - } - w = buffer ? buffer : x; - - /* temporary place to hold headers to merge in later */ - merge = apr_table_make(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 = apr_table_make(r->pool, 2); - apr_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_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Premature end of script headers: %s", r->filename); - return HTTP_INTERNAL_SERVER_ERROR; - } - - /* Delete terminal (CR?)LF */ - - p = strlen(w); - /* Indeed, the host's '\n': - '\012' for UNIX; '\015' for MacOS; '\025' for OS/390 - -- whatever the script generates. - */ - if (p > 0 && w[p - 1] == '\n') { - if (p > 1 && w[p - 2] == CR) { - 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; - - if ((cgi_status == HTTP_OK) && (r->method_number == M_GET)) { - cond_status = ap_meets_conditions(r); - } - apr_table_overlap(r->err_headers_out, merge, - APR_OVERLAP_TABLES_MERGE); - if (!apr_is_empty_table(cookie_table)) { - /* the cookies have already been copied to the cookie_table */ - apr_table_unset(r->err_headers_out, "Set-Cookie"); - r->err_headers_out = apr_table_overlay(r->pool, - r->err_headers_out, cookie_table); - } - return cond_status; - } - - /* if we see a bogus header don't ignore it. Shout and scream */ - -#if APR_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; - unsigned char *cp, native; - apr_size_t inbytes_left, outbytes_left; - - for (cp = w; *cp != '\0'; ++cp) { - native = apr_xlate_conv_byte(ap_hdrs_from_ascii, *cp); - if (isprint(*cp) && !isprint(native)) - ++maybeEBCDIC; - if (!isprint(*cp) && isprint(native)) - ++maybeASCII; - } - if (maybeASCII > maybeEBCDIC) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r->server, - "CGI Interface Error: Script headers apparently ASCII: (CGI = %s)", - r->filename); - inbytes_left = outbytes_left = cp - w; - apr_xlate_conv_buffer(ap_hdrs_from_ascii, - w, &inbytes_left, w, &outbytes_left); - } - } -#endif /*APR_CHARSET_EBCDIC*/ - 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_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "%s: %s", malformed, r->filename); - return HTTP_INTERNAL_SERVER_ERROR; - } - - *l++ = '\0'; - while (*l && apr_isspace(*l)) { - ++l; - } - - if (!strcasecmp(w, "Content-type")) { - char *tmp; - - /* Nuke trailing whitespace */ - - char *endp = l + strlen(l) - 1; - while (endp > l && apr_isspace(*endp)) { - *endp-- = '\0'; - } - - tmp = apr_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 = apr_pstrdup(r->pool, l); - } - else if (!strcasecmp(w, "Location")) { - apr_table_set(r->headers_out, w, l); - } - else if (!strcasecmp(w, "Content-Length")) { - apr_table_set(r->headers_out, w, l); - } - else if (!strcasecmp(w, "Transfer-Encoding")) { - apr_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")) { - ap_update_mtime(r, ap_parseHTTPdate(l)); - ap_set_last_modified(r); - } - else if (!strcasecmp(w, "Set-Cookie")) { - apr_table_add(cookie_table, w, l); - } - else { - apr_table_add(merge, w, l); - } - } -} - -static int getsfunc_FILE(char *buf, int len, void *f) -{ - return apr_file_gets(buf, len, (apr_file_t *) f) == APR_SUCCESS; -} - -AP_DECLARE(int) ap_scan_script_header_err(request_rec *r, apr_file_t *f, - char *buffer) -{ - return ap_scan_script_header_err_core(r, buffer, getsfunc_FILE, f); -} - -struct vastrs { - va_list args; - int arg; - const char *curpos; -}; - -static int getsfunc_STRING(char *w, int len, void *pvastrs) -{ - struct vastrs *strs = (struct vastrs*) pvastrs; - const char *p; - int t; - - if (!strs->curpos || !*strs->curpos) - return 0; - p = ap_strchr_c(strs->curpos, '\n'); - if (p) - ++p; - else - p = ap_strchr_c(strs->curpos, '\0'); - t = p - strs->curpos; - if (t > len) - t = len; - strncpy (w, strs->curpos, t); - w[t] = '\0'; - if (!strs->curpos[t]) { - ++strs->arg; - strs->curpos = va_arg(strs->args, const char *); - } - else - strs->curpos += t; - return t; -} - -/* ap_scan_script_header_err_strs() accepts additional const char* args... - * each is treated as one or more header lines, and the first non-header - * character is returned to **arg, **data. (The first optional arg is - * counted as 0.) - */ -AP_DECLARE_NONSTD(int) ap_scan_script_header_err_strs(request_rec *r, - char *buffer, - const char **termch, - int *termarg, ...) -{ - struct vastrs strs; - int res; - - va_start(strs.args, termarg); - strs.arg = 0; - strs.curpos = va_arg(strs.args, char*); - res = ap_scan_script_header_err_core(r, buffer, getsfunc_STRING, (void *) &strs); - if (termch) - *termch = strs.curpos; - if (termarg) - *termarg = strs.arg; - va_end(strs.args); - return res; -} - -AP_DECLARE(void) ap_send_size(apr_ssize_t size, request_rec *r) -{ - /* XXX: this -1 thing is a gross hack */ - if (size == (apr_ssize_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, "%4" APR_SSIZE_T_FMT "k", (size + 512) / 1024); - } - else if (size < 103809024) { - ap_rprintf(r, "%4.1fM", size / 1048576.0); - } - else { - ap_rprintf(r, "%4" APR_SSIZE_T_FMT "M", (size + 524288) / 1048576); - } -} - diff --git a/server/util_uri.c b/server/util_uri.c deleted file mode 100644 index 508c6f199c..0000000000 --- a/server/util_uri.c +++ /dev/null @@ -1,359 +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. - */ - -/* - * util_uri.c: URI related utility things - * - */ - -#include "apr.h" -#include "apr_strings.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "ap_config.h" -#include "httpd.h" -#include "http_log.h" -#include "util_uri.h" - -/* Some WWW schemes and their default ports; this is basically /etc/services */ -/* This will become global when the protocol abstraction comes */ -/* As the schemes are searched by a linear search, */ -/* they are sorted by their expected frequency */ -static schemes_t schemes[] = -{ - {"http", DEFAULT_HTTP_PORT}, - {"ftp", DEFAULT_FTP_PORT}, - {"https", DEFAULT_HTTPS_PORT}, - {"gopher", DEFAULT_GOPHER_PORT}, - {"wais", DEFAULT_WAIS_PORT}, - {"nntp", DEFAULT_NNTP_PORT}, - {"snews", DEFAULT_SNEWS_PORT}, - {"prospero", DEFAULT_PROSPERO_PORT}, - { NULL, 0xFFFF } /* unknown port */ -}; - - -AP_DECLARE(apr_port_t) ap_default_port_for_scheme(const char *scheme_str) -{ - schemes_t *scheme; - - for (scheme = schemes; scheme->name != NULL; ++scheme) - if (strcasecmp(scheme_str, scheme->name) == 0) - return scheme->default_port; - - return 0; -} - -AP_DECLARE(apr_port_t) ap_default_port_for_request(const request_rec *r) -{ - return (r->parsed_uri.scheme) - ? ap_default_port_for_scheme(r->parsed_uri.scheme) - : 0; -} - -/* Unparse a uri_components structure to an URI string. - * Optionally suppress the password for security reasons. - */ -AP_DECLARE(char *) ap_unparse_uri_components(apr_pool_t *p, const uri_components *uptr, unsigned flags) -{ - char *ret = ""; - - /* If suppressing the site part, omit both user name & scheme://hostname */ - if (!(flags & UNP_OMITSITEPART)) { - - /* Construct a "user:password@" string, honoring the passed UNP_ flags: */ - if (uptr->user||uptr->password) - ret = apr_pstrcat (p, - (uptr->user && !(flags & UNP_OMITUSER)) ? uptr->user : "", - (uptr->password && !(flags & UNP_OMITPASSWORD)) ? ":" : "", - (uptr->password && !(flags & UNP_OMITPASSWORD)) - ? ((flags & UNP_REVEALPASSWORD) ? uptr->password : "XXXXXXXX") - : "", - "@", NULL); - - /* Construct scheme://site string */ - if (uptr->hostname) { - int is_default_port; - - is_default_port = - (uptr->port_str == NULL || - uptr->port == 0 || - uptr->port == ap_default_port_for_scheme(uptr->scheme)); - - ret = apr_pstrcat (p, - uptr->scheme, "://", ret, - uptr->hostname ? uptr->hostname : "", - is_default_port ? "" : ":", - is_default_port ? "" : uptr->port_str, - NULL); - } - } - - /* Should we suppress all path info? */ - if (!(flags & UNP_OMITPATHINFO)) { - /* Append path, query and fragment strings: */ - ret = apr_pstrcat (p, - ret, - uptr->path ? uptr->path : "", - (uptr->query && !(flags & UNP_OMITQUERY)) ? "?" : "", - (uptr->query && !(flags & UNP_OMITQUERY)) ? uptr->query : "", - (uptr->fragment && !(flags & UNP_OMITQUERY)) ? "#" : NULL, - (uptr->fragment && !(flags & UNP_OMITQUERY)) ? uptr->fragment : NULL, - NULL); - } - return ret; -} - -/* Here is the hand-optimized parse_uri_components(). There are some wild - * tricks we could pull in assembly language that we don't pull here... like we - * can do word-at-time scans for delimiter characters using the same technique - * that fast memchr()s use. But that would be way non-portable. -djg - */ - -/* We have a apr_table_t that we can index by character and it tells us if the - * character is one of the interesting delimiters. Note that we even get - * compares for NUL for free -- it's just another delimiter. - */ - -#define T_COLON 0x01 /* ':' */ -#define T_SLASH 0x02 /* '/' */ -#define T_QUESTION 0x04 /* '?' */ -#define T_HASH 0x08 /* '#' */ -#define T_NUL 0x80 /* '\0' */ - -/* the uri_delims.h file is autogenerated by gen_uri_delims.c */ -#include "uri_delims.h" - -/* it works like this: - if (uri_delims[ch] & NOTEND_foobar) { - then we're not at a delimiter for foobar - } -*/ - -/* Note that we optimize the scheme scanning here, we cheat and let the - * compiler know that it doesn't have to do the & masking. - */ -#define NOTEND_SCHEME (0xff) -#define NOTEND_HOSTINFO (T_SLASH | T_QUESTION | T_HASH | T_NUL) -#define NOTEND_PATH (T_QUESTION | T_HASH | T_NUL) - -/* parse_uri_components(): - * Parse a given URI, fill in all supplied fields of a uri_components - * structure. This eliminates the necessity of extracting host, port, - * path, query info repeatedly in the modules. - * Side effects: - * - fills in fields of uri_components *uptr - * - none on any of the r->* fields - */ -AP_DECLARE(int) ap_parse_uri_components(apr_pool_t *p, const char *uri, uri_components *uptr) -{ - const char *s; - const char *s1; - const char *hostinfo; - char *endstr; - int port; - - /* Initialize the structure. parse_uri() and parse_uri_components() - * can be called more than once per request. - */ - memset (uptr, '\0', sizeof(*uptr)); - uptr->is_initialized = 1; - - /* We assume the processor has a branch predictor like most -- - * it assumes forward branches are untaken and backwards are taken. That's - * the reason for the gotos. -djg - */ - if (uri[0] == '/') { -deal_with_path: - /* we expect uri to point to first character of path ... remember - * that the path could be empty -- http://foobar?query for example - */ - s = uri; - while ((uri_delims[*(unsigned char *)s] & NOTEND_PATH) == 0) { - ++s; - } - if (s != uri) { - uptr->path = apr_pstrndup(p, uri, s - uri); - } - if (*s == 0) { - return HTTP_OK; - } - if (*s == '?') { - ++s; - s1 = ap_strchr_c(s, '#'); - if (s1) { - uptr->fragment = apr_pstrdup(p, s1 + 1); - uptr->query = apr_pstrndup(p, s, s1 - s); - } - else { - uptr->query = apr_pstrdup(p, s); - } - return HTTP_OK; - } - /* otherwise it's a fragment */ - uptr->fragment = apr_pstrdup(p, s + 1); - return HTTP_OK; - } - - /* find the scheme: */ - s = uri; - while ((uri_delims[*(unsigned char *)s] & NOTEND_SCHEME) == 0) { - ++s; - } - /* scheme must be non-empty and followed by :// */ - if (s == uri || s[0] != ':' || s[1] != '/' || s[2] != '/') { - goto deal_with_path; /* backwards predicted taken! */ - } - - uptr->scheme = apr_pstrndup(p, uri, s - uri); - s += 3; - hostinfo = s; - while ((uri_delims[*(unsigned char *)s] & NOTEND_HOSTINFO) == 0) { - ++s; - } - uri = s; /* whatever follows hostinfo is start of uri */ - uptr->hostinfo = apr_pstrndup(p, hostinfo, uri - hostinfo); - - /* If there's a username:password@host:port, the @ we want is the last @... - * too bad there's no memrchr()... For the C purists, note that hostinfo - * is definately not the first character of the original uri so therefore - * &hostinfo[-1] < &hostinfo[0] ... and this loop is valid C. - */ - do { - --s; - } while (s >= hostinfo && *s != '@'); - if (s < hostinfo) { - /* again we want the common case to be fall through */ -deal_with_host: - /* We expect hostinfo to point to the first character of - * the hostname. If there's a port it is the first colon. - */ - s = memchr(hostinfo, ':', uri - hostinfo); - if (s == NULL) { - /* we expect the common case to have no port */ - uptr->hostname = apr_pstrndup(p, hostinfo, uri - hostinfo); - goto deal_with_path; - } - uptr->hostname = apr_pstrndup(p, hostinfo, s - hostinfo); - ++s; - uptr->port_str = apr_pstrndup(p, s, uri - s); - if (uri != s) { - port = strtol(uptr->port_str, &endstr, 10); - uptr->port = port; - if (*endstr == '\0') { - goto deal_with_path; - } - /* Invalid characters after ':' found */ - return HTTP_BAD_REQUEST; - } - uptr->port = ap_default_port_for_scheme(uptr->scheme); - goto deal_with_path; - } - - /* first colon delimits username:password */ - s1 = memchr(hostinfo, ':', s - hostinfo); - if (s1) { - uptr->user = apr_pstrndup(p, hostinfo, s1 - hostinfo); - ++s1; - uptr->password = apr_pstrndup(p, s1, s - s1); - } - else { - uptr->user = apr_pstrndup(p, hostinfo, s - hostinfo); - } - hostinfo = s + 1; - goto deal_with_host; -} - -/* Special case for CONNECT parsing: it comes with the hostinfo part only */ -/* See the INTERNET-DRAFT document "Tunneling SSL Through a WWW Proxy" - * currently at http://www.mcom.com/newsref/std/tunneling_ssl.html - * for the format of the "CONNECT host:port HTTP/1.0" request - */ -AP_DECLARE(int) ap_parse_hostinfo_components(apr_pool_t *p, const char *hostinfo, uri_components *uptr) -{ - const char *s; - char *endstr; - - /* Initialize the structure. parse_uri() and parse_uri_components() - * can be called more than once per request. - */ - memset (uptr, '\0', sizeof(*uptr)); - uptr->is_initialized = 1; - uptr->hostinfo = apr_pstrdup(p, hostinfo); - - /* We expect hostinfo to point to the first character of - * the hostname. There must be a port, separated by a colon - */ - s = ap_strchr_c(hostinfo, ':'); - if (s == NULL) { - return HTTP_BAD_REQUEST; - } - uptr->hostname = apr_pstrndup(p, hostinfo, s - hostinfo); - ++s; - uptr->port_str = apr_pstrdup(p, s); - if (*s != '\0') { - uptr->port = (unsigned short) strtol(uptr->port_str, &endstr, 10); - if (*endstr == '\0') { - return HTTP_OK; - } - /* Invalid characters after ':' found */ - } - return HTTP_BAD_REQUEST; -} diff --git a/server/util_xml.c b/server/util_xml.c deleted file mode 100644 index 9c617b298c..0000000000 --- a/server/util_xml.c +++ /dev/null @@ -1,134 +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/>. - */ - -#include "apr_xml.h" - -#include "httpd.h" -#include "http_protocol.h" -#include "http_log.h" -#include "http_core.h" - -#include "util_xml.h" - - -#define READ_BLOCKSIZE 2048 /* used for reading input blocks */ - - -AP_DECLARE(int) ap_xml_parse_input(request_rec * r, apr_xml_doc **pdoc) -{ - apr_xml_parser *parser; - int result; - apr_status_t status; - char errbuf[200]; - - if ((result = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)) != OK) - return result; - - if (r->remaining == 0) { - *pdoc = NULL; - return OK; - } - - parser = apr_xml_parser_create(r->pool); - - if (ap_should_client_block(r)) { - long len; - char *buffer; - apr_size_t total_read = 0; - apr_size_t limit_xml_body = ap_get_limit_xml_body(r); - - /* allocate our working buffer */ - buffer = apr_palloc(r->pool, READ_BLOCKSIZE); - - /* read the body, stuffing it into the parser */ - while ((len = ap_get_client_block(r, buffer, READ_BLOCKSIZE)) > 0) { - total_read += len; - if (limit_xml_body && total_read > limit_xml_body) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "XML request body is larger than the configured " - "limit of %lu", (unsigned long)limit_xml_body); - goto read_error; - } - - status = apr_xml_parser_feed(parser, buffer, len); - if (status) - goto parser_error; - } - if (len == -1) { - /* ap_get_client_block() has logged an error */ - goto read_error; - } - } - - /* tell the parser that we're done */ - status = apr_xml_parser_done(parser, pdoc); - if (status) - goto parser_error; - - return OK; - - parser_error: - (void) apr_xml_parser_geterror(parser, errbuf, sizeof(errbuf)); - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, - "%s", errbuf); - - /* FALLTHRU */ - - read_error: - /* make sure the parser is terminated */ - (void) apr_xml_parser_done(parser, NULL); - - /* Apache will supply a default error, plus the error log above. */ - return HTTP_BAD_REQUEST; -} diff --git a/server/vhost.c b/server/vhost.c deleted file mode 100644 index ca373e5916..0000000000 --- a/server/vhost.c +++ /dev/null @@ -1,1017 +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. - */ - -/* - * http_vhost.c: functions pertaining to virtual host addresses - * (configuration and run-time) - */ - -#include "apr.h" -#include "apr_strings.h" -#include "apr_lib.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_log.h" -#include "http_vhost.h" -#include "http_protocol.h" -#include "http_core.h" - -#if APR_HAVE_ARPA_INET_H -#include <arpa/inet.h> -#endif - -/* - * 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 apr_table_t 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(apr_pool_t *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 <address>[: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(apr_pool_t *p, const char *w_, - server_addr_rec ***paddr, - apr_port_t default_port) -{ - apr_sockaddr_t *my_addr; - server_addr_rec *sar; - char *w, *host, *scope_id; - int wild_port; - size_t wlen; - apr_port_t port; - apr_status_t rv; - - if (*w_ == '\0') - return NULL; - - w = apr_pstrdup(p, w_); - /* apr_parse_addr_port() doesn't understand ":*" so handle that first. */ - wlen = strlen(w); - if (wlen > 2 && w[wlen - 1] == '*' && w[wlen - 2] == ':') { - w[wlen - 2] = '\0'; - wild_port = 1; - } - else { - wild_port = 0; - } - rv = apr_parse_addr_port(&host, &scope_id, &port, w, p); - if (rv != APR_SUCCESS) { - return "The address or port is invalid"; - } - if (scope_id) { - return "Scope ids are not supported"; - } - if (!port && !wild_port) { - port = default_port; - } - - if (strcmp(host, "*") == 0) { - rv = apr_sockaddr_info_get(&my_addr, NULL, APR_INET, port, 0, p); - my_addr->sa.sin.sin_addr.s_addr = htonl(INADDR_ANY); - } else if (strcasecmp(host, "_default_") == 0 - || strcmp(host, "255.255.255.255") == 0) { - rv = apr_sockaddr_info_get(&my_addr, NULL, APR_INET, port, 0, p); - ap_assert(rv == APR_SUCCESS); /* must be bug or out of storage */ - my_addr->sa.sin.sin_addr.s_addr = DEFAULT_VHOST_ADDR; - } else { - rv = apr_sockaddr_info_get(&my_addr, host, APR_UNSPEC, port, 0, p); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, - "Cannot resolve host name %s --- ignoring!", host); - return NULL; - } - } - - /* XXX Gotta go through *all* addresses for the host name! - * Fix apr_sockaddr_info_get() to save them! */ - - sar = apr_pcalloc(p, sizeof(server_addr_rec)); - **paddr = sar; - *paddr = &sar->next; - sar->host_addr = my_addr; - sar->host_port = port; - sar->virthost = host; - return NULL; -} - - -/* parse the <VirtualHost> addresses */ -const char *ap_parse_vhost_addrs(apr_pool_t *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, - const 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 apr_table_t 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 + apr_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 += apr_snprintf(p, sizeof(buf) - (p - buf), " %ux%u", - total, count[i - 1]); - total = 1; - } - else { - ++total; - } - } - p += apr_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 APR_INLINE unsigned hash_inaddr(unsigned key) -{ - key ^= (key >> 16); - return ((key >> 8) ^ key) % IPHASH_TABLE_SIZE; -} - -static APR_INLINE unsigned hash_addr(struct apr_sockaddr_t *sa) -{ - unsigned key; - - /* The key is the last four bytes of the IP address. - * For IPv4, this is the entire address, as always. - * For IPv6, this is usually part of the MAC address. - */ - key = *(unsigned *)((char *)sa->ipaddr_ptr + sa->ipaddr_len - 4); - return hash_inaddr(key); -} - -static ipaddr_chain *new_ipaddr_chain(apr_pool_t *p, - server_rec *s, server_addr_rec *sar) -{ - ipaddr_chain *new; - - new = apr_palloc(p, sizeof(*new)); - new->names = NULL; - new->server = s; - new->sar = sar; - new->next = NULL; - return new; -} - - -static name_chain *new_name_chain(apr_pool_t *p, server_rec *s, server_addr_rec *sar) -{ - name_chain *new; - - new = apr_palloc(p, sizeof(*new)); - new->server = s; - new->sar = sar; - new->next = NULL; - return new; -} - - -static APR_INLINE ipaddr_chain *find_ipaddr(apr_sockaddr_t *sa) -{ - unsigned bucket; - ipaddr_chain *trav; - - /* scan the hash apr_table_t for an exact match first */ - bucket = hash_addr(sa); - for (trav = iphash_table[bucket]; trav; trav = trav->next) { - server_addr_rec *sar = trav->sar; - apr_sockaddr_t *cur = sar->host_addr; - - if (cur->sa.sin.sin_port == 0 || - sa->sa.sin.sin_port == 0 || - cur->sa.sin.sin_port == sa->sa.sin.sin_port) { - if (cur->ipaddr_len == sa->ipaddr_len && - !memcmp(cur->ipaddr_ptr, - sa->ipaddr_ptr, - sa->ipaddr_len)) { - return trav; - } - } - } - return NULL; -} - - -static ipaddr_chain *find_default_server(apr_port_t 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_a_vhost(apr_file_t *f, ipaddr_chain *ic) -{ - name_chain *nc; - int len; - char buf[MAX_STRING_LEN]; - apr_sockaddr_t *ha = ic->sar->host_addr; - - if (ha->sa.sin.sin_family == APR_INET && - ha->sa.sin.sin_addr.s_addr == DEFAULT_VHOST_ADDR) { - len = apr_snprintf(buf, sizeof(buf), "_default_:%u", - ic->sar->host_port); - } - else if (ha->sa.sin.sin_family == APR_INET && - ha->sa.sin.sin_addr.s_addr == INADDR_ANY) { - len = apr_snprintf(buf, sizeof(buf), "*:%u", - ic->sar->host_port); - } - else { - len = apr_snprintf(buf, sizeof(buf), "%pI", ha); - } - if (ic->sar->host_port == 0) { - buf[len-1] = '*'; - } - if (ic->names == NULL) { - apr_file_printf(f, "%-22s %s (%s:%u)\n", buf, ic->server->server_hostname, - ic->server->defn_name, ic->server->defn_line_number); - return; - } - apr_file_printf(f, "%-22s is a NameVirtualHost\n" - "%8s 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) { - apr_file_printf(f, "%8s port %u ", "", nc->sar->host_port); - } - else { - apr_file_printf(f, "%8s port * ", ""); - } - apr_file_printf(f, "namevhost %s (%s:%u)\n", nc->server->server_hostname, - nc->server->defn_name, nc->server->defn_line_number); - } -} - -static void dump_vhost_config(apr_file_t *f) -{ - ipaddr_chain *ic; - int i; - - apr_file_printf(f, "VirtualHost configuration:\n"); - for (i = 0; i < IPHASH_TABLE_SIZE; ++i) { - for (ic = iphash_table[i]; ic; ic = ic->next) { - dump_a_vhost(f, ic); - } - } - if (default_list) { - apr_file_printf(f, "wildcard NameVirtualHosts and _default_ servers:\n"); - for (ic = default_list; ic; ic = ic->next) { - dump_a_vhost(f, ic); - } - } -} - -/* - * Two helper functions for ap_fini_vhost_config() - */ -static int add_name_vhost_config(apr_pool_t *p, server_rec *main_s, server_rec *s, - server_addr_rec *sar, ipaddr_chain *ic) -{ - /* the first time we encounter a NameVirtualHost address - * ic->server will be NULL, on subsequent encounters - * ic->names will be non-NULL. - */ - if (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, 0, 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); - } - return 1; - } - else { - /* IP-based vhosts are handled by the caller */ - return 0; - } -} - -static void remove_unused_name_vhosts(server_rec *main_s, ipaddr_chain **pic) -{ - while (*pic) { - ipaddr_chain *ic = *pic; - - if (ic->server == NULL) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, 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; - } - } -} - -/* compile the tables and such we need to do the run-time vhost lookups */ -AP_DECLARE(void) ap_fini_vhost_config(apr_pool_t *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 apr_table_t 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_addr(sar->host_addr); - ipaddr_chain *ic = new_ipaddr_chain(p, NULL, sar); - - if (sar->host_addr->sa.sin.sin_addr.s_addr != INADDR_ANY) { - *iphash_table_tail[bucket] = ic; - iphash_table_tail[bucket] = &ic->next; - } - else { - /* A wildcard NameVirtualHost goes on the default_list so - * that it can catch incoming requests on any address. - */ - ic->next = default_list; - default_list = ic; - } - /* Notice that what we've done is insert an ipaddr_chain with - * both server and names NULL. This fact is used to spot name- - * based vhosts in add_name_vhost_config(). - */ - } - - /* The next things to go into the hash apr_table_t 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->sa.sin.sin_addr.s_addr == DEFAULT_VHOST_ADDR - || sar->host_addr->sa.sin.sin_addr.s_addr == INADDR_ANY) { - ic = find_default_server(sar->host_port); - if (!ic || !add_name_vhost_config(p, main_s, s, sar, ic)) { - if (ic && ic->sar->host_port != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, - 0, main_s, "_default_ VirtualHost overlap on port %u," - " the first has precedence", sar->host_port); - } - ic = new_ipaddr_chain(p, s, sar); - ic->next = default_list; - default_list = ic; - } - has_default_vhost_addr = 1; - } - else { - /* see if it matches something we've already got */ - ic = find_ipaddr(sar->host_addr); - - if (!ic) { - unsigned bucket = hash_addr(sar->host_addr); - - ic = new_ipaddr_chain(p, s, sar); - ic->next = *iphash_table_tail[bucket]; - *iphash_table_tail[bucket] = ic; - } - else if (!add_name_vhost_config(p, main_s, s, sar, ic)) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, 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; - } - } - } - - /* 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 = - apr_pstrdup(p, "bogus_host_without_forward_dns"); - } - else { - apr_status_t rv; - char *hostname; - - rv = apr_getnameinfo(&hostname, s->addrs->host_addr, 0); - if (rv == APR_SUCCESS) { - s->server_hostname = apr_pstrdup(p, hostname); - } - else { - /* again, what can we do? They didn't specify a - ServerName, and their DNS isn't working. -djg */ - char *ipaddr_str; - - apr_sockaddr_ip_get(&ipaddr_str, s->addrs->host_addr); - ap_log_error(APLOG_MARK, APLOG_ERR, rv, main_s, - "Failed to resolve server name " - "for %s (check DNS) -- or specify an explicit " - "ServerName", - ipaddr_str); - s->server_hostname = - apr_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) { - remove_unused_name_vhosts(main_s, &iphash_table[i]); - } - remove_unused_name_vhosts(main_s, &default_list); - -#ifdef IPHASH_STATISTICS - dump_iphash_statistics(main_s); -#endif - if (ap_exists_config_define("DUMP_VHOSTS")) { - apr_file_t *thefile = NULL; - apr_file_open_stderr(&thefile, p); - dump_vhost_config(thefile); - } -} - - -/***************************************************************************** - * run-time vhost matching functions - */ - -/* Lowercase and remove any trailing dot and/or :port from the hostname, - * and check that it is sane. - * - * In most configurations the exact syntax of the hostname isn't - * important so strict sanity checking isn't necessary. However, in - * mass hosting setups (using mod_vhost_alias or mod_rewrite) where - * the hostname is interpolated into the filename, we need to be sure - * that the interpolation doesn't expose parts of the filesystem. - * We don't do strict RFC 952 / RFC 1123 syntax checking in order - * to support iDNS and people who erroneously use underscores. - * Instead we just check for filesystem metacharacters: directory - * separators / and \ and sequences of more than one dot. - */ -static void fix_hostname(request_rec *r) -{ - char *host, *scope_id; - char *dst; - apr_port_t port; - apr_status_t rv; - - rv = apr_parse_addr_port(&host, &scope_id, &port, r->hostname, r->pool); - if (rv != APR_SUCCESS || scope_id) { - goto bad; - } - - /* if the hostname is an IPv6 numeric address string, it was validated - * already; otherwise, further validation is needed - */ - if (r->hostname[0] != '[') { - for (dst = host; *dst; dst++) { - if (*dst == '.') { - dst++; - if (*dst == '.') - goto bad; - } - else if (*dst == '/' || *dst == '\\') { - goto bad; - } - } - /* strip trailing gubbins */ - if (dst > host && dst[-1] == '.') { - dst[-1] = '\0'; - } - } - r->hostname = host; - return; - -bad: - r->status = HTTP_BAD_REQUEST; - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Client sent malformed Host header"); - return; -} - - -/* return 1 if host matches ServerName or ServerAliases */ -static int matches_aliases(server_rec *s, const char *host) -{ - int i; - apr_array_header_t *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. - */ -AP_DECLARE(int) ap_matches_request_vhost(request_rec *r, const char *host, - apr_port_t port) -{ - server_rec *s; - server_addr_rec *sar; - - s = r->server; - - /* search all the <VirtualHost> values */ - /* XXX: If this is a NameVirtualHost then we may not be doing the Right Thing - * consider: - * - * NameVirtualHost 10.1.1.1 - * <VirtualHost 10.1.1.1> - * ServerName v1 - * </VirtualHost> - * <VirtualHost 10.1.1.1> - * ServerName v2 - * </VirtualHost> - * - * 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; - apr_port_t port; - server_rec *s; - server_rec *last_s; - name_chain *src; - apr_sockaddr_t *localsa; - - last_s = NULL; - apr_socket_addr_get(&localsa, APR_LOCAL, r->connection->client_socket); - apr_sockaddr_port_get(&port, localsa); - - /* 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 = s; -} - - -static void check_serverpath(request_rec *r) -{ - server_rec *s; - server_rec *last_s; - name_chain *src; - apr_port_t port; - apr_sockaddr_t *localsa; - - apr_socket_addr_get(&localsa, APR_LOCAL, r->connection->client_socket); - apr_sockaddr_port_get(&port, localsa); - - /* - * 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 = s; - return; - } - } -} - - -void ap_update_vhost_from_headers(request_rec *r) -{ - /* must set this for HTTP/1.1 support */ - if (r->hostname || (r->hostname = apr_table_get(r->headers_in, "Host"))) { - fix_hostname(r); - if (r->status != HTTP_OK) - return; - } - /* 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; - apr_port_t port; - - /* scan the hash apr_table_t for an exact match first */ - trav = find_ipaddr(conn->local_addr); - if (trav) { - /* save the name_chain for later in case this is a name-vhost */ - conn->vhost_lookup_data = trav->names; - conn->base_server = trav->server; - return; - } - - /* maybe there's a default server or wildcard name-based vhost - * matching this port - */ - apr_sockaddr_port_get(&port, conn->local_addr); - trav = find_default_server(port); - if (trav) { - conn->vhost_lookup_data = trav->names; - conn->base_server = trav->server; - return; - } - - /* otherwise we're stuck with just the main server - * and no name-based vhosts - */ - conn->vhost_lookup_data = NULL; -} diff --git a/srclib/.cvsignore b/srclib/.cvsignore deleted file mode 100644 index 5ae47612da..0000000000 --- a/srclib/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile -pth -.deps diff --git a/srclib/Makefile.in b/srclib/Makefile.in deleted file mode 100644 index 121ccc81a8..0000000000 --- a/srclib/Makefile.in +++ /dev/null @@ -1,4 +0,0 @@ - -SUBDIRS = apr $(AP_LIB_DIRS) apr-util pcre - -include $(top_srcdir)/build/rules.mk diff --git a/srclib/pcre/.cvsignore b/srclib/pcre/.cvsignore deleted file mode 100644 index 37baba5ec6..0000000000 --- a/srclib/pcre/.cvsignore +++ /dev/null @@ -1,22 +0,0 @@ -*.la -*.lo -.libs -Makefile -*.mak -chartables.c -config.h -config.log -config.status -configure -dftables -dftables.exe -Debug -Release -libtool -pcre-config -pcretest -pgrep -LibD -LibR -.deps -pcre.h diff --git a/srclib/pcre/AUTHORS b/srclib/pcre/AUTHORS deleted file mode 100644 index bfe1b5d8a4..0000000000 --- a/srclib/pcre/AUTHORS +++ /dev/null @@ -1,6 +0,0 @@ -Written by: Philip Hazel <ph10@cam.ac.uk> - -University of Cambridge Computing Service, -Cambridge, England. Phone: +44 1223 334714. - -Copyright (c) 1997-2000 University of Cambridge diff --git a/srclib/pcre/COPYING b/srclib/pcre/COPYING deleted file mode 100644 index f305033c16..0000000000 --- a/srclib/pcre/COPYING +++ /dev/null @@ -1,32 +0,0 @@ -PCRE LICENCE ------------- - -PCRE is a library of functions to support regular expressions whose syntax -and semantics are as close as possible to those of the Perl 5 language. - -Written by: Philip Hazel <ph10@cam.ac.uk> - -University of Cambridge Computing Service, -Cambridge, England. Phone: +44 1223 334714. - -Copyright (c) 1997-2000 University of Cambridge - -Permission is granted to anyone to use this software for any purpose on any -computer system, and to redistribute it freely, subject to the following -restrictions: - -1. This software 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. - -2. The origin of this software must not be misrepresented, either by - explicit claim or by omission. - -3. Altered versions must be plainly marked as such, and must not be - misrepresented as being the original software. - -4. If PCRE is embedded in any software that is released under the GNU - General Purpose Licence (GPL), then the terms of that licence shall - supersede any condition above with which it is incompatible. - -End diff --git a/srclib/pcre/ChangeLog b/srclib/pcre/ChangeLog deleted file mode 100644 index 5bedd53bc6..0000000000 --- a/srclib/pcre/ChangeLog +++ /dev/null @@ -1,615 +0,0 @@ -ChangeLog for PCRE ------------------- - - -Version 3.2 12-May-00 ---------------------- - -This is purely a bug fixing release. - -1. If the pattern /((Z)+|A)*/ was matched agained ZABCDEFG it matched Z instead -of ZA. This was just one example of several cases that could provoke this bug, -which was introduced by change 9 of version 2.00. The code for breaking -infinite loops after an iteration that matches an empty string was't working -correctly. - -2. The pcretest program was not imitating Perl correctly for the pattern /a*/g -when matched against abbab (for example). After matching an empty string, it -wasn't forcing anchoring when setting PCRE_NOTEMPTY for the next attempt; this -caused it to match further down the string than it should. - -3. The code contained an inclusion of sys/types.h. It isn't clear why this -was there because it doesn't seem to be needed, and it causes trouble on some -systems, as it is not a Standard C header. It has been removed. - -4. Made 4 silly changes to the source to avoid stupid compiler warnings that -were reported on the Macintosh. The changes were from - - while ((c = *(++ptr)) != 0 && c != '\n'); -to - while ((c = *(++ptr)) != 0 && c != '\n') ; - -Totally extraordinary, but if that's what it takes... - -5. PCRE is being used in one environment where neither memmove() nor bcopy() is -available. Added HAVE_BCOPY and an autoconf test for it; if neither -HAVE_MEMMOVE nor HAVE_BCOPY is set, use a built-in emulation function which -assumes the way PCRE uses memmove() (always moving upwards). - -6. PCRE is being used in one environment where strchr() is not available. There -was only one use in pcre.c, and writing it out to avoid strchr() probably gives -faster code anyway. - - -Version 3.1 09-Feb-00 ---------------------- - -The only change in this release is the fixing of some bugs in Makefile.in for -the "install" target: - -(1) It was failing to install pcreposix.h. - -(2) It was overwriting the pcre.3 man page with the pcreposix.3 man page. - - -Version 3.0 01-Feb-00 ---------------------- - -1. Add support for the /+ modifier to perltest (to output $` like it does in -pcretest). - -2. Add support for the /g modifier to perltest. - -3. Fix pcretest so that it behaves even more like Perl for /g when the pattern -matches null strings. - -4. Fix perltest so that it doesn't do unwanted things when fed an empty -pattern. Perl treats empty patterns specially - it reuses the most recent -pattern, which is not what we want. Replace // by /(?#)/ in order to avoid this -effect. - -5. The POSIX interface was broken in that it was just handing over the POSIX -captured string vector to pcre_exec(), but (since release 2.00) PCRE has -required a bigger vector, with some working space on the end. This means that -the POSIX wrapper now has to get and free some memory, and copy the results. - -6. Added some simple autoconf support, placing the test data and the -documentation in separate directories, re-organizing some of the -information files, and making it build pcre-config (a GNU standard). Also added -libtool support for building PCRE as a shared library, which is now the -default. - -7. Got rid of the leading zero in the definition of PCRE_MINOR because 08 and -09 are not valid octal constants. Single digits will be used for minor values -less than 10. - -8. Defined REG_EXTENDED and REG_NOSUB as zero in the POSIX header, so that -existing programs that set these in the POSIX interface can use PCRE without -modification. - -9. Added a new function, pcre_fullinfo() with an extensible interface. It can -return all that pcre_info() returns, plus additional data. The pcre_info() -function is retained for compatibility, but is considered to be obsolete. - -10. Added experimental recursion feature (?R) to handle one common case that -Perl 5.6 will be able to do with (?p{...}). - -11. Added support for POSIX character classes like [:alpha:], which Perl is -adopting. - - -Version 2.08 31-Aug-99 ----------------------- - -1. When startoffset was not zero and the pattern began with ".*", PCRE was not -trying to match at the startoffset position, but instead was moving forward to -the next newline as if a previous match had failed. - -2. pcretest was not making use of PCRE_NOTEMPTY when repeating for /g and /G, -and could get into a loop if a null string was matched other than at the start -of the subject. - -3. Added definitions of PCRE_MAJOR and PCRE_MINOR to pcre.h so the version can -be distinguished at compile time, and for completeness also added PCRE_DATE. - -5. Added Paul Sokolovsky's minor changes to make it easy to compile a Win32 DLL -in GnuWin32 environments. - - -Version 2.07 29-Jul-99 ----------------------- - -1. The documentation is now supplied in plain text form and HTML as well as in -the form of man page sources. - -2. C++ compilers don't like assigning (void *) values to other pointer types. -In particular this affects malloc(). Although there is no problem in Standard -C, I've put in casts to keep C++ compilers happy. - -3. Typo on pcretest.c; a cast of (unsigned char *) in the POSIX regexec() call -should be (const char *). - -4. If NOPOSIX is defined, pcretest.c compiles without POSIX support. This may -be useful for non-Unix systems who don't want to bother with the POSIX stuff. -However, I haven't made this a standard facility. The documentation doesn't -mention it, and the Makefile doesn't support it. - -5. The Makefile now contains an "install" target, with editable destinations at -the top of the file. The pcretest program is not installed. - -6. pgrep -V now gives the PCRE version number and date. - -7. Fixed bug: a zero repetition after a literal string (e.g. /abcde{0}/) was -causing the entire string to be ignored, instead of just the last character. - -8. If a pattern like /"([^\\"]+|\\.)*"/ is applied in the normal way to a -non-matching string, it can take a very, very long time, even for strings of -quite modest length, because of the nested recursion. PCRE now does better in -some of these cases. It does this by remembering the last required literal -character in the pattern, and pre-searching the subject to ensure it is present -before running the real match. In other words, it applies a heuristic to detect -some types of certain failure quickly, and in the above example, if presented -with a string that has no trailing " it gives "no match" very quickly. - -9. A new runtime option PCRE_NOTEMPTY causes null string matches to be ignored; -other alternatives are tried instead. - - -Version 2.06 09-Jun-99 ----------------------- - -1. Change pcretest's output for amount of store used to show just the code -space, because the remainder (the data block) varies in size between 32-bit and -64-bit systems. - -2. Added an extra argument to pcre_exec() to supply an offset in the subject to -start matching at. This allows lookbehinds to work when searching for multiple -occurrences in a string. - -3. Added additional options to pcretest for testing multiple occurrences: - - /+ outputs the rest of the string that follows a match - /g loops for multiple occurrences, using the new startoffset argument - /G loops for multiple occurrences by passing an incremented pointer - -4. PCRE wasn't doing the "first character" optimization for patterns starting -with \b or \B, though it was doing it for other lookbehind assertions. That is, -it wasn't noticing that a match for a pattern such as /\bxyz/ has to start with -the letter 'x'. On long subject strings, this gives a significant speed-up. - - -Version 2.05 21-Apr-99 ----------------------- - -1. Changed the type of magic_number from int to long int so that it works -properly on 16-bit systems. - -2. Fixed a bug which caused patterns starting with .* not to work correctly -when the subject string contained newline characters. PCRE was assuming -anchoring for such patterns in all cases, which is not correct because .* will -not pass a newline unless PCRE_DOTALL is set. It now assumes anchoring only if -DOTALL is set at top level; otherwise it knows that patterns starting with .* -must be retried after every newline in the subject. - - -Version 2.04 18-Feb-99 ----------------------- - -1. For parenthesized subpatterns with repeats whose minimum was zero, the -computation of the store needed to hold the pattern was incorrect (too large). -If such patterns were nested a few deep, this could multiply and become a real -problem. - -2. Added /M option to pcretest to show the memory requirement of a specific -pattern. Made -m a synonym of -s (which does this globally) for compatibility. - -3. Subpatterns of the form (regex){n,m} (i.e. limited maximum) were being -compiled in such a way that the backtracking after subsequent failure was -pessimal. Something like (a){0,3} was compiled as (a)?(a)?(a)? instead of -((a)((a)(a)?)?)? with disastrous performance if the maximum was of any size. - - -Version 2.03 02-Feb-99 ----------------------- - -1. Fixed typo and small mistake in man page. - -2. Added 4th condition (GPL supersedes if conflict) and created separate -LICENCE file containing the conditions. - -3. Updated pcretest so that patterns such as /abc\/def/ work like they do in -Perl, that is the internal \ allows the delimiter to be included in the -pattern. Locked out the use of \ as a delimiter. If \ immediately follows -the final delimiter, add \ to the end of the pattern (to test the error). - -4. Added the convenience functions for extracting substrings after a successful -match. Updated pcretest to make it able to test these functions. - - -Version 2.02 14-Jan-99 ----------------------- - -1. Initialized the working variables associated with each extraction so that -their saving and restoring doesn't refer to uninitialized store. - -2. Put dummy code into study.c in order to trick the optimizer of the IBM C -compiler for OS/2 into generating correct code. Apparently IBM isn't going to -fix the problem. - -3. Pcretest: the timing code wasn't using LOOPREPEAT for timing execution -calls, and wasn't printing the correct value for compiling calls. Increased the -default value of LOOPREPEAT, and the number of significant figures in the -times. - -4. Changed "/bin/rm" in the Makefile to "-rm" so it works on Windows NT. - -5. Renamed "deftables" as "dftables" to get it down to 8 characters, to avoid -a building problem on Windows NT with a FAT file system. - - -Version 2.01 21-Oct-98 ----------------------- - -1. Changed the API for pcre_compile() to allow for the provision of a pointer -to character tables built by pcre_maketables() in the current locale. If NULL -is passed, the default tables are used. - - -Version 2.00 24-Sep-98 ----------------------- - -1. Since the (>?) facility is in Perl 5.005, don't require PCRE_EXTRA to enable -it any more. - -2. Allow quantification of (?>) groups, and make it work correctly. - -3. The first character computation wasn't working for (?>) groups. - -4. Correct the implementation of \Z (it is permitted to match on the \n at the -end of the subject) and add 5.005's \z, which really does match only at the -very end of the subject. - -5. Remove the \X "cut" facility; Perl doesn't have it, and (?> is neater. - -6. Remove the ability to specify CASELESS, MULTILINE, DOTALL, and -DOLLAR_END_ONLY at runtime, to make it possible to implement the Perl 5.005 -localized options. All options to pcre_study() were also removed. - -7. Add other new features from 5.005: - - $(?<= positive lookbehind - $(?<! negative lookbehind - (?imsx-imsx) added the unsetting capability - such a setting is global if at outer level; local otherwise - (?imsx-imsx:) non-capturing groups with option setting - (?(cond)re|re) conditional pattern matching - - A backreference to itself in a repeated group matches the previous - captured string. - -8. General tidying up of studying (both automatic and via "study") -consequential on the addition of new assertions. - -9. As in 5.005, unlimited repeated groups that could match an empty substring -are no longer faulted at compile time. Instead, the loop is forcibly broken at -runtime if any iteration does actually match an empty substring. - -10. Include the RunTest script in the distribution. - -11. Added tests from the Perl 5.005_02 distribution. This showed up a few -discrepancies, some of which were old and were also with respect to 5.004. They -have now been fixed. - - -Version 1.09 28-Apr-98 ----------------------- - -1. A negated single character class followed by a quantifier with a minimum -value of one (e.g. [^x]{1,6} ) was not compiled correctly. This could lead to -program crashes, or just wrong answers. This did not apply to negated classes -containing more than one character, or to minima other than one. - - -Version 1.08 27-Mar-98 ----------------------- - -1. Add PCRE_UNGREEDY to invert the greediness of quantifiers. - -2. Add (?U) and (?X) to set PCRE_UNGREEDY and PCRE_EXTRA respectively. The -latter must appear before anything that relies on it in the pattern. - - -Version 1.07 16-Feb-98 ----------------------- - -1. A pattern such as /((a)*)*/ was not being diagnosed as in error (unlimited -repeat of a potentially empty string). - - -Version 1.06 23-Jan-98 ----------------------- - -1. Added Markus Oberhumer's little patches for C++. - -2. Literal strings longer than 255 characters were broken. - - -Version 1.05 23-Dec-97 ----------------------- - -1. Negated character classes containing more than one character were failing if -PCRE_CASELESS was set at run time. - - -Version 1.04 19-Dec-97 ----------------------- - -1. Corrected the man page, where some "const" qualifiers had been omitted. - -2. Made debugging output print "{0,xxx}" instead of just "{,xxx}" to agree with -input syntax. - -3. Fixed memory leak which occurred when a regex with back references was -matched with an offsets vector that wasn't big enough. The temporary memory -that is used in this case wasn't being freed if the match failed. - -4. Tidied pcretest to ensure it frees memory that it gets. - -5. Temporary memory was being obtained in the case where the passed offsets -vector was exactly big enough. - -6. Corrected definition of offsetof() from change 5 below. - -7. I had screwed up change 6 below and broken the rules for the use of -setjmp(). Now fixed. - - -Version 1.03 18-Dec-97 ----------------------- - -1. A erroneous regex with a missing opening parenthesis was correctly -diagnosed, but PCRE attempted to access brastack[-1], which could cause crashes -on some systems. - -2. Replaced offsetof(real_pcre, code) by offsetof(real_pcre, code[0]) because -it was reported that one broken compiler failed on the former because "code" is -also an independent variable. - -3. The erroneous regex a[]b caused an array overrun reference. - -4. A regex ending with a one-character negative class (e.g. /[^k]$/) did not -fail on data ending with that character. (It was going on too far, and checking -the next character, typically a binary zero.) This was specific to the -optimized code for single-character negative classes. - -5. Added a contributed patch from the TIN world which does the following: - - + Add an undef for memmove, in case the the system defines a macro for it. - - + Add a definition of offsetof(), in case there isn't one. (I don't know - the reason behind this - offsetof() is part of the ANSI standard - but - it does no harm). - - + Reduce the ifdef's in pcre.c using macro DPRINTF, thereby eliminating - most of the places where whitespace preceded '#'. I have given up and - allowed the remaining 2 cases to be at the margin. - - + Rename some variables in pcre to eliminate shadowing. This seems very - pedantic, but does no harm, of course. - -6. Moved the call to setjmp() into its own function, to get rid of warnings -from gcc -Wall, and avoided calling it at all unless PCRE_EXTRA is used. - -7. Constructs such as \d{8,} were compiling into the equivalent of -\d{8}\d{0,65527} instead of \d{8}\d* which didn't make much difference to the -outcome, but in this particular case used more store than had been allocated, -which caused the bug to be discovered because it threw up an internal error. - -8. The debugging code in both pcre and pcretest for outputting the compiled -form of a regex was going wrong in the case of back references followed by -curly-bracketed repeats. - - -Version 1.02 12-Dec-97 ----------------------- - -1. Typos in pcre.3 and comments in the source fixed. - -2. Applied a contributed patch to get rid of places where it used to remove -'const' from variables, and fixed some signed/unsigned and uninitialized -variable warnings. - -3. Added the "runtest" target to Makefile. - -4. Set default compiler flag to -O2 rather than just -O. - - -Version 1.01 19-Nov-97 ----------------------- - -1. PCRE was failing to diagnose unlimited repeat of empty string for patterns -like /([ab]*)*/, that is, for classes with more than one character in them. - -2. Likewise, it wasn't diagnosing patterns with "once-only" subpatterns, such -as /((?>a*))*/ (a PCRE_EXTRA facility). - - -Version 1.00 18-Nov-97 ----------------------- - -1. Added compile-time macros to support systems such as SunOS4 which don't have -memmove() or strerror() but have other things that can be used instead. - -2. Arranged that "make clean" removes the executables. - - -Version 0.99 27-Oct-97 ----------------------- - -1. Fixed bug in code for optimizing classes with only one character. It was -initializing a 32-byte map regardless, which could cause it to run off the end -of the memory it had got. - -2. Added, conditional on PCRE_EXTRA, the proposed (?>REGEX) construction. - - -Version 0.98 22-Oct-97 ----------------------- - -1. Fixed bug in code for handling temporary memory usage when there are more -back references than supplied space in the ovector. This could cause segfaults. - - -Version 0.97 21-Oct-97 ----------------------- - -1. Added the \X "cut" facility, conditional on PCRE_EXTRA. - -2. Optimized negated single characters not to use a bit map. - -3. Brought error texts together as macro definitions; clarified some of them; -fixed one that was wrong - it said "range out of order" when it meant "invalid -escape sequence". - -4. Changed some char * arguments to const char *. - -5. Added PCRE_NOTBOL and PCRE_NOTEOL (from POSIX). - -6. Added the POSIX-style API wrapper in pcreposix.a and testing facilities in -pcretest. - - -Version 0.96 16-Oct-97 ----------------------- - -1. Added a simple "pgrep" utility to the distribution. - -2. Fixed an incompatibility with Perl: "{" is now treated as a normal character -unless it appears in one of the precise forms "{ddd}", "{ddd,}", or "{ddd,ddd}" -where "ddd" means "one or more decimal digits". - -3. Fixed serious bug. If a pattern had a back reference, but the call to -pcre_exec() didn't supply a large enough ovector to record the related -identifying subpattern, the match always failed. PCRE now remembers the number -of the largest back reference, and gets some temporary memory in which to save -the offsets during matching if necessary, in order to ensure that -backreferences always work. - -4. Increased the compatibility with Perl in a number of ways: - - (a) . no longer matches \n by default; an option PCRE_DOTALL is provided - to request this handling. The option can be set at compile or exec time. - - (b) $ matches before a terminating newline by default; an option - PCRE_DOLLAR_ENDONLY is provided to override this (but not in multiline - mode). The option can be set at compile or exec time. - - (c) The handling of \ followed by a digit other than 0 is now supposed to be - the same as Perl's. If the decimal number it represents is less than 10 - or there aren't that many previous left capturing parentheses, an octal - escape is read. Inside a character class, it's always an octal escape, - even if it is a single digit. - - (d) An escaped but undefined alphabetic character is taken as a literal, - unless PCRE_EXTRA is set. Currently this just reserves the remaining - escapes. - - (e) {0} is now permitted. (The previous item is removed from the compiled - pattern). - -5. Changed all the names of code files so that the basic parts are no longer -than 10 characters, and abolished the teeny "globals.c" file. - -6. Changed the handling of character classes; they are now done with a 32-byte -bit map always. - -7. Added the -d and /D options to pcretest to make it possible to look at the -internals of compilation without having to recompile pcre. - - -Version 0.95 23-Sep-97 ----------------------- - -1. Fixed bug in pre-pass concerning escaped "normal" characters such as \x5c or -\x20 at the start of a run of normal characters. These were being treated as -real characters, instead of the source characters being re-checked. - - -Version 0.94 18-Sep-97 ----------------------- - -1. The functions are now thread-safe, with the caveat that the global variables -containing pointers to malloc() and free() or alternative functions are the -same for all threads. - -2. Get pcre_study() to generate a bitmap of initial characters for non- -anchored patterns when this is possible, and use it if passed to pcre_exec(). - - -Version 0.93 15-Sep-97 ----------------------- - -1. /(b)|(:+)/ was computing an incorrect first character. - -2. Add pcre_study() to the API and the passing of pcre_extra to pcre_exec(), -but not actually doing anything yet. - -3. Treat "-" characters in classes that cannot be part of ranges as literals, -as Perl does (e.g. [-az] or [az-]). - -4. Set the anchored flag if a branch starts with .* or .*? because that tests -all possible positions. - -5. Split up into different modules to avoid including unneeded functions in a -compiled binary. However, compile and exec are still in one module. The "study" -function is split off. - -6. The character tables are now in a separate module whose source is generated -by an auxiliary program - but can then be edited by hand if required. There are -now no calls to isalnum(), isspace(), isdigit(), isxdigit(), tolower() or -toupper() in the code. - -7. Turn the malloc/free funtions variables into pcre_malloc and pcre_free and -make them global. Abolish the function for setting them, as the caller can now -set them directly. - - -Version 0.92 11-Sep-97 ----------------------- - -1. A repeat with a fixed maximum and a minimum of 1 for an ordinary character -(e.g. /a{1,3}/) was broken (I mis-optimized it). - -2. Caseless matching was not working in character classes if the characters in -the pattern were in upper case. - -3. Make ranges like [W-c] work in the same way as Perl for caseless matching. - -4. Make PCRE_ANCHORED public and accept as a compile option. - -5. Add an options word to pcre_exec() and accept PCRE_ANCHORED and -PCRE_CASELESS at run time. Add escapes \A and \I to pcretest to cause it to -pass them. - -6. Give an error if bad option bits passed at compile or run time. - -7. Add PCRE_MULTILINE at compile and exec time, and (?m) as well. Add \M to -pcretest to cause it to pass that flag. - -8. Add pcre_info(), to get the number of identifying subpatterns, the stored -options, and the first character, if set. - -9. Recognize C+ or C{n,m} where n >= 1 as providing a fixed starting character. - - -Version 0.91 10-Sep-97 ----------------------- - -1. PCRE was failing to diagnose unlimited repeats of subpatterns that could -match the empty string as in /(a*)*/. It was looping and ultimately crashing. - -2. PCRE was looping on encountering an indefinitely repeated back reference to -a subpattern that had matched an empty string, e.g. /(a|)\1*/. It now does what -Perl does - treats the match as successful. - -**** diff --git a/srclib/pcre/INSTALL b/srclib/pcre/INSTALL deleted file mode 100644 index d63a78fef9..0000000000 --- a/srclib/pcre/INSTALL +++ /dev/null @@ -1,185 +0,0 @@ -Basic Installation -================== - - These are generic installation instructions that apply to systems that -can run the `configure' shell script - Unix systems and any that imitate -it. They are not specific to PCRE. There are PCRE-specific instructions -for non-Unix systems in the file NON-UNIX. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. diff --git a/srclib/pcre/LICENCE b/srclib/pcre/LICENCE deleted file mode 100644 index 8422bd9ae6..0000000000 --- a/srclib/pcre/LICENCE +++ /dev/null @@ -1,44 +0,0 @@ -PCRE LICENCE ------------- - -PCRE is a library of functions to support regular expressions whose syntax -and semantics are as close as possible to those of the Perl 5 language. - -Written by: Philip Hazel <ph10@cam.ac.uk> - -University of Cambridge Computing Service, -Cambridge, England. Phone: +44 1223 334714. - -Copyright (c) 1997-2000 University of Cambridge - -Permission is granted to anyone to use this software for any purpose on any -computer system, and to redistribute it freely, subject to the following -restrictions: - -1. This software 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. - -2. The origin of this software must not be misrepresented, either by - explicit claim or by omission. In practice, this means you must put - a sentence like this - - Regular expression support is provided by the PCRE library package, - which is open source software, copyright by the University of - Cambridge. - - somewhere reasonably visible in your documentation and in any relevant - files. A reference to the ftp site for the source should also be given - - ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ - - in the documentation. - -3. Altered versions must be plainly marked as such, and must not be - misrepresented as being the original software. - -4. If PCRE is embedded in any software that is released under the GNU - General Purpose Licence (GPL), then the terms of that licence shall - supersede any condition above with which it is incompatible. - -End diff --git a/srclib/pcre/Makefile.in b/srclib/pcre/Makefile.in deleted file mode 100644 index 24738722af..0000000000 --- a/srclib/pcre/Makefile.in +++ /dev/null @@ -1,20 +0,0 @@ -LTLIBRARY_NAME = libpcre.la -LTLIBRARY_SOURCES = maketables.c get.c study.c pcre.c pcreposix.c - -CLEAN_TARGETS = dftables chartables.c -DISTCLEAN_TARGETS = pcre.h pcre-config config.h $(CLEAN_TARGETS) - -include $(top_srcdir)/build/ltlib.mk - -config.h: - touch $@ - -$(LTLIBRARY_OBJECTS) dftables.lo: config.h - -dftables: dftables.lo - $(LINK) $(EXTRA_LDFLAGS) dftables.lo $(EXTRA_LIBS) - -$(srcdir)/chartables.c: dftables - ./dftables > $@ - -pcre.lo: $(srcdir)/chartables.c diff --git a/srclib/pcre/NEWS b/srclib/pcre/NEWS deleted file mode 100644 index 4c80bd6833..0000000000 --- a/srclib/pcre/NEWS +++ /dev/null @@ -1,46 +0,0 @@ -News about PCRE releases ------------------------- - -Release 3.0 01-Feb-00 ---------------------- - -1. A "configure" script is now used to configure PCRE for Unix systems. It -builds a Makefile, a config.h file, and the pcre-config script. - -2. PCRE is built as a shared library by default. - -3. There is support for POSIX classes such as [:alpha:]. - -5. There is an experimental recursion feature. - ----------------------------------------------------------------------------- - IMPORTANT FOR THOSE UPGRADING FROM VERSIONS BEFORE 2.00 - -Please note that there has been a change in the API such that a larger -ovector is required at matching time, to provide some additional workspace. -The new man page has details. This change was necessary in order to support -some of the new functionality in Perl 5.005. - - IMPORTANT FOR THOSE UPGRADING FROM VERSION 2.00 - -Another (I hope this is the last!) change has been made to the API for the -pcre_compile() function. An additional argument has been added to make it -possible to pass over a pointer to character tables built in the current -locale by pcre_maketables(). To use the default tables, this new arguement -should be passed as NULL. - - IMPORTANT FOR THOSE UPGRADING FROM VERSION 2.05 - -Yet another (and again I hope this really is the last) change has been made -to the API for the pcre_exec() function. An additional argument has been -added to make it possible to start the match other than at the start of the -subject string. This is important if there are lookbehinds. The new man -page has the details, but you just want to convert existing programs, all -you need to do is to stick in a new fifth argument to pcre_exec(), with a -value of zero. For example, change - - pcre_exec(pattern, extra, subject, length, options, ovec, ovecsize) -to - pcre_exec(pattern, extra, subject, length, 0, options, ovec, ovecsize) - -**** diff --git a/srclib/pcre/NON-UNIX-USE b/srclib/pcre/NON-UNIX-USE deleted file mode 100644 index 09a743245b..0000000000 --- a/srclib/pcre/NON-UNIX-USE +++ /dev/null @@ -1,50 +0,0 @@ -Compiling PCRE on non-Unix systems ----------------------------------- - -If you want to compile PCRE for a non-Unix system, note that it consists -entirely of code written in Standard C, and so should compile successfully -on any machine with a Standard C compiler and library, using normal compiling -commands to do the following: - -(1) Copy or rename the file config.in as config.h, and change the macros that -define HAVE_STRERROR and HAVE_MEMMOVE to define them as 1 rather than 0. -Unfortunately, because of the way Unix autoconf works, the default setting has -to be 0. - -(2) Copy or rename the file pcre.in as pcre.h, and change the macro definitions -for PCRE_MAJOR, PCRE_MINOR, and PCRE_DATE near its start to the values set in -configure.in. - -(3) Compile dftables.c as a stand-alone program, and then run it with -the standard output sent to chartables.c. This generates a set of standard -character tables. - -(4) Compile maketables.c, get.c, study.c and pcre.c and link them all -together into an object library in whichever form your system keeps such -libraries. This is the pcre library (chartables.c gets included by means of an -#include directive). - -(5) Similarly, compile pcreposix.c and link it as the pcreposix library. - -(6) Compile the test program pcretest.c. This needs the functions in the -pcre and pcreposix libraries when linking. - -(7) Run pcretest on the testinput files in the testdata directory, and check -that the output matches the corresponding testoutput files. You must use the --i option when checking testinput2. - -If you have a system without "configure" but where you can use a Makefile, edit -Makefile.in to create Makefile, substituting suitable values for the variables -at the head of the file. - -Some help in building a Win32 DLL of PCRE in GnuWin32 environments was -contributed by Paul.Sokolovsky@technologist.com. These environments are -Mingw32 (http://www.xraylith.wisc.edu/~khan/software/gnu-win32/) and -CygWin (http://sourceware.cygnus.com/cygwin/). Paul comments: - - For CygWin, set CFLAGS=-mno-cygwin, and do 'make dll'. You'll get - pcre.dll (containing pcreposix also), libpcre.dll.a, and dynamically - linked pgrep and pcretest. If you have /bin/sh, run RunTest (three - main test go ok, locale not supported). - -**** diff --git a/srclib/pcre/README b/srclib/pcre/README deleted file mode 100644 index 90aaf4d6a6..0000000000 --- a/srclib/pcre/README +++ /dev/null @@ -1,239 +0,0 @@ -README file for PCRE (Perl-compatible regular expression library) ------------------------------------------------------------------ - -The latest release of PCRE is always available from - - ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gz - -Please read the NEWS file if you are upgrading from a previous release. - - -Building PCRE on a Unix system ------------------------------- - -To build PCRE on a Unix system, run the "configure" command in the PCRE -distribution directory. This is a standard GNU "autoconf" configuration script, -for which generic instructions are supplied in INSTALL. On many systems just -running "./configure" is sufficient, but the usual methods of changing standard -defaults are available. For example - -CFLAGS='-O2 -Wall' ./configure --prefix=/opt/local - -specifies that the C compiler should be run with the flags '-O2 -Wall' instead -of the default, and that "make install" should install PCRE under /opt/local -instead of the default /usr/local. The "configure" script builds thre files: - -. Makefile is built by copying Makefile.in and making substitutions. -. config.h is built by copying config.in and making substitutions. -. pcre-config is built by copying pcre-config.in and making substitutions. - -Once "configure" has run, you can run "make". It builds two libraries called -libpcre and libpcreposix, a test program called pcretest, and the pgrep -command. You can use "make install" to copy these, and the public header file -pcre.h, to appropriate live directories on your system, in the normal way. - -Running "make install" also installs the command pcre-config, which can be used -to recall information about the PCRE configuration and installation. For -example, - - pcre-config --version - -prints the version number, and - - pcre-config --libs - -outputs information about where the library is installed. This command can be -included in makefiles for programs that use PCRE, saving the programmer from -having to remember too many details. - - -Shared libraries on Unix systems --------------------------------- - -The default distribution builds PCRE as two shared libraries. This support is -new and experimental and may not work on all systems. It relies on the -"libtool" scripts - these are distributed with PCRE. It should build a -"libtool" script and use this to compile and link shared libraries, which are -placed in a subdirectory called .libs. The programs pcretest and pgrep are -built to use these uninstalled libraries by means of wrapper scripts. When you -use "make install" to install shared libraries, pgrep and pcretest are -automatically re-built to use the newly installed libraries. However, only -pgrep is installed, as pcretest is really just a test program. - -To build PCRE using static libraries you must use --disable-shared when -configuring it. For example - -./configure --prefix=/usr/gnu --disable-shared - -Then run "make" in the usual way. - - -Building on non-Unix systems ----------------------------- - -For a non-Unix system, read the comments in the file NON-UNIX-USE. PCRE has -been compiled on Windows systems and on Macintoshes, but I don't know the -details because I don't use those systems. It should be straightforward to -build PCRE on any system that has a Standard C compiler, because it uses only -Standard C functions. - - -Testing PCRE ------------- - -To test PCRE on a Unix system, run the RunTest script in the pcre directory. -(This can also be run by "make runtest" or "make check".) For other systems, -see the instruction in NON-UNIX-USE. - -The script runs the pcretest test program (which is documented in -doc/pcretest.txt) on each of the testinput files (in the testdata directory) in -turn, and compares the output with the contents of the corresponding testoutput -file. A file called testtry is used to hold the output from pcretest. To run -pcretest on just one of the test files, give its number as an argument to -RunTest, for example: - - RunTest 3 - -The first and third test files can also be fed directly into the perltest -script to check that Perl gives the same results. The third file requires the -additional features of release 5.005, which is why it is kept separate from the -main test input, which needs only Perl 5.004. In the long run, when 5.005 is -widespread, these two test files may get amalgamated. - -The second set of tests check pcre_info(), pcre_study(), pcre_copy_substring(), -pcre_get_substring(), pcre_get_substring_list(), error detection and run-time -flags that are specific to PCRE, as well as the POSIX wrapper API. - -The fourth set of tests checks pcre_maketables(), the facility for building a -set of character tables for a specific locale and using them instead of the -default tables. The tests make use of the "fr" (French) locale. Before running -the test, the script checks for the presence of this locale by running the -"locale" command. If that command fails, or if it doesn't include "fr" in the -list of available locales, the fourth test cannot be run, and a comment is -output to say why. If running this test produces instances of the error - - ** Failed to set locale "fr" - -in the comparison output, it means that locale is not available on your system, -despite being listed by "locale". This does not mean that PCRE is broken. - -PCRE has its own native API, but a set of "wrapper" functions that are based on -the POSIX API are also supplied in the library libpcreposix.a. Note that this -just provides a POSIX calling interface to PCRE: the regular expressions -themselves still follow Perl syntax and semantics. The header file -for the POSIX-style functions is called pcreposix.h. The official POSIX name is -regex.h, but I didn't want to risk possible problems with existing files of -that name by distributing it that way. To use it with an existing program that -uses the POSIX API, it will have to be renamed or pointed at by a link. - - -Character tables ----------------- - -PCRE uses four tables for manipulating and identifying characters. The final -argument of the pcre_compile() function is a pointer to a block of memory -containing the concatenated tables. A call to pcre_maketables() can be used to -generate a set of tables in the current locale. If the final argument for -pcre_compile() is passed as NULL, a set of default tables that is built into -the binary is used. - -The source file called chartables.c contains the default set of tables. This is -not supplied in the distribution, but is built by the program dftables -(compiled from dftables.c), which uses the ANSI C character handling functions -such as isalnum(), isalpha(), isupper(), islower(), etc. to build the table -sources. This means that the default C locale which is set for your system will -control the contents of these default tables. You can change the default tables -by editing chartables.c and then re-building PCRE. If you do this, you should -probably also edit Makefile to ensure that the file doesn't ever get -re-generated. - -The first two 256-byte tables provide lower casing and case flipping functions, -respectively. The next table consists of three 32-byte bit maps which identify -digits, "word" characters, and white space, respectively. These are used when -building 32-byte bit maps that represent character classes. - -The final 256-byte table has bits indicating various character types, as -follows: - - 1 white space character - 2 letter - 4 decimal digit - 8 hexadecimal digit - 16 alphanumeric or '_' - 128 regular expression metacharacter or binary zero - -You should not alter the set of characters that contain the 128 bit, as that -will cause PCRE to malfunction. - - -Manifest --------- - -The distribution should contain the following files: - -(A) The actual source files of the PCRE library functions and their - headers: - - dftables.c auxiliary program for building chartables.c - get.c ) - maketables.c ) - study.c ) source of - pcre.c ) the functions - pcreposix.c ) - pcre.in "source" for the header for the external API; pcre.h - is built from this by "configure" - pcreposix.h header for the external POSIX wrapper API - internal.h header for internal use - config.in template for config.h, which is built by configure - -(B) Auxiliary files: - - AUTHORS information about the author of PCRE - ChangeLog log of changes to the code - INSTALL generic installation instructions - LICENCE conditions for the use of PCRE - COPYING the same, using GNU's standard name - Makefile.in template for Unix Makefile, which is built by configure - NEWS important changes in this release - NON-UNIX-USE notes on building PCRE on non-Unix systems - README this file - RunTest a Unix shell script for running tests - config.guess ) files used by libtool, - config.sub ) used only when building a shared library - configure a configuring shell script (built by autoconf) - configure.in the autoconf input used to build configure - doc/Tech.Notes notes on the encoding - doc/pcre.3 man page source for the PCRE functions - doc/pcre.html HTML version - doc/pcre.txt plain text version - doc/pcreposix.3 man page source for the POSIX wrapper API - doc/pcreposix.html HTML version - doc/pcreposix.txt plain text version - doc/pcretest.txt documentation of test program - doc/perltest.txt documentation of Perl test program - doc/pgrep.1 man page source for the pgrep utility - doc/pgrep.html HTML version - doc/pgrep.txt plain text version - install-sh a shell script for installing files - ltconfig ) files used to build "libtool", - ltmain.sh ) used only when building a shared library - pcretest.c test program - perltest Perl test program - pgrep.c source of a grep utility that uses PCRE - pcre-config.in source of script which retains PCRE information - testdata/testinput1 test data, compatible with Perl 5.004 and 5.005 - testdata/testinput2 test data for error messages and non-Perl things - testdata/testinput3 test data, compatible with Perl 5.005 - testdata/testinput4 test data for locale-specific tests - testdata/testoutput1 test results corresponding to testinput1 - testdata/testoutput2 test results corresponding to testinput2 - testdata/testoutput3 test results corresponding to testinput3 - testdata/testoutput4 test results corresponding to testinput4 - -(C) Auxiliary files for Win32 DLL - - dll.mk - pcre.def - -Philip Hazel <ph10@cam.ac.uk> -February 2000 diff --git a/srclib/pcre/RunTest b/srclib/pcre/RunTest deleted file mode 100755 index 85eeb6245e..0000000000 --- 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.guess b/srclib/pcre/config.guess deleted file mode 100644 index e1b5871708..0000000000 --- a/srclib/pcre/config.guess +++ /dev/null @@ -1,1121 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 -# Free Software Foundation, Inc. -# -# 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. - -# Written by Per Bothner <bothner@cygnus.com>. -# The master version of this file is at the FSF in /home/gd/gnu/lib. -# Please send patches to <autoconf-patches@gnu.org>. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit system type (host/target name). -# -# Only a few systems have been added to this list; please add others -# (but try to keep the structure clean). -# - -# Use $HOST_CC if defined. $CC may point to a cross-compiler -if test x"$CC_FOR_BUILD" = x; then - if test x"$HOST_CC" != x; then - CC_FOR_BUILD="$HOST_CC" - else - if test x"$CC" != x; then - CC_FOR_BUILD="$CC" - else - CC_FOR_BUILD=cc - fi - fi -fi - - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 8/24/94.) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - cat <<EOF >$dummy.s - .globl main - .ent main -main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-cbm-sysv4 - exit 0;; - amiga:NetBSD:*:*) - echo m68k-cbm-netbsd${UNAME_RELEASE} - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; - arc64:OpenBSD:*:*) - echo mips64el-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hkmips:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - arm32:NetBSD:*:*) - echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - SR2?01:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit 0 ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit 0 ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit 0 ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; - atari*:NetBSD:*:*) - echo m68k-atari-netbsd${UNAME_RELEASE} - exit 0 ;; - atari*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; - sun3*:NetBSD:*:*) - echo m68k-sun-netbsd${UNAME_RELEASE} - exit 0 ;; - sun3*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:NetBSD:*:*) - echo m68k-apple-netbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; - macppc:NetBSD:*:*) - echo powerpc-apple-netbsd${UNAME_RELEASE} - exit 0 ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy \ - && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit 0 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit 0 ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit 0 ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit 0 ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit 0 ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit 0 ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit 0 ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit 0 ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit 0 ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i?86:AIX:*:*) - echo i386-ibm-aix - exit 0 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - sed 's/^ //' << EOF >$dummy.c - #include <sys/systemcfg.h> - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo rs6000-ibm-aix3.2.5 - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit 0 ;; - *:AIX:*:4) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` - if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=4.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit 0 ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit 0 ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit 0 ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit 0 ;; - 9000/[34678]??:HP-UX:*:*) - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - sed 's/^ //' << EOF >$dummy.c - #include <stdlib.h> - #include <unistd.h> - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` - rm -f $dummy.c $dummy - esac - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - sed 's/^ //' << EOF >$dummy.c - #include <unistd.h> - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - *9??*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit 0 ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit 0 ;; - i?86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit 0 ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit 0 ;; - hppa*:OpenBSD:*:*) - echo hppa-unknown-openbsd - exit 0 ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit 0 ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit 0 ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit 0 ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit 0 ;; - CRAY*X-MP:*:*:*) - echo xmp-cray-unicos - exit 0 ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} - exit 0 ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} - exit 0 ;; - CRAY*T3E:*:*:*) - echo alpha-cray-unicosmk${UNAME_RELEASE} - exit 0 ;; - CRAY-2:*:*:*) - echo cray2-cray-unicos - exit 0 ;; - F300:UNIX_System_V:*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - F301:UNIX_System_V:*:*) - echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` - exit 0 ;; - hp3[0-9][05]:NetBSD:*:*) - echo m68k-hp-netbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - i?86:BSD/386:*:* | i?86:BSD/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*) - if test -x /usr/bin/objformat; then - if test "elf" = "`/usr/bin/objformat`"; then - echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` - exit 0 - fi - fi - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; - *:NetBSD:*:*) - echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i386-pc-interix - exit 0 ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit 0 ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - *:Linux:*:*) - - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - ld_help_string=`cd /; ld --help 2>&1` - ld_supported_emulations=`echo $ld_help_string \ - | sed -ne '/supported emulations:/!d - s/[ ][ ]*/ /g - s/.*supported emulations: *// - s/ .*// - p'` - case "$ld_supported_emulations" in - *ia64) - echo "${UNAME_MACHINE}-unknown-linux" - exit 0 - ;; - i?86linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 - ;; - i?86coff) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 - ;; - sparclinux) - echo "${UNAME_MACHINE}-unknown-linux-gnuaout" - exit 0 - ;; - armlinux) - echo "${UNAME_MACHINE}-unknown-linux-gnuaout" - exit 0 - ;; - elf32arm*) - echo "${UNAME_MACHINE}-unknown-linux-gnu" - exit 0 - ;; - armelf_linux*) - echo "${UNAME_MACHINE}-unknown-linux-gnu" - exit 0 - ;; - m68klinux) - echo "${UNAME_MACHINE}-unknown-linux-gnuaout" - exit 0 - ;; - elf32ppc) - # Determine Lib Version - cat >$dummy.c <<EOF -#include <features.h> -#if defined(__GLIBC__) -extern char __libc_version[]; -extern char __libc_release[]; -#endif -main(argc, argv) - int argc; - char *argv[]; -{ -#if defined(__GLIBC__) - printf("%s %s\n", __libc_version, __libc_release); -#else - printf("unkown\n"); -#endif - return 0; -} -EOF - LIBC="" - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy | grep 1\.99 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.c $dummy - echo powerpc-unknown-linux-gnu${LIBC} - exit 0 - ;; - esac - - if test "${UNAME_MACHINE}" = "alpha" ; then - sed 's/^ //' <<EOF >$dummy.s - .globl main - .ent main - main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - LIBC="" - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - - objdump --private-headers $dummy | \ - grep ld.so.1 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 - elif test "${UNAME_MACHINE}" = "mips" ; then - cat >$dummy.c <<EOF -#ifdef __cplusplus - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __MIPSEB__ - printf ("%s-unknown-linux-gnu\n", argv[1]); -#endif -#ifdef __MIPSEL__ - printf ("%sel-unknown-linux-gnu\n", argv[1]); -#endif - return 0; -} -EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - else - # Either a pre-BFD a.out linker (linux-gnuoldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" - test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - - case "${UNAME_MACHINE}" in - i?86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; - ;; - esac - # Determine whether the default compiler is a.out or elf - cat >$dummy.c <<EOF -#include <features.h> -#ifdef __cplusplus - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __ELF__ -# ifdef __GLIBC__ -# if __GLIBC__ >= 2 - printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif -#else - printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); -#endif - return 0; -} -EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - fi ;; -# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions -# are messed up and put the nodename in both sysname and nodename. - i?86:DYNIX/ptx:4*:*) - echo i386-sequent-sysv4 - exit 0 ;; - i?86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; - i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit 0 ;; - i?86:*:5:7*) - # Fixed at (any) Pentium or better - UNAME_MACHINE=i586 - if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then - echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} - fi - exit 0 ;; - i?86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` - echo ${UNAME_MACHINE}-pc-isc$UNAME_REL - elif /bin/uname -X 2>/dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit 0 ;; - pc:*:*:*) - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit 0 ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit 0 ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit 0 ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit 0 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit 0 ;; - PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes <hewes@openmarket.com>. - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit 0 ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - news*:NEWS-OS:*:6*) - echo mips-sony-newsos6 - exit 0 ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit 0 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit 0 ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit 0 ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit 0 ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:QNX:*:4*) - echo i386-qnx-qnx${UNAME_VERSION} - exit 0 ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -cat >$dummy.c <<EOF -#ifdef _SEQUENT_ -# include <sys/types.h> -# include <sys/utsname.h> -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include <sys/param.h> - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -#if !defined (ultrix) - printf ("vax-dec-bsd\n"); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); -#endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 -rm -f $dummy.c $dummy - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - esac -fi - -#echo '(Unable to guess system type)' 1>&2 - -exit 1 diff --git a/srclib/pcre/config.hw b/srclib/pcre/config.hw deleted file mode 100644 index 124f5de2ce..0000000000 --- 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 <stddef.h> 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/config.in b/srclib/pcre/config.in deleted file mode 100644 index 02f425936d..0000000000 --- a/srclib/pcre/config.in +++ /dev/null @@ -1,33 +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. If your system -has bcopy() and not memmove(), change the definition of HAVE_BCOPY instead of -HAVE_MEMMOVE. If your system has neither bcopy() nor memmove(), leave them both -as 0; an emulation function will be used. */ - -/* Define to empty if the keyword does not work. */ - -#undef const - -/* Define to `unsigned' if <stddef.h> 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 HAVE_STRERROR and HAVE_MEMMOVE 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. If HAVE_MEMMOVE is set to 1, the value of HAVE_BCOPY is not relevant. */ - -#define HAVE_STRERROR 0 -#define HAVE_MEMMOVE 0 -#define HAVE_BCOPY 0 - -/* End */ diff --git a/srclib/pcre/config.sub b/srclib/pcre/config.sub deleted file mode 100644 index 28426bb8fa..0000000000 --- a/srclib/pcre/config.sub +++ /dev/null @@ -1,1232 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc. -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# 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. - -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -if [ x$1 = x ] -then - echo Configuration name missing. 1>&2 - echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 - echo "or $0 ALIAS" 1>&2 - echo where ALIAS is a recognized configuration type. 1>&2 - exit 1 -fi - -# First pass through any local machine types. -case $1 in - *local*) - echo $1 - exit 0 - ;; - *) - ;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - linux-gnu*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ - | 580 | i960 | h8300 \ - | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ - | alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \ - | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ - | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ - | mips64orion | mips64orionel | mipstx39 | mipstx39el \ - | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ - | mips64vr5000 | miprs64vr5000el | mcore \ - | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ - | thumb | d10v | fr30) - basic_machine=$basic_machine-unknown - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i[34567]86) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - # FIXME: clean up the formatting here. - vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ - | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ - | xmp-* | ymp-* \ - | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \ - | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \ - | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ - | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ - | mipstx39-* | mipstx39el-* | mcore-* \ - | f301-* | armv*-* | t3e-* \ - | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ - | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* ) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-cbm - ;; - amigaos | amigados) - basic_machine=m68k-cbm - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-cbm - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | ymp) - basic_machine=ymp-cray - os=-unicos - ;; - cray2) - basic_machine=cray2-cray - os=-unicos - ;; - [ctj]90-cray) - basic_machine=c90-cray - os=-unicos - ;; - crds | unos) - basic_machine=m68k-crds - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i[34567]86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i[34567]86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i[34567]86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i[34567]86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - i386-go32 | go32) - basic_machine=i386-unknown - os=-go32 - ;; - i386-mingw32 | mingw32) - basic_machine=i386-unknown - os=-mingw32 - ;; - i386-qnx | qnx) - basic_machine=i386-qnx - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mipsel*-linux*) - basic_machine=mipsel-unknown - os=-linux-gnu - ;; - mips*-linux*) - basic_machine=mips-unknown - os=-linux-gnu - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - msdos) - basic_machine=i386-unknown - os=-msdos - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - np1) - basic_machine=np1-gould - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pentium | p5 | k5 | k6 | nexen) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86) - basic_machine=i686-pc - ;; - pentiumii | pentium2) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexen-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=rs6000-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sparclite-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=t3e-cray - os=-unicos - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xmp) - basic_machine=xmp-cray - os=-unicos - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - mips) - if [ x$os = x-linux-gnu ]; then - basic_machine=mips-unknown - else - basic_machine=mips-mips - fi - ;; - romp) - basic_machine=romp-ibm - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sparc | sparcv9) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - c4x*) - basic_machine=c4x-none - os=-coff - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -opened* | -openstep* | -oskit*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ - | -macos* | -mpw* | -magic* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -ns2 ) - os=-nextstep2 - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -qnx) - os=-qnx4 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -*MiNT) - os=-mint - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-ibm) - os=-aix - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f301-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -vxsim* | -vxworks*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -*MiNT) - vendor=atari - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os diff --git a/srclib/pcre/configure.in b/srclib/pcre/configure.in deleted file mode 100644 index 0b15310313..0000000000 --- a/srclib/pcre/configure.in +++ /dev/null @@ -1,75 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -dnl This is required at the start; the name is the name of a file -dnl it should be seeing, to verify it is in the same directory. - -AC_INIT(dftables.c) - -dnl Arrange to build config.h from config.in. Note that pcre.h is -dnl built differently, as it is just a "substitution" file. -dnl Manual says this macro should come right after AC_INIT. -AC_CONFIG_HEADER(config.h:config.in) - -dnl Provide the current PCRE version information. Do not use numbers -dnl with leading zeros for the minor version, as they end up in a C -dnl macro, and may be treated as octal constants. Stick to single -dnl digits for minor numbers less than 10. There are unlikely to be -dnl that many releases anyway. - -PCRE_MAJOR=3 -PCRE_MINOR=2 -PCRE_DATE=12-May-2000 -PCRE_VERSION=${PCRE_MAJOR}.${PCRE_MINOR} - -dnl Provide versioning information for libtool shared libraries that -dnl are built by default on Unix systems. - -PCRE_LIB_VERSION=0:1:0 -PCRE_POSIXLIB_VERSION=0:0:0 - -dnl Checks for programs. - -AC_PROG_CC -AC_PROG_RANLIB - -dnl Checks for header files. - -AC_HEADER_STDC -AC_CHECK_HEADERS(limits.h) - -dnl Checks for typedefs, structures, and compiler characteristics. - -AC_C_CONST -AC_TYPE_SIZE_T - -dnl Checks for library functions. - -AC_CHECK_FUNCS(bcopy memmove strerror) - -dnl Handle --enable-shared-libraries - -LIBTOOL=./libtool -LIBSUFFIX=la -AC_ARG_ENABLE(shared, -[ --disable-shared build PCRE as a static library], -if test "$enableval" = "no"; then - LIBTOOL= - LIBSUFFIX=a -fi -) - -dnl "Export" these variables - -AC_SUBST(HAVE_MEMMOVE) -AC_SUBST(HAVE_STRERROR) -AC_SUBST(LIBTOOL) -AC_SUBST(LIBSUFFIX) -AC_SUBST(PCRE_MAJOR) -AC_SUBST(PCRE_MINOR) -AC_SUBST(PCRE_DATE) -AC_SUBST(PCRE_VERSION) -AC_SUBST(PCRE_LIB_VERSION) -AC_SUBST(PCRE_POSIXLIB_VERSION) - -dnl This must be last; it determines what files are written -AC_OUTPUT(Makefile pcre.h:pcre.in pcre-config,[chmod a+x pcre-config]) diff --git a/srclib/pcre/dftables.c b/srclib/pcre/dftables.c deleted file mode 100644 index d572dfd3e6..0000000000 --- a/srclib/pcre/dftables.c +++ /dev/null @@ -1,148 +0,0 @@ -/************************************************* -* Perl-Compatible Regular Expressions * -*************************************************/ - -/* -PCRE is a library of functions to support regular expressions whose syntax -and semantics are as close as possible to those of the Perl 5 language. - -Written by: Philip Hazel <ph10@cam.ac.uk> - - Copyright (c) 1997-2000 University of Cambridge - ------------------------------------------------------------------------------ -Permission is granted to anyone to use this software for any purpose on any -computer system, and to redistribute it freely, subject to the following -restrictions: - -1. This software 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. - -2. The origin of this software must not be misrepresented, either by - explicit claim or by omission. - -3. Altered versions must be plainly marked as such, and must not be - misrepresented as being the original software. - -4. If PCRE is embedded in any software that is released under the GNU - General Purpose Licence (GPL), then the terms of that licence shall - supersede any condition above with which it is incompatible. ------------------------------------------------------------------------------ - -See the file Tech.Notes for some information on the internals. -*/ - - -/* This is a support program to generate the file chartables.c, containing -character tables of various kinds. They are built according to the default C -locale and used as the default tables by PCRE. Now that pcre_maketables is -a function visible to the outside world, we make use of its code from here in -order to be consistent. */ - -#include <ctype.h> -#include <stdio.h> -#include <string.h> - -#include "internal.h" - -#define DFTABLES /* maketables.c notices this */ -#include "maketables.c" - - -int main(void) -{ -int i; -unsigned const char *tables = pcre_maketables(); - -printf( - "/*************************************************\n" - "* Perl-Compatible Regular Expressions *\n" - "*************************************************/\n\n" - "/* This file is automatically written by the dftables auxiliary \n" - "program. If you edit it by hand, you might like to edit the Makefile to \n" - "prevent its ever being regenerated.\n\n" - "This file is #included in the compilation of pcre.c to build the default\n" - "character tables which are used when no tables are passed to the compile\n" - "function. */\n\n" - "static unsigned char pcre_default_tables[] = {\n\n" - "/* This table is a lower casing table. */\n\n"); - -printf(" "); -for (i = 0; i < 256; i++) - { - if ((i & 7) == 0 && i != 0) printf("\n "); - printf("%3d", *tables++); - if (i != 255) printf(","); - } -printf(",\n\n"); - -printf("/* This table is a case flipping table. */\n\n"); - -printf(" "); -for (i = 0; i < 256; i++) - { - if ((i & 7) == 0 && i != 0) printf("\n "); - printf("%3d", *tables++); - if (i != 255) printf(","); - } -printf(",\n\n"); - -printf( - "/* This table contains bit maps for various character classes.\n" - "Each map is 32 bytes long and the bits run from the least\n" - "significant end of each byte. The classes that have their own\n" - "maps are: space, xdigit, digit, upper, lower, word, graph\n" - "print, punct, and cntrl. Other classes are built from combinations. */\n\n"); - -printf(" "); -for (i = 0; i < cbit_length; i++) - { - if ((i & 7) == 0 && i != 0) - { - if ((i & 31) == 0) printf("\n"); - printf("\n "); - } - printf("0x%02x", *tables++); - if (i != cbit_length - 1) printf(","); - } -printf(",\n\n"); - -printf( - "/* This table identifies various classes of character by individual bits:\n" - " 0x%02x white space character\n" - " 0x%02x letter\n" - " 0x%02x decimal digit\n" - " 0x%02x hexadecimal digit\n" - " 0x%02x alphanumeric or '_'\n" - " 0x%02x regular expression metacharacter or binary zero\n*/\n\n", - ctype_space, ctype_letter, ctype_digit, ctype_xdigit, ctype_word, - ctype_meta); - -printf(" "); -for (i = 0; i < 256; i++) - { - if ((i & 7) == 0 && i != 0) - { - printf(" /* "); - if (isprint(i-8)) printf(" %c -", i-8); - else printf("%3d-", i-8); - if (isprint(i-1)) printf(" %c ", i-1); - else printf("%3d", i-1); - printf(" */\n "); - } - printf("0x%02x", *tables++); - if (i != 255) printf(","); - } - -printf("};/* "); -if (isprint(i-8)) printf(" %c -", i-8); - else printf("%3d-", i-8); -if (isprint(i-1)) printf(" %c ", i-1); - else printf("%3d", i-1); -printf(" */\n\n/* End of chartables.c */\n"); - -return 0; -} - -/* End of dftables.c */ diff --git a/srclib/pcre/dftables.dsp b/srclib/pcre/dftables.dsp deleted file mode 100644 index 744ae5c045..0000000000 --- a/srclib/pcre/dftables.dsp +++ /dev/null @@ -1,165 +0,0 @@ -# Microsoft Developer Studio Project File - Name="dftables" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.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 AllowPerConfigDependencies 0 -# 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 "" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" -# 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" /Fd"Release\dftables" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /D "_WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fd"Release\dftables" /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 /incremental:no /pdb:"Release\dftables.pdb" /map /machine:I386 -# ADD LINK32 kernel32.lib /nologo /subsystem:console /incremental:no /pdb:"Release\dftables.pdb" /map /machine:I386 - -!ELSEIF "$(CFG)" == "dftables - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" -# 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" /Fd"Debug\dftables" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /D "_WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fd"Debug\dftables" /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 /incremental:no /pdb:"Debug\dftables.pdb" /map /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib /nologo /subsystem:console /incremental:no /pdb:"Debug\dftables.pdb" /map /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)" - copy .\config.hw .\config.h >nul - echo Created pcre config.h from config.hw - -# End Custom Build - -!ELSEIF "$(CFG)" == "dftables - Win32 Debug" - -# Begin Custom Build -InputPath=.\config.hw - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\config.hw .\config.h >nul - echo Created pcre config.h from config.hw - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\internal.h -# End Source File -# Begin Source File - -SOURCE=.\maketables.c -# PROP Exclude_From_Build 1 -# 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)" - copy .\pcre.hw .\pcre.h >nul - echo Created pcre.h from pcre.hw - -# End Custom Build - -!ELSEIF "$(CFG)" == "dftables - Win32 Debug" - -# Begin Custom Build -InputPath=.\pcre.hw - -".\pcre.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\pcre.hw .\pcre.h >nul - echo Created pcre.h from pcre.hw - -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# End Target -# End Project diff --git a/srclib/pcre/dftables.mak b/srclib/pcre/dftables.mak deleted file mode 100644 index 1b8e847689..0000000000 --- a/srclib/pcre/dftables.mak +++ /dev/null @@ -1,255 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on dftables.dsp -!IF "$(CFG)" == "" -CFG=dftables - Win32 Debug -!MESSAGE No configuration specified. Defaulting to dftables - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "dftables - Win32 Release" && "$(CFG)" !=\ - "dftables - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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 -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "dftables - Win32 Release" - -OUTDIR=. -INTDIR=.\Release -# Begin Custom Macros -OutDir=. -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\dftables.exe" - -!ELSE - -ALL : "$(OUTDIR)\dftables.exe" - -!ENDIF - -CLEAN : - -@erase "$(INTDIR)\dftables.idb" - -@erase "$(INTDIR)\dftables.obj" - -@erase "$(OUTDIR)\dftables.exe" - -@erase "$(OUTDIR)\Release\dftables.map" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /D "_WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS"\ - /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\dftables" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\dftables.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:console /incremental:no\ - /pdb:"$(OUTDIR)\Release\dftables.pdb" /map:"$(INTDIR)\dftables.map"\ - /machine:I386 /out:"$(OUTDIR)\dftables.exe" -LINK32_OBJS= \ - "$(INTDIR)\dftables.obj" - -"$(OUTDIR)\dftables.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "dftables - Win32 Debug" - -OUTDIR=. -INTDIR=.\Debug -# Begin Custom Macros -OutDir=. -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\dftables.exe" - -!ELSE - -ALL : "$(OUTDIR)\dftables.exe" - -!ENDIF - -CLEAN : - -@erase "$(INTDIR)\dftables.idb" - -@erase "$(INTDIR)\dftables.obj" - -@erase "$(OUTDIR)\Debug\dftables.map" - -@erase "$(OUTDIR)\Debug\dftables.pdb" - -@erase "$(OUTDIR)\dftables.exe" - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Zi /Od /D "_WIN32" /D "_DEBUG" /D "_CONSOLE" /D\ - "_MBCS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\dftables" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\dftables.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib /nologo /subsystem:console /incremental:no\ - /pdb:"$(OUTDIR)\Debug\dftables.pdb" /map:"$(INTDIR)\dftables.map" /debug\ - /machine:I386 /out:"$(OUTDIR)\dftables.exe" -LINK32_OBJS= \ - "$(INTDIR)\dftables.obj" - -"$(OUTDIR)\dftables.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "dftables - Win32 Release" || "$(CFG)" ==\ - "dftables - Win32 Debug" -SOURCE=.\dftables.c -DEP_CPP_DFTAB=\ - ".\config.h"\ - ".\internal.h"\ - ".\maketables.c"\ - ".\pcre.h"\ - - -"$(INTDIR)\dftables.obj" : $(SOURCE) $(DEP_CPP_DFTAB) "$(INTDIR)" ".\config.h"\ - ".\pcre.h" - - -SOURCE=.\config.hw - -!IF "$(CFG)" == "dftables - Win32 Release" - -InputPath=.\config.hw - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\config.hw .\config.h >nul - echo Created pcre config.h from config.hw - - -!ELSEIF "$(CFG)" == "dftables - Win32 Debug" - -InputPath=.\config.hw - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\config.hw .\config.h >nul - echo Created pcre config.h from config.hw - - -!ENDIF - -SOURCE=.\maketables.c -SOURCE=.\pcre.hw - -!IF "$(CFG)" == "dftables - Win32 Release" - -InputPath=.\pcre.hw - -".\pcre.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\pcre.hw .\pcre.h >nul - echo Created pcre.h from pcre.hw - - -!ELSEIF "$(CFG)" == "dftables - Win32 Debug" - -InputPath=.\pcre.hw - -".\pcre.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\pcre.hw .\pcre.h >nul - echo Created pcre.h from pcre.hw - - -!ENDIF - - -!ENDIF - diff --git a/srclib/pcre/dll.mk b/srclib/pcre/dll.mk deleted file mode 100644 index d8b728e57e..0000000000 --- a/srclib/pcre/dll.mk +++ /dev/null @@ -1,60 +0,0 @@ -# dll.mk - auxilary Makefile to easy build dll's for mingw32 target -# ver. 0.6 of 1999-03-25 -# -# Homepage of this makefile - http://www.is.lg.ua/~paul/devel/ -# Homepage of original mingw32 project - -# http://www.fu.is.saga-u.ac.jp/~colin/gcc.html -# -# How to use: -# This makefile can: -# 1. Create automatical .def file from list of objects -# 2. Create .dll from objects and .def file, either automatical, or your -# hand-written (maybe) file, which must have same basename as dll -# WARNING! There MUST be object, which name match dll's name. Make sux. -# 3. Create import library from .def (as for .dll, only its name required, -# not dll itself) -# By convention implibs for dll have .dll.a suffix, e.g. libstuff.dll.a -# Why not just libstuff.a? 'Cos that's name for static lib, ok? -# Process divided into 3 phases because: -# 1. Pre-existent .def possible -# 2. Generating implib is enough time-consuming -# -# Variables: -# DLL_LDLIBS - libs for linking dll -# DLL_LDFLAGS - flags for linking dll -# -# By using $(DLL_SUFFIX) instead of 'dll', e.g. stuff.$(DLL_SUFFIX) -# you may help porting makefiles to other platforms -# -# Put this file in your make's include path (e.g. main include dir, for -# more information see include section in make doc). Put in the beginning -# of your own Makefile line "include dll.mk". Specify dependences, e.g.: -# -# Do all stuff in one step -# libstuff.dll.a: $(OBJECTS) stuff.def -# stuff.def: $(OBJECTS) -# -# Steps separated, pre-provided .def, link with user32 -# -# DLL_LDLIBS=-luser32 -# stuff.dll: $(OBJECTS) -# libstuff.dll.a: $(OBJECTS) - - -DLLWRAP=dllwrap -DLLTOOL=dlltool - -DLL_SUFFIX=dll - -.SUFFIXES: .o .$(DLL_SUFFIX) - -_%.def: %.o - $(DLLTOOL) --export-all --output-def $@ $^ - -%.$(DLL_SUFFIX): %.o - $(DLLWRAP) --dllname $(notdir $@) --driver-name $(CC) --def $*.def -o $@ $(filter %.o,$^) $(DLL_LDFLAGS) $(DLL_LDLIBS) - -lib%.$(DLL_SUFFIX).a:%.def - $(DLLTOOL) --dllname $(notdir $*.dll) --def $< --output-lib $@ - -# End diff --git a/srclib/pcre/doc/Tech.Notes b/srclib/pcre/doc/Tech.Notes deleted file mode 100644 index 03904db3cc..0000000000 --- a/srclib/pcre/doc/Tech.Notes +++ /dev/null @@ -1,242 +0,0 @@ -Technical Notes about PCRE --------------------------- - -Many years ago I implemented some regular expression functions to an algorithm -suggested by Martin Richards. These were not Unix-like in form, and were quite -restricted in what they could do by comparison with Perl. The interesting part -about the algorithm was that the amount of space required to hold the compiled -form of an expression was known in advance. The code to apply an expression did -not operate by backtracking, as the Henry Spencer and Perl code does, but -instead checked all possibilities simultaneously by keeping a list of current -states and checking all of them as it advanced through the subject string. (In -the terminology of Jeffrey Friedl's book, it was a "DFA algorithm".) When the -pattern was all used up, all remaining states were possible matches, and the -one matching the longest subset of the subject string was chosen. This did not -necessarily maximize the individual wild portions of the pattern, as is -expected in Unix and Perl-style regular expressions. - -By contrast, the code originally written by Henry Spencer and subsequently -heavily modified for Perl actually compiles the expression twice: once in a -dummy mode in order to find out how much store will be needed, and then for -real. The execution function operates by backtracking and maximizing (or, -optionally, minimizing in Perl) the amount of the subject that matches -individual wild portions of the pattern. This is an "NFA algorithm" in Friedl's -terminology. - -For the set of functions that forms PCRE (which are unrelated to those -mentioned above), I tried at first to invent an algorithm that used an amount -of store bounded by a multiple of the number of characters in the pattern, to -save on compiling time. However, because of the greater complexity in Perl -regular expressions, I couldn't do this. In any case, a first pass through the -pattern is needed, in order to find internal flag settings like (?i) at top -level. So PCRE works by running a very degenerate first pass to calculate a -maximum store size, and then a second pass to do the real compile - which may -use a bit less than the predicted amount of store. The idea is that this is -going to turn out faster because the first pass is degenerate and the second -pass can just store stuff straight into the vector. It does make the compiling -functions bigger, of course, but they have got quite big anyway to handle all -the Perl stuff. - -The compiled form of a pattern is a vector of bytes, containing items of -variable length. The first byte in an item is an opcode, and the length of the -item is either implicit in the opcode or contained in the data bytes which -follow it. A list of all the opcodes follows: - -Opcodes with no following data ------------------------------- - -These items are all just one byte long - - OP_END end of pattern - OP_ANY match any character - OP_SOD match start of data: \A - OP_CIRC ^ (start of data, or after \n in multiline) - OP_NOT_WORD_BOUNDARY \W - OP_WORD_BOUNDARY \w - OP_NOT_DIGIT \D - OP_DIGIT \d - OP_NOT_WHITESPACE \S - OP_WHITESPACE \s - OP_NOT_WORDCHAR \W - OP_WORDCHAR \w - OP_EODN match end of data or \n at end: \Z - OP_EOD match end of data: \z - OP_DOLL $ (end of data, or before \n in multiline) - OP_RECURSE match the pattern recursively - - -Repeating single characters ---------------------------- - -The common repeats (*, +, ?) when applied to a single character appear as -two-byte items using the following opcodes: - - OP_STAR - OP_MINSTAR - OP_PLUS - OP_MINPLUS - OP_QUERY - OP_MINQUERY - -Those with "MIN" in their name are the minimizing versions. Each is followed by -the character that is to be repeated. Other repeats make use of - - OP_UPTO - OP_MINUPTO - OP_EXACT - -which are followed by a two-byte count (most significant first) and the -repeated character. OP_UPTO matches from 0 to the given number. A repeat with a -non-zero minimum and a fixed maximum is coded as an OP_EXACT followed by an -OP_UPTO (or OP_MINUPTO). - - -Repeating character types -------------------------- - -Repeats of things like \d are done exactly as for single characters, except -that instead of a character, the opcode for the type is stored in the data -byte. The opcodes are: - - OP_TYPESTAR - OP_TYPEMINSTAR - OP_TYPEPLUS - OP_TYPEMINPLUS - OP_TYPEQUERY - OP_TYPEMINQUERY - OP_TYPEUPTO - OP_TYPEMINUPTO - OP_TYPEEXACT - - -Matching a character string ---------------------------- - -The OP_CHARS opcode is followed by a one-byte count and then that number of -characters. If there are more than 255 characters in sequence, successive -instances of OP_CHARS are used. - - -Character classes ------------------ - -OP_CLASS is used for a character class, provided there are at least two -characters in the class. If there is only one character, OP_CHARS is used for a -positive class, and OP_NOT for a negative one (that is, for something like -[^a]). Another set of repeating opcodes (OP_NOTSTAR etc.) are used for a -repeated, negated, single-character class. The normal ones (OP_STAR etc.) are -used for a repeated positive single-character class. - -OP_CLASS is followed by a 32-byte bit map containing a 1 bit for every -character that is acceptable. The bits are counted from the least significant -end of each byte. - - -Back references ---------------- - -OP_REF is followed by a single byte containing the reference number. - - -Repeating character classes and back references ------------------------------------------------ - -Single-character classes are handled specially (see above). This applies to -OP_CLASS and OP_REF. In both cases, the repeat information follows the base -item. The matching code looks at the following opcode to see if it is one of - - OP_CRSTAR - OP_CRMINSTAR - OP_CRPLUS - OP_CRMINPLUS - OP_CRQUERY - OP_CRMINQUERY - OP_CRRANGE - OP_CRMINRANGE - -All but the last two are just single-byte items. The others are followed by -four bytes of data, comprising the minimum and maximum repeat counts. - - -Brackets and alternation ------------------------- - -A pair of non-capturing (round) brackets is wrapped round each expression at -compile time, so alternation always happens in the context of brackets. -Non-capturing brackets use the opcode OP_BRA, while capturing brackets use -OP_BRA+1, OP_BRA+2, etc. [Note for North Americans: "bracket" to some English -speakers, including myself, can be round, square, curly, or pointy. Hence this -usage.] - -A bracket opcode is followed by two bytes which give the offset to the next -alternative OP_ALT or, if there aren't any branches, to the matching KET -opcode. Each OP_ALT is followed by two bytes giving the offset to the next one, -or to the KET opcode. - -OP_KET is used for subpatterns that do not repeat indefinitely, while -OP_KETRMIN and OP_KETRMAX are used for indefinite repetitions, minimally or -maximally respectively. All three are followed by two bytes giving (as a -positive number) the offset back to the matching BRA opcode. - -If a subpattern is quantified such that it is permitted to match zero times, it -is preceded by one of OP_BRAZERO or OP_BRAMINZERO. These are single-byte -opcodes which tell the matcher that skipping this subpattern entirely is a -valid branch. - -A subpattern with an indefinite maximum repetition is replicated in the -compiled data its minimum number of times (or once with a BRAZERO if the -minimum is zero), with the final copy terminating with a KETRMIN or KETRMAX as -appropriate. - -A subpattern with a bounded maximum repetition is replicated in a nested -fashion up to the maximum number of times, with BRAZERO or BRAMINZERO before -each replication after the minimum, so that, for example, (abc){2,5} is -compiled as (abc)(abc)((abc)((abc)(abc)?)?)?. The 200-bracket limit does not -apply to these internally generated brackets. - - -Assertions ----------- - -Forward assertions are just like other subpatterns, but starting with one of -the opcodes OP_ASSERT or OP_ASSERT_NOT. Backward assertions use the opcodes -OP_ASSERTBACK and OP_ASSERTBACK_NOT, and the first opcode inside the assertion -is OP_REVERSE, followed by a two byte count of the number of characters to move -back the pointer in the subject string. A separate count is present in each -alternative of a lookbehind assertion, allowing them to have different fixed -lengths. - - -Once-only subpatterns ---------------------- - -These are also just like other subpatterns, but they start with the opcode -OP_ONCE. - - -Conditional subpatterns ------------------------ - -These are like other subpatterns, but they start with the opcode OP_COND. If -the condition is a back reference, this is stored at the start of the -subpattern using the opcode OP_CREF followed by one byte containing the -reference number. Otherwise, a conditional subpattern will always start with -one of the assertions. - - -Changing options ----------------- - -If any of the /i, /m, or /s options are changed within a parenthesized group, -an OP_OPT opcode is compiled, followed by one byte containing the new settings -of these flags. If there are several alternatives in a group, there is an -occurrence of OP_OPT at the start of all those following the first options -change, to set appropriate options for the start of the alternative. -Immediately after the end of the group there is another such item to reset the -flags to their previous values. Other changes of flag within the pattern can be -handled entirely at compile time, and so do not cause anything to be put into -the compiled data. - - -Philip Hazel -February 2000 diff --git a/srclib/pcre/doc/pcre.3 b/srclib/pcre/doc/pcre.3 deleted file mode 100644 index 4334be2440..0000000000 --- a/srclib/pcre/doc/pcre.3 +++ /dev/null @@ -1,1701 +0,0 @@ -.TH PCRE 3 -.SH NAME -pcre - Perl-compatible regular expressions. -.SH SYNOPSIS -.B #include <pcre.h> -.PP -.SM -.br -.B pcre *pcre_compile(const char *\fIpattern\fR, int \fIoptions\fR, -.ti +5n -.B const char **\fIerrptr\fR, int *\fIerroffset\fR, -.ti +5n -.B const unsigned char *\fItableptr\fR); -.PP -.br -.B pcre_extra *pcre_study(const pcre *\fIcode\fR, int \fIoptions\fR, -.ti +5n -.B const char **\fIerrptr\fR); -.PP -.br -.B int pcre_exec(const pcre *\fIcode\fR, "const pcre_extra *\fIextra\fR," -.ti +5n -.B "const char *\fIsubject\fR," int \fIlength\fR, int \fIstartoffset\fR, -.ti +5n -.B int \fIoptions\fR, int *\fIovector\fR, int \fIovecsize\fR); -.PP -.br -.B int pcre_copy_substring(const char *\fIsubject\fR, int *\fIovector\fR, -.ti +5n -.B int \fIstringcount\fR, int \fIstringnumber\fR, char *\fIbuffer\fR, -.ti +5n -.B int \fIbuffersize\fR); -.PP -.br -.B int pcre_get_substring(const char *\fIsubject\fR, int *\fIovector\fR, -.ti +5n -.B int \fIstringcount\fR, int \fIstringnumber\fR, -.ti +5n -.B const char **\fIstringptr\fR); -.PP -.br -.B int pcre_get_substring_list(const char *\fIsubject\fR, -.ti +5n -.B int *\fIovector\fR, int \fIstringcount\fR, "const char ***\fIlistptr\fR);" -.PP -.br -.B const unsigned char *pcre_maketables(void); -.PP -.br -.B int pcre_fullinfo(const pcre *\fIcode\fR, "const pcre_extra *\fIextra\fR," -.ti +5n -.B int \fIwhat\fR, void *\fIwhere\fR); -.PP -.br -.B int pcre_info(const pcre *\fIcode\fR, int *\fIoptptr\fR, int -.B *\fIfirstcharptr\fR); -.PP -.br -.B char *pcre_version(void); -.PP -.br -.B void *(*pcre_malloc)(size_t); -.PP -.br -.B void (*pcre_free)(void *); - - - -.SH DESCRIPTION -The PCRE library is a set of functions that implement regular expression -pattern matching using the same syntax and semantics as Perl 5, with just a few -differences (see below). The current implementation corresponds to Perl 5.005, -with some additional features from the Perl development release. - -PCRE has its own native API, which is described in this document. There is also -a set of wrapper functions that correspond to the POSIX regular expression API. -These are described in the \fBpcreposix\fR documentation. - -The native API function prototypes are defined in the header file \fBpcre.h\fR, -and on Unix systems the library itself is called \fBlibpcre.a\fR, so can be -accessed by adding \fB-lpcre\fR to the command for linking an application which -calls it. The header file defines the macros PCRE_MAJOR and PCRE_MINOR to -contain the major and minor release numbers for the library. Applications can -use these to include support for different releases. - -The functions \fBpcre_compile()\fR, \fBpcre_study()\fR, and \fBpcre_exec()\fR -are used for compiling and matching regular expressions, while -\fBpcre_copy_substring()\fR, \fBpcre_get_substring()\fR, and -\fBpcre_get_substring_list()\fR are convenience functions for extracting -captured substrings from a matched subject string. The function -\fBpcre_maketables()\fR is used (optionally) to build a set of character tables -in the current locale for passing to \fBpcre_compile()\fR. - -The function \fBpcre_fullinfo()\fR is used to find out information about a -compiled pattern; \fBpcre_info()\fR is an obsolete version which returns only -some of the available information, but is retained for backwards compatibility. -The function \fBpcre_version()\fR returns a pointer to a string containing the -version of PCRE and its date of release. - -The global variables \fBpcre_malloc\fR and \fBpcre_free\fR initially contain -the entry points of the standard \fBmalloc()\fR and \fBfree()\fR functions -respectively. PCRE calls the memory management functions via these variables, -so a calling program can replace them if it wishes to intercept the calls. This -should be done before calling any PCRE functions. - - -.SH MULTI-THREADING -The PCRE functions can be used in multi-threading applications, with the -proviso that the memory management functions pointed to by \fBpcre_malloc\fR -and \fBpcre_free\fR are shared by all threads. - -The compiled form of a regular expression is not altered during matching, so -the same compiled pattern can safely be used by several threads at once. - - -.SH COMPILING A PATTERN -The function \fBpcre_compile()\fR is called to compile a pattern into an -internal form. The pattern is a C string terminated by a binary zero, and -is passed in the argument \fIpattern\fR. A pointer to a single block of memory -that is obtained via \fBpcre_malloc\fR is returned. This contains the -compiled code and related data. The \fBpcre\fR type is defined for this for -convenience, but in fact \fBpcre\fR is just a typedef for \fBvoid\fR, since the -contents of the block are not externally defined. It is up to the caller to -free the memory when it is no longer required. -.PP -The size of a compiled pattern is roughly proportional to the length of the -pattern string, except that each character class (other than those containing -just a single character, negated or not) requires 33 bytes, and repeat -quantifiers with a minimum greater than one or a bounded maximum cause the -relevant portions of the compiled pattern to be replicated. -.PP -The \fIoptions\fR argument contains independent bits that affect the -compilation. It should be zero if no options are required. Some of the options, -in particular, those that are compatible with Perl, can also be set and unset -from within the pattern (see the detailed description of regular expressions -below). For these options, the contents of the \fIoptions\fR argument specifies -their initial settings at the start of compilation and execution. The -PCRE_ANCHORED option can be set at the time of matching as well as at compile -time. -.PP -If \fIerrptr\fR is NULL, \fBpcre_compile()\fR returns NULL immediately. -Otherwise, if compilation of a pattern fails, \fBpcre_compile()\fR returns -NULL, and sets the variable pointed to by \fIerrptr\fR to point to a textual -error message. The offset from the start of the pattern to the character where -the error was discovered is placed in the variable pointed to by -\fIerroffset\fR, which must not be NULL. If it is, an immediate error is given. -.PP -If the final argument, \fItableptr\fR, is NULL, PCRE uses a default set of -character tables which are built when it is compiled, using the default C -locale. Otherwise, \fItableptr\fR must be the result of a call to -\fBpcre_maketables()\fR. See the section on locale support below. -.PP -The following option bits are defined in the header file: - - PCRE_ANCHORED - -If this bit is set, the pattern is forced to be "anchored", that is, it is -constrained to match only at the start of the string which is being searched -(the "subject string"). This effect can also be achieved by appropriate -constructs in the pattern itself, which is the only way to do it in Perl. - - PCRE_CASELESS - -If this bit is set, letters in the pattern match both upper and lower case -letters. It is equivalent to Perl's /i option. - - PCRE_DOLLAR_ENDONLY - -If this bit is set, a dollar metacharacter in the pattern matches only at the -end of the subject string. Without this option, a dollar also matches -immediately before the final character if it is a newline (but not before any -other newlines). The PCRE_DOLLAR_ENDONLY option is ignored if PCRE_MULTILINE is -set. There is no equivalent to this option in Perl. - - PCRE_DOTALL - -If this bit is set, a dot metacharater in the pattern matches all characters, -including newlines. Without it, newlines are excluded. This option is -equivalent to Perl's /s option. A negative class such as [^a] always matches a -newline character, independent of the setting of this option. - - PCRE_EXTENDED - -If this bit is set, whitespace data characters in the pattern are totally -ignored except when escaped or inside a character class, and characters between -an unescaped # outside a character class and the next newline character, -inclusive, are also ignored. This is equivalent to Perl's /x option, and makes -it possible to include comments inside complicated patterns. Note, however, -that this applies only to data characters. Whitespace characters may never -appear within special character sequences in a pattern, for example within the -sequence (?( which introduces a conditional subpattern. - - PCRE_EXTRA - -This option was invented in order to turn on additional functionality of PCRE -that is incompatible with Perl, but it is currently of very little use. When -set, any backslash in a pattern that is followed by a letter that has no -special meaning causes an error, thus reserving these combinations for future -expansion. By default, as in Perl, a backslash followed by a letter with no -special meaning is treated as a literal. There are at present no other features -controlled by this option. It can also be set by a (?X) option setting within a -pattern. - - PCRE_MULTILINE - -By default, PCRE treats the subject string as consisting of a single "line" of -characters (even if it actually contains several newlines). The "start of line" -metacharacter (^) matches only at the start of the string, while the "end of -line" metacharacter ($) matches only at the end of the string, or before a -terminating newline (unless PCRE_DOLLAR_ENDONLY is set). This is the same as -Perl. - -When PCRE_MULTILINE it is set, the "start of line" and "end of line" constructs -match immediately following or immediately before any newline in the subject -string, respectively, as well as at the very start and end. This is equivalent -to Perl's /m option. If there are no "\\n" characters in a subject string, or -no occurrences of ^ or $ in a pattern, setting PCRE_MULTILINE has no -effect. - - PCRE_UNGREEDY - -This option inverts the "greediness" of the quantifiers so that they are not -greedy by default, but become greedy if followed by "?". It is not compatible -with Perl. It can also be set by a (?U) option setting within the pattern. - - -.SH STUDYING A PATTERN -When a pattern is going to be used several times, it is worth spending more -time analyzing it in order to speed up the time taken for matching. The -function \fBpcre_study()\fR takes a pointer to a compiled pattern as its first -argument, and returns a pointer to a \fBpcre_extra\fR block (another \fBvoid\fR -typedef) containing additional information about the pattern; this can be -passed to \fBpcre_exec()\fR. If no additional information is available, NULL -is returned. - -The second argument contains option bits. At present, no options are defined -for \fBpcre_study()\fR, and this argument should always be zero. - -The third argument for \fBpcre_study()\fR is a pointer to an error message. If -studying succeeds (even if no data is returned), the variable it points to is -set to NULL. Otherwise it points to a textual error message. - -At present, studying a pattern is useful only for non-anchored patterns that do -not have a single fixed starting character. A bitmap of possible starting -characters is created. - - -.SH LOCALE SUPPORT -PCRE handles caseless matching, and determines whether characters are letters, -digits, or whatever, by reference to a set of tables. The library contains a -default set of tables which is created in the default C locale when PCRE is -compiled. This is used when the final argument of \fBpcre_compile()\fR is NULL, -and is sufficient for many applications. - -An alternative set of tables can, however, be supplied. Such tables are built -by calling the \fBpcre_maketables()\fR function, which has no arguments, in the -relevant locale. The result can then be passed to \fBpcre_compile()\fR as often -as necessary. For example, to build and use tables that are appropriate for the -French locale (where accented characters with codes greater than 128 are -treated as letters), the following code could be used: - - setlocale(LC_CTYPE, "fr"); - tables = pcre_maketables(); - re = pcre_compile(..., tables); - -The tables are built in memory that is obtained via \fBpcre_malloc\fR. The -pointer that is passed to \fBpcre_compile\fR is saved with the compiled -pattern, and the same tables are used via this pointer by \fBpcre_study()\fR -and \fBpcre_exec()\fR. Thus for any single pattern, compilation, studying and -matching all happen in the same locale, but different patterns can be compiled -in different locales. It is the caller's responsibility to ensure that the -memory containing the tables remains available for as long as it is needed. - - -.SH INFORMATION ABOUT A PATTERN -The \fBpcre_fullinfo()\fR function returns information about a compiled -pattern. It replaces the obsolete \fBpcre_info()\fR function, which is -nevertheless retained for backwards compability (and is documented below). - -The first argument for \fBpcre_fullinfo()\fR is a pointer to the compiled -pattern. The second argument is the result of \fBpcre_study()\fR, or NULL if -the pattern was not studied. The third argument specifies which piece of -information is required, while the fourth argument is a pointer to a variable -to receive the data. The yield of the function is zero for success, or one of -the following negative numbers: - - PCRE_ERROR_NULL the argument \fIcode\fR was NULL - the argument \fIwhere\fR was NULL - PCRE_ERROR_BADMAGIC the "magic number" was not found - PCRE_ERROR_BADOPTION the value of \fIwhat\fR was invalid - -The possible values for the third argument are defined in \fBpcre.h\fR, and are -as follows: - - PCRE_INFO_OPTIONS - -Return a copy of the options with which the pattern was compiled. The fourth -argument should point to au \fBunsigned long int\fR variable. These option bits -are those specified in the call to \fBpcre_compile()\fR, modified by any -top-level option settings within the pattern itself, and with the PCRE_ANCHORED -bit forcibly set if the form of the pattern implies that it can match only at -the start of a subject string. - - PCRE_INFO_SIZE - -Return the size of the compiled pattern, that is, the value that was passed as -the argument to \fBpcre_malloc()\fR when PCRE was getting memory in which to -place the compiled data. The fourth argument should point to a \fBsize_t\fR -variable. - - PCRE_INFO_CAPTURECOUNT - -Return the number of capturing subpatterns in the pattern. The fourth argument -should point to an \fbint\fR variable. - - PCRE_INFO_BACKREFMAX - -Return the number of the highest back reference in the pattern. The fourth -argument should point to an \fBint\fR variable. Zero is returned if there are -no back references. - - PCRE_INFO_FIRSTCHAR - -Return information about the first character of any matched string, for a -non-anchored pattern. If there is a fixed first character, e.g. from a pattern -such as (cat|cow|coyote), it is returned in the integer pointed to by -\fIwhere\fR. Otherwise, if either - -(a) the pattern was compiled with the PCRE_MULTILINE option, and every branch -starts with "^", or - -(b) every branch of the pattern starts with ".*" and PCRE_DOTALL is not set -(if it were set, the pattern would be anchored), - --1 is returned, indicating that the pattern matches only at the start of a -subject string or after any "\\n" within the string. Otherwise -2 is returned. -For anchored patterns, -2 is returned. - - PCRE_INFO_FIRSTTABLE - -If the pattern was studied, and this resulted in the construction of a 256-bit -table indicating a fixed set of characters for the first character in any -matching string, a pointer to the table is returned. Otherwise NULL is -returned. The fourth argument should point to an \fBunsigned char *\fR -variable. - - PCRE_INFO_LASTLITERAL - -For a non-anchored pattern, return the value of the rightmost literal character -which must exist in any matched string, other than at its start. The fourth -argument should point to an \fBint\fR variable. If there is no such character, -or if the pattern is anchored, -1 is returned. For example, for the pattern -/a\\d+z\\d+/ the returned value is 'z'. - -The \fBpcre_info()\fR function is now obsolete because its interface is too -restrictive to return all the available data about a compiled pattern. New -programs should use \fBpcre_fullinfo()\fR instead. The yield of -\fBpcre_info()\fR is the number of capturing subpatterns, or one of the -following negative numbers: - - PCRE_ERROR_NULL the argument \fIcode\fR was NULL - PCRE_ERROR_BADMAGIC the "magic number" was not found - -If the \fIoptptr\fR argument is not NULL, a copy of the options with which the -pattern was compiled is placed in the integer it points to (see -PCRE_INFO_OPTIONS above). - -If the pattern is not anchored and the \fIfirstcharptr\fR argument is not NULL, -it is used to pass back information about the first character of any matched -string (see PCRE_INFO_FIRSTCHAR above). - - -.SH MATCHING A PATTERN -The function \fBpcre_exec()\fR is called to match a subject string against a -pre-compiled pattern, which is passed in the \fIcode\fR argument. If the -pattern has been studied, the result of the study should be passed in the -\fIextra\fR argument. Otherwise this must be NULL. - -The PCRE_ANCHORED option can be passed in the \fIoptions\fR argument, whose -unused bits must be zero. However, if a pattern was compiled with -PCRE_ANCHORED, or turned out to be anchored by virtue of its contents, it -cannot be made unachored at matching time. - -There are also three further options that can be set only at matching time: - - PCRE_NOTBOL - -The first character of the string is not the beginning of a line, so the -circumflex metacharacter should not match before it. Setting this without -PCRE_MULTILINE (at compile time) causes circumflex never to match. - - PCRE_NOTEOL - -The end of the string is not the end of a line, so the dollar metacharacter -should not match it nor (except in multiline mode) a newline immediately before -it. Setting this without PCRE_MULTILINE (at compile time) causes dollar never -to match. - - PCRE_NOTEMPTY - -An empty string is not considered to be a valid match if this option is set. If -there are alternatives in the pattern, they are tried. If all the alternatives -match the empty string, the entire match fails. For example, if the pattern - - a?b? - -is applied to a string not beginning with "a" or "b", it matches the empty -string at the start of the subject. With PCRE_NOTEMPTY set, this match is not -valid, so PCRE searches further into the string for occurrences of "a" or "b". - -Perl has no direct equivalent of PCRE_NOTEMPTY, but it does make a special case -of a pattern match of the empty string within its \fBsplit()\fR function, and -when using the /g modifier. It is possible to emulate Perl's behaviour after -matching a null string by first trying the match again at the same offset with -PCRE_NOTEMPTY set, and then if that fails by advancing the starting offset (see -below) and trying an ordinary match again. - -The subject string is passed as a pointer in \fIsubject\fR, a length in -\fIlength\fR, and a starting offset in \fIstartoffset\fR. Unlike the pattern -string, it may contain binary zero characters. When the starting offset is -zero, the search for a match starts at the beginning of the subject, and this -is by far the most common case. - -A non-zero starting offset is useful when searching for another match in the -same subject by calling \fBpcre_exec()\fR again after a previous success. -Setting \fIstartoffset\fR differs from just passing over a shortened string and -setting PCRE_NOTBOL in the case of a pattern that begins with any kind of -lookbehind. For example, consider the pattern - - \\Biss\\B - -which finds occurrences of "iss" in the middle of words. (\\B matches only if -the current position in the subject is not a word boundary.) When applied to -the string "Mississipi" the first call to \fBpcre_exec()\fR finds the first -occurrence. If \fBpcre_exec()\fR is called again with just the remainder of the -subject, namely "issipi", it does not match, because \\B is always false at the -start of the subject, which is deemed to be a word boundary. However, if -\fBpcre_exec()\fR is passed the entire string again, but with \fIstartoffset\fR -set to 4, it finds the second occurrence of "iss" because it is able to look -behind the starting point to discover that it is preceded by a letter. - -If a non-zero starting offset is passed when the pattern is anchored, one -attempt to match at the given offset is tried. This can only succeed if the -pattern does not require the match to be at the start of the subject. - -In general, a pattern matches a certain portion of the subject, and in -addition, further substrings from the subject may be picked out by parts of the -pattern. Following the usage in Jeffrey Friedl's book, this is called -"capturing" in what follows, and the phrase "capturing subpattern" is used for -a fragment of a pattern that picks out a substring. PCRE supports several other -kinds of parenthesized subpattern that do not cause substrings to be captured. - -Captured substrings are returned to the caller via a vector of integer offsets -whose address is passed in \fIovector\fR. The number of elements in the vector -is passed in \fIovecsize\fR. The first two-thirds of the vector is used to pass -back captured substrings, each substring using a pair of integers. The -remaining third of the vector is used as workspace by \fBpcre_exec()\fR while -matching capturing subpatterns, and is not available for passing back -information. The length passed in \fIovecsize\fR should always be a multiple of -three. If it is not, it is rounded down. - -When a match has been successful, information about captured substrings is -returned in pairs of integers, starting at the beginning of \fIovector\fR, and -continuing up to two-thirds of its length at the most. The first element of a -pair is set to the offset of the first character in a substring, and the second -is set to the offset of the first character after the end of a substring. The -first pair, \fIovector[0]\fR and \fIovector[1]\fR, identify the portion of the -subject string matched by the entire pattern. The next pair is used for the -first capturing subpattern, and so on. The value returned by \fBpcre_exec()\fR -is the number of pairs that have been set. If there are no capturing -subpatterns, the return value from a successful match is 1, indicating that -just the first pair of offsets has been set. - -Some convenience functions are provided for extracting the captured substrings -as separate strings. These are described in the following section. - -It is possible for an capturing subpattern number \fIn+1\fR to match some -part of the subject when subpattern \fIn\fR has not been used at all. For -example, if the string "abc" is matched against the pattern (a|(z))(bc) -subpatterns 1 and 3 are matched, but 2 is not. When this happens, both offset -values corresponding to the unused subpattern are set to -1. - -If a capturing subpattern is matched repeatedly, it is the last portion of the -string that it matched that gets returned. - -If the vector is too small to hold all the captured substrings, it is used as -far as possible (up to two-thirds of its length), and the function returns a -value of zero. In particular, if the substring offsets are not of interest, -\fBpcre_exec()\fR may be called with \fIovector\fR passed as NULL and -\fIovecsize\fR as zero. However, if the pattern contains back references and -the \fIovector\fR isn't big enough to remember the related substrings, PCRE has -to get additional memory for use during matching. Thus it is usually advisable -to supply an \fIovector\fR. - -Note that \fBpcre_info()\fR can be used to find out how many capturing -subpatterns there are in a compiled pattern. The smallest size for -\fIovector\fR that will allow for \fIn\fR captured substrings in addition to -the offsets of the substring matched by the whole pattern is (\fIn\fR+1)*3. - -If \fBpcre_exec()\fR fails, it returns a negative number. The following are -defined in the header file: - - PCRE_ERROR_NOMATCH (-1) - -The subject string did not match the pattern. - - PCRE_ERROR_NULL (-2) - -Either \fIcode\fR or \fIsubject\fR was passed as NULL, or \fIovector\fR was -NULL and \fIovecsize\fR was not zero. - - PCRE_ERROR_BADOPTION (-3) - -An unrecognized bit was set in the \fIoptions\fR argument. - - PCRE_ERROR_BADMAGIC (-4) - -PCRE stores a 4-byte "magic number" at the start of the compiled code, to catch -the case when it is passed a junk pointer. This is the error it gives when the -magic number isn't present. - - PCRE_ERROR_UNKNOWN_NODE (-5) - -While running the pattern match, an unknown item was encountered in the -compiled pattern. This error could be caused by a bug in PCRE or by overwriting -of the compiled pattern. - - PCRE_ERROR_NOMEMORY (-6) - -If a pattern contains back references, but the \fIovector\fR that is passed to -\fBpcre_exec()\fR is not big enough to remember the referenced substrings, PCRE -gets a block of memory at the start of matching to use for this purpose. If the -call via \fBpcre_malloc()\fR fails, this error is given. The memory is freed at -the end of matching. - - -.SH EXTRACTING CAPTURED SUBSTRINGS -Captured substrings can be accessed directly by using the offsets returned by -\fBpcre_exec()\fR in \fIovector\fR. For convenience, the functions -\fBpcre_copy_substring()\fR, \fBpcre_get_substring()\fR, and -\fBpcre_get_substring_list()\fR are provided for extracting captured substrings -as new, separate, zero-terminated strings. A substring that contains a binary -zero is correctly extracted and has a further zero added on the end, but the -result does not, of course, function as a C string. - -The first three arguments are the same for all three functions: \fIsubject\fR -is the subject string which has just been successfully matched, \fIovector\fR -is a pointer to the vector of integer offsets that was passed to -\fBpcre_exec()\fR, and \fIstringcount\fR is the number of substrings that -were captured by the match, including the substring that matched the entire -regular expression. This is the value returned by \fBpcre_exec\fR if it -is greater than zero. If \fBpcre_exec()\fR returned zero, indicating that it -ran out of space in \fIovector\fR, the value passed as \fIstringcount\fR should -be the size of the vector divided by three. - -The functions \fBpcre_copy_substring()\fR and \fBpcre_get_substring()\fR -extract a single substring, whose number is given as \fIstringnumber\fR. A -value of zero extracts the substring that matched the entire pattern, while -higher values extract the captured substrings. For \fBpcre_copy_substring()\fR, -the string is placed in \fIbuffer\fR, whose length is given by -\fIbuffersize\fR, while for \fBpcre_get_substring()\fR a new block of store is -obtained via \fBpcre_malloc\fR, and its address is returned via -\fIstringptr\fR. The yield of the function is the length of the string, not -including the terminating zero, or one of - - PCRE_ERROR_NOMEMORY (-6) - -The buffer was too small for \fBpcre_copy_substring()\fR, or the attempt to get -memory failed for \fBpcre_get_substring()\fR. - - PCRE_ERROR_NOSUBSTRING (-7) - -There is no substring whose number is \fIstringnumber\fR. - -The \fBpcre_get_substring_list()\fR function extracts all available substrings -and builds a list of pointers to them. All this is done in a single block of -memory which is obtained via \fBpcre_malloc\fR. The address of the memory block -is returned via \fIlistptr\fR, which is also the start of the list of string -pointers. The end of the list is marked by a NULL pointer. The yield of the -function is zero if all went well, or - - PCRE_ERROR_NOMEMORY (-6) - -if the attempt to get the memory block failed. - -When any of these functions encounter a substring that is unset, which can -happen when capturing subpattern number \fIn+1\fR matches some part of the -subject, but subpattern \fIn\fR has not been used at all, they return an empty -string. This can be distinguished from a genuine zero-length substring by -inspecting the appropriate offset in \fIovector\fR, which is negative for unset -substrings. - - - -.SH LIMITATIONS -There are some size limitations in PCRE but it is hoped that they will never in -practice be relevant. -The maximum length of a compiled pattern is 65539 (sic) bytes. -All values in repeating quantifiers must be less than 65536. -The maximum number of capturing subpatterns is 99. -The maximum number of all parenthesized subpatterns, including capturing -subpatterns, assertions, and other types of subpattern, is 200. - -The maximum length of a subject string is the largest positive number that an -integer variable can hold. However, PCRE uses recursion to handle subpatterns -and indefinite repetition. This means that the available stack space may limit -the size of a subject string that can be processed by certain patterns. - - -.SH DIFFERENCES FROM PERL -The differences described here are with respect to Perl 5.005. - -1. By default, a whitespace character is any character that the C library -function \fBisspace()\fR recognizes, though it is possible to compile PCRE with -alternative character type tables. Normally \fBisspace()\fR matches space, -formfeed, newline, carriage return, horizontal tab, and vertical tab. Perl 5 -no longer includes vertical tab in its set of whitespace characters. The \\v -escape that was in the Perl documentation for a long time was never in fact -recognized. However, the character itself was treated as whitespace at least -up to 5.002. In 5.004 and 5.005 it does not match \\s. - -2. PCRE does not allow repeat quantifiers on lookahead assertions. Perl permits -them, but they do not mean what you might think. For example, (?!a){3} does -not assert that the next three characters are not "a". It just asserts that the -next character is not "a" three times. - -3. Capturing subpatterns that occur inside negative lookahead assertions are -counted, but their entries in the offsets vector are never set. Perl sets its -numerical variables from any such patterns that are matched before the -assertion fails to match something (thereby succeeding), but only if the -negative lookahead assertion contains just one branch. - -4. Though binary zero characters are supported in the subject string, they are -not allowed in a pattern string because it is passed as a normal C string, -terminated by zero. The escape sequence "\\0" can be used in the pattern to -represent a binary zero. - -5. The following Perl escape sequences are not supported: \\l, \\u, \\L, \\U, -\\E, \\Q. In fact these are implemented by Perl's general string-handling and -are not part of its pattern matching engine. - -6. The Perl \\G assertion is not supported as it is not relevant to single -pattern matches. - -7. Fairly obviously, PCRE does not support the (?{code}) and (?p{code}) -constructions. However, there is some experimental support for recursive -patterns using the non-Perl item (?R). - -8. There are at the time of writing some oddities in Perl 5.005_02 concerned -with the settings of captured strings when part of a pattern is repeated. For -example, matching "aba" against the pattern /^(a(b)?)+$/ sets $2 to the value -"b", but matching "aabbaa" against /^(aa(bb)?)+$/ leaves $2 unset. However, if -the pattern is changed to /^(aa(b(b))?)+$/ then $2 (and $3) are set. - -In Perl 5.004 $2 is set in both cases, and that is also true of PCRE. If in the -future Perl changes to a consistent state that is different, PCRE may change to -follow. - -9. Another as yet unresolved discrepancy is that in Perl 5.005_02 the pattern -/^(a)?(?(1)a|b)+$/ matches the string "a", whereas in PCRE it does not. -However, in both Perl and PCRE /^(a)?a/ matched against "a" leaves $1 unset. - -10. PCRE provides some extensions to the Perl regular expression facilities: - -(a) Although lookbehind assertions must match fixed length strings, each -alternative branch of a lookbehind assertion can match a different length of -string. Perl 5.005 requires them all to have the same length. - -(b) If PCRE_DOLLAR_ENDONLY is set and PCRE_MULTILINE is not set, the $ meta- -character matches only at the very end of the string. - -(c) If PCRE_EXTRA is set, a backslash followed by a letter with no special -meaning is faulted. - -(d) If PCRE_UNGREEDY is set, the greediness of the repetition quantifiers is -inverted, that is, by default they are not greedy, but if followed by a -question mark they are. - -(e) PCRE_ANCHORED can be used to force a pattern to be tried only at the start -of the subject. - -(f) The PCRE_NOTBOL, PCRE_NOTEOL, and PCRE_NOTEMPTY options for -\fBpcre_exec()\fR have no Perl equivalents. - -(g) The (?R) construct allows for recursive pattern matching (Perl 5.6 can do -this using the (?p{code}) construct, which PCRE cannot of course support.) - - -.SH REGULAR EXPRESSION DETAILS -The syntax and semantics of the regular expressions supported by PCRE are -described below. Regular expressions are also described in the Perl -documentation and in a number of other books, some of which have copious -examples. Jeffrey Friedl's "Mastering Regular Expressions", published by -O'Reilly (ISBN 1-56592-257), covers them in great detail. The description -here is intended as reference documentation. - -A regular expression is a pattern that is matched against a subject string from -left to right. Most characters stand for themselves in a pattern, and match the -corresponding characters in the subject. As a trivial example, the pattern - - The quick brown fox - -matches a portion of a subject string that is identical to itself. The power of -regular expressions comes from the ability to include alternatives and -repetitions in the pattern. These are encoded in the pattern by the use of -\fImeta-characters\fR, which do not stand for themselves but instead are -interpreted in some special way. - -There are two different sets of meta-characters: those that are recognized -anywhere in the pattern except within square brackets, and those that are -recognized in square brackets. Outside square brackets, the meta-characters are -as follows: - - \\ general escape character with several uses - ^ assert start of subject (or line, in multiline mode) - $ assert end of subject (or line, in multiline mode) - . match any character except newline (by default) - [ start character class definition - | start of alternative branch - ( start subpattern - ) end subpattern - ? extends the meaning of ( - also 0 or 1 quantifier - also quantifier minimizer - * 0 or more quantifier - + 1 or more quantifier - { start min/max quantifier - -Part of a pattern that is in square brackets is called a "character class". In -a character class the only meta-characters are: - - \\ general escape character - ^ negate the class, but only if the first character - - indicates character range - ] terminates the character class - -The following sections describe the use of each of the meta-characters. - - -.SH BACKSLASH -The backslash character has several uses. Firstly, if it is followed by a -non-alphameric character, it takes away any special meaning that character may -have. This use of backslash as an escape character applies both inside and -outside character classes. - -For example, if you want to match a "*" character, you write "\\*" in the -pattern. This applies whether or not the following character would otherwise be -interpreted as a meta-character, so it is always safe to precede a -non-alphameric with "\\" to specify that it stands for itself. In particular, -if you want to match a backslash, you write "\\\\". - -If a pattern is compiled with the PCRE_EXTENDED option, whitespace in the -pattern (other than in a character class) and characters between a "#" outside -a character class and the next newline character are ignored. An escaping -backslash can be used to include a whitespace or "#" character as part of the -pattern. - -A second use of backslash provides a way of encoding non-printing characters -in patterns in a visible manner. There is no restriction on the appearance of -non-printing characters, apart from the binary zero that terminates a pattern, -but when a pattern is being prepared by text editing, it is usually easier to -use one of the following escape sequences than the binary character it -represents: - - \\a alarm, that is, the BEL character (hex 07) - \\cx "control-x", where x is any character - \\e escape (hex 1B) - \\f formfeed (hex 0C) - \\n newline (hex 0A) - \\r carriage return (hex 0D) - \\t tab (hex 09) - \\xhh character with hex code hh - \\ddd character with octal code ddd, or backreference - -The precise effect of "\\cx" is as follows: if "x" is a lower case letter, it -is converted to upper case. Then bit 6 of the character (hex 40) is inverted. -Thus "\\cz" becomes hex 1A, but "\\c{" becomes hex 3B, while "\\c;" becomes hex -7B. - -After "\\x", up to two hexadecimal digits are read (letters can be in upper or -lower case). - -After "\\0" up to two further octal digits are read. In both cases, if there -are fewer than two digits, just those that are present are used. Thus the -sequence "\\0\\x\\07" specifies two binary zeros followed by a BEL character. -Make sure you supply two digits after the initial zero if the character that -follows is itself an octal digit. - -The handling of a backslash followed by a digit other than 0 is complicated. -Outside a character class, PCRE reads it and any following digits as a decimal -number. If the number is less than 10, or if there have been at least that many -previous capturing left parentheses in the expression, the entire sequence is -taken as a \fIback reference\fR. A description of how this works is given -later, following the discussion of parenthesized subpatterns. - -Inside a character class, or if the decimal number is greater than 9 and there -have not been that many capturing subpatterns, PCRE re-reads up to three octal -digits following the backslash, and generates a single byte from the least -significant 8 bits of the value. Any subsequent digits stand for themselves. -For example: - - \\040 is another way of writing a space - \\40 is the same, provided there are fewer than 40 - previous capturing subpatterns - \\7 is always a back reference - \\11 might be a back reference, or another way of - writing a tab - \\011 is always a tab - \\0113 is a tab followed by the character "3" - \\113 is the character with octal code 113 (since there - can be no more than 99 back references) - \\377 is a byte consisting entirely of 1 bits - \\81 is either a back reference, or a binary zero - followed by the two characters "8" and "1" - -Note that octal values of 100 or greater must not be introduced by a leading -zero, because no more than three octal digits are ever read. - -All the sequences that define a single byte value can be used both inside and -outside character classes. In addition, inside a character class, the sequence -"\\b" is interpreted as the backspace character (hex 08). Outside a character -class it has a different meaning (see below). - -The third use of backslash is for specifying generic character types: - - \\d any decimal digit - \\D any character that is not a decimal digit - \\s any whitespace character - \\S any character that is not a whitespace character - \\w any "word" character - \\W any "non-word" character - -Each pair of escape sequences partitions the complete set of characters into -two disjoint sets. Any given character matches one, and only one, of each pair. - -A "word" character is any letter or digit or the underscore character, that is, -any character which can be part of a Perl "word". The definition of letters and -digits is controlled by PCRE's character tables, and may vary if locale- -specific matching is taking place (see "Locale support" above). For example, in -the "fr" (French) locale, some character codes greater than 128 are used for -accented letters, and these are matched by \\w. - -These character type sequences can appear both inside and outside character -classes. They each match one character of the appropriate type. If the current -matching point is at the end of the subject string, all of them fail, since -there is no character to match. - -The fourth use of backslash is for certain simple assertions. An assertion -specifies a condition that has to be met at a particular point in a match, -without consuming any characters from the subject string. The use of -subpatterns for more complicated assertions is described below. The backslashed -assertions are - - \\b word boundary - \\B not a word boundary - \\A start of subject (independent of multiline mode) - \\Z end of subject or newline at end (independent of multiline mode) - \\z end of subject (independent of multiline mode) - -These assertions may not appear in character classes (but note that "\\b" has a -different meaning, namely the backspace character, inside a character class). - -A word boundary is a position in the subject string where the current character -and the previous character do not both match \\w or \\W (i.e. one matches -\\w and the other matches \\W), or the start or end of the string if the -first or last character matches \\w, respectively. - -The \\A, \\Z, and \\z assertions differ from the traditional circumflex and -dollar (described below) in that they only ever match at the very start and end -of the subject string, whatever options are set. They are not affected by the -PCRE_NOTBOL or PCRE_NOTEOL options. If the \fIstartoffset\fR argument of -\fBpcre_exec()\fR is non-zero, \\A can never match. The difference between \\Z -and \\z is that \\Z matches before a newline that is the last character of the -string as well as at the end of the string, whereas \\z matches only at the -end. - - -.SH CIRCUMFLEX AND DOLLAR -Outside a character class, in the default matching mode, the circumflex -character is an assertion which is true only if the current matching point is -at the start of the subject string. If the \fIstartoffset\fR argument of -\fBpcre_exec()\fR is non-zero, circumflex can never match. Inside a character -class, circumflex has an entirely different meaning (see below). - -Circumflex need not be the first character of the pattern if a number of -alternatives are involved, but it should be the first thing in each alternative -in which it appears if the pattern is ever to match that branch. If all -possible alternatives start with a circumflex, that is, if the pattern is -constrained to match only at the start of the subject, it is said to be an -"anchored" pattern. (There are also other constructs that can cause a pattern -to be anchored.) - -A dollar character is an assertion which is true only if the current matching -point is at the end of the subject string, or immediately before a newline -character that is the last character in the string (by default). Dollar need -not be the last character of the pattern if a number of alternatives are -involved, but it should be the last item in any branch in which it appears. -Dollar has no special meaning in a character class. - -The meaning of dollar can be changed so that it matches only at the very end of -the string, by setting the PCRE_DOLLAR_ENDONLY option at compile or matching -time. This does not affect the \\Z assertion. - -The meanings of the circumflex and dollar characters are changed if the -PCRE_MULTILINE option is set. When this is the case, they match immediately -after and immediately before an internal "\\n" character, respectively, in -addition to matching at the start and end of the subject string. For example, -the pattern /^abc$/ matches the subject string "def\\nabc" in multiline mode, -but not otherwise. Consequently, patterns that are anchored in single line mode -because all branches start with "^" are not anchored in multiline mode, and a -match for circumflex is possible when the \fIstartoffset\fR argument of -\fBpcre_exec()\fR is non-zero. The PCRE_DOLLAR_ENDONLY option is ignored if -PCRE_MULTILINE is set. - -Note that the sequences \\A, \\Z, and \\z can be used to match the start and -end of the subject in both modes, and if all branches of a pattern start with -\\A is it always anchored, whether PCRE_MULTILINE is set or not. - - -.SH FULL STOP (PERIOD, DOT) -Outside a character class, a dot in the pattern matches any one character in -the subject, including a non-printing character, but not (by default) newline. -If the PCRE_DOTALL option is set, dots match newlines as well. The handling of -dot is entirely independent of the handling of circumflex and dollar, the only -relationship being that they both involve newline characters. Dot has no -special meaning in a character class. - - -.SH SQUARE BRACKETS -An opening square bracket introduces a character class, terminated by a closing -square bracket. A closing square bracket on its own is not special. If a -closing square bracket is required as a member of the class, it should be the -first data character in the class (after an initial circumflex, if present) or -escaped with a backslash. - -A character class matches a single character in the subject; the character must -be in the set of characters defined by the class, unless the first character in -the class is a circumflex, in which case the subject character must not be in -the set defined by the class. If a circumflex is actually required as a member -of the class, ensure it is not the first character, or escape it with a -backslash. - -For example, the character class [aeiou] matches any lower case vowel, while -[^aeiou] matches any character that is not a lower case vowel. Note that a -circumflex is just a convenient notation for specifying the characters which -are in the class by enumerating those that are not. It is not an assertion: it -still consumes a character from the subject string, and fails if the current -pointer is at the end of the string. - -When caseless matching is set, any letters in a class represent both their -upper case and lower case versions, so for example, a caseless [aeiou] matches -"A" as well as "a", and a caseless [^aeiou] does not match "A", whereas a -caseful version would. - -The newline character is never treated in any special way in character classes, -whatever the setting of the PCRE_DOTALL or PCRE_MULTILINE options is. A class -such as [^a] will always match a newline. - -The minus (hyphen) character can be used to specify a range of characters in a -character class. For example, [d-m] matches any letter between d and m, -inclusive. If a minus character is required in a class, it must be escaped with -a backslash or appear in a position where it cannot be interpreted as -indicating a range, typically as the first or last character in the class. - -It is not possible to have the literal character "]" as the end character of a -range. A pattern such as [W-]46] is interpreted as a class of two characters -("W" and "-") followed by a literal string "46]", so it would match "W46]" or -"-46]". However, if the "]" is escaped with a backslash it is interpreted as -the end of range, so [W-\\]46] is interpreted as a single class containing a -range followed by two separate characters. The octal or hexadecimal -representation of "]" can also be used to end a range. - -Ranges operate in ASCII collating sequence. They can also be used for -characters specified numerically, for example [\\000-\\037]. If a range that -includes letters is used when caseless matching is set, it matches the letters -in either case. For example, [W-c] is equivalent to [][\\^_`wxyzabc], matched -caselessly, and if character tables for the "fr" locale are in use, -[\\xc8-\\xcb] matches accented E characters in both cases. - -The character types \\d, \\D, \\s, \\S, \\w, and \\W may also appear in a -character class, and add the characters that they match to the class. For -example, [\\dABCDEF] matches any hexadecimal digit. A circumflex can -conveniently be used with the upper case character types to specify a more -restricted set of characters than the matching lower case type. For example, -the class [^\\W_] matches any letter or digit, but not underscore. - -All non-alphameric characters other than \\, -, ^ (at the start) and the -terminating ] are non-special in character classes, but it does no harm if they -are escaped. - - -.SH POSIX CHARACTER CLASSES -Perl 5.6 (not yet released at the time of writing) is going to support the -POSIX notation for character classes, which uses names enclosed by [: and :] -within the enclosing square brackets. PCRE supports this notation. For example, - - [01[:alpha:]%] - -matches "0", "1", any alphabetic character, or "%". The supported class names -are - - alnum letters and digits - alpha letters - ascii character codes 0 - 127 - cntrl control characters - digit decimal digits (same as \\d) - graph printing characters, excluding space - lower lower case letters - print printing characters, including space - punct printing characters, excluding letters and digits - space white space (same as \\s) - upper upper case letters - word "word" characters (same as \\w) - xdigit hexadecimal digits - -The names "ascii" and "word" are Perl extensions. Another Perl extension is -negation, which is indicated by a ^ character after the colon. For example, - - [12[:^digit:]] - -matches "1", "2", or any non-digit. PCRE (and Perl) also recogize the POSIX -syntax [.ch.] and [=ch=] where "ch" is a "collating element", but these are not -supported, and an error is given if they are encountered. - - -.SH VERTICAL BAR -Vertical bar characters are used to separate alternative patterns. For example, -the pattern - - gilbert|sullivan - -matches either "gilbert" or "sullivan". Any number of alternatives may appear, -and an empty alternative is permitted (matching the empty string). -The matching process tries each alternative in turn, from left to right, -and the first one that succeeds is used. If the alternatives are within a -subpattern (defined below), "succeeds" means matching the rest of the main -pattern as well as the alternative in the subpattern. - - -.SH INTERNAL OPTION SETTING -The settings of PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and PCRE_EXTENDED -can be changed from within the pattern by a sequence of Perl option letters -enclosed between "(?" and ")". The option letters are - - i for PCRE_CASELESS - m for PCRE_MULTILINE - s for PCRE_DOTALL - x for PCRE_EXTENDED - -For example, (?im) sets caseless, multiline matching. It is also possible to -unset these options by preceding the letter with a hyphen, and a combined -setting and unsetting such as (?im-sx), which sets PCRE_CASELESS and -PCRE_MULTILINE while unsetting PCRE_DOTALL and PCRE_EXTENDED, is also -permitted. If a letter appears both before and after the hyphen, the option is -unset. - -The scope of these option changes depends on where in the pattern the setting -occurs. For settings that are outside any subpattern (defined below), the -effect is the same as if the options were set or unset at the start of -matching. The following patterns all behave in exactly the same way: - - (?i)abc - a(?i)bc - ab(?i)c - abc(?i) - -which in turn is the same as compiling the pattern abc with PCRE_CASELESS set. -In other words, such "top level" settings apply to the whole pattern (unless -there are other changes inside subpatterns). If there is more than one setting -of the same option at top level, the rightmost setting is used. - -If an option change occurs inside a subpattern, the effect is different. This -is a change of behaviour in Perl 5.005. An option change inside a subpattern -affects only that part of the subpattern that follows it, so - - (a(?i)b)c - -matches abc and aBc and no other strings (assuming PCRE_CASELESS is not used). -By this means, options can be made to have different settings in different -parts of the pattern. Any changes made in one alternative do carry on -into subsequent branches within the same subpattern. For example, - - (a(?i)b|c) - -matches "ab", "aB", "c", and "C", even though when matching "C" the first -branch is abandoned before the option setting. This is because the effects of -option settings happen at compile time. There would be some very weird -behaviour otherwise. - -The PCRE-specific options PCRE_UNGREEDY and PCRE_EXTRA can be changed in the -same way as the Perl-compatible options by using the characters U and X -respectively. The (?X) flag setting is special in that it must always occur -earlier in the pattern than any of the additional features it turns on, even -when it is at top level. It is best put at the start. - - -.SH SUBPATTERNS -Subpatterns are delimited by parentheses (round brackets), which can be nested. -Marking part of a pattern as a subpattern does two things: - -1. It localizes a set of alternatives. For example, the pattern - - cat(aract|erpillar|) - -matches one of the words "cat", "cataract", or "caterpillar". Without the -parentheses, it would match "cataract", "erpillar" or the empty string. - -2. It sets up the subpattern as a capturing subpattern (as defined above). -When the whole pattern matches, that portion of the subject string that matched -the subpattern is passed back to the caller via the \fIovector\fR argument of -\fBpcre_exec()\fR. Opening parentheses are counted from left to right (starting -from 1) to obtain the numbers of the capturing subpatterns. - -For example, if the string "the red king" is matched against the pattern - - the ((red|white) (king|queen)) - -the captured substrings are "red king", "red", and "king", and are numbered 1, -2, and 3. - -The fact that plain parentheses fulfil two functions is not always helpful. -There are often times when a grouping subpattern is required without a -capturing requirement. If an opening parenthesis is followed by "?:", the -subpattern does not do any capturing, and is not counted when computing the -number of any subsequent capturing subpatterns. For example, if the string "the -white queen" is matched against the pattern - - the ((?:red|white) (king|queen)) - -the captured substrings are "white queen" and "queen", and are numbered 1 and -2. The maximum number of captured substrings is 99, and the maximum number of -all subpatterns, both capturing and non-capturing, is 200. - -As a convenient shorthand, if any option settings are required at the start of -a non-capturing subpattern, the option letters may appear between the "?" and -the ":". Thus the two patterns - - (?i:saturday|sunday) - (?:(?i)saturday|sunday) - -match exactly the same set of strings. Because alternative branches are tried -from left to right, and options are not reset until the end of the subpattern -is reached, an option setting in one branch does affect subsequent branches, so -the above patterns match "SUNDAY" as well as "Saturday". - - -.SH REPETITION -Repetition is specified by quantifiers, which can follow any of the following -items: - - a single character, possibly escaped - the . metacharacter - a character class - a back reference (see next section) - a parenthesized subpattern (unless it is an assertion - see below) - -The general repetition quantifier specifies a minimum and maximum number of -permitted matches, by giving the two numbers in curly brackets (braces), -separated by a comma. The numbers must be less than 65536, and the first must -be less than or equal to the second. For example: - - z{2,4} - -matches "zz", "zzz", or "zzzz". A closing brace on its own is not a special -character. If the second number is omitted, but the comma is present, there is -no upper limit; if the second number and the comma are both omitted, the -quantifier specifies an exact number of required matches. Thus - - [aeiou]{3,} - -matches at least 3 successive vowels, but may match many more, while - - \\d{8} - -matches exactly 8 digits. An opening curly bracket that appears in a position -where a quantifier is not allowed, or one that does not match the syntax of a -quantifier, is taken as a literal character. For example, {,6} is not a -quantifier, but a literal string of four characters. - -The quantifier {0} is permitted, causing the expression to behave as if the -previous item and the quantifier were not present. - -For convenience (and historical compatibility) the three most common -quantifiers have single-character abbreviations: - - * is equivalent to {0,} - + is equivalent to {1,} - ? is equivalent to {0,1} - -It is possible to construct infinite loops by following a subpattern that can -match no characters with a quantifier that has no upper limit, for example: - - (a?)* - -Earlier versions of Perl and PCRE used to give an error at compile time for -such patterns. However, because there are cases where this can be useful, such -patterns are now accepted, but if any repetition of the subpattern does in fact -match no characters, the loop is forcibly broken. - -By default, the quantifiers are "greedy", that is, they match as much as -possible (up to the maximum number of permitted times), without causing the -rest of the pattern to fail. The classic example of where this gives problems -is in trying to match comments in C programs. These appear between the -sequences /* and */ and within the sequence, individual * and / characters may -appear. An attempt to match C comments by applying the pattern - - /\\*.*\\*/ - -to the string - - /* first command */ not comment /* second comment */ - -fails, because it matches the entire string due to the greediness of the .* -item. - -However, if a quantifier is followed by a question mark, it ceases to be -greedy, and instead matches the minimum number of times possible, so the -pattern - - /\\*.*?\\*/ - -does the right thing with the C comments. The meaning of the various -quantifiers is not otherwise changed, just the preferred number of matches. -Do not confuse this use of question mark with its use as a quantifier in its -own right. Because it has two uses, it can sometimes appear doubled, as in - - \\d??\\d - -which matches one digit by preference, but can match two if that is the only -way the rest of the pattern matches. - -If the PCRE_UNGREEDY option is set (an option which is not available in Perl), -the quantifiers are not greedy by default, but individual ones can be made -greedy by following them with a question mark. In other words, it inverts the -default behaviour. - -When a parenthesized subpattern is quantified with a minimum repeat count that -is greater than 1 or with a limited maximum, more store is required for the -compiled pattern, in proportion to the size of the minimum or maximum. - -If a pattern starts with .* or .{0,} and the PCRE_DOTALL option (equivalent -to Perl's /s) is set, thus allowing the . to match newlines, the pattern is -implicitly anchored, because whatever follows will be tried against every -character position in the subject string, so there is no point in retrying the -overall match at any position after the first. PCRE treats such a pattern as -though it were preceded by \\A. In cases where it is known that the subject -string contains no newlines, it is worth setting PCRE_DOTALL when the pattern -begins with .* in order to obtain this optimization, or alternatively using ^ -to indicate anchoring explicitly. - -When a capturing subpattern is repeated, the value captured is the substring -that matched the final iteration. For example, after - - (tweedle[dume]{3}\\s*)+ - -has matched "tweedledum tweedledee" the value of the captured substring is -"tweedledee". However, if there are nested capturing subpatterns, the -corresponding captured values may have been set in previous iterations. For -example, after - - /(a|(b))+/ - -matches "aba" the value of the second captured substring is "b". - - -.SH BACK REFERENCES -Outside a character class, a backslash followed by a digit greater than 0 (and -possibly further digits) is a back reference to a capturing subpattern earlier -(i.e. to its left) in the pattern, provided there have been that many previous -capturing left parentheses. - -However, if the decimal number following the backslash is less than 10, it is -always taken as a back reference, and causes an error only if there are not -that many capturing left parentheses in the entire pattern. In other words, the -parentheses that are referenced need not be to the left of the reference for -numbers less than 10. See the section entitled "Backslash" above for further -details of the handling of digits following a backslash. - -A back reference matches whatever actually matched the capturing subpattern in -the current subject string, rather than anything matching the subpattern -itself. So the pattern - - (sens|respons)e and \\1ibility - -matches "sense and sensibility" and "response and responsibility", but not -"sense and responsibility". If caseful matching is in force at the time of the -back reference, the case of letters is relevant. For example, - - ((?i)rah)\\s+\\1 - -matches "rah rah" and "RAH RAH", but not "RAH rah", even though the original -capturing subpattern is matched caselessly. - -There may be more than one back reference to the same subpattern. If a -subpattern has not actually been used in a particular match, any back -references to it always fail. For example, the pattern - - (a|(bc))\\2 - -always fails if it starts to match "a" rather than "bc". Because there may be -up to 99 back references, all digits following the backslash are taken -as part of a potential back reference number. If the pattern continues with a -digit character, some delimiter must be used to terminate the back reference. -If the PCRE_EXTENDED option is set, this can be whitespace. Otherwise an empty -comment can be used. - -A back reference that occurs inside the parentheses to which it refers fails -when the subpattern is first used, so, for example, (a\\1) never matches. -However, such references can be useful inside repeated subpatterns. For -example, the pattern - - (a|b\\1)+ - -matches any number of "a"s and also "aba", "ababaa" etc. At each iteration of -the subpattern, the back reference matches the character string corresponding -to the previous iteration. In order for this to work, the pattern must be such -that the first iteration does not need to match the back reference. This can be -done using alternation, as in the example above, or by a quantifier with a -minimum of zero. - - -.SH ASSERTIONS -An assertion is a test on the characters following or preceding the current -matching point that does not actually consume any characters. The simple -assertions coded as \\b, \\B, \\A, \\Z, \\z, ^ and $ are described above. More -complicated assertions are coded as subpatterns. There are two kinds: those -that look ahead of the current position in the subject string, and those that -look behind it. - -An assertion subpattern is matched in the normal way, except that it does not -cause the current matching position to be changed. Lookahead assertions start -with (?= for positive assertions and (?! for negative assertions. For example, - - \\w+(?=;) - -matches a word followed by a semicolon, but does not include the semicolon in -the match, and - - foo(?!bar) - -matches any occurrence of "foo" that is not followed by "bar". Note that the -apparently similar pattern - - (?!foo)bar - -does not find an occurrence of "bar" that is preceded by something other than -"foo"; it finds any occurrence of "bar" whatsoever, because the assertion -(?!foo) is always true when the next three characters are "bar". A -lookbehind assertion is needed to achieve this effect. - -Lookbehind assertions start with (?<= for positive assertions and (?<! for -negative assertions. For example, - - (?<!foo)bar - -does find an occurrence of "bar" that is not preceded by "foo". The contents of -a lookbehind assertion are restricted such that all the strings it matches must -have a fixed length. However, if there are several alternatives, they do not -all have to have the same fixed length. Thus - - (?<=bullock|donkey) - -is permitted, but - - (?<!dogs?|cats?) - -causes an error at compile time. Branches that match different length strings -are permitted only at the top level of a lookbehind assertion. This is an -extension compared with Perl 5.005, which requires all branches to match the -same length of string. An assertion such as - - (?<=ab(c|de)) - -is not permitted, because its single top-level branch can match two different -lengths, but it is acceptable if rewritten to use two top-level branches: - - (?<=abc|abde) - -The implementation of lookbehind assertions is, for each alternative, to -temporarily move the current position back by the fixed width and then try to -match. If there are insufficient characters before the current position, the -match is deemed to fail. Lookbehinds in conjunction with once-only subpatterns -can be particularly useful for matching at the ends of strings; an example is -given at the end of the section on once-only subpatterns. - -Several assertions (of any sort) may occur in succession. For example, - - (?<=\\d{3})(?<!999)foo - -matches "foo" preceded by three digits that are not "999". Notice that each of -the assertions is applied independently at the same point in the subject -string. First there is a check that the previous three characters are all -digits, and then there is a check that the same three characters are not "999". -This pattern does \fInot\fR match "foo" preceded by six characters, the first -of which are digits and the last three of which are not "999". For example, it -doesn't match "123abcfoo". A pattern to do that is - - (?<=\\d{3}...)(?<!999)foo - -This time the first assertion looks at the preceding six characters, checking -that the first three are digits, and then the second assertion checks that the -preceding three characters are not "999". - -Assertions can be nested in any combination. For example, - - (?<=(?<!foo)bar)baz - -matches an occurrence of "baz" that is preceded by "bar" which in turn is not -preceded by "foo", while - - (?<=\\d{3}(?!999)...)foo - -is another pattern which matches "foo" preceded by three digits and any three -characters that are not "999". - -Assertion subpatterns are not capturing subpatterns, and may not be repeated, -because it makes no sense to assert the same thing several times. If any kind -of assertion contains capturing subpatterns within it, these are counted for -the purposes of numbering the capturing subpatterns in the whole pattern. -However, substring capturing is carried out only for positive assertions, -because it does not make sense for negative assertions. - -Assertions count towards the maximum of 200 parenthesized subpatterns. - - -.SH ONCE-ONLY SUBPATTERNS -With both maximizing and minimizing repetition, failure of what follows -normally causes the repeated item to be re-evaluated to see if a different -number of repeats allows the rest of the pattern to match. Sometimes it is -useful to prevent this, either to change the nature of the match, or to cause -it fail earlier than it otherwise might, when the author of the pattern knows -there is no point in carrying on. - -Consider, for example, the pattern \\d+foo when applied to the subject line - - 123456bar - -After matching all 6 digits and then failing to match "foo", the normal -action of the matcher is to try again with only 5 digits matching the \\d+ -item, and then with 4, and so on, before ultimately failing. Once-only -subpatterns provide the means for specifying that once a portion of the pattern -has matched, it is not to be re-evaluated in this way, so the matcher would -give up immediately on failing to match "foo" the first time. The notation is -another kind of special parenthesis, starting with (?> as in this example: - - (?>\\d+)bar - -This kind of parenthesis "locks up" the part of the pattern it contains once -it has matched, and a failure further into the pattern is prevented from -backtracking into it. Backtracking past it to previous items, however, works as -normal. - -An alternative description is that a subpattern of this type matches the string -of characters that an identical standalone pattern would match, if anchored at -the current point in the subject string. - -Once-only subpatterns are not capturing subpatterns. Simple cases such as the -above example can be thought of as a maximizing repeat that must swallow -everything it can. So, while both \\d+ and \\d+? are prepared to adjust the -number of digits they match in order to make the rest of the pattern match, -(?>\\d+) can only match an entire sequence of digits. - -This construction can of course contain arbitrarily complicated subpatterns, -and it can be nested. - -Once-only subpatterns can be used in conjunction with lookbehind assertions to -specify efficient matching at the end of the subject string. Consider a simple -pattern such as - - abcd$ - -when applied to a long string which does not match. Because matching proceeds -from left to right, PCRE will look for each "a" in the subject and then see if -what follows matches the rest of the pattern. If the pattern is specified as - - ^.*abcd$ - -the initial .* matches the entire string at first, but when this fails (because -there is no following "a"), it backtracks to match all but the last character, -then all but the last two characters, and so on. Once again the search for "a" -covers the entire string, from right to left, so we are no better off. However, -if the pattern is written as - - ^(?>.*)(?<=abcd) - -there can be no backtracking for the .* item; it can match only the entire -string. The subsequent lookbehind assertion does a single test on the last four -characters. If it fails, the match fails immediately. For long strings, this -approach makes a significant difference to the processing time. - -When a pattern contains an unlimited repeat inside a subpattern that can itself -be repeated an unlimited number of times, the use of a once-only subpattern is -the only way to avoid some failing matches taking a very long time indeed. -The pattern - - (\\D+|<\\d+>)*[!?] - -matches an unlimited number of substrings that either consist of non-digits, or -digits enclosed in <>, followed by either ! or ?. When it matches, it runs -quickly. However, if it is applied to - - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - -it takes a long time before reporting failure. This is because the string can -be divided between the two repeats in a large number of ways, and all have to -be tried. (The example used [!?] rather than a single character at the end, -because both PCRE and Perl have an optimization that allows for fast failure -when a single character is used. They remember the last single character that -is required for a match, and fail early if it is not present in the string.) -If the pattern is changed to - - ((?>\\D+)|<\\d+>)*[!?] - -sequences of non-digits cannot be broken, and failure happens quickly. - - -.SH CONDITIONAL SUBPATTERNS -It is possible to cause the matching process to obey a subpattern -conditionally or to choose between two alternative subpatterns, depending on -the result of an assertion, or whether a previous capturing subpattern matched -or not. The two possible forms of conditional subpattern are - - (?(condition)yes-pattern) - (?(condition)yes-pattern|no-pattern) - -If the condition is satisfied, the yes-pattern is used; otherwise the -no-pattern (if present) is used. If there are more than two alternatives in the -subpattern, a compile-time error occurs. - -There are two kinds of condition. If the text between the parentheses consists -of a sequence of digits, the condition is satisfied if the capturing subpattern -of that number has previously matched. Consider the following pattern, which -contains non-significant white space to make it more readable (assume the -PCRE_EXTENDED option) and to divide it into three parts for ease of discussion: - - ( \\( )? [^()]+ (?(1) \\) ) - -The first part matches an optional opening parenthesis, and if that -character is present, sets it as the first captured substring. The second part -matches one or more characters that are not parentheses. The third part is a -conditional subpattern that tests whether the first set of parentheses matched -or not. If they did, that is, if subject started with an opening parenthesis, -the condition is true, and so the yes-pattern is executed and a closing -parenthesis is required. Otherwise, since no-pattern is not present, the -subpattern matches nothing. In other words, this pattern matches a sequence of -non-parentheses, optionally enclosed in parentheses. - -If the condition is not a sequence of digits, it must be an assertion. This may -be a positive or negative lookahead or lookbehind assertion. Consider this -pattern, again containing non-significant white space, and with the two -alternatives on the second line: - - (?(?=[^a-z]*[a-z]) - \\d{2}-[a-z]{3}-\\d{2} | \\d{2}-\\d{2}-\\d{2} ) - -The condition is a positive lookahead assertion that matches an optional -sequence of non-letters followed by a letter. In other words, it tests for the -presence of at least one letter in the subject. If a letter is found, the -subject is matched against the first alternative; otherwise it is matched -against the second. This pattern matches strings in one of the two forms -dd-aaa-dd or dd-dd-dd, where aaa are letters and dd are digits. - - -.SH COMMENTS -The sequence (?# marks the start of a comment which continues up to the next -closing parenthesis. Nested parentheses are not permitted. The characters -that make up a comment play no part in the pattern matching at all. - -If the PCRE_EXTENDED option is set, an unescaped # character outside a -character class introduces a comment that continues up to the next newline -character in the pattern. - - -.SH RECURSIVE PATTERNS -Consider the problem of matching a string in parentheses, allowing for -unlimited nested parentheses. Without the use of recursion, the best that can -be done is to use a pattern that matches up to some fixed depth of nesting. It -is not possible to handle an arbitrary nesting depth. Perl 5.6 has provided an -experimental facility that allows regular expressions to recurse (amongst other -things). It does this by interpolating Perl code in the expression at run time, -and the code can refer to the expression itself. A Perl pattern to solve the -parentheses problem can be created like this: - - $re = qr{\\( (?: (?>[^()]+) | (?p{$re}) )* \\)}x; - -The (?p{...}) item interpolates Perl code at run time, and in this case refers -recursively to the pattern in which it appears. Obviously, PCRE cannot support -the interpolation of Perl code. Instead, the special item (?R) is provided for -the specific case of recursion. This PCRE pattern solves the parentheses -problem (assume the PCRE_EXTENDED option is set so that white space is -ignored): - - \\( ( (?>[^()]+) | (?R) )* \\) - -First it matches an opening parenthesis. Then it matches any number of -substrings which can either be a sequence of non-parentheses, or a recursive -match of the pattern itself (i.e. a correctly parenthesized substring). Finally -there is a closing parenthesis. - -This particular example pattern contains nested unlimited repeats, and so the -use of a once-only subpattern for matching strings of non-parentheses is -important when applying the pattern to strings that do not match. For example, -when it is applied to - - (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() - -it yields "no match" quickly. However, if a once-only subpattern is not used, -the match runs for a very long time indeed because there are so many different -ways the + and * repeats can carve up the subject, and all have to be tested -before failure can be reported. - -The values set for any capturing subpatterns are those from the outermost level -of the recursion at which the subpattern value is set. If the pattern above is -matched against - - (ab(cd)ef) - -the value for the capturing parentheses is "ef", which is the last value taken -on at the top level. If additional parentheses are added, giving - - \\( ( ( (?>[^()]+) | (?R) )* ) \\) - ^ ^ - ^ ^ -the string they capture is "ab(cd)ef", the contents of the top level -parentheses. If there are more than 15 capturing parentheses in a pattern, PCRE -has to obtain extra memory to store data during a recursion, which it does by -using \fBpcre_malloc\fR, freeing it via \fBpcre_free\fR afterwards. If no -memory can be obtained, it saves data for the first 15 capturing parentheses -only, as there is no way to give an out-of-memory error from within a -recursion. - - -.SH PERFORMANCE -Certain items that may appear in patterns are more efficient than others. It is -more efficient to use a character class like [aeiou] than a set of alternatives -such as (a|e|i|o|u). In general, the simplest construction that provides the -required behaviour is usually the most efficient. Jeffrey Friedl's book -contains a lot of discussion about optimizing regular expressions for efficient -performance. - -When a pattern begins with .* and the PCRE_DOTALL option is set, the pattern is -implicitly anchored by PCRE, since it can match only at the start of a subject -string. However, if PCRE_DOTALL is not set, PCRE cannot make this optimization, -because the . metacharacter does not then match a newline, and if the subject -string contains newlines, the pattern may match from the character immediately -following one of them instead of from the very start. For example, the pattern - - (.*) second - -matches the subject "first\\nand second" (where \\n stands for a newline -character) with the first captured substring being "and". In order to do this, -PCRE has to retry the match starting after every newline in the subject. - -If you are using such a pattern with subject strings that do not contain -newlines, the best performance is obtained by setting PCRE_DOTALL, or starting -the pattern with ^.* to indicate explicit anchoring. That saves PCRE from -having to scan along the subject looking for a newline to restart at. - -Beware of patterns that contain nested indefinite repeats. These can take a -long time to run when applied to a string that does not match. Consider the -pattern fragment - - (a+)* - -This can match "aaaa" in 33 different ways, and this number increases very -rapidly as the string gets longer. (The * repeat can match 0, 1, 2, 3, or 4 -times, and for each of those cases other than 0, the + repeats can match -different numbers of times.) When the remainder of the pattern is such that the -entire match is going to fail, PCRE has in principle to try every possible -variation, and this can take an extremely long time. - -An optimization catches some of the more simple cases such as - - (a+)*b - -where a literal character follows. Before embarking on the standard matching -procedure, PCRE checks that there is a "b" later in the subject string, and if -there is not, it fails the match immediately. However, when there is no -following literal this optimization cannot be used. You can see the difference -by comparing the behaviour of - - (a+)*\\d - -with the pattern above. The former gives a failure almost instantly when -applied to a whole line of "a" characters, whereas the latter takes an -appreciable time with strings longer than about 20 characters. - -.SH AUTHOR -Philip Hazel <ph10@cam.ac.uk> -.br -University Computing Service, -.br -New Museums Site, -.br -Cambridge CB2 3QG, England. -.br -Phone: +44 1223 334714 - -Last updated: 27 January 2000 -.br -Copyright (c) 1997-2000 University of Cambridge. diff --git a/srclib/pcre/doc/pcre.html b/srclib/pcre/doc/pcre.html deleted file mode 100644 index 7eba9c35dd..0000000000 --- a/srclib/pcre/doc/pcre.html +++ /dev/null @@ -1,2258 +0,0 @@ -<HTML> -<HEAD> -<TITLE>pcre specification - - -

    pcre 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 -

    -pcre - Perl-compatible regular expressions. -

    -
  • SYNOPSIS -

    -#include <pcre.h> -

    -

    -pcre *pcre_compile(const char *pattern, int options, -const char **errptr, int *erroffset, -const unsigned char *tableptr); -

    -

    -pcre_extra *pcre_study(const pcre *code, int options, -const char **errptr); -

    -

    -int pcre_exec(const pcre *code, const pcre_extra *extra, -const char *subject, int length, int startoffset, -int options, int *ovector, int ovecsize); -

    -

    -int pcre_copy_substring(const char *subject, int *ovector, -int stringcount, int stringnumber, char *buffer, -int buffersize); -

    -

    -int pcre_get_substring(const char *subject, int *ovector, -int stringcount, int stringnumber, -const char **stringptr); -

    -

    -int pcre_get_substring_list(const char *subject, -int *ovector, int stringcount, const char ***listptr); -

    -

    -const unsigned char *pcre_maketables(void); -

    -

    -int pcre_fullinfo(const pcre *code, const pcre_extra *extra, -int what, void *where); -

    -

    -int pcre_info(const pcre *code, int *optptr, int -*firstcharptr); -

    -

    -char *pcre_version(void); -

    -

    -void *(*pcre_malloc)(size_t); -

    -

    -void (*pcre_free)(void *); -

    -
  • DESCRIPTION -

    -The PCRE library is a set of functions that implement regular expression -pattern matching using the same syntax and semantics as Perl 5, with just a few -differences (see below). The current implementation corresponds to Perl 5.005, -with some additional features from the Perl development release. -

    -

    -PCRE has its own native API, which is described in this document. There is also -a set of wrapper functions that correspond to the POSIX regular expression API. -These are described in the pcreposix documentation. -

    -

    -The native API function prototypes are defined in the header file pcre.h, -and on Unix systems the library itself is called libpcre.a, so can be -accessed by adding -lpcre to the command for linking an application which -calls it. The header file defines the macros PCRE_MAJOR and PCRE_MINOR to -contain the major and minor release numbers for the library. Applications can -use these to include support for different releases. -

    -

    -The functions pcre_compile(), pcre_study(), and pcre_exec() -are used for compiling and matching regular expressions, while -pcre_copy_substring(), pcre_get_substring(), and -pcre_get_substring_list() are convenience functions for extracting -captured substrings from a matched subject string. The function -pcre_maketables() is used (optionally) to build a set of character tables -in the current locale for passing to pcre_compile(). -

    -

    -The function pcre_fullinfo() is used to find out information about a -compiled pattern; pcre_info() is an obsolete version which returns only -some of the available information, but is retained for backwards compatibility. -The function pcre_version() returns a pointer to a string containing the -version of PCRE and its date of release. -

    -

    -The global variables pcre_malloc and pcre_free initially contain -the entry points of the standard malloc() and free() functions -respectively. PCRE calls the memory management functions via these variables, -so a calling program can replace them if it wishes to intercept the calls. This -should be done before calling any PCRE functions. -

    -
  • MULTI-THREADING -

    -The PCRE functions can be used in multi-threading applications, with the -proviso that the memory management functions pointed to by pcre_malloc -and pcre_free are shared by all threads. -

    -

    -The compiled form of a regular expression is not altered during matching, so -the same compiled pattern can safely be used by several threads at once. -

    -
  • COMPILING A PATTERN -

    -The function pcre_compile() is called to compile a pattern into an -internal form. The pattern is a C string terminated by a binary zero, and -is passed in the argument pattern. A pointer to a single block of memory -that is obtained via pcre_malloc is returned. This contains the -compiled code and related data. The pcre type is defined for this for -convenience, but in fact pcre is just a typedef for void, since the -contents of the block are not externally defined. It is up to the caller to -free the memory when it is no longer required. -

    -

    -The size of a compiled pattern is roughly proportional to the length of the -pattern string, except that each character class (other than those containing -just a single character, negated or not) requires 33 bytes, and repeat -quantifiers with a minimum greater than one or a bounded maximum cause the -relevant portions of the compiled pattern to be replicated. -

    -

    -The options argument contains independent bits that affect the -compilation. It should be zero if no options are required. Some of the options, -in particular, those that are compatible with Perl, can also be set and unset -from within the pattern (see the detailed description of regular expressions -below). For these options, the contents of the options argument specifies -their initial settings at the start of compilation and execution. The -PCRE_ANCHORED option can be set at the time of matching as well as at compile -time. -

    -

    -If errptr is NULL, pcre_compile() returns NULL immediately. -Otherwise, if compilation of a pattern fails, pcre_compile() returns -NULL, and sets the variable pointed to by errptr to point to a textual -error message. The offset from the start of the pattern to the character where -the error was discovered is placed in the variable pointed to by -erroffset, which must not be NULL. If it is, an immediate error is given. -

    -

    -If the final argument, tableptr, is NULL, PCRE uses a default set of -character tables which are built when it is compiled, using the default C -locale. Otherwise, tableptr must be the result of a call to -pcre_maketables(). See the section on locale support below. -

    -

    -The following option bits are defined in the header file: -

    -

    -

    -  PCRE_ANCHORED
    -
    -

    -

    -If this bit is set, the pattern is forced to be "anchored", that is, it is -constrained to match only at the start of the string which is being searched -(the "subject string"). This effect can also be achieved by appropriate -constructs in the pattern itself, which is the only way to do it in Perl. -

    -

    -

    -  PCRE_CASELESS
    -
    -

    -

    -If this bit is set, letters in the pattern match both upper and lower case -letters. It is equivalent to Perl's /i option. -

    -

    -

    -  PCRE_DOLLAR_ENDONLY
    -
    -

    -

    -If this bit is set, a dollar metacharacter in the pattern matches only at the -end of the subject string. Without this option, a dollar also matches -immediately before the final character if it is a newline (but not before any -other newlines). The PCRE_DOLLAR_ENDONLY option is ignored if PCRE_MULTILINE is -set. There is no equivalent to this option in Perl. -

    -

    -

    -  PCRE_DOTALL
    -
    -

    -

    -If this bit is set, a dot metacharater in the pattern matches all characters, -including newlines. Without it, newlines are excluded. This option is -equivalent to Perl's /s option. A negative class such as [^a] always matches a -newline character, independent of the setting of this option. -

    -

    -

    -  PCRE_EXTENDED
    -
    -

    -

    -If this bit is set, whitespace data characters in the pattern are totally -ignored except when escaped or inside a character class, and characters between -an unescaped # outside a character class and the next newline character, -inclusive, are also ignored. This is equivalent to Perl's /x option, and makes -it possible to include comments inside complicated patterns. Note, however, -that this applies only to data characters. Whitespace characters may never -appear within special character sequences in a pattern, for example within the -sequence (?( which introduces a conditional subpattern. -

    -

    -

    -  PCRE_EXTRA
    -
    -

    -

    -This option was invented in order to turn on additional functionality of PCRE -that is incompatible with Perl, but it is currently of very little use. When -set, any backslash in a pattern that is followed by a letter that has no -special meaning causes an error, thus reserving these combinations for future -expansion. By default, as in Perl, a backslash followed by a letter with no -special meaning is treated as a literal. There are at present no other features -controlled by this option. It can also be set by a (?X) option setting within a -pattern. -

    -

    -

    -  PCRE_MULTILINE
    -
    -

    -

    -By default, PCRE treats the subject string as consisting of a single "line" of -characters (even if it actually contains several newlines). The "start of line" -metacharacter (^) matches only at the start of the string, while the "end of -line" metacharacter ($) matches only at the end of the string, or before a -terminating newline (unless PCRE_DOLLAR_ENDONLY is set). This is the same as -Perl. -

    -

    -When PCRE_MULTILINE it is set, the "start of line" and "end of line" constructs -match immediately following or immediately before any newline in the subject -string, respectively, as well as at the very start and end. This is equivalent -to Perl's /m option. If there are no "\n" characters in a subject string, or -no occurrences of ^ or $ in a pattern, setting PCRE_MULTILINE has no -effect. -

    -

    -

    -  PCRE_UNGREEDY
    -
    -

    -

    -This option inverts the "greediness" of the quantifiers so that they are not -greedy by default, but become greedy if followed by "?". It is not compatible -with Perl. It can also be set by a (?U) option setting within the pattern. -

    -
  • STUDYING A PATTERN -

    -When a pattern is going to be used several times, it is worth spending more -time analyzing it in order to speed up the time taken for matching. The -function pcre_study() takes a pointer to a compiled pattern as its first -argument, and returns a pointer to a pcre_extra block (another void -typedef) containing additional information about the pattern; this can be -passed to pcre_exec(). If no additional information is available, NULL -is returned. -

    -

    -The second argument contains option bits. At present, no options are defined -for pcre_study(), and this argument should always be zero. -

    -

    -The third argument for pcre_study() is a pointer to an error message. If -studying succeeds (even if no data is returned), the variable it points to is -set to NULL. Otherwise it points to a textual error message. -

    -

    -At present, studying a pattern is useful only for non-anchored patterns that do -not have a single fixed starting character. A bitmap of possible starting -characters is created. -

    -
  • LOCALE SUPPORT -

    -PCRE handles caseless matching, and determines whether characters are letters, -digits, or whatever, by reference to a set of tables. The library contains a -default set of tables which is created in the default C locale when PCRE is -compiled. This is used when the final argument of pcre_compile() is NULL, -and is sufficient for many applications. -

    -

    -An alternative set of tables can, however, be supplied. Such tables are built -by calling the pcre_maketables() function, which has no arguments, in the -relevant locale. The result can then be passed to pcre_compile() as often -as necessary. For example, to build and use tables that are appropriate for the -French locale (where accented characters with codes greater than 128 are -treated as letters), the following code could be used: -

    -

    -

    -  setlocale(LC_CTYPE, "fr");
    -  tables = pcre_maketables();
    -  re = pcre_compile(..., tables);
    -
    -

    -

    -The tables are built in memory that is obtained via pcre_malloc. The -pointer that is passed to pcre_compile is saved with the compiled -pattern, and the same tables are used via this pointer by pcre_study() -and pcre_exec(). Thus for any single pattern, compilation, studying and -matching all happen in the same locale, but different patterns can be compiled -in different locales. It is the caller's responsibility to ensure that the -memory containing the tables remains available for as long as it is needed. -

    -
  • INFORMATION ABOUT A PATTERN -

    -The pcre_fullinfo() function returns information about a compiled -pattern. It replaces the obsolete pcre_info() function, which is -nevertheless retained for backwards compability (and is documented below). -

    -

    -The first argument for pcre_fullinfo() is a pointer to the compiled -pattern. The second argument is the result of pcre_study(), or NULL if -the pattern was not studied. The third argument specifies which piece of -information is required, while the fourth argument is a pointer to a variable -to receive the data. The yield of the function is zero for success, or one of -the following negative numbers: -

    -

    -

    -  PCRE_ERROR_NULL       the argument code was NULL
    -                        the argument where was NULL
    -  PCRE_ERROR_BADMAGIC   the "magic number" was not found
    -  PCRE_ERROR_BADOPTION  the value of what was invalid
    -
    -

    -

    -The possible values for the third argument are defined in pcre.h, and are -as follows: -

    -

    -

    -  PCRE_INFO_OPTIONS
    -
    -

    -

    -Return a copy of the options with which the pattern was compiled. The fourth -argument should point to au unsigned long int variable. These option bits -are those specified in the call to pcre_compile(), modified by any -top-level option settings within the pattern itself, and with the PCRE_ANCHORED -bit forcibly set if the form of the pattern implies that it can match only at -the start of a subject string. -

    -

    -

    -  PCRE_INFO_SIZE
    -
    -

    -

    -Return the size of the compiled pattern, that is, the value that was passed as -the argument to pcre_malloc() when PCRE was getting memory in which to -place the compiled data. The fourth argument should point to a size_t -variable. -

    -

    -

    -  PCRE_INFO_CAPTURECOUNT
    -
    -

    -

    -Return the number of capturing subpatterns in the pattern. The fourth argument -should point to an \fbint\fR variable. -

    -

    -

    -  PCRE_INFO_BACKREFMAX
    -
    -

    -

    -Return the number of the highest back reference in the pattern. The fourth -argument should point to an int variable. Zero is returned if there are -no back references. -

    -

    -

    -  PCRE_INFO_FIRSTCHAR
    -
    -

    -

    -Return information about the first character of any matched string, for a -non-anchored pattern. If there is a fixed first character, e.g. from a pattern -such as (cat|cow|coyote), it is returned in the integer pointed to by -where. Otherwise, if either -

    -

    -(a) the pattern was compiled with the PCRE_MULTILINE option, and every branch -starts with "^", or -

    -

    -(b) every branch of the pattern starts with ".*" and PCRE_DOTALL is not set -(if it were set, the pattern would be anchored), -

    -

    --1 is returned, indicating that the pattern matches only at the start of a -subject string or after any "\n" within the string. Otherwise -2 is returned. -For anchored patterns, -2 is returned. -

    -

    -

    -  PCRE_INFO_FIRSTTABLE
    -
    -

    -

    -If the pattern was studied, and this resulted in the construction of a 256-bit -table indicating a fixed set of characters for the first character in any -matching string, a pointer to the table is returned. Otherwise NULL is -returned. The fourth argument should point to an unsigned char * -variable. -

    -

    -

    -  PCRE_INFO_LASTLITERAL
    -
    -

    -

    -For a non-anchored pattern, return the value of the rightmost literal character -which must exist in any matched string, other than at its start. The fourth -argument should point to an int variable. If there is no such character, -or if the pattern is anchored, -1 is returned. For example, for the pattern -/a\d+z\d+/ the returned value is 'z'. -

    -

    -The pcre_info() function is now obsolete because its interface is too -restrictive to return all the available data about a compiled pattern. New -programs should use pcre_fullinfo() instead. The yield of -pcre_info() is the number of capturing subpatterns, or one of the -following negative numbers: -

    -

    -

    -  PCRE_ERROR_NULL       the argument code was NULL
    -  PCRE_ERROR_BADMAGIC   the "magic number" was not found
    -
    -

    -

    -If the optptr argument is not NULL, a copy of the options with which the -pattern was compiled is placed in the integer it points to (see -PCRE_INFO_OPTIONS above). -

    -

    -If the pattern is not anchored and the firstcharptr argument is not NULL, -it is used to pass back information about the first character of any matched -string (see PCRE_INFO_FIRSTCHAR above). -

    -
  • MATCHING A PATTERN -

    -The function pcre_exec() is called to match a subject string against a -pre-compiled pattern, which is passed in the code argument. If the -pattern has been studied, the result of the study should be passed in the -extra argument. Otherwise this must be NULL. -

    -

    -The PCRE_ANCHORED option can be passed in the options argument, whose -unused bits must be zero. However, if a pattern was compiled with -PCRE_ANCHORED, or turned out to be anchored by virtue of its contents, it -cannot be made unachored at matching time. -

    -

    -There are also three further options that can be set only at matching time: -

    -

    -

    -  PCRE_NOTBOL
    -
    -

    -

    -The first character of the string is not the beginning of a line, so the -circumflex metacharacter should not match before it. Setting this without -PCRE_MULTILINE (at compile time) causes circumflex never to match. -

    -

    -

    -  PCRE_NOTEOL
    -
    -

    -

    -The end of the string is not the end of a line, so the dollar metacharacter -should not match it nor (except in multiline mode) a newline immediately before -it. Setting this without PCRE_MULTILINE (at compile time) causes dollar never -to match. -

    -

    -

    -  PCRE_NOTEMPTY
    -
    -

    -

    -An empty string is not considered to be a valid match if this option is set. If -there are alternatives in the pattern, they are tried. If all the alternatives -match the empty string, the entire match fails. For example, if the pattern -

    -

    -

    -  a?b?
    -
    -

    -

    -is applied to a string not beginning with "a" or "b", it matches the empty -string at the start of the subject. With PCRE_NOTEMPTY set, this match is not -valid, so PCRE searches further into the string for occurrences of "a" or "b". -

    -

    -Perl has no direct equivalent of PCRE_NOTEMPTY, but it does make a special case -of a pattern match of the empty string within its split() function, and -when using the /g modifier. It is possible to emulate Perl's behaviour after -matching a null string by first trying the match again at the same offset with -PCRE_NOTEMPTY set, and then if that fails by advancing the starting offset (see -below) and trying an ordinary match again. -

    -

    -The subject string is passed as a pointer in subject, a length in -length, and a starting offset in startoffset. Unlike the pattern -string, it may contain binary zero characters. When the starting offset is -zero, the search for a match starts at the beginning of the subject, and this -is by far the most common case. -

    -

    -A non-zero starting offset is useful when searching for another match in the -same subject by calling pcre_exec() again after a previous success. -Setting startoffset differs from just passing over a shortened string and -setting PCRE_NOTBOL in the case of a pattern that begins with any kind of -lookbehind. For example, consider the pattern -

    -

    -

    -  \Biss\B
    -
    -

    -

    -which finds occurrences of "iss" in the middle of words. (\B matches only if -the current position in the subject is not a word boundary.) When applied to -the string "Mississipi" the first call to pcre_exec() finds the first -occurrence. If pcre_exec() is called again with just the remainder of the -subject, namely "issipi", it does not match, because \B is always false at the -start of the subject, which is deemed to be a word boundary. However, if -pcre_exec() is passed the entire string again, but with startoffset -set to 4, it finds the second occurrence of "iss" because it is able to look -behind the starting point to discover that it is preceded by a letter. -

    -

    -If a non-zero starting offset is passed when the pattern is anchored, one -attempt to match at the given offset is tried. This can only succeed if the -pattern does not require the match to be at the start of the subject. -

    -

    -In general, a pattern matches a certain portion of the subject, and in -addition, further substrings from the subject may be picked out by parts of the -pattern. Following the usage in Jeffrey Friedl's book, this is called -"capturing" in what follows, and the phrase "capturing subpattern" is used for -a fragment of a pattern that picks out a substring. PCRE supports several other -kinds of parenthesized subpattern that do not cause substrings to be captured. -

    -

    -Captured substrings are returned to the caller via a vector of integer offsets -whose address is passed in ovector. The number of elements in the vector -is passed in ovecsize. The first two-thirds of the vector is used to pass -back captured substrings, each substring using a pair of integers. The -remaining third of the vector is used as workspace by pcre_exec() while -matching capturing subpatterns, and is not available for passing back -information. The length passed in ovecsize should always be a multiple of -three. If it is not, it is rounded down. -

    -

    -When a match has been successful, information about captured substrings is -returned in pairs of integers, starting at the beginning of ovector, and -continuing up to two-thirds of its length at the most. The first element of a -pair is set to the offset of the first character in a substring, and the second -is set to the offset of the first character after the end of a substring. The -first pair, ovector[0] and ovector[1], identify the portion of the -subject string matched by the entire pattern. The next pair is used for the -first capturing subpattern, and so on. The value returned by pcre_exec() -is the number of pairs that have been set. If there are no capturing -subpatterns, the return value from a successful match is 1, indicating that -just the first pair of offsets has been set. -

    -

    -Some convenience functions are provided for extracting the captured substrings -as separate strings. These are described in the following section. -

    -

    -It is possible for an capturing subpattern number n+1 to match some -part of the subject when subpattern n has not been used at all. For -example, if the string "abc" is matched against the pattern (a|(z))(bc) -subpatterns 1 and 3 are matched, but 2 is not. When this happens, both offset -values corresponding to the unused subpattern are set to -1. -

    -

    -If a capturing subpattern is matched repeatedly, it is the last portion of the -string that it matched that gets returned. -

    -

    -If the vector is too small to hold all the captured substrings, it is used as -far as possible (up to two-thirds of its length), and the function returns a -value of zero. In particular, if the substring offsets are not of interest, -pcre_exec() may be called with ovector passed as NULL and -ovecsize as zero. However, if the pattern contains back references and -the ovector isn't big enough to remember the related substrings, PCRE has -to get additional memory for use during matching. Thus it is usually advisable -to supply an ovector. -

    -

    -Note that pcre_info() can be used to find out how many capturing -subpatterns there are in a compiled pattern. The smallest size for -ovector that will allow for n captured substrings in addition to -the offsets of the substring matched by the whole pattern is (n+1)*3. -

    -

    -If pcre_exec() fails, it returns a negative number. The following are -defined in the header file: -

    -

    -

    -  PCRE_ERROR_NOMATCH        (-1)
    -
    -

    -

    -The subject string did not match the pattern. -

    -

    -

    -  PCRE_ERROR_NULL           (-2)
    -
    -

    -

    -Either code or subject was passed as NULL, or ovector was -NULL and ovecsize was not zero. -

    -

    -

    -  PCRE_ERROR_BADOPTION      (-3)
    -
    -

    -

    -An unrecognized bit was set in the options argument. -

    -

    -

    -  PCRE_ERROR_BADMAGIC       (-4)
    -
    -

    -

    -PCRE stores a 4-byte "magic number" at the start of the compiled code, to catch -the case when it is passed a junk pointer. This is the error it gives when the -magic number isn't present. -

    -

    -

    -  PCRE_ERROR_UNKNOWN_NODE   (-5)
    -
    -

    -

    -While running the pattern match, an unknown item was encountered in the -compiled pattern. This error could be caused by a bug in PCRE or by overwriting -of the compiled pattern. -

    -

    -

    -  PCRE_ERROR_NOMEMORY       (-6)
    -
    -

    -

    -If a pattern contains back references, but the ovector that is passed to -pcre_exec() is not big enough to remember the referenced substrings, PCRE -gets a block of memory at the start of matching to use for this purpose. If the -call via pcre_malloc() fails, this error is given. The memory is freed at -the end of matching. -

    -
  • EXTRACTING CAPTURED SUBSTRINGS -

    -Captured substrings can be accessed directly by using the offsets returned by -pcre_exec() in ovector. For convenience, the functions -pcre_copy_substring(), pcre_get_substring(), and -pcre_get_substring_list() are provided for extracting captured substrings -as new, separate, zero-terminated strings. A substring that contains a binary -zero is correctly extracted and has a further zero added on the end, but the -result does not, of course, function as a C string. -

    -

    -The first three arguments are the same for all three functions: subject -is the subject string which has just been successfully matched, ovector -is a pointer to the vector of integer offsets that was passed to -pcre_exec(), and stringcount is the number of substrings that -were captured by the match, including the substring that matched the entire -regular expression. This is the value returned by pcre_exec if it -is greater than zero. If pcre_exec() returned zero, indicating that it -ran out of space in ovector, the value passed as stringcount should -be the size of the vector divided by three. -

    -

    -The functions pcre_copy_substring() and pcre_get_substring() -extract a single substring, whose number is given as stringnumber. A -value of zero extracts the substring that matched the entire pattern, while -higher values extract the captured substrings. For pcre_copy_substring(), -the string is placed in buffer, whose length is given by -buffersize, while for pcre_get_substring() a new block of store is -obtained via pcre_malloc, and its address is returned via -stringptr. The yield of the function is the length of the string, not -including the terminating zero, or one of -

    -

    -

    -  PCRE_ERROR_NOMEMORY       (-6)
    -
    -

    -

    -The buffer was too small for pcre_copy_substring(), or the attempt to get -memory failed for pcre_get_substring(). -

    -

    -

    -  PCRE_ERROR_NOSUBSTRING    (-7)
    -
    -

    -

    -There is no substring whose number is stringnumber. -

    -

    -The pcre_get_substring_list() function extracts all available substrings -and builds a list of pointers to them. All this is done in a single block of -memory which is obtained via pcre_malloc. The address of the memory block -is returned via listptr, which is also the start of the list of string -pointers. The end of the list is marked by a NULL pointer. The yield of the -function is zero if all went well, or -

    -

    -

    -  PCRE_ERROR_NOMEMORY       (-6)
    -
    -

    -

    -if the attempt to get the memory block failed. -

    -

    -When any of these functions encounter a substring that is unset, which can -happen when capturing subpattern number n+1 matches some part of the -subject, but subpattern n has not been used at all, they return an empty -string. This can be distinguished from a genuine zero-length substring by -inspecting the appropriate offset in ovector, which is negative for unset -substrings. -

    -
  • LIMITATIONS -

    -There are some size limitations in PCRE but it is hoped that they will never in -practice be relevant. -The maximum length of a compiled pattern is 65539 (sic) bytes. -All values in repeating quantifiers must be less than 65536. -The maximum number of capturing subpatterns is 99. -The maximum number of all parenthesized subpatterns, including capturing -subpatterns, assertions, and other types of subpattern, is 200. -

    -

    -The maximum length of a subject string is the largest positive number that an -integer variable can hold. However, PCRE uses recursion to handle subpatterns -and indefinite repetition. This means that the available stack space may limit -the size of a subject string that can be processed by certain patterns. -

    -
  • DIFFERENCES FROM PERL -

    -The differences described here are with respect to Perl 5.005. -

    -

    -1. By default, a whitespace character is any character that the C library -function isspace() recognizes, though it is possible to compile PCRE with -alternative character type tables. Normally isspace() matches space, -formfeed, newline, carriage return, horizontal tab, and vertical tab. Perl 5 -no longer includes vertical tab in its set of whitespace characters. The \v -escape that was in the Perl documentation for a long time was never in fact -recognized. However, the character itself was treated as whitespace at least -up to 5.002. In 5.004 and 5.005 it does not match \s. -

    -

    -2. PCRE does not allow repeat quantifiers on lookahead assertions. Perl permits -them, but they do not mean what you might think. For example, (?!a){3} does -not assert that the next three characters are not "a". It just asserts that the -next character is not "a" three times. -

    -

    -3. Capturing subpatterns that occur inside negative lookahead assertions are -counted, but their entries in the offsets vector are never set. Perl sets its -numerical variables from any such patterns that are matched before the -assertion fails to match something (thereby succeeding), but only if the -negative lookahead assertion contains just one branch. -

    -

    -4. Though binary zero characters are supported in the subject string, they are -not allowed in a pattern string because it is passed as a normal C string, -terminated by zero. The escape sequence "\0" can be used in the pattern to -represent a binary zero. -

    -

    -5. The following Perl escape sequences are not supported: \l, \u, \L, \U, -\E, \Q. In fact these are implemented by Perl's general string-handling and -are not part of its pattern matching engine. -

    -

    -6. The Perl \G assertion is not supported as it is not relevant to single -pattern matches. -

    -

    -7. Fairly obviously, PCRE does not support the (?{code}) and (?p{code}) -constructions. However, there is some experimental support for recursive -patterns using the non-Perl item (?R). -

    -

    -8. There are at the time of writing some oddities in Perl 5.005_02 concerned -with the settings of captured strings when part of a pattern is repeated. For -example, matching "aba" against the pattern /^(a(b)?)+$/ sets $2 to the value -"b", but matching "aabbaa" against /^(aa(bb)?)+$/ leaves $2 unset. However, if -the pattern is changed to /^(aa(b(b))?)+$/ then $2 (and $3) are set. -

    -

    -In Perl 5.004 $2 is set in both cases, and that is also true of PCRE. If in the -future Perl changes to a consistent state that is different, PCRE may change to -follow. -

    -

    -9. Another as yet unresolved discrepancy is that in Perl 5.005_02 the pattern -/^(a)?(?(1)a|b)+$/ matches the string "a", whereas in PCRE it does not. -However, in both Perl and PCRE /^(a)?a/ matched against "a" leaves $1 unset. -

    -

    -10. PCRE provides some extensions to the Perl regular expression facilities: -

    -

    -(a) Although lookbehind assertions must match fixed length strings, each -alternative branch of a lookbehind assertion can match a different length of -string. Perl 5.005 requires them all to have the same length. -

    -

    -(b) If PCRE_DOLLAR_ENDONLY is set and PCRE_MULTILINE is not set, the $ meta- -character matches only at the very end of the string. -

    -

    -(c) If PCRE_EXTRA is set, a backslash followed by a letter with no special -meaning is faulted. -

    -

    -(d) If PCRE_UNGREEDY is set, the greediness of the repetition quantifiers is -inverted, that is, by default they are not greedy, but if followed by a -question mark they are. -

    -

    -(e) PCRE_ANCHORED can be used to force a pattern to be tried only at the start -of the subject. -

    -

    -(f) The PCRE_NOTBOL, PCRE_NOTEOL, and PCRE_NOTEMPTY options for -pcre_exec() have no Perl equivalents. -

    -

    -(g) The (?R) construct allows for recursive pattern matching (Perl 5.6 can do -this using the (?p{code}) construct, which PCRE cannot of course support.) -

    -
  • REGULAR EXPRESSION DETAILS -

    -The syntax and semantics of the regular expressions supported by PCRE are -described below. Regular expressions are also described in the Perl -documentation and in a number of other books, some of which have copious -examples. Jeffrey Friedl's "Mastering Regular Expressions", published by -O'Reilly (ISBN 1-56592-257), covers them in great detail. The description -here is intended as reference documentation. -

    -

    -A regular expression is a pattern that is matched against a subject string from -left to right. Most characters stand for themselves in a pattern, and match the -corresponding characters in the subject. As a trivial example, the pattern -

    -

    -

    -  The quick brown fox
    -
    -

    -

    -matches a portion of a subject string that is identical to itself. The power of -regular expressions comes from the ability to include alternatives and -repetitions in the pattern. These are encoded in the pattern by the use of -meta-characters, which do not stand for themselves but instead are -interpreted in some special way. -

    -

    -There are two different sets of meta-characters: those that are recognized -anywhere in the pattern except within square brackets, and those that are -recognized in square brackets. Outside square brackets, the meta-characters are -as follows: -

    -

    -

    -  \      general escape character with several uses
    -  ^      assert start of subject (or line, in multiline mode)
    -  $      assert end of subject (or line, in multiline mode)
    -  .      match any character except newline (by default)
    -  [      start character class definition
    -  |      start of alternative branch
    -  (      start subpattern
    -  )      end subpattern
    -  ?      extends the meaning of (
    -         also 0 or 1 quantifier
    -         also quantifier minimizer
    -  *      0 or more quantifier
    -  +      1 or more quantifier
    -  {      start min/max quantifier
    -
    -

    -

    -Part of a pattern that is in square brackets is called a "character class". In -a character class the only meta-characters are: -

    -

    -

    -  \      general escape character
    -  ^      negate the class, but only if the first character
    -  -      indicates character range
    -  ]      terminates the character class
    -
    -

    -

    -The following sections describe the use of each of the meta-characters. -

    -
  • BACKSLASH -

    -The backslash character has several uses. Firstly, if it is followed by a -non-alphameric character, it takes away any special meaning that character may -have. This use of backslash as an escape character applies both inside and -outside character classes. -

    -

    -For example, if you want to match a "*" character, you write "\*" in the -pattern. This applies whether or not the following character would otherwise be -interpreted as a meta-character, so it is always safe to precede a -non-alphameric with "\" to specify that it stands for itself. In particular, -if you want to match a backslash, you write "\\". -

    -

    -If a pattern is compiled with the PCRE_EXTENDED option, whitespace in the -pattern (other than in a character class) and characters between a "#" outside -a character class and the next newline character are ignored. An escaping -backslash can be used to include a whitespace or "#" character as part of the -pattern. -

    -

    -A second use of backslash provides a way of encoding non-printing characters -in patterns in a visible manner. There is no restriction on the appearance of -non-printing characters, apart from the binary zero that terminates a pattern, -but when a pattern is being prepared by text editing, it is usually easier to -use one of the following escape sequences than the binary character it -represents: -

    -

    -

    -  \a     alarm, that is, the BEL character (hex 07)
    -  \cx    "control-x", where x is any character
    -  \e     escape (hex 1B)
    -  \f     formfeed (hex 0C)
    -  \n     newline (hex 0A)
    -  \r     carriage return (hex 0D)
    -  \t     tab (hex 09)
    -  \xhh   character with hex code hh
    -  \ddd   character with octal code ddd, or backreference
    -
    -

    -

    -The precise effect of "\cx" is as follows: if "x" is a lower case letter, it -is converted to upper case. Then bit 6 of the character (hex 40) is inverted. -Thus "\cz" becomes hex 1A, but "\c{" becomes hex 3B, while "\c;" becomes hex -7B. -

    -

    -After "\x", up to two hexadecimal digits are read (letters can be in upper or -lower case). -

    -

    -After "\0" up to two further octal digits are read. In both cases, if there -are fewer than two digits, just those that are present are used. Thus the -sequence "\0\x\07" specifies two binary zeros followed by a BEL character. -Make sure you supply two digits after the initial zero if the character that -follows is itself an octal digit. -

    -

    -The handling of a backslash followed by a digit other than 0 is complicated. -Outside a character class, PCRE reads it and any following digits as a decimal -number. If the number is less than 10, or if there have been at least that many -previous capturing left parentheses in the expression, the entire sequence is -taken as a back reference. A description of how this works is given -later, following the discussion of parenthesized subpatterns. -

    -

    -Inside a character class, or if the decimal number is greater than 9 and there -have not been that many capturing subpatterns, PCRE re-reads up to three octal -digits following the backslash, and generates a single byte from the least -significant 8 bits of the value. Any subsequent digits stand for themselves. -For example: -

    -

    -

    -  \040   is another way of writing a space
    -  \40    is the same, provided there are fewer than 40
    -            previous capturing subpatterns
    -  \7     is always a back reference
    -  \11    might be a back reference, or another way of
    -            writing a tab
    -  \011   is always a tab
    -  \0113  is a tab followed by the character "3"
    -  \113   is the character with octal code 113 (since there
    -            can be no more than 99 back references)
    -  \377   is a byte consisting entirely of 1 bits
    -  \81    is either a back reference, or a binary zero
    -            followed by the two characters "8" and "1"
    -
    -

    -

    -Note that octal values of 100 or greater must not be introduced by a leading -zero, because no more than three octal digits are ever read. -

    -

    -All the sequences that define a single byte value can be used both inside and -outside character classes. In addition, inside a character class, the sequence -"\b" is interpreted as the backspace character (hex 08). Outside a character -class it has a different meaning (see below). -

    -

    -The third use of backslash is for specifying generic character types: -

    -

    -

    -  \d     any decimal digit
    -  \D     any character that is not a decimal digit
    -  \s     any whitespace character
    -  \S     any character that is not a whitespace character
    -  \w     any "word" character
    -  \W     any "non-word" character
    -
    -

    -

    -Each pair of escape sequences partitions the complete set of characters into -two disjoint sets. Any given character matches one, and only one, of each pair. -

    -

    -A "word" character is any letter or digit or the underscore character, that is, -any character which can be part of a Perl "word". The definition of letters and -digits is controlled by PCRE's character tables, and may vary if locale- -specific matching is taking place (see "Locale support" above). For example, in -the "fr" (French) locale, some character codes greater than 128 are used for -accented letters, and these are matched by \w. -

    -

    -These character type sequences can appear both inside and outside character -classes. They each match one character of the appropriate type. If the current -matching point is at the end of the subject string, all of them fail, since -there is no character to match. -

    -

    -The fourth use of backslash is for certain simple assertions. An assertion -specifies a condition that has to be met at a particular point in a match, -without consuming any characters from the subject string. The use of -subpatterns for more complicated assertions is described below. The backslashed -assertions are -

    -

    -

    -  \b     word boundary
    -  \B     not a word boundary
    -  \A     start of subject (independent of multiline mode)
    -  \Z     end of subject or newline at end (independent of multiline mode)
    -  \z     end of subject (independent of multiline mode)
    -
    -

    -

    -These assertions may not appear in character classes (but note that "\b" has a -different meaning, namely the backspace character, inside a character class). -

    -

    -A word boundary is a position in the subject string where the current character -and the previous character do not both match \w or \W (i.e. one matches -\w and the other matches \W), or the start or end of the string if the -first or last character matches \w, respectively. -

    -

    -The \A, \Z, and \z assertions differ from the traditional circumflex and -dollar (described below) in that they only ever match at the very start and end -of the subject string, whatever options are set. They are not affected by the -PCRE_NOTBOL or PCRE_NOTEOL options. If the startoffset argument of -pcre_exec() is non-zero, \A can never match. The difference between \Z -and \z is that \Z matches before a newline that is the last character of the -string as well as at the end of the string, whereas \z matches only at the -end. -

    -
  • CIRCUMFLEX AND DOLLAR -

    -Outside a character class, in the default matching mode, the circumflex -character is an assertion which is true only if the current matching point is -at the start of the subject string. If the startoffset argument of -pcre_exec() is non-zero, circumflex can never match. Inside a character -class, circumflex has an entirely different meaning (see below). -

    -

    -Circumflex need not be the first character of the pattern if a number of -alternatives are involved, but it should be the first thing in each alternative -in which it appears if the pattern is ever to match that branch. If all -possible alternatives start with a circumflex, that is, if the pattern is -constrained to match only at the start of the subject, it is said to be an -"anchored" pattern. (There are also other constructs that can cause a pattern -to be anchored.) -

    -

    -A dollar character is an assertion which is true only if the current matching -point is at the end of the subject string, or immediately before a newline -character that is the last character in the string (by default). Dollar need -not be the last character of the pattern if a number of alternatives are -involved, but it should be the last item in any branch in which it appears. -Dollar has no special meaning in a character class. -

    -

    -The meaning of dollar can be changed so that it matches only at the very end of -the string, by setting the PCRE_DOLLAR_ENDONLY option at compile or matching -time. This does not affect the \Z assertion. -

    -

    -The meanings of the circumflex and dollar characters are changed if the -PCRE_MULTILINE option is set. When this is the case, they match immediately -after and immediately before an internal "\n" character, respectively, in -addition to matching at the start and end of the subject string. For example, -the pattern /^abc$/ matches the subject string "def\nabc" in multiline mode, -but not otherwise. Consequently, patterns that are anchored in single line mode -because all branches start with "^" are not anchored in multiline mode, and a -match for circumflex is possible when the startoffset argument of -pcre_exec() is non-zero. The PCRE_DOLLAR_ENDONLY option is ignored if -PCRE_MULTILINE is set. -

    -

    -Note that the sequences \A, \Z, and \z can be used to match the start and -end of the subject in both modes, and if all branches of a pattern start with -\A is it always anchored, whether PCRE_MULTILINE is set or not. -

    -
  • FULL STOP (PERIOD, DOT) -

    -Outside a character class, a dot in the pattern matches any one character in -the subject, including a non-printing character, but not (by default) newline. -If the PCRE_DOTALL option is set, dots match newlines as well. The handling of -dot is entirely independent of the handling of circumflex and dollar, the only -relationship being that they both involve newline characters. Dot has no -special meaning in a character class. -

    -
  • SQUARE BRACKETS -

    -An opening square bracket introduces a character class, terminated by a closing -square bracket. A closing square bracket on its own is not special. If a -closing square bracket is required as a member of the class, it should be the -first data character in the class (after an initial circumflex, if present) or -escaped with a backslash. -

    -

    -A character class matches a single character in the subject; the character must -be in the set of characters defined by the class, unless the first character in -the class is a circumflex, in which case the subject character must not be in -the set defined by the class. If a circumflex is actually required as a member -of the class, ensure it is not the first character, or escape it with a -backslash. -

    -

    -For example, the character class [aeiou] matches any lower case vowel, while -[^aeiou] matches any character that is not a lower case vowel. Note that a -circumflex is just a convenient notation for specifying the characters which -are in the class by enumerating those that are not. It is not an assertion: it -still consumes a character from the subject string, and fails if the current -pointer is at the end of the string. -

    -

    -When caseless matching is set, any letters in a class represent both their -upper case and lower case versions, so for example, a caseless [aeiou] matches -"A" as well as "a", and a caseless [^aeiou] does not match "A", whereas a -caseful version would. -

    -

    -The newline character is never treated in any special way in character classes, -whatever the setting of the PCRE_DOTALL or PCRE_MULTILINE options is. A class -such as [^a] will always match a newline. -

    -

    -The minus (hyphen) character can be used to specify a range of characters in a -character class. For example, [d-m] matches any letter between d and m, -inclusive. If a minus character is required in a class, it must be escaped with -a backslash or appear in a position where it cannot be interpreted as -indicating a range, typically as the first or last character in the class. -

    -

    -It is not possible to have the literal character "]" as the end character of a -range. A pattern such as [W-]46] is interpreted as a class of two characters -("W" and "-") followed by a literal string "46]", so it would match "W46]" or -"-46]". However, if the "]" is escaped with a backslash it is interpreted as -the end of range, so [W-\]46] is interpreted as a single class containing a -range followed by two separate characters. The octal or hexadecimal -representation of "]" can also be used to end a range. -

    -

    -Ranges operate in ASCII collating sequence. They can also be used for -characters specified numerically, for example [\000-\037]. If a range that -includes letters is used when caseless matching is set, it matches the letters -in either case. For example, [W-c] is equivalent to [][\^_`wxyzabc], matched -caselessly, and if character tables for the "fr" locale are in use, -[\xc8-\xcb] matches accented E characters in both cases. -

    -

    -The character types \d, \D, \s, \S, \w, and \W may also appear in a -character class, and add the characters that they match to the class. For -example, [\dABCDEF] matches any hexadecimal digit. A circumflex can -conveniently be used with the upper case character types to specify a more -restricted set of characters than the matching lower case type. For example, -the class [^\W_] matches any letter or digit, but not underscore. -

    -

    -All non-alphameric characters other than \, -, ^ (at the start) and the -terminating ] are non-special in character classes, but it does no harm if they -are escaped. -

    -
  • POSIX CHARACTER CLASSES -

    -Perl 5.6 (not yet released at the time of writing) is going to support the -POSIX notation for character classes, which uses names enclosed by [: and :] -within the enclosing square brackets. PCRE supports this notation. For example, -

    -

    -

    -  [01[:alpha:]%]
    -
    -

    -

    -matches "0", "1", any alphabetic character, or "%". The supported class names -are -

    -

    -

    -  alnum    letters and digits
    -  alpha    letters
    -  ascii    character codes 0 - 127
    -  cntrl    control characters
    -  digit    decimal digits (same as \d)
    -  graph    printing characters, excluding space
    -  lower    lower case letters
    -  print    printing characters, including space
    -  punct    printing characters, excluding letters and digits
    -  space    white space (same as \s)
    -  upper    upper case letters
    -  word     "word" characters (same as \w)
    -  xdigit   hexadecimal digits
    -
    -

    -

    -The names "ascii" and "word" are Perl extensions. Another Perl extension is -negation, which is indicated by a ^ character after the colon. For example, -

    -

    -

    -  [12[:^digit:]]
    -
    -

    -

    -matches "1", "2", or any non-digit. PCRE (and Perl) also recogize the POSIX -syntax [.ch.] and [=ch=] where "ch" is a "collating element", but these are not -supported, and an error is given if they are encountered. -

    -
  • VERTICAL BAR -

    -Vertical bar characters are used to separate alternative patterns. For example, -the pattern -

    -

    -

    -  gilbert|sullivan
    -
    -

    -

    -matches either "gilbert" or "sullivan". Any number of alternatives may appear, -and an empty alternative is permitted (matching the empty string). -The matching process tries each alternative in turn, from left to right, -and the first one that succeeds is used. If the alternatives are within a -subpattern (defined below), "succeeds" means matching the rest of the main -pattern as well as the alternative in the subpattern. -

    -
  • INTERNAL OPTION SETTING -

    -The settings of PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and PCRE_EXTENDED -can be changed from within the pattern by a sequence of Perl option letters -enclosed between "(?" and ")". The option letters are -

    -

    -

    -  i  for PCRE_CASELESS
    -  m  for PCRE_MULTILINE
    -  s  for PCRE_DOTALL
    -  x  for PCRE_EXTENDED
    -
    -

    -

    -For example, (?im) sets caseless, multiline matching. It is also possible to -unset these options by preceding the letter with a hyphen, and a combined -setting and unsetting such as (?im-sx), which sets PCRE_CASELESS and -PCRE_MULTILINE while unsetting PCRE_DOTALL and PCRE_EXTENDED, is also -permitted. If a letter appears both before and after the hyphen, the option is -unset. -

    -

    -The scope of these option changes depends on where in the pattern the setting -occurs. For settings that are outside any subpattern (defined below), the -effect is the same as if the options were set or unset at the start of -matching. The following patterns all behave in exactly the same way: -

    -

    -

    -  (?i)abc
    -  a(?i)bc
    -  ab(?i)c
    -  abc(?i)
    -
    -

    -

    -which in turn is the same as compiling the pattern abc with PCRE_CASELESS set. -In other words, such "top level" settings apply to the whole pattern (unless -there are other changes inside subpatterns). If there is more than one setting -of the same option at top level, the rightmost setting is used. -

    -

    -If an option change occurs inside a subpattern, the effect is different. This -is a change of behaviour in Perl 5.005. An option change inside a subpattern -affects only that part of the subpattern that follows it, so -

    -

    -

    -  (a(?i)b)c
    -
    -

    -

    -matches abc and aBc and no other strings (assuming PCRE_CASELESS is not used). -By this means, options can be made to have different settings in different -parts of the pattern. Any changes made in one alternative do carry on -into subsequent branches within the same subpattern. For example, -

    -

    -

    -  (a(?i)b|c)
    -
    -

    -

    -matches "ab", "aB", "c", and "C", even though when matching "C" the first -branch is abandoned before the option setting. This is because the effects of -option settings happen at compile time. There would be some very weird -behaviour otherwise. -

    -

    -The PCRE-specific options PCRE_UNGREEDY and PCRE_EXTRA can be changed in the -same way as the Perl-compatible options by using the characters U and X -respectively. The (?X) flag setting is special in that it must always occur -earlier in the pattern than any of the additional features it turns on, even -when it is at top level. It is best put at the start. -

    -
  • SUBPATTERNS -

    -Subpatterns are delimited by parentheses (round brackets), which can be nested. -Marking part of a pattern as a subpattern does two things: -

    -

    -1. It localizes a set of alternatives. For example, the pattern -

    -

    -

    -  cat(aract|erpillar|)
    -
    -

    -

    -matches one of the words "cat", "cataract", or "caterpillar". Without the -parentheses, it would match "cataract", "erpillar" or the empty string. -

    -

    -2. It sets up the subpattern as a capturing subpattern (as defined above). -When the whole pattern matches, that portion of the subject string that matched -the subpattern is passed back to the caller via the ovector argument of -pcre_exec(). Opening parentheses are counted from left to right (starting -from 1) to obtain the numbers of the capturing subpatterns. -

    -

    -For example, if the string "the red king" is matched against the pattern -

    -

    -

    -  the ((red|white) (king|queen))
    -
    -

    -

    -the captured substrings are "red king", "red", and "king", and are numbered 1, -2, and 3. -

    -

    -The fact that plain parentheses fulfil two functions is not always helpful. -There are often times when a grouping subpattern is required without a -capturing requirement. If an opening parenthesis is followed by "?:", the -subpattern does not do any capturing, and is not counted when computing the -number of any subsequent capturing subpatterns. For example, if the string "the -white queen" is matched against the pattern -

    -

    -

    -  the ((?:red|white) (king|queen))
    -
    -

    -

    -the captured substrings are "white queen" and "queen", and are numbered 1 and -2. The maximum number of captured substrings is 99, and the maximum number of -all subpatterns, both capturing and non-capturing, is 200. -

    -

    -As a convenient shorthand, if any option settings are required at the start of -a non-capturing subpattern, the option letters may appear between the "?" and -the ":". Thus the two patterns -

    -

    -

    -  (?i:saturday|sunday)
    -  (?:(?i)saturday|sunday)
    -
    -

    -

    -match exactly the same set of strings. Because alternative branches are tried -from left to right, and options are not reset until the end of the subpattern -is reached, an option setting in one branch does affect subsequent branches, so -the above patterns match "SUNDAY" as well as "Saturday". -

    -
  • REPETITION -

    -Repetition is specified by quantifiers, which can follow any of the following -items: -

    -

    -

    -  a single character, possibly escaped
    -  the . metacharacter
    -  a character class
    -  a back reference (see next section)
    -  a parenthesized subpattern (unless it is an assertion - see below)
    -
    -

    -

    -The general repetition quantifier specifies a minimum and maximum number of -permitted matches, by giving the two numbers in curly brackets (braces), -separated by a comma. The numbers must be less than 65536, and the first must -be less than or equal to the second. For example: -

    -

    -

    -  z{2,4}
    -
    -

    -

    -matches "zz", "zzz", or "zzzz". A closing brace on its own is not a special -character. If the second number is omitted, but the comma is present, there is -no upper limit; if the second number and the comma are both omitted, the -quantifier specifies an exact number of required matches. Thus -

    -

    -

    -  [aeiou]{3,}
    -
    -

    -

    -matches at least 3 successive vowels, but may match many more, while -

    -

    -

    -  \d{8}
    -
    -

    -

    -matches exactly 8 digits. An opening curly bracket that appears in a position -where a quantifier is not allowed, or one that does not match the syntax of a -quantifier, is taken as a literal character. For example, {,6} is not a -quantifier, but a literal string of four characters. -

    -

    -The quantifier {0} is permitted, causing the expression to behave as if the -previous item and the quantifier were not present. -

    -

    -For convenience (and historical compatibility) the three most common -quantifiers have single-character abbreviations: -

    -

    -

    -  *    is equivalent to {0,}
    -  +    is equivalent to {1,}
    -  ?    is equivalent to {0,1}
    -
    -

    -

    -It is possible to construct infinite loops by following a subpattern that can -match no characters with a quantifier that has no upper limit, for example: -

    -

    -

    -  (a?)*
    -
    -

    -

    -Earlier versions of Perl and PCRE used to give an error at compile time for -such patterns. However, because there are cases where this can be useful, such -patterns are now accepted, but if any repetition of the subpattern does in fact -match no characters, the loop is forcibly broken. -

    -

    -By default, the quantifiers are "greedy", that is, they match as much as -possible (up to the maximum number of permitted times), without causing the -rest of the pattern to fail. The classic example of where this gives problems -is in trying to match comments in C programs. These appear between the -sequences /* and */ and within the sequence, individual * and / characters may -appear. An attempt to match C comments by applying the pattern -

    -

    -

    -  /\*.*\*/
    -
    -

    -

    -to the string -

    -

    -

    -  /* first command */  not comment  /* second comment */
    -
    -

    -

    -fails, because it matches the entire string due to the greediness of the .* -item. -

    -

    -However, if a quantifier is followed by a question mark, it ceases to be -greedy, and instead matches the minimum number of times possible, so the -pattern -

    -

    -

    -  /\*.*?\*/
    -
    -

    -

    -does the right thing with the C comments. The meaning of the various -quantifiers is not otherwise changed, just the preferred number of matches. -Do not confuse this use of question mark with its use as a quantifier in its -own right. Because it has two uses, it can sometimes appear doubled, as in -

    -

    -

    -  \d??\d
    -
    -

    -

    -which matches one digit by preference, but can match two if that is the only -way the rest of the pattern matches. -

    -

    -If the PCRE_UNGREEDY option is set (an option which is not available in Perl), -the quantifiers are not greedy by default, but individual ones can be made -greedy by following them with a question mark. In other words, it inverts the -default behaviour. -

    -

    -When a parenthesized subpattern is quantified with a minimum repeat count that -is greater than 1 or with a limited maximum, more store is required for the -compiled pattern, in proportion to the size of the minimum or maximum. -

    -

    -If a pattern starts with .* or .{0,} and the PCRE_DOTALL option (equivalent -to Perl's /s) is set, thus allowing the . to match newlines, the pattern is -implicitly anchored, because whatever follows will be tried against every -character position in the subject string, so there is no point in retrying the -overall match at any position after the first. PCRE treats such a pattern as -though it were preceded by \A. In cases where it is known that the subject -string contains no newlines, it is worth setting PCRE_DOTALL when the pattern -begins with .* in order to obtain this optimization, or alternatively using ^ -to indicate anchoring explicitly. -

    -

    -When a capturing subpattern is repeated, the value captured is the substring -that matched the final iteration. For example, after -

    -

    -

    -  (tweedle[dume]{3}\s*)+
    -
    -

    -

    -has matched "tweedledum tweedledee" the value of the captured substring is -"tweedledee". However, if there are nested capturing subpatterns, the -corresponding captured values may have been set in previous iterations. For -example, after -

    -

    -

    -  /(a|(b))+/
    -
    -

    -

    -matches "aba" the value of the second captured substring is "b". -

    -
  • BACK REFERENCES -

    -Outside a character class, a backslash followed by a digit greater than 0 (and -possibly further digits) is a back reference to a capturing subpattern earlier -(i.e. to its left) in the pattern, provided there have been that many previous -capturing left parentheses. -

    -

    -However, if the decimal number following the backslash is less than 10, it is -always taken as a back reference, and causes an error only if there are not -that many capturing left parentheses in the entire pattern. In other words, the -parentheses that are referenced need not be to the left of the reference for -numbers less than 10. See the section entitled "Backslash" above for further -details of the handling of digits following a backslash. -

    -

    -A back reference matches whatever actually matched the capturing subpattern in -the current subject string, rather than anything matching the subpattern -itself. So the pattern -

    -

    -

    -  (sens|respons)e and \1ibility
    -
    -

    -

    -matches "sense and sensibility" and "response and responsibility", but not -"sense and responsibility". If caseful matching is in force at the time of the -back reference, the case of letters is relevant. For example, -

    -

    -

    -  ((?i)rah)\s+\1
    -
    -

    -

    -matches "rah rah" and "RAH RAH", but not "RAH rah", even though the original -capturing subpattern is matched caselessly. -

    -

    -There may be more than one back reference to the same subpattern. If a -subpattern has not actually been used in a particular match, any back -references to it always fail. For example, the pattern -

    -

    -

    -  (a|(bc))\2
    -
    -

    -

    -always fails if it starts to match "a" rather than "bc". Because there may be -up to 99 back references, all digits following the backslash are taken -as part of a potential back reference number. If the pattern continues with a -digit character, some delimiter must be used to terminate the back reference. -If the PCRE_EXTENDED option is set, this can be whitespace. Otherwise an empty -comment can be used. -

    -

    -A back reference that occurs inside the parentheses to which it refers fails -when the subpattern is first used, so, for example, (a\1) never matches. -However, such references can be useful inside repeated subpatterns. For -example, the pattern -

    -

    -

    -  (a|b\1)+
    -
    -

    -

    -matches any number of "a"s and also "aba", "ababaa" etc. At each iteration of -the subpattern, the back reference matches the character string corresponding -to the previous iteration. In order for this to work, the pattern must be such -that the first iteration does not need to match the back reference. This can be -done using alternation, as in the example above, or by a quantifier with a -minimum of zero. -

    -
  • ASSERTIONS -

    -An assertion is a test on the characters following or preceding the current -matching point that does not actually consume any characters. The simple -assertions coded as \b, \B, \A, \Z, \z, ^ and $ are described above. More -complicated assertions are coded as subpatterns. There are two kinds: those -that look ahead of the current position in the subject string, and those that -look behind it. -

    -

    -An assertion subpattern is matched in the normal way, except that it does not -cause the current matching position to be changed. Lookahead assertions start -with (?= for positive assertions and (?! for negative assertions. For example, -

    -

    -

    -  \w+(?=;)
    -
    -

    -

    -matches a word followed by a semicolon, but does not include the semicolon in -the match, and -

    -

    -

    -  foo(?!bar)
    -
    -

    -

    -matches any occurrence of "foo" that is not followed by "bar". Note that the -apparently similar pattern -

    -

    -

    -  (?!foo)bar
    -
    -

    -

    -does not find an occurrence of "bar" that is preceded by something other than -"foo"; it finds any occurrence of "bar" whatsoever, because the assertion -(?!foo) is always true when the next three characters are "bar". A -lookbehind assertion is needed to achieve this effect. -

    -

    -Lookbehind assertions start with (?<= for positive assertions and (?<! for -negative assertions. For example, -

    -

    -

    -  (?<!foo)bar
    -
    -

    -

    -does find an occurrence of "bar" that is not preceded by "foo". The contents of -a lookbehind assertion are restricted such that all the strings it matches must -have a fixed length. However, if there are several alternatives, they do not -all have to have the same fixed length. Thus -

    -

    -

    -  (?<=bullock|donkey)
    -
    -

    -

    -is permitted, but -

    -

    -

    -  (?<!dogs?|cats?)
    -
    -

    -

    -causes an error at compile time. Branches that match different length strings -are permitted only at the top level of a lookbehind assertion. This is an -extension compared with Perl 5.005, which requires all branches to match the -same length of string. An assertion such as -

    -

    -

    -  (?<=ab(c|de))
    -
    -

    -

    -is not permitted, because its single top-level branch can match two different -lengths, but it is acceptable if rewritten to use two top-level branches: -

    -

    -

    -  (?<=abc|abde)
    -
    -

    -

    -The implementation of lookbehind assertions is, for each alternative, to -temporarily move the current position back by the fixed width and then try to -match. If there are insufficient characters before the current position, the -match is deemed to fail. Lookbehinds in conjunction with once-only subpatterns -can be particularly useful for matching at the ends of strings; an example is -given at the end of the section on once-only subpatterns. -

    -

    -Several assertions (of any sort) may occur in succession. For example, -

    -

    -

    -  (?<=\d{3})(?<!999)foo
    -
    -

    -

    -matches "foo" preceded by three digits that are not "999". Notice that each of -the assertions is applied independently at the same point in the subject -string. First there is a check that the previous three characters are all -digits, and then there is a check that the same three characters are not "999". -This pattern does not match "foo" preceded by six characters, the first -of which are digits and the last three of which are not "999". For example, it -doesn't match "123abcfoo". A pattern to do that is -

    -

    -

    -  (?<=\d{3}...)(?<!999)foo
    -
    -

    -

    -This time the first assertion looks at the preceding six characters, checking -that the first three are digits, and then the second assertion checks that the -preceding three characters are not "999". -

    -

    -Assertions can be nested in any combination. For example, -

    -

    -

    -  (?<=(?<!foo)bar)baz
    -
    -

    -

    -matches an occurrence of "baz" that is preceded by "bar" which in turn is not -preceded by "foo", while -

    -

    -

    -  (?<=\d{3}(?!999)...)foo
    -
    -

    -

    -is another pattern which matches "foo" preceded by three digits and any three -characters that are not "999". -

    -

    -Assertion subpatterns are not capturing subpatterns, and may not be repeated, -because it makes no sense to assert the same thing several times. If any kind -of assertion contains capturing subpatterns within it, these are counted for -the purposes of numbering the capturing subpatterns in the whole pattern. -However, substring capturing is carried out only for positive assertions, -because it does not make sense for negative assertions. -

    -

    -Assertions count towards the maximum of 200 parenthesized subpatterns. -

    -
  • ONCE-ONLY SUBPATTERNS -

    -With both maximizing and minimizing repetition, failure of what follows -normally causes the repeated item to be re-evaluated to see if a different -number of repeats allows the rest of the pattern to match. Sometimes it is -useful to prevent this, either to change the nature of the match, or to cause -it fail earlier than it otherwise might, when the author of the pattern knows -there is no point in carrying on. -

    -

    -Consider, for example, the pattern \d+foo when applied to the subject line -

    -

    -

    -  123456bar
    -
    -

    -

    -After matching all 6 digits and then failing to match "foo", the normal -action of the matcher is to try again with only 5 digits matching the \d+ -item, and then with 4, and so on, before ultimately failing. Once-only -subpatterns provide the means for specifying that once a portion of the pattern -has matched, it is not to be re-evaluated in this way, so the matcher would -give up immediately on failing to match "foo" the first time. The notation is -another kind of special parenthesis, starting with (?> as in this example: -

    -

    -

    -  (?>\d+)bar
    -
    -

    -

    -This kind of parenthesis "locks up" the part of the pattern it contains once -it has matched, and a failure further into the pattern is prevented from -backtracking into it. Backtracking past it to previous items, however, works as -normal. -

    -

    -An alternative description is that a subpattern of this type matches the string -of characters that an identical standalone pattern would match, if anchored at -the current point in the subject string. -

    -

    -Once-only subpatterns are not capturing subpatterns. Simple cases such as the -above example can be thought of as a maximizing repeat that must swallow -everything it can. So, while both \d+ and \d+? are prepared to adjust the -number of digits they match in order to make the rest of the pattern match, -(?>\d+) can only match an entire sequence of digits. -

    -

    -This construction can of course contain arbitrarily complicated subpatterns, -and it can be nested. -

    -

    -Once-only subpatterns can be used in conjunction with lookbehind assertions to -specify efficient matching at the end of the subject string. Consider a simple -pattern such as -

    -

    -

    -  abcd$
    -
    -

    -

    -when applied to a long string which does not match. Because matching proceeds -from left to right, PCRE will look for each "a" in the subject and then see if -what follows matches the rest of the pattern. If the pattern is specified as -

    -

    -

    -  ^.*abcd$
    -
    -

    -

    -the initial .* matches the entire string at first, but when this fails (because -there is no following "a"), it backtracks to match all but the last character, -then all but the last two characters, and so on. Once again the search for "a" -covers the entire string, from right to left, so we are no better off. However, -if the pattern is written as -

    -

    -

    -  ^(?>.*)(?<=abcd)
    -
    -

    -

    -there can be no backtracking for the .* item; it can match only the entire -string. The subsequent lookbehind assertion does a single test on the last four -characters. If it fails, the match fails immediately. For long strings, this -approach makes a significant difference to the processing time. -

    -

    -When a pattern contains an unlimited repeat inside a subpattern that can itself -be repeated an unlimited number of times, the use of a once-only subpattern is -the only way to avoid some failing matches taking a very long time indeed. -The pattern -

    -

    -

    -  (\D+|<\d+>)*[!?]
    -
    -

    -

    -matches an unlimited number of substrings that either consist of non-digits, or -digits enclosed in <>, followed by either ! or ?. When it matches, it runs -quickly. However, if it is applied to -

    -

    -

    -  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    -
    -

    -

    -it takes a long time before reporting failure. This is because the string can -be divided between the two repeats in a large number of ways, and all have to -be tried. (The example used [!?] rather than a single character at the end, -because both PCRE and Perl have an optimization that allows for fast failure -when a single character is used. They remember the last single character that -is required for a match, and fail early if it is not present in the string.) -If the pattern is changed to -

    -

    -

    -  ((?>\D+)|<\d+>)*[!?]
    -
    -

    -

    -sequences of non-digits cannot be broken, and failure happens quickly. -

    -
  • CONDITIONAL SUBPATTERNS -

    -It is possible to cause the matching process to obey a subpattern -conditionally or to choose between two alternative subpatterns, depending on -the result of an assertion, or whether a previous capturing subpattern matched -or not. The two possible forms of conditional subpattern are -

    -

    -

    -  (?(condition)yes-pattern)
    -  (?(condition)yes-pattern|no-pattern)
    -
    -

    -

    -If the condition is satisfied, the yes-pattern is used; otherwise the -no-pattern (if present) is used. If there are more than two alternatives in the -subpattern, a compile-time error occurs. -

    -

    -There are two kinds of condition. If the text between the parentheses consists -of a sequence of digits, the condition is satisfied if the capturing subpattern -of that number has previously matched. Consider the following pattern, which -contains non-significant white space to make it more readable (assume the -PCRE_EXTENDED option) and to divide it into three parts for ease of discussion: -

    -

    -

    -  ( \( )?    [^()]+    (?(1) \) )
    -
    -

    -

    -The first part matches an optional opening parenthesis, and if that -character is present, sets it as the first captured substring. The second part -matches one or more characters that are not parentheses. The third part is a -conditional subpattern that tests whether the first set of parentheses matched -or not. If they did, that is, if subject started with an opening parenthesis, -the condition is true, and so the yes-pattern is executed and a closing -parenthesis is required. Otherwise, since no-pattern is not present, the -subpattern matches nothing. In other words, this pattern matches a sequence of -non-parentheses, optionally enclosed in parentheses. -

    -

    -If the condition is not a sequence of digits, it must be an assertion. This may -be a positive or negative lookahead or lookbehind assertion. Consider this -pattern, again containing non-significant white space, and with the two -alternatives on the second line: -

    -

    -

    -  (?(?=[^a-z]*[a-z])
    -  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} )
    -
    -

    -

    -The condition is a positive lookahead assertion that matches an optional -sequence of non-letters followed by a letter. In other words, it tests for the -presence of at least one letter in the subject. If a letter is found, the -subject is matched against the first alternative; otherwise it is matched -against the second. This pattern matches strings in one of the two forms -dd-aaa-dd or dd-dd-dd, where aaa are letters and dd are digits. -

    -
  • COMMENTS -

    -The sequence (?# marks the start of a comment which continues up to the next -closing parenthesis. Nested parentheses are not permitted. The characters -that make up a comment play no part in the pattern matching at all. -

    -

    -If the PCRE_EXTENDED option is set, an unescaped # character outside a -character class introduces a comment that continues up to the next newline -character in the pattern. -

    -
  • RECURSIVE PATTERNS -

    -Consider the problem of matching a string in parentheses, allowing for -unlimited nested parentheses. Without the use of recursion, the best that can -be done is to use a pattern that matches up to some fixed depth of nesting. It -is not possible to handle an arbitrary nesting depth. Perl 5.6 has provided an -experimental facility that allows regular expressions to recurse (amongst other -things). It does this by interpolating Perl code in the expression at run time, -and the code can refer to the expression itself. A Perl pattern to solve the -parentheses problem can be created like this: -

    -

    -

    -  $re = qr{\( (?: (?>[^()]+) | (?p{$re}) )* \)}x;
    -
    -

    -

    -The (?p{...}) item interpolates Perl code at run time, and in this case refers -recursively to the pattern in which it appears. Obviously, PCRE cannot support -the interpolation of Perl code. Instead, the special item (?R) is provided for -the specific case of recursion. This PCRE pattern solves the parentheses -problem (assume the PCRE_EXTENDED option is set so that white space is -ignored): -

    -

    -

    -  \( ( (?>[^()]+) | (?R) )* \)
    -
    -

    -

    -First it matches an opening parenthesis. Then it matches any number of -substrings which can either be a sequence of non-parentheses, or a recursive -match of the pattern itself (i.e. a correctly parenthesized substring). Finally -there is a closing parenthesis. -

    -

    -This particular example pattern contains nested unlimited repeats, and so the -use of a once-only subpattern for matching strings of non-parentheses is -important when applying the pattern to strings that do not match. For example, -when it is applied to -

    -

    -

    -  (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
    -
    -

    -

    -it yields "no match" quickly. However, if a once-only subpattern is not used, -the match runs for a very long time indeed because there are so many different -ways the + and * repeats can carve up the subject, and all have to be tested -before failure can be reported. -

    -

    -The values set for any capturing subpatterns are those from the outermost level -of the recursion at which the subpattern value is set. If the pattern above is -matched against -

    -

    -

    -  (ab(cd)ef)
    -
    -

    -

    -the value for the capturing parentheses is "ef", which is the last value taken -on at the top level. If additional parentheses are added, giving -

    -

    -

    -  \( ( ( (?>[^()]+) | (?R) )* ) \)
    -     ^                        ^
    -     ^                        ^
    -
    -the string they capture is "ab(cd)ef", the contents of the top level -parentheses. If there are more than 15 capturing parentheses in a pattern, PCRE -has to obtain extra memory to store data during a recursion, which it does by -using pcre_malloc, freeing it via pcre_free afterwards. If no -memory can be obtained, it saves data for the first 15 capturing parentheses -only, as there is no way to give an out-of-memory error from within a -recursion. -

    -
  • PERFORMANCE -

    -Certain items that may appear in patterns are more efficient than others. It is -more efficient to use a character class like [aeiou] than a set of alternatives -such as (a|e|i|o|u). In general, the simplest construction that provides the -required behaviour is usually the most efficient. Jeffrey Friedl's book -contains a lot of discussion about optimizing regular expressions for efficient -performance. -

    -

    -When a pattern begins with .* and the PCRE_DOTALL option is set, the pattern is -implicitly anchored by PCRE, since it can match only at the start of a subject -string. However, if PCRE_DOTALL is not set, PCRE cannot make this optimization, -because the . metacharacter does not then match a newline, and if the subject -string contains newlines, the pattern may match from the character immediately -following one of them instead of from the very start. For example, the pattern -

    -

    -

    -  (.*) second
    -
    -

    -

    -matches the subject "first\nand second" (where \n stands for a newline -character) with the first captured substring being "and". In order to do this, -PCRE has to retry the match starting after every newline in the subject. -

    -

    -If you are using such a pattern with subject strings that do not contain -newlines, the best performance is obtained by setting PCRE_DOTALL, or starting -the pattern with ^.* to indicate explicit anchoring. That saves PCRE from -having to scan along the subject looking for a newline to restart at. -

    -

    -Beware of patterns that contain nested indefinite repeats. These can take a -long time to run when applied to a string that does not match. Consider the -pattern fragment -

    -

    -

    -  (a+)*
    -
    -

    -

    -This can match "aaaa" in 33 different ways, and this number increases very -rapidly as the string gets longer. (The * repeat can match 0, 1, 2, 3, or 4 -times, and for each of those cases other than 0, the + repeats can match -different numbers of times.) When the remainder of the pattern is such that the -entire match is going to fail, PCRE has in principle to try every possible -variation, and this can take an extremely long time. -

    -

    -An optimization catches some of the more simple cases such as -

    -

    -

    -  (a+)*b
    -
    -

    -

    -where a literal character follows. Before embarking on the standard matching -procedure, PCRE checks that there is a "b" later in the subject string, and if -there is not, it fails the match immediately. However, when there is no -following literal this optimization cannot be used. You can see the difference -by comparing the behaviour of -

    -

    -

    -  (a+)*\d
    -
    -

    -

    -with the pattern above. The former gives a failure almost instantly when -applied to a whole line of "a" characters, whereas the latter takes an -appreciable time with strings longer than about 20 characters. -

    -
  • AUTHOR -

    -Philip Hazel <ph10@cam.ac.uk> -
    -University Computing Service, -
    -New Museums Site, -
    -Cambridge CB2 3QG, England. -
    -Phone: +44 1223 334714 -

    -

    -Last updated: 27 January 2000 -
    -Copyright (c) 1997-2000 University of Cambridge. diff --git a/srclib/pcre/doc/pcre.txt b/srclib/pcre/doc/pcre.txt deleted file mode 100644 index b8106e4457..0000000000 --- a/srclib/pcre/doc/pcre.txt +++ /dev/null @@ -1,1977 +0,0 @@ -NAME - pcre - Perl-compatible regular expressions. - - - -SYNOPSIS - #include - - pcre *pcre_compile(const char *pattern, int options, - const char **errptr, int *erroffset, - const unsigned char *tableptr); - - pcre_extra *pcre_study(const pcre *code, int options, - const char **errptr); - - int pcre_exec(const pcre *code, const pcre_extra *extra, - const char *subject, int length, int startoffset, - int options, int *ovector, int ovecsize); - - int pcre_copy_substring(const char *subject, int *ovector, - int stringcount, int stringnumber, char *buffer, - int buffersize); - - int pcre_get_substring(const char *subject, int *ovector, - int stringcount, int stringnumber, - const char **stringptr); - - int pcre_get_substring_list(const char *subject, - int *ovector, int stringcount, const char ***listptr); - - const unsigned char *pcre_maketables(void); - - int pcre_fullinfo(const pcre *code, const pcre_extra *extra, - int what, void *where); - - int pcre_info(const pcre *code, int *optptr, *firstcharptr); - - char *pcre_version(void); - - void *(*pcre_malloc)(size_t); - - void (*pcre_free)(void *); - - - - -DESCRIPTION - The PCRE library is a set of functions that implement regu- - lar expression pattern matching using the same syntax and - semantics as Perl 5, with just a few differences (see - below). The current implementation corresponds to Perl - 5.005, with some additional features from the Perl develop- - ment release. - - PCRE has its own native API, which is described in this - document. There is also a set of wrapper functions that - correspond to the POSIX regular expression API. These are - described in the pcreposix documentation. - - The native API function prototypes are defined in the header - file pcre.h, and on Unix systems the library itself is - called libpcre.a, so can be accessed by adding -lpcre to the - command for linking an application which calls it. The - header file defines the macros PCRE_MAJOR and PCRE_MINOR to - contain the major and minor release numbers for the library. - Applications can use these to include support for different - releases. - - The functions pcre_compile(), pcre_study(), and pcre_exec() - are used for compiling and matching regular expressions, - while pcre_copy_substring(), pcre_get_substring(), and - pcre_get_substring_list() are convenience functions for - extracting captured substrings from a matched subject - string. The function pcre_maketables() is used (optionally) - to build a set of character tables in the current locale for - passing to pcre_compile(). - - The function pcre_fullinfo() is used to find out information - about a compiled pattern; pcre_info() is an obsolete version - which returns only some of the available information, but is - retained for backwards compatibility. The function - pcre_version() returns a pointer to a string containing the - version of PCRE and its date of release. - - The global variables pcre_malloc and pcre_free initially - contain the entry points of the standard malloc() and free() - functions respectively. PCRE calls the memory management - functions via these variables, so a calling program can - replace them if it wishes to intercept the calls. This - should be done before calling any PCRE functions. - - - -MULTI-THREADING - The PCRE functions can be used in multi-threading applica- - tions, with the proviso that the memory management functions - pointed to by pcre_malloc and pcre_free are shared by all - threads. - - The compiled form of a regular expression is not altered - during matching, so the same compiled pattern can safely be - used by several threads at once. - - - - -COMPILING A PATTERN - The function pcre_compile() is called to compile a pattern - into an internal form. The pattern is a C string terminated - by a binary zero, and is passed in the argument pattern. A - pointer to a single block of memory that is obtained via - pcre_malloc is returned. This contains the compiled code and - related data. The pcre type is defined for this for conveni- - ence, but in fact pcre is just a typedef for void, since the - contents of the block are not externally defined. It is up - to the caller to free the memory when it is no longer - required. - - The size of a compiled pattern is roughly proportional to - the length of the pattern string, except that each character - class (other than those containing just a single character, - negated or not) requires 33 bytes, and repeat quantifiers - with a minimum greater than one or a bounded maximum cause - the relevant portions of the compiled pattern to be repli- - cated. - - The options argument contains independent bits that affect - the compilation. It should be zero if no options are - required. Some of the options, in particular, those that are - compatible with Perl, can also be set and unset from within - the pattern (see the detailed description of regular expres- - sions below). For these options, the contents of the options - argument specifies their initial settings at the start of - compilation and execution. The PCRE_ANCHORED option can be - set at the time of matching as well as at compile time. - - If errptr is NULL, pcre_compile() returns NULL immediately. - Otherwise, if compilation of a pattern fails, pcre_compile() - returns NULL, and sets the variable pointed to by errptr to - point to a textual error message. The offset from the start - of the pattern to the character where the error was - discovered is placed in the variable pointed to by - erroffset, which must not be NULL. If it is, an immediate - error is given. - - If the final argument, tableptr, is NULL, PCRE uses a - default set of character tables which are built when it is - compiled, using the default C locale. Otherwise, tableptr - must be the result of a call to pcre_maketables(). See the - section on locale support below. - - The following option bits are defined in the header file: - - PCRE_ANCHORED - - If this bit is set, the pattern is forced to be "anchored", - that is, it is constrained to match only at the start of the - string which is being searched (the "subject string"). This - effect can also be achieved by appropriate constructs in the - pattern itself, which is the only way to do it in Perl. - - PCRE_CASELESS - - If this bit is set, letters in the pattern match both upper - and lower case letters. It is equivalent to Perl's /i - option. - - PCRE_DOLLAR_ENDONLY - - If this bit is set, a dollar metacharacter in the pattern - matches only at the end of the subject string. Without this - option, a dollar also matches immediately before the final - character if it is a newline (but not before any other new- - lines). The PCRE_DOLLAR_ENDONLY option is ignored if - PCRE_MULTILINE is set. There is no equivalent to this option - in Perl. - - PCRE_DOTALL - - If this bit is set, a dot metacharater in the pattern - matches all characters, including newlines. Without it, new- - lines are excluded. This option is equivalent to Perl's /s - option. A negative class such as [^a] always matches a new- - line character, independent of the setting of this option. - - PCRE_EXTENDED - - If this bit is set, whitespace data characters in the pat- - tern are totally ignored except when escaped or inside a - character class, and characters between an unescaped # out- - side a character class and the next newline character, - inclusive, are also ignored. This is equivalent to Perl's /x - option, and makes it possible to include comments inside - complicated patterns. Note, however, that this applies only - to data characters. Whitespace characters may never appear - within special character sequences in a pattern, for example - within the sequence (?( which introduces a conditional sub- - pattern. - - PCRE_EXTRA - - This option was invented in order to turn on additional - functionality of PCRE that is incompatible with Perl, but it - is currently of very little use. When set, any backslash in - a pattern that is followed by a letter that has no special - meaning causes an error, thus reserving these combinations - for future expansion. By default, as in Perl, a backslash - followed by a letter with no special meaning is treated as a - literal. There are at present no other features controlled - by this option. It can also be set by a (?X) option setting - within a pattern. - - PCRE_MULTILINE - - By default, PCRE treats the subject string as consisting of - a single "line" of characters (even if it actually contains - several newlines). The "start of line" metacharacter (^) - matches only at the start of the string, while the "end of - line" metacharacter ($) matches only at the end of the - string, or before a terminating newline (unless - PCRE_DOLLAR_ENDONLY is set). This is the same as Perl. - - When PCRE_MULTILINE it is set, the "start of line" and "end - of line" constructs match immediately following or immedi- - ately before any newline in the subject string, respec- - tively, as well as at the very start and end. This is - equivalent to Perl's /m option. If there are no "\n" charac- - ters in a subject string, or no occurrences of ^ or $ in a - pattern, setting PCRE_MULTILINE has no effect. - - PCRE_UNGREEDY - - This option inverts the "greediness" of the quantifiers so - that they are not greedy by default, but become greedy if - followed by "?". It is not compatible with Perl. It can also - be set by a (?U) option setting within the pattern. - - - -STUDYING A PATTERN - When a pattern is going to be used several times, it is - worth spending more time analyzing it in order to speed up - the time taken for matching. The function pcre_study() takes - a pointer to a compiled pattern as its first argument, and - returns a pointer to a pcre_extra block (another void - typedef) containing additional information about the pat- - tern; this can be passed to pcre_exec(). If no additional - information is available, NULL is returned. - - The second argument contains option bits. At present, no - options are defined for pcre_study(), and this argument - should always be zero. - - The third argument for pcre_study() is a pointer to an error - message. If studying succeeds (even if no data is returned), - the variable it points to is set to NULL. Otherwise it - points to a textual error message. - - At present, studying a pattern is useful only for non- - anchored patterns that do not have a single fixed starting - character. A bitmap of possible starting characters is - created. - - - -LOCALE SUPPORT - PCRE handles caseless matching, and determines whether char- - acters are letters, digits, or whatever, by reference to a - set of tables. The library contains a default set of tables - which is created in the default C locale when PCRE is com- - piled. This is used when the final argument of - pcre_compile() is NULL, and is sufficient for many applica- - tions. - - An alternative set of tables can, however, be supplied. Such - tables are built by calling the pcre_maketables() function, - which has no arguments, in the relevant locale. The result - can then be passed to pcre_compile() as often as necessary. - For example, to build and use tables that are appropriate - for the French locale (where accented characters with codes - greater than 128 are treated as letters), the following code - could be used: - - setlocale(LC_CTYPE, "fr"); - tables = pcre_maketables(); - re = pcre_compile(..., tables); - - The tables are built in memory that is obtained via - pcre_malloc. The pointer that is passed to pcre_compile is - saved with the compiled pattern, and the same tables are - used via this pointer by pcre_study() and pcre_exec(). Thus - for any single pattern, compilation, studying and matching - all happen in the same locale, but different patterns can be - compiled in different locales. It is the caller's responsi- - bility to ensure that the memory containing the tables - remains available for as long as it is needed. - - - -INFORMATION ABOUT A PATTERN - The pcre_fullinfo() function returns information about a - compiled pattern. It replaces the obsolete pcre_info() func- - tion, which is nevertheless retained for backwards compabil- - ity (and is documented below). - - The first argument for pcre_fullinfo() is a pointer to the - compiled pattern. The second argument is the result of - pcre_study(), or NULL if the pattern was not studied. The - third argument specifies which piece of information is - required, while the fourth argument is a pointer to a vari- - able to receive the data. The yield of the function is zero - for success, or one of the following negative numbers: - - PCRE_ERROR_NULL the argument code was NULL - the argument where was NULL - PCRE_ERROR_BADMAGIC the "magic number" was not found - PCRE_ERROR_BADOPTION the value of what was invalid - - The possible values for the third argument are defined in - pcre.h, and are as follows: - - PCRE_INFO_OPTIONS - - Return a copy of the options with which the pattern was com- - piled. The fourth argument should point to au unsigned long - int variable. These option bits are those specified in the - call to pcre_compile(), modified by any top-level option - settings within the pattern itself, and with the - PCRE_ANCHORED bit forcibly set if the form of the pattern - implies that it can match only at the start of a subject - string. - - PCRE_INFO_SIZE - - Return the size of the compiled pattern, that is, the value - that was passed as the argument to pcre_malloc() when PCRE - was getting memory in which to place the compiled data. The - fourth argument should point to a size_t variable. - - PCRE_INFO_CAPTURECOUNT - - Return the number of capturing subpatterns in the pattern. - The fourth argument should point to an int variable. - - PCRE_INFO_BACKREFMAX - - Return the number of the highest back reference in the pat- - tern. The fourth argument should point to an int variable. - Zero is returned if there are no back references. - - PCRE_INFO_FIRSTCHAR - - Return information about the first character of any matched - string, for a non-anchored pattern. If there is a fixed - first character, e.g. from a pattern such as - (cat|cow|coyote), it is returned in the integer pointed to - by where. Otherwise, if either - - (a) the pattern was compiled with the PCRE_MULTILINE option, - and every branch starts with "^", or - - (b) every branch of the pattern starts with ".*" and - PCRE_DOTALL is not set (if it were set, the pattern would be - anchored), - - -1 is returned, indicating that the pattern matches only at - the start of a subject string or after any "\n" within the - string. Otherwise -2 is returned. For anchored patterns, -2 - is returned. - - PCRE_INFO_FIRSTTABLE - - If the pattern was studied, and this resulted in the con- - struction of a 256-bit table indicating a fixed set of char- - acters for the first character in any matching string, a - pointer to the table is returned. Otherwise NULL is - returned. The fourth argument should point to an unsigned - char * variable. - - PCRE_INFO_LASTLITERAL - - For a non-anchored pattern, return the value of the right- - most literal character which must exist in any matched - string, other than at its start. The fourth argument should - point to an int variable. If there is no such character, or - if the pattern is anchored, -1 is returned. For example, for - the pattern /a\d+z\d+/ the returned value is 'z'. - - The pcre_info() function is now obsolete because its inter- - face is too restrictive to return all the available data - about a compiled pattern. New programs should use - pcre_fullinfo() instead. The yield of pcre_info() is the - number of capturing subpatterns, or one of the following - negative numbers: - - PCRE_ERROR_NULL the argument code was NULL - PCRE_ERROR_BADMAGIC the "magic number" was not found - - If the optptr argument is not NULL, a copy of the options - with which the pattern was compiled is placed in the integer - it points to (see PCRE_INFO_OPTIONS above). - - If the pattern is not anchored and the firstcharptr argument - is not NULL, it is used to pass back information about the - first character of any matched string (see - PCRE_INFO_FIRSTCHAR above). - - - -MATCHING A PATTERN - The function pcre_exec() is called to match a subject string - against a pre-compiled pattern, which is passed in the code - argument. If the pattern has been studied, the result of the - study should be passed in the extra argument. Otherwise this - must be NULL. - - The PCRE_ANCHORED option can be passed in the options argu- - ment, whose unused bits must be zero. However, if a pattern - was compiled with PCRE_ANCHORED, or turned out to be - anchored by virtue of its contents, it cannot be made - unachored at matching time. - - There are also three further options that can be set only at - matching time: - - PCRE_NOTBOL - - The first character of the string is not the beginning of a - line, so the circumflex metacharacter should not match - before it. Setting this without PCRE_MULTILINE (at compile - time) causes circumflex never to match. - - PCRE_NOTEOL - - The end of the string is not the end of a line, so the dol- - lar metacharacter should not match it nor (except in multi- - line mode) a newline immediately before it. Setting this - without PCRE_MULTILINE (at compile time) causes dollar never - to match. - - PCRE_NOTEMPTY - - An empty string is not considered to be a valid match if - this option is set. If there are alternatives in the pat- - tern, they are tried. If all the alternatives match the - empty string, the entire match fails. For example, if the - pattern - - a?b? - - is applied to a string not beginning with "a" or "b", it - matches the empty string at the start of the subject. With - PCRE_NOTEMPTY set, this match is not valid, so PCRE searches - further into the string for occurrences of "a" or "b". - - Perl has no direct equivalent of PCRE_NOTEMPTY, but it does - make a special case of a pattern match of the empty string - within its split() function, and when using the /g modifier. - It is possible to emulate Perl's behaviour after matching a - null string by first trying the match again at the same - offset with PCRE_NOTEMPTY set, and then if that fails by - advancing the starting offset (see below) and trying an - ordinary match again. - - The subject string is passed as a pointer in subject, a - length in length, and a starting offset in startoffset. - Unlike the pattern string, it may contain binary zero char- - acters. When the starting offset is zero, the search for a - match starts at the beginning of the subject, and this is by - far the most common case. - - A non-zero starting offset is useful when searching for - another match in the same subject by calling pcre_exec() - again after a previous success. Setting startoffset differs - from just passing over a shortened string and setting - PCRE_NOTBOL in the case of a pattern that begins with any - kind of lookbehind. For example, consider the pattern - - \Biss\B - - which finds occurrences of "iss" in the middle of words. (\B - matches only if the current position in the subject is not a - word boundary.) When applied to the string "Mississipi" the - first call to pcre_exec() finds the first occurrence. If - pcre_exec() is called again with just the remainder of the - subject, namely "issipi", it does not match, because \B is - always false at the start of the subject, which is deemed to - be a word boundary. However, if pcre_exec() is passed the - entire string again, but with startoffset set to 4, it finds - the second occurrence of "iss" because it is able to look - behind the starting point to discover that it is preceded by - a letter. - - If a non-zero starting offset is passed when the pattern is - anchored, one attempt to match at the given offset is tried. - This can only succeed if the pattern does not require the - match to be at the start of the subject. - - In general, a pattern matches a certain portion of the sub- - ject, and in addition, further substrings from the subject - may be picked out by parts of the pattern. Following the - usage in Jeffrey Friedl's book, this is called "capturing" - in what follows, and the phrase "capturing subpattern" is - used for a fragment of a pattern that picks out a substring. - PCRE supports several other kinds of parenthesized subpat- - tern that do not cause substrings to be captured. - - Captured substrings are returned to the caller via a vector - of integer offsets whose address is passed in ovector. The - number of elements in the vector is passed in ovecsize. The - first two-thirds of the vector is used to pass back captured - substrings, each substring using a pair of integers. The - remaining third of the vector is used as workspace by - pcre_exec() while matching capturing subpatterns, and is not - available for passing back information. The length passed in - ovecsize should always be a multiple of three. If it is not, - it is rounded down. - - When a match has been successful, information about captured - substrings is returned in pairs of integers, starting at the - beginning of ovector, and continuing up to two-thirds of its - length at the most. The first element of a pair is set to - the offset of the first character in a substring, and the - second is set to the offset of the first character after the - end of a substring. The first pair, ovector[0] and ovec- - tor[1], identify the portion of the subject string matched - by the entire pattern. The next pair is used for the first - capturing subpattern, and so on. The value returned by - pcre_exec() is the number of pairs that have been set. If - there are no capturing subpatterns, the return value from a - successful match is 1, indicating that just the first pair - of offsets has been set. - - Some convenience functions are provided for extracting the - captured substrings as separate strings. These are described - in the following section. - - It is possible for an capturing subpattern number n+1 to - match some part of the subject when subpattern n has not - been used at all. For example, if the string "abc" is - matched against the pattern (a|(z))(bc) subpatterns 1 and 3 - are matched, but 2 is not. When this happens, both offset - values corresponding to the unused subpattern are set to -1. - - If a capturing subpattern is matched repeatedly, it is the - last portion of the string that it matched that gets - returned. - - If the vector is too small to hold all the captured sub- - strings, it is used as far as possible (up to two-thirds of - its length), and the function returns a value of zero. In - particular, if the substring offsets are not of interest, - pcre_exec() may be called with ovector passed as NULL and - ovecsize as zero. However, if the pattern contains back - references and the ovector isn't big enough to remember the - related substrings, PCRE has to get additional memory for - use during matching. Thus it is usually advisable to supply - an ovector. - - Note that pcre_info() can be used to find out how many cap- - turing subpatterns there are in a compiled pattern. The - smallest size for ovector that will allow for n captured - substrings in addition to the offsets of the substring - matched by the whole pattern is (n+1)*3. - - If pcre_exec() fails, it returns a negative number. The fol- - lowing are defined in the header file: - - PCRE_ERROR_NOMATCH (-1) - - The subject string did not match the pattern. - - PCRE_ERROR_NULL (-2) - - Either code or subject was passed as NULL, or ovector was - NULL and ovecsize was not zero. - - PCRE_ERROR_BADOPTION (-3) - - An unrecognized bit was set in the options argument. - - PCRE_ERROR_BADMAGIC (-4) - - PCRE stores a 4-byte "magic number" at the start of the com- - piled code, to catch the case when it is passed a junk - pointer. This is the error it gives when the magic number - isn't present. - - PCRE_ERROR_UNKNOWN_NODE (-5) - - While running the pattern match, an unknown item was encoun- - tered in the compiled pattern. This error could be caused by - a bug in PCRE or by overwriting of the compiled pattern. - - PCRE_ERROR_NOMEMORY (-6) - - If a pattern contains back references, but the ovector that - is passed to pcre_exec() is not big enough to remember the - referenced substrings, PCRE gets a block of memory at the - start of matching to use for this purpose. If the call via - pcre_malloc() fails, this error is given. The memory is - freed at the end of matching. - - - -EXTRACTING CAPTURED SUBSTRINGS - Captured substrings can be accessed directly by using the - offsets returned by pcre_exec() in ovector. For convenience, - the functions pcre_copy_substring(), pcre_get_substring(), - and pcre_get_substring_list() are provided for extracting - captured substrings as new, separate, zero-terminated - strings. A substring that contains a binary zero is - correctly extracted and has a further zero added on the end, - but the result does not, of course, function as a C string. - - The first three arguments are the same for all three func- - tions: subject is the subject string which has just been - successfully matched, ovector is a pointer to the vector of - integer offsets that was passed to pcre_exec(), and - stringcount is the number of substrings that were captured - by the match, including the substring that matched the - entire regular expression. This is the value returned by - pcre_exec if it is greater than zero. If pcre_exec() - returned zero, indicating that it ran out of space in ovec- - tor, the value passed as stringcount should be the size of - the vector divided by three. - - The functions pcre_copy_substring() and pcre_get_substring() - extract a single substring, whose number is given as string- - number. A value of zero extracts the substring that matched - the entire pattern, while higher values extract the captured - substrings. For pcre_copy_substring(), the string is placed - in buffer, whose length is given by buffersize, while for - pcre_get_substring() a new block of store is obtained via - pcre_malloc, and its address is returned via stringptr. The - yield of the function is the length of the string, not - including the terminating zero, or one of - - PCRE_ERROR_NOMEMORY (-6) - - The buffer was too small for pcre_copy_substring(), or the - attempt to get memory failed for pcre_get_substring(). - - PCRE_ERROR_NOSUBSTRING (-7) - - There is no substring whose number is stringnumber. - - The pcre_get_substring_list() function extracts all avail- - able substrings and builds a list of pointers to them. All - this is done in a single block of memory which is obtained - via pcre_malloc. The address of the memory block is returned - via listptr, which is also the start of the list of string - pointers. The end of the list is marked by a NULL pointer. - The yield of the function is zero if all went well, or - - PCRE_ERROR_NOMEMORY (-6) - - if the attempt to get the memory block failed. - - When any of these functions encounter a substring that is - unset, which can happen when capturing subpattern number n+1 - matches some part of the subject, but subpattern n has not - been used at all, they return an empty string. This can be - distinguished from a genuine zero-length substring by - inspecting the appropriate offset in ovector, which is nega- - tive for unset substrings. - - - - -LIMITATIONS - There are some size limitations in PCRE but it is hoped that - they will never in practice be relevant. The maximum length - of a compiled pattern is 65539 (sic) bytes. All values in - repeating quantifiers must be less than 65536. The maximum - number of capturing subpatterns is 99. The maximum number - of all parenthesized subpatterns, including capturing sub- - patterns, assertions, and other types of subpattern, is 200. - - The maximum length of a subject string is the largest posi- - tive number that an integer variable can hold. However, PCRE - uses recursion to handle subpatterns and indefinite repeti- - tion. This means that the available stack space may limit - the size of a subject string that can be processed by cer- - tain patterns. - - - -DIFFERENCES FROM PERL - The differences described here are with respect to Perl - 5.005. - - 1. By default, a whitespace character is any character that - the C library function isspace() recognizes, though it is - possible to compile PCRE with alternative character type - tables. Normally isspace() matches space, formfeed, newline, - carriage return, horizontal tab, and vertical tab. Perl 5 no - longer includes vertical tab in its set of whitespace char- - acters. The \v escape that was in the Perl documentation for - a long time was never in fact recognized. However, the char- - acter itself was treated as whitespace at least up to 5.002. - In 5.004 and 5.005 it does not match \s. - - 2. PCRE does not allow repeat quantifiers on lookahead - assertions. Perl permits them, but they do not mean what you - might think. For example, (?!a){3} does not assert that the - next three characters are not "a". It just asserts that the - next character is not "a" three times. - - 3. Capturing subpatterns that occur inside negative looka- - head assertions are counted, but their entries in the - offsets vector are never set. Perl sets its numerical vari- - ables from any such patterns that are matched before the - assertion fails to match something (thereby succeeding), but - only if the negative lookahead assertion contains just one - branch. - - 4. Though binary zero characters are supported in the sub- - ject string, they are not allowed in a pattern string - because it is passed as a normal C string, terminated by - zero. The escape sequence "\0" can be used in the pattern to - represent a binary zero. - - 5. The following Perl escape sequences are not supported: - \l, \u, \L, \U, \E, \Q. In fact these are implemented by - Perl's general string-handling and are not part of its pat- - tern matching engine. - - 6. The Perl \G assertion is not supported as it is not - relevant to single pattern matches. - - 7. Fairly obviously, PCRE does not support the (?{code}) and - (?p{code}) constructions. However, there is some experimen- - tal support for recursive patterns using the non-Perl item - (?R). - 8. There are at the time of writing some oddities in Perl - 5.005_02 concerned with the settings of captured strings - when part of a pattern is repeated. For example, matching - "aba" against the pattern /^(a(b)?)+$/ sets $2 to the value - "b", but matching "aabbaa" against /^(aa(bb)?)+$/ leaves $2 - unset. However, if the pattern is changed to - /^(aa(b(b))?)+$/ then $2 (and $3) are set. - - In Perl 5.004 $2 is set in both cases, and that is also true - of PCRE. If in the future Perl changes to a consistent state - that is different, PCRE may change to follow. - - 9. Another as yet unresolved discrepancy is that in Perl - 5.005_02 the pattern /^(a)?(?(1)a|b)+$/ matches the string - "a", whereas in PCRE it does not. However, in both Perl and - PCRE /^(a)?a/ matched against "a" leaves $1 unset. - - 10. PCRE provides some extensions to the Perl regular - expression facilities: - - (a) Although lookbehind assertions must match fixed length - strings, each alternative branch of a lookbehind assertion - can match a different length of string. Perl 5.005 requires - them all to have the same length. - - (b) If PCRE_DOLLAR_ENDONLY is set and PCRE_MULTILINE is not - set, the $ meta- character matches only at the very end of - the string. - - (c) If PCRE_EXTRA is set, a backslash followed by a letter - with no special meaning is faulted. - - (d) If PCRE_UNGREEDY is set, the greediness of the repeti- - tion quantifiers is inverted, that is, by default they are - not greedy, but if followed by a question mark they are. - - (e) PCRE_ANCHORED can be used to force a pattern to be tried - only at the start of the subject. - - (f) The PCRE_NOTBOL, PCRE_NOTEOL, and PCRE_NOTEMPTY options - for pcre_exec() have no Perl equivalents. - - (g) The (?R) construct allows for recursive pattern matching - (Perl 5.6 can do this using the (?p{code}) construct, which - PCRE cannot of course support.) - - - -REGULAR EXPRESSION DETAILS - The syntax and semantics of the regular expressions sup- - ported by PCRE are described below. Regular expressions are - also described in the Perl documentation and in a number of - - other books, some of which have copious examples. Jeffrey - Friedl's "Mastering Regular Expressions", published by - O'Reilly (ISBN 1-56592-257), covers them in great detail. - The description here is intended as reference documentation. - - A regular expression is a pattern that is matched against a - subject string from left to right. Most characters stand for - themselves in a pattern, and match the corresponding charac- - ters in the subject. As a trivial example, the pattern - - The quick brown fox - - matches a portion of a subject string that is identical to - itself. The power of regular expressions comes from the - ability to include alternatives and repetitions in the pat- - tern. These are encoded in the pattern by the use of meta- - characters, which do not stand for themselves but instead - are interpreted in some special way. - - There are two different sets of meta-characters: those that - are recognized anywhere in the pattern except within square - brackets, and those that are recognized in square brackets. - Outside square brackets, the meta-characters are as follows: - - \ general escape character with several uses - ^ assert start of subject (or line, in multiline - mode) - $ assert end of subject (or line, in multiline mode) - . match any character except newline (by default) - [ start character class definition - | start of alternative branch - ( start subpattern - ) end subpattern - ? extends the meaning of ( - also 0 or 1 quantifier - also quantifier minimizer - * 0 or more quantifier - + 1 or more quantifier - { start min/max quantifier - - Part of a pattern that is in square brackets is called a - "character class". In a character class the only meta- - characters are: - - \ general escape character - ^ negate the class, but only if the first character - - indicates character range - ] terminates the character class - - The following sections describe the use of each of the - meta-characters. - - - -BACKSLASH - The backslash character has several uses. Firstly, if it is - followed by a non-alphameric character, it takes away any - special meaning that character may have. This use of - backslash as an escape character applies both inside and - outside character classes. - - For example, if you want to match a "*" character, you write - "\*" in the pattern. This applies whether or not the follow- - ing character would otherwise be interpreted as a meta- - character, so it is always safe to precede a non-alphameric - with "\" to specify that it stands for itself. In particu- - lar, if you want to match a backslash, you write "\\". - - If a pattern is compiled with the PCRE_EXTENDED option, whi- - tespace in the pattern (other than in a character class) and - characters between a "#" outside a character class and the - next newline character are ignored. An escaping backslash - can be used to include a whitespace or "#" character as part - of the pattern. - - A second use of backslash provides a way of encoding non- - printing characters in patterns in a visible manner. There - is no restriction on the appearance of non-printing charac- - ters, apart from the binary zero that terminates a pattern, - but when a pattern is being prepared by text editing, it is - usually easier to use one of the following escape sequences - than the binary character it represents: - - \a alarm, that is, the BEL character (hex 07) - \cx "control-x", where x is any character - \e escape (hex 1B) - \f formfeed (hex 0C) - \n newline (hex 0A) - \r carriage return (hex 0D) - \t tab (hex 09) - \xhh character with hex code hh - \ddd character with octal code ddd, or backreference - - The precise effect of "\cx" is as follows: if "x" is a lower - case letter, it is converted to upper case. Then bit 6 of - the character (hex 40) is inverted. Thus "\cz" becomes hex - 1A, but "\c{" becomes hex 3B, while "\c;" becomes hex 7B. - - After "\x", up to two hexadecimal digits are read (letters - can be in upper or lower case). - - After "\0" up to two further octal digits are read. In both - cases, if there are fewer than two digits, just those that - are present are used. Thus the sequence "\0\x\07" specifies - two binary zeros followed by a BEL character. Make sure you - supply two digits after the initial zero if the character - that follows is itself an octal digit. - - The handling of a backslash followed by a digit other than 0 - is complicated. Outside a character class, PCRE reads it - and any following digits as a decimal number. If the number - is less than 10, or if there have been at least that many - previous capturing left parentheses in the expression, the - entire sequence is taken as a back reference. A description - of how this works is given later, following the discussion - of parenthesized subpatterns. - - Inside a character class, or if the decimal number is - greater than 9 and there have not been that many capturing - subpatterns, PCRE re-reads up to three octal digits follow- - ing the backslash, and generates a single byte from the - least significant 8 bits of the value. Any subsequent digits - stand for themselves. For example: - - \040 is another way of writing a space - \40 is the same, provided there are fewer than 40 - previous capturing subpatterns - \7 is always a back reference - \11 might be a back reference, or another way of - writing a tab - \011 is always a tab - \0113 is a tab followed by the character "3" - \113 is the character with octal code 113 (since there - can be no more than 99 back references) - \377 is a byte consisting entirely of 1 bits - \81 is either a back reference, or a binary zero - followed by the two characters "8" and "1" - - Note that octal values of 100 or greater must not be intro- - duced by a leading zero, because no more than three octal - digits are ever read. - - All the sequences that define a single byte value can be - used both inside and outside character classes. In addition, - inside a character class, the sequence "\b" is interpreted - as the backspace character (hex 08). Outside a character - class it has a different meaning (see below). - - The third use of backslash is for specifying generic charac- - ter types: - - \d any decimal digit - \D any character that is not a decimal digit - \s any whitespace character - \S any character that is not a whitespace character - \w any "word" character - \W any "non-word" character - - Each pair of escape sequences partitions the complete set of - characters into two disjoint sets. Any given character - matches one, and only one, of each pair. - - A "word" character is any letter or digit or the underscore - character, that is, any character which can be part of a - Perl "word". The definition of letters and digits is con- - trolled by PCRE's character tables, and may vary if locale- - specific matching is taking place (see "Locale support" - above). For example, in the "fr" (French) locale, some char- - acter codes greater than 128 are used for accented letters, - and these are matched by \w. - - These character type sequences can appear both inside and - outside character classes. They each match one character of - the appropriate type. If the current matching point is at - the end of the subject string, all of them fail, since there - is no character to match. - - The fourth use of backslash is for certain simple asser- - tions. An assertion specifies a condition that has to be met - at a particular point in a match, without consuming any - characters from the subject string. The use of subpatterns - for more complicated assertions is described below. The - backslashed assertions are - - \b word boundary - \B not a word boundary - \A start of subject (independent of multiline mode) - \Z end of subject or newline at end (independent of - multiline mode) - \z end of subject (independent of multiline mode) - - These assertions may not appear in character classes (but - note that "\b" has a different meaning, namely the backspace - character, inside a character class). - - A word boundary is a position in the subject string where - the current character and the previous character do not both - match \w or \W (i.e. one matches \w and the other matches - \W), or the start or end of the string if the first or last - character matches \w, respectively. - - The \A, \Z, and \z assertions differ from the traditional - circumflex and dollar (described below) in that they only - ever match at the very start and end of the subject string, - whatever options are set. They are not affected by the - PCRE_NOTBOL or PCRE_NOTEOL options. If the startoffset argu- - ment of pcre_exec() is non-zero, \A can never match. The - difference between \Z and \z is that \Z matches before a - newline that is the last character of the string as well as - at the end of the string, whereas \z matches only at the - end. - - - -CIRCUMFLEX AND DOLLAR - Outside a character class, in the default matching mode, the - circumflex character is an assertion which is true only if - the current matching point is at the start of the subject - string. If the startoffset argument of pcre_exec() is non- - zero, circumflex can never match. Inside a character class, - circumflex has an entirely different meaning (see below). - - Circumflex need not be the first character of the pattern if - a number of alternatives are involved, but it should be the - first thing in each alternative in which it appears if the - pattern is ever to match that branch. If all possible alter- - natives start with a circumflex, that is, if the pattern is - constrained to match only at the start of the subject, it is - said to be an "anchored" pattern. (There are also other con- - structs that can cause a pattern to be anchored.) - - A dollar character is an assertion which is true only if the - current matching point is at the end of the subject string, - or immediately before a newline character that is the last - character in the string (by default). Dollar need not be the - last character of the pattern if a number of alternatives - are involved, but it should be the last item in any branch - in which it appears. Dollar has no special meaning in a - character class. - - The meaning of dollar can be changed so that it matches only - at the very end of the string, by setting the - PCRE_DOLLAR_ENDONLY option at compile or matching time. This - does not affect the \Z assertion. - - The meanings of the circumflex and dollar characters are - changed if the PCRE_MULTILINE option is set. When this is - the case, they match immediately after and immediately - before an internal "\n" character, respectively, in addition - to matching at the start and end of the subject string. For - example, the pattern /^abc$/ matches the subject string - "def\nabc" in multiline mode, but not otherwise. Conse- - quently, patterns that are anchored in single line mode - because all branches start with "^" are not anchored in mul- - tiline mode, and a match for circumflex is possible when the - startoffset argument of pcre_exec() is non-zero. The - PCRE_DOLLAR_ENDONLY option is ignored if PCRE_MULTILINE is - set. - - Note that the sequences \A, \Z, and \z can be used to match - the start and end of the subject in both modes, and if all - branches of a pattern start with \A is it always anchored, - whether PCRE_MULTILINE is set or not. - - - -FULL STOP (PERIOD, DOT) - Outside a character class, a dot in the pattern matches any - one character in the subject, including a non-printing char- - acter, but not (by default) newline. If the PCRE_DOTALL - option is set, dots match newlines as well. The handling of - dot is entirely independent of the handling of circumflex - and dollar, the only relationship being that they both - involve newline characters. Dot has no special meaning in a - character class. - - - -SQUARE BRACKETS - An opening square bracket introduces a character class, ter- - minated by a closing square bracket. A closing square - bracket on its own is not special. If a closing square - bracket is required as a member of the class, it should be - the first data character in the class (after an initial cir- - cumflex, if present) or escaped with a backslash. - - A character class matches a single character in the subject; - the character must be in the set of characters defined by - the class, unless the first character in the class is a cir- - cumflex, in which case the subject character must not be in - the set defined by the class. If a circumflex is actually - required as a member of the class, ensure it is not the - first character, or escape it with a backslash. - - For example, the character class [aeiou] matches any lower - case vowel, while [^aeiou] matches any character that is not - a lower case vowel. Note that a circumflex is just a con- - venient notation for specifying the characters which are in - the class by enumerating those that are not. It is not an - assertion: it still consumes a character from the subject - string, and fails if the current pointer is at the end of - the string. - - When caseless matching is set, any letters in a class - represent both their upper case and lower case versions, so - for example, a caseless [aeiou] matches "A" as well as "a", - and a caseless [^aeiou] does not match "A", whereas a case- - ful version would. - - The newline character is never treated in any special way in - character classes, whatever the setting of the PCRE_DOTALL - or PCRE_MULTILINE options is. A class such as [^a] will - always match a newline. - - The minus (hyphen) character can be used to specify a range - of characters in a character class. For example, [d-m] - matches any letter between d and m, inclusive. If a minus - character is required in a class, it must be escaped with a - backslash or appear in a position where it cannot be inter- - preted as indicating a range, typically as the first or last - character in the class. - - It is not possible to have the literal character "]" as the - end character of a range. A pattern such as [W-]46] is - interpreted as a class of two characters ("W" and "-") fol- - lowed by a literal string "46]", so it would match "W46]" or - "-46]". However, if the "]" is escaped with a backslash it - is interpreted as the end of range, so [W-\]46] is inter- - preted as a single class containing a range followed by two - separate characters. The octal or hexadecimal representation - of "]" can also be used to end a range. - - Ranges operate in ASCII collating sequence. They can also be - used for characters specified numerically, for example - [\000-\037]. If a range that includes letters is used when - caseless matching is set, it matches the letters in either - case. For example, [W-c] is equivalent to [][\^_`wxyzabc], - matched caselessly, and if character tables for the "fr" - locale are in use, [\xc8-\xcb] matches accented E characters - in both cases. - - The character types \d, \D, \s, \S, \w, and \W may also - appear in a character class, and add the characters that - they match to the class. For example, [\dABCDEF] matches any - hexadecimal digit. A circumflex can conveniently be used - with the upper case character types to specify a more res- - tricted set of characters than the matching lower case type. - For example, the class [^\W_] matches any letter or digit, - but not underscore. - - All non-alphameric characters other than \, -, ^ (at the - start) and the terminating ] are non-special in character - classes, but it does no harm if they are escaped. - - - -POSIX CHARACTER CLASSES - Perl 5.6 (not yet released at the time of writing) is going - to support the POSIX notation for character classes, which - uses names enclosed by [: and :] within the enclosing - square brackets. PCRE supports this notation. For example, - - [01[:alpha:]%] - - matches "0", "1", any alphabetic character, or "%". The sup- - ported class names are - - alnum letters and digits - alpha letters - ascii character codes 0 - 127 - cntrl control characters - digit decimal digits (same as \d) - graph printing characters, excluding space - lower lower case letters - print printing characters, including space - punct printing characters, excluding letters and digits - space white space (same as \s) - upper upper case letters - word "word" characters (same as \w) - xdigit hexadecimal digits - - The names "ascii" and "word" are Perl extensions. Another - Perl extension is negation, which is indicated by a ^ char- - acter after the colon. For example, - - [12[:^digit:]] - - matches "1", "2", or any non-digit. PCRE (and Perl) also - recogize the POSIX syntax [.ch.] and [=ch=] where "ch" is a - "collating element", but these are not supported, and an - error is given if they are encountered. - - - -VERTICAL BAR - Vertical bar characters are used to separate alternative - patterns. For example, the pattern - - gilbert|sullivan - - matches either "gilbert" or "sullivan". Any number of alter- - natives may appear, and an empty alternative is permitted - (matching the empty string). The matching process tries - each alternative in turn, from left to right, and the first - one that succeeds is used. If the alternatives are within a - subpattern (defined below), "succeeds" means matching the - rest of the main pattern as well as the alternative in the - subpattern. - - - -INTERNAL OPTION SETTING - The settings of PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, - and PCRE_EXTENDED can be changed from within the pattern by - a sequence of Perl option letters enclosed between "(?" and - ")". The option letters are - - i for PCRE_CASELESS - m for PCRE_MULTILINE - s for PCRE_DOTALL - x for PCRE_EXTENDED - - For example, (?im) sets caseless, multiline matching. It is - also possible to unset these options by preceding the letter - with a hyphen, and a combined setting and unsetting such as - (?im-sx), which sets PCRE_CASELESS and PCRE_MULTILINE while - unsetting PCRE_DOTALL and PCRE_EXTENDED, is also permitted. - If a letter appears both before and after the hyphen, the - option is unset. - - The scope of these option changes depends on where in the - pattern the setting occurs. For settings that are outside - any subpattern (defined below), the effect is the same as if - the options were set or unset at the start of matching. The - following patterns all behave in exactly the same way: - - (?i)abc - a(?i)bc - ab(?i)c - abc(?i) - - which in turn is the same as compiling the pattern abc with - PCRE_CASELESS set. In other words, such "top level" set- - tings apply to the whole pattern (unless there are other - changes inside subpatterns). If there is more than one set- - ting of the same option at top level, the rightmost setting - is used. - - If an option change occurs inside a subpattern, the effect - is different. This is a change of behaviour in Perl 5.005. - An option change inside a subpattern affects only that part - of the subpattern that follows it, so - - (a(?i)b)c - - matches abc and aBc and no other strings (assuming - PCRE_CASELESS is not used). By this means, options can be - made to have different settings in different parts of the - pattern. Any changes made in one alternative do carry on - into subsequent branches within the same subpattern. For - example, - - (a(?i)b|c) - - matches "ab", "aB", "c", and "C", even though when matching - "C" the first branch is abandoned before the option setting. - This is because the effects of option settings happen at - compile time. There would be some very weird behaviour oth- - erwise. - - The PCRE-specific options PCRE_UNGREEDY and PCRE_EXTRA can - be changed in the same way as the Perl-compatible options by - using the characters U and X respectively. The (?X) flag - setting is special in that it must always occur earlier in - the pattern than any of the additional features it turns on, - even when it is at top level. It is best put at the start. - - - -SUBPATTERNS - Subpatterns are delimited by parentheses (round brackets), - which can be nested. Marking part of a pattern as a subpat- - tern does two things: - - 1. It localizes a set of alternatives. For example, the pat- - tern - - cat(aract|erpillar|) - - matches one of the words "cat", "cataract", or "caterpil- - lar". Without the parentheses, it would match "cataract", - "erpillar" or the empty string. - - 2. It sets up the subpattern as a capturing subpattern (as - defined above). When the whole pattern matches, that por- - tion of the subject string that matched the subpattern is - passed back to the caller via the ovector argument of - pcre_exec(). Opening parentheses are counted from left to - right (starting from 1) to obtain the numbers of the captur- - ing subpatterns. - - For example, if the string "the red king" is matched against - the pattern - - the ((red|white) (king|queen)) - - the captured substrings are "red king", "red", and "king", - and are numbered 1, 2, and 3. - - The fact that plain parentheses fulfil two functions is not - always helpful. There are often times when a grouping sub- - pattern is required without a capturing requirement. If an - opening parenthesis is followed by "?:", the subpattern does - not do any capturing, and is not counted when computing the - number of any subsequent capturing subpatterns. For example, - if the string "the white queen" is matched against the pat- - tern - - the ((?:red|white) (king|queen)) - - the captured substrings are "white queen" and "queen", and - are numbered 1 and 2. The maximum number of captured sub- - strings is 99, and the maximum number of all subpatterns, - both capturing and non-capturing, is 200. - - As a convenient shorthand, if any option settings are - required at the start of a non-capturing subpattern, the - option letters may appear between the "?" and the ":". Thus - the two patterns - - (?i:saturday|sunday) - (?:(?i)saturday|sunday) - - match exactly the same set of strings. Because alternative - branches are tried from left to right, and options are not - reset until the end of the subpattern is reached, an option - setting in one branch does affect subsequent branches, so - the above patterns match "SUNDAY" as well as "Saturday". - - - -REPETITION - Repetition is specified by quantifiers, which can follow any - of the following items: - - a single character, possibly escaped - the . metacharacter - a character class - a back reference (see next section) - a parenthesized subpattern (unless it is an assertion - - see below) - - The general repetition quantifier specifies a minimum and - maximum number of permitted matches, by giving the two - numbers in curly brackets (braces), separated by a comma. - The numbers must be less than 65536, and the first must be - less than or equal to the second. For example: - - z{2,4} - - matches "zz", "zzz", or "zzzz". A closing brace on its own - is not a special character. If the second number is omitted, - but the comma is present, there is no upper limit; if the - second number and the comma are both omitted, the quantifier - specifies an exact number of required matches. Thus - - [aeiou]{3,} - - matches at least 3 successive vowels, but may match many - more, while - - \d{8} - - matches exactly 8 digits. An opening curly bracket that - appears in a position where a quantifier is not allowed, or - one that does not match the syntax of a quantifier, is taken - as a literal character. For example, {,6} is not a quantif- - ier, but a literal string of four characters. - - The quantifier {0} is permitted, causing the expression to - behave as if the previous item and the quantifier were not - present. - - For convenience (and historical compatibility) the three - most common quantifiers have single-character abbreviations: - - * is equivalent to {0,} - + is equivalent to {1,} - ? is equivalent to {0,1} - - It is possible to construct infinite loops by following a - subpattern that can match no characters with a quantifier - that has no upper limit, for example: - - (a?)* - - Earlier versions of Perl and PCRE used to give an error at - compile time for such patterns. However, because there are - cases where this can be useful, such patterns are now - accepted, but if any repetition of the subpattern does in - fact match no characters, the loop is forcibly broken. - - By default, the quantifiers are "greedy", that is, they - match as much as possible (up to the maximum number of per- - mitted times), without causing the rest of the pattern to - fail. The classic example of where this gives problems is in - trying to match comments in C programs. These appear between - the sequences /* and */ and within the sequence, individual - * and / characters may appear. An attempt to match C com- - ments by applying the pattern - - /\*.*\*/ - - to the string - - /* first command */ not comment /* second comment */ - - fails, because it matches the entire string due to the - greediness of the .* item. - - However, if a quantifier is followed by a question mark, it - ceases to be greedy, and instead matches the minimum number - of times possible, so the pattern - - /\*.*?\*/ - - does the right thing with the C comments. The meaning of the - various quantifiers is not otherwise changed, just the pre- - ferred number of matches. Do not confuse this use of ques- - tion mark with its use as a quantifier in its own right. - Because it has two uses, it can sometimes appear doubled, as - in - - \d??\d - - which matches one digit by preference, but can match two if - that is the only way the rest of the pattern matches. - - If the PCRE_UNGREEDY option is set (an option which is not - available in Perl), the quantifiers are not greedy by - default, but individual ones can be made greedy by following - them with a question mark. In other words, it inverts the - default behaviour. - - When a parenthesized subpattern is quantified with a minimum - repeat count that is greater than 1 or with a limited max- - imum, more store is required for the compiled pattern, in - proportion to the size of the minimum or maximum. - - If a pattern starts with .* or .{0,} and the PCRE_DOTALL - option (equivalent to Perl's /s) is set, thus allowing the . - to match newlines, the pattern is implicitly anchored, - because whatever follows will be tried against every charac- - ter position in the subject string, so there is no point in - retrying the overall match at any position after the first. - PCRE treats such a pattern as though it were preceded by \A. - In cases where it is known that the subject string contains - no newlines, it is worth setting PCRE_DOTALL when the pat- - tern begins with .* in order to obtain this optimization, or - alternatively using ^ to indicate anchoring explicitly. - - When a capturing subpattern is repeated, the value captured - is the substring that matched the final iteration. For exam- - ple, after - - (tweedle[dume]{3}\s*)+ - - has matched "tweedledum tweedledee" the value of the cap- - tured substring is "tweedledee". However, if there are - nested capturing subpatterns, the corresponding captured - values may have been set in previous iterations. For exam- - ple, after - - /(a|(b))+/ - - matches "aba" the value of the second captured substring is - "b". - - - -BACK REFERENCES - Outside a character class, a backslash followed by a digit - greater than 0 (and possibly further digits) is a back - reference to a capturing subpattern earlier (i.e. to its - left) in the pattern, provided there have been that many - previous capturing left parentheses. - - However, if the decimal number following the backslash is - less than 10, it is always taken as a back reference, and - causes an error only if there are not that many capturing - left parentheses in the entire pattern. In other words, the - parentheses that are referenced need not be to the left of - the reference for numbers less than 10. See the section - entitled "Backslash" above for further details of the han- - dling of digits following a backslash. - - A back reference matches whatever actually matched the cap- - turing subpattern in the current subject string, rather than - anything matching the subpattern itself. So the pattern - - (sens|respons)e and \1ibility - - matches "sense and sensibility" and "response and responsi- - bility", but not "sense and responsibility". If caseful - matching is in force at the time of the back reference, the - case of letters is relevant. For example, - - ((?i)rah)\s+\1 - - matches "rah rah" and "RAH RAH", but not "RAH rah", even - though the original capturing subpattern is matched case- - lessly. - - There may be more than one back reference to the same sub- - pattern. If a subpattern has not actually been used in a - particular match, any back references to it always fail. For - example, the pattern - - (a|(bc))\2 - - always fails if it starts to match "a" rather than "bc". - Because there may be up to 99 back references, all digits - following the backslash are taken as part of a potential - back reference number. If the pattern continues with a digit - character, some delimiter must be used to terminate the back - reference. If the PCRE_EXTENDED option is set, this can be - whitespace. Otherwise an empty comment can be used. - - A back reference that occurs inside the parentheses to which - it refers fails when the subpattern is first used, so, for - example, (a\1) never matches. However, such references can - be useful inside repeated subpatterns. For example, the - pattern - - (a|b\1)+ - - matches any number of "a"s and also "aba", "ababaa" etc. At - each iteration of the subpattern, the back reference matches - the character string corresponding to the previous itera- - tion. In order for this to work, the pattern must be such - that the first iteration does not need to match the back - reference. This can be done using alternation, as in the - example above, or by a quantifier with a minimum of zero. - - - -ASSERTIONS - An assertion is a test on the characters following or - preceding the current matching point that does not actually - consume any characters. The simple assertions coded as \b, - \B, \A, \Z, \z, ^ and $ are described above. More compli- - cated assertions are coded as subpatterns. There are two - kinds: those that look ahead of the current position in the - subject string, and those that look behind it. - - An assertion subpattern is matched in the normal way, except - that it does not cause the current matching position to be - changed. Lookahead assertions start with (?= for positive - assertions and (?! for negative assertions. For example, - - \w+(?=;) - - matches a word followed by a semicolon, but does not include - the semicolon in the match, and - - foo(?!bar) - - matches any occurrence of "foo" that is not followed by - "bar". Note that the apparently similar pattern - - (?!foo)bar - - does not find an occurrence of "bar" that is preceded by - something other than "foo"; it finds any occurrence of "bar" - whatsoever, because the assertion (?!foo) is always true - when the next three characters are "bar". A lookbehind - assertion is needed to achieve this effect. - - Lookbehind assertions start with (?<= for positive asser- - tions and (? as in this example: - - (?>\d+)bar - - This kind of parenthesis "locks up" the part of the pattern - it contains once it has matched, and a failure further into - the pattern is prevented from backtracking into it. Back- - tracking past it to previous items, however, works as nor- - mal. - - An alternative description is that a subpattern of this type - matches the string of characters that an identical stan- - dalone pattern would match, if anchored at the current point - in the subject string. - - Once-only subpatterns are not capturing subpatterns. Simple - cases such as the above example can be thought of as a max- - imizing repeat that must swallow everything it can. So, - while both \d+ and \d+? are prepared to adjust the number of - digits they match in order to make the rest of the pattern - match, (?>\d+) can only match an entire sequence of digits. - - This construction can of course contain arbitrarily compli- - cated subpatterns, and it can be nested. - - Once-only subpatterns can be used in conjunction with look- - behind assertions to specify efficient matching at the end - of the subject string. Consider a simple pattern such as - - abcd$ - - when applied to a long string which does not match. Because - matching proceeds from left to right, PCRE will look for - each "a" in the subject and then see if what follows matches - the rest of the pattern. If the pattern is specified as - - ^.*abcd$ - - the initial .* matches the entire string at first, but when - this fails (because there is no following "a"), it back- - tracks to match all but the last character, then all but the - last two characters, and so on. Once again the search for - "a" covers the entire string, from right to left, so we are - no better off. However, if the pattern is written as - - ^(?>.*)(?<=abcd) - - there can be no backtracking for the .* item; it can match - only the entire string. The subsequent lookbehind assertion - does a single test on the last four characters. If it fails, - the match fails immediately. For long strings, this approach - makes a significant difference to the processing time. - - When a pattern contains an unlimited repeat inside a subpat- - tern that can itself be repeated an unlimited number of - times, the use of a once-only subpattern is the only way to - avoid some failing matches taking a very long time indeed. - The pattern - - (\D+|<\d+>)*[!?] - - matches an unlimited number of substrings that either con- - sist of non-digits, or digits enclosed in <>, followed by - either ! or ?. When it matches, it runs quickly. However, if - it is applied to - - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - - it takes a long time before reporting failure. This is - because the string can be divided between the two repeats in - a large number of ways, and all have to be tried. (The exam- - ple used [!?] rather than a single character at the end, - because both PCRE and Perl have an optimization that allows - for fast failure when a single character is used. They - remember the last single character that is required for a - match, and fail early if it is not present in the string.) - If the pattern is changed to - - ((?>\D+)|<\d+>)*[!?] - - sequences of non-digits cannot be broken, and failure hap- - pens quickly. - - - -CONDITIONAL SUBPATTERNS - It is possible to cause the matching process to obey a sub- - pattern conditionally or to choose between two alternative - subpatterns, depending on the result of an assertion, or - whether a previous capturing subpattern matched or not. The - two possible forms of conditional subpattern are - - (?(condition)yes-pattern) - (?(condition)yes-pattern|no-pattern) - - If the condition is satisfied, the yes-pattern is used; oth- - erwise the no-pattern (if present) is used. If there are - more than two alternatives in the subpattern, a compile-time - error occurs. - - There are two kinds of condition. If the text between the - parentheses consists of a sequence of digits, the condition - is satisfied if the capturing subpattern of that number has - previously matched. Consider the following pattern, which - contains non-significant white space to make it more read- - able (assume the PCRE_EXTENDED option) and to divide it into - three parts for ease of discussion: - - ( \( )? [^()]+ (?(1) \) ) - - The first part matches an optional opening parenthesis, and - if that character is present, sets it as the first captured - substring. The second part matches one or more characters - that are not parentheses. The third part is a conditional - subpattern that tests whether the first set of parentheses - matched or not. If they did, that is, if subject started - with an opening parenthesis, the condition is true, and so - the yes-pattern is executed and a closing parenthesis is - required. Otherwise, since no-pattern is not present, the - subpattern matches nothing. In other words, this pattern - matches a sequence of non-parentheses, optionally enclosed - in parentheses. - - If the condition is not a sequence of digits, it must be an - assertion. This may be a positive or negative lookahead or - lookbehind assertion. Consider this pattern, again contain- - ing non-significant white space, and with the two alterna- - tives on the second line: - - (?(?=[^a-z]*[a-z]) - \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) - - The condition is a positive lookahead assertion that matches - an optional sequence of non-letters followed by a letter. In - other words, it tests for the presence of at least one - letter in the subject. If a letter is found, the subject is - matched against the first alternative; otherwise it is - matched against the second. This pattern matches strings in - one of the two forms dd-aaa-dd or dd-dd-dd, where aaa are - letters and dd are digits. - - - -COMMENTS - The sequence (?# marks the start of a comment which contin- - ues up to the next closing parenthesis. Nested parentheses - are not permitted. The characters that make up a comment - play no part in the pattern matching at all. - - If the PCRE_EXTENDED option is set, an unescaped # character - outside a character class introduces a comment that contin- - ues up to the next newline character in the pattern. - - - -RECURSIVE PATTERNS - Consider the problem of matching a string in parentheses, - allowing for unlimited nested parentheses. Without the use - of recursion, the best that can be done is to use a pattern - that matches up to some fixed depth of nesting. It is not - possible to handle an arbitrary nesting depth. Perl 5.6 has - provided an experimental facility that allows regular - expressions to recurse (amongst other things). It does this - by interpolating Perl code in the expression at run time, - and the code can refer to the expression itself. A Perl pat- - tern to solve the parentheses problem can be created like - this: - - $re = qr{\( (?: (?>[^()]+) | (?p{$re}) )* \)}x; - - The (?p{...}) item interpolates Perl code at run time, and - in this case refers recursively to the pattern in which it - appears. Obviously, PCRE cannot support the interpolation of - Perl code. Instead, the special item (?R) is provided for - the specific case of recursion. This PCRE pattern solves the - parentheses problem (assume the PCRE_EXTENDED option is set - so that white space is ignored): - - \( ( (?>[^()]+) | (?R) )* \) - - First it matches an opening parenthesis. Then it matches any - number of substrings which can either be a sequence of non- - parentheses, or a recursive match of the pattern itself - (i.e. a correctly parenthesized substring). Finally there is - a closing parenthesis. - - This particular example pattern contains nested unlimited - repeats, and so the use of a once-only subpattern for match- - ing strings of non-parentheses is important when applying - the pattern to strings that do not match. For example, when - it is applied to - - (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() - - it yields "no match" quickly. However, if a once-only sub- - pattern is not used, the match runs for a very long time - indeed because there are so many different ways the + and * - repeats can carve up the subject, and all have to be tested - before failure can be reported. - - The values set for any capturing subpatterns are those from - the outermost level of the recursion at which the subpattern - value is set. If the pattern above is matched against - - (ab(cd)ef) - - the value for the capturing parentheses is "ef", which is - the last value taken on at the top level. If additional - parentheses are added, giving - - \( ( ( (?>[^()]+) | (?R) )* ) \) - ^ ^ - ^ ^ the string they capture is - "ab(cd)ef", the contents of the top level parentheses. If - there are more than 15 capturing parentheses in a pattern, - PCRE has to obtain extra memory to store data during a - recursion, which it does by using pcre_malloc, freeing it - via pcre_free afterwards. If no memory can be obtained, it - saves data for the first 15 capturing parentheses only, as - there is no way to give an out-of-memory error from within a - recursion. - - - -PERFORMANCE - Certain items that may appear in patterns are more efficient - than others. It is more efficient to use a character class - like [aeiou] than a set of alternatives such as (a|e|i|o|u). - In general, the simplest construction that provides the - required behaviour is usually the most efficient. Jeffrey - Friedl's book contains a lot of discussion about optimizing - regular expressions for efficient performance. - - When a pattern begins with .* and the PCRE_DOTALL option is - set, the pattern is implicitly anchored by PCRE, since it - can match only at the start of a subject string. However, if - PCRE_DOTALL is not set, PCRE cannot make this optimization, - because the . metacharacter does not then match a newline, - and if the subject string contains newlines, the pattern may - match from the character immediately following one of them - instead of from the very start. For example, the pattern - - (.*) second - - matches the subject "first\nand second" (where \n stands for - a newline character) with the first captured substring being - "and". In order to do this, PCRE has to retry the match - starting after every newline in the subject. - - If you are using such a pattern with subject strings that do - not contain newlines, the best performance is obtained by - setting PCRE_DOTALL, or starting the pattern with ^.* to - indicate explicit anchoring. That saves PCRE from having to - scan along the subject looking for a newline to restart at. - - Beware of patterns that contain nested indefinite repeats. - These can take a long time to run when applied to a string - that does not match. Consider the pattern fragment - - (a+)* - - This can match "aaaa" in 33 different ways, and this number - increases very rapidly as the string gets longer. (The * - repeat can match 0, 1, 2, 3, or 4 times, and for each of - those cases other than 0, the + repeats can match different - numbers of times.) When the remainder of the pattern is such - that the entire match is going to fail, PCRE has in princi- - ple to try every possible variation, and this can take an - extremely long time. - - An optimization catches some of the more simple cases such - as - - (a+)*b - - where a literal character follows. Before embarking on the - standard matching procedure, PCRE checks that there is a "b" - later in the subject string, and if there is not, it fails - the match immediately. However, when there is no following - literal this optimization cannot be used. You can see the - difference by comparing the behaviour of - - (a+)*\d - - with the pattern above. The former gives a failure almost - instantly when applied to a whole line of "a" characters, - whereas the latter takes an appreciable time with strings - longer than about 20 characters. - - - -AUTHOR - Philip Hazel - University Computing Service, - New Museums Site, - Cambridge CB2 3QG, England. - Phone: +44 1223 334714 - - Last updated: 27 January 2000 - Copyright (c) 1997-2000 University of Cambridge. diff --git a/srclib/pcre/doc/pcreposix.3 b/srclib/pcre/doc/pcreposix.3 deleted file mode 100644 index 1be5d9ac6f..0000000000 --- a/srclib/pcre/doc/pcreposix.3 +++ /dev/null @@ -1,141 +0,0 @@ -.TH PCRE 3 -.SH NAME -pcreposix - POSIX API for Perl-compatible regular expressions. -.SH SYNOPSIS -.B #include -.PP -.SM -.br -.B int regcomp(regex_t *\fIpreg\fR, const char *\fIpattern\fR, -.ti +5n -.B int \fIcflags\fR); -.PP -.br -.B int regexec(regex_t *\fIpreg\fR, const char *\fIstring\fR, -.ti +5n -.B size_t \fInmatch\fR, regmatch_t \fIpmatch\fR[], int \fIeflags\fR); -.PP -.br -.B size_t regerror(int \fIerrcode\fR, const regex_t *\fIpreg\fR, -.ti +5n -.B char *\fIerrbuf\fR, size_t \fIerrbuf_size\fR); -.PP -.br -.B void regfree(regex_t *\fIpreg\fR); - - -.SH DESCRIPTION -This set of functions provides a POSIX-style API to the PCRE regular expression -package. See the \fBpcre\fR documentation for a description of the native API, -which contains additional functionality. - -The functions described here are just wrapper functions that ultimately call -the native API. Their prototypes are defined in the \fBpcreposix.h\fR header -file, and on Unix systems the library itself is called \fBpcreposix.a\fR, so -can be accessed by adding \fB-lpcreposix\fR to the command for linking an -application which uses them. Because the POSIX functions call the native ones, -it is also necessary to add \fR-lpcre\fR. - -I have implemented only those option bits that can be reasonably mapped to PCRE -native options. In addition, the options REG_EXTENDED and REG_NOSUB are defined -with the value zero. They have no effect, but since programs that are written -to the POSIX interface often use them, this makes it easier to slot in PCRE as -a replacement library. Other POSIX options are not even defined. - -When PCRE is called via these functions, it is only the API that is POSIX-like -in style. The syntax and semantics of the regular expressions themselves are -still those of Perl, subject to the setting of various PCRE options, as -described below. - -The header for these functions is supplied as \fBpcreposix.h\fR to avoid any -potential clash with other POSIX libraries. It can, of course, be renamed or -aliased as \fBregex.h\fR, which is the "correct" name. It provides two -structure types, \fIregex_t\fR for compiled internal forms, and -\fIregmatch_t\fR for returning captured substrings. It also defines some -constants whose names start with "REG_"; these are used for setting options and -identifying error codes. - - -.SH COMPILING A PATTERN - -The function \fBregcomp()\fR is called to compile a pattern into an -internal form. The pattern is a C string terminated by a binary zero, and -is passed in the argument \fIpattern\fR. The \fIpreg\fR argument is a pointer -to a regex_t structure which is used as a base for storing information about -the compiled expression. - -The argument \fIcflags\fR is either zero, or contains one or more of the bits -defined by the following macros: - - REG_ICASE - -The PCRE_CASELESS option is set when the expression is passed for compilation -to the native function. - - REG_NEWLINE - -The PCRE_MULTILINE option is set when the expression is passed for compilation -to the native function. - -The yield of \fBregcomp()\fR is zero on success, and non-zero otherwise. The -\fIpreg\fR structure is filled in on success, and one member of the structure -is publicized: \fIre_nsub\fR contains the number of capturing subpatterns in -the regular expression. Various error codes are defined in the header file. - - -.SH MATCHING A PATTERN -The function \fBregexec()\fR is called to match a pre-compiled pattern -\fIpreg\fR against a given \fIstring\fR, which is terminated by a zero byte, -subject to the options in \fIeflags\fR. These can be: - - REG_NOTBOL - -The PCRE_NOTBOL option is set when calling the underlying PCRE matching -function. - - REG_NOTEOL - -The PCRE_NOTEOL option is set when calling the underlying PCRE matching -function. - -The portion of the string that was matched, and also any captured substrings, -are returned via the \fIpmatch\fR argument, which points to an array of -\fInmatch\fR structures of type \fIregmatch_t\fR, containing the members -\fIrm_so\fR and \fIrm_eo\fR. These contain the offset to the first character of -each substring and the offset to the first character after the end of each -substring, respectively. The 0th element of the vector relates to the entire -portion of \fIstring\fR that was matched; subsequent elements relate to the -capturing subpatterns of the regular expression. Unused entries in the array -have both structure members set to -1. - -A successful match yields a zero return; various error codes are defined in the -header file, of which REG_NOMATCH is the "expected" failure code. - - -.SH ERROR MESSAGES -The \fBregerror()\fR function maps a non-zero errorcode from either -\fBregcomp\fR or \fBregexec\fR to a printable message. If \fIpreg\fR is not -NULL, the error should have arisen from the use of that structure. A message -terminated by a binary zero is placed in \fIerrbuf\fR. The length of the -message, including the zero, is limited to \fIerrbuf_size\fR. The yield of the -function is the size of buffer needed to hold the whole message. - - -.SH STORAGE -Compiling a regular expression causes memory to be allocated and associated -with the \fIpreg\fR structure. The function \fBregfree()\fR frees all such -memory, after which \fIpreg\fR may no longer be used as a compiled expression. - - -.SH AUTHOR -Philip Hazel -.br -University Computing Service, -.br -New Museums Site, -.br -Cambridge CB2 3QG, England. -.br -Phone: +44 1223 334714 - -Copyright (c) 1997-1999 University of Cambridge. diff --git a/srclib/pcre/doc/pcreposix.html b/srclib/pcre/doc/pcreposix.html deleted file mode 100644 index 121d90f867..0000000000 --- a/srclib/pcre/doc/pcreposix.html +++ /dev/null @@ -1,182 +0,0 @@ - - -pcreposix specification - - -

    pcreposix 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 -

    -pcreposix - POSIX API for Perl-compatible regular expressions. -

    -
  • SYNOPSIS -

    -#include <pcreposix.h> -

    -

    -int regcomp(regex_t *preg, const char *pattern, -int cflags); -

    -

    -int regexec(regex_t *preg, const char *string, -size_t nmatch, regmatch_t pmatch[], int eflags); -

    -

    -size_t regerror(int errcode, const regex_t *preg, -char *errbuf, size_t errbuf_size); -

    -

    -void regfree(regex_t *preg); -

    -
  • DESCRIPTION -

    -This set of functions provides a POSIX-style API to the PCRE regular expression -package. See the pcre documentation for a description of the native API, -which contains additional functionality. -

    -

    -The functions described here are just wrapper functions that ultimately call -the native API. Their prototypes are defined in the pcreposix.h header -file, and on Unix systems the library itself is called pcreposix.a, so -can be accessed by adding -lpcreposix to the command for linking an -application which uses them. Because the POSIX functions call the native ones, -it is also necessary to add \fR-lpcre\fR. -

    -

    -I have implemented only those option bits that can be reasonably mapped to PCRE -native options. In addition, the options REG_EXTENDED and REG_NOSUB are defined -with the value zero. They have no effect, but since programs that are written -to the POSIX interface often use them, this makes it easier to slot in PCRE as -a replacement library. Other POSIX options are not even defined. -

    -

    -When PCRE is called via these functions, it is only the API that is POSIX-like -in style. The syntax and semantics of the regular expressions themselves are -still those of Perl, subject to the setting of various PCRE options, as -described below. -

    -

    -The header for these functions is supplied as pcreposix.h to avoid any -potential clash with other POSIX libraries. It can, of course, be renamed or -aliased as regex.h, which is the "correct" name. It provides two -structure types, regex_t for compiled internal forms, and -regmatch_t for returning captured substrings. It also defines some -constants whose names start with "REG_"; these are used for setting options and -identifying error codes. -

    -
  • COMPILING A PATTERN -

    -The function regcomp() is called to compile a pattern into an -internal form. The pattern is a C string terminated by a binary zero, and -is passed in the argument pattern. The preg argument is a pointer -to a regex_t structure which is used as a base for storing information about -the compiled expression. -

    -

    -The argument cflags is either zero, or contains one or more of the bits -defined by the following macros: -

    -

    -

    -  REG_ICASE
    -
    -

    -

    -The PCRE_CASELESS option is set when the expression is passed for compilation -to the native function. -

    -

    -

    -  REG_NEWLINE
    -
    -

    -

    -The PCRE_MULTILINE option is set when the expression is passed for compilation -to the native function. -

    -

    -The yield of regcomp() is zero on success, and non-zero otherwise. The -preg structure is filled in on success, and one member of the structure -is publicized: re_nsub contains the number of capturing subpatterns in -the regular expression. Various error codes are defined in the header file. -

    -
  • MATCHING A PATTERN -

    -The function regexec() is called to match a pre-compiled pattern -preg against a given string, which is terminated by a zero byte, -subject to the options in eflags. These can be: -

    -

    -

    -  REG_NOTBOL
    -
    -

    -

    -The PCRE_NOTBOL option is set when calling the underlying PCRE matching -function. -

    -

    -

    -  REG_NOTEOL
    -
    -

    -

    -The PCRE_NOTEOL option is set when calling the underlying PCRE matching -function. -

    -

    -The portion of the string that was matched, and also any captured substrings, -are returned via the pmatch argument, which points to an array of -nmatch structures of type regmatch_t, containing the members -rm_so and rm_eo. These contain the offset to the first character of -each substring and the offset to the first character after the end of each -substring, respectively. The 0th element of the vector relates to the entire -portion of string that was matched; subsequent elements relate to the -capturing subpatterns of the regular expression. Unused entries in the array -have both structure members set to -1. -

    -

    -A successful match yields a zero return; various error codes are defined in the -header file, of which REG_NOMATCH is the "expected" failure code. -

    -
  • ERROR MESSAGES -

    -The regerror() function maps a non-zero errorcode from either -regcomp or regexec to a printable message. If preg is not -NULL, the error should have arisen from the use of that structure. A message -terminated by a binary zero is placed in errbuf. The length of the -message, including the zero, is limited to errbuf_size. The yield of the -function is the size of buffer needed to hold the whole message. -

    -
  • STORAGE -

    -Compiling a regular expression causes memory to be allocated and associated -with the preg structure. The function regfree() frees all such -memory, after which preg may no longer be used as a compiled expression. -

    -
  • AUTHOR -

    -Philip Hazel <ph10@cam.ac.uk> -
    -University Computing Service, -
    -New Museums Site, -
    -Cambridge CB2 3QG, England. -
    -Phone: +44 1223 334714 -

    -

    -Copyright (c) 1997-1999 University of Cambridge. diff --git a/srclib/pcre/doc/pcreposix.txt b/srclib/pcre/doc/pcreposix.txt deleted file mode 100644 index 4a7036f340..0000000000 --- a/srclib/pcre/doc/pcreposix.txt +++ /dev/null @@ -1,150 +0,0 @@ -NAME - pcreposix - POSIX API for Perl-compatible regular expres- - sions. - - - -SYNOPSIS - #include - - int regcomp(regex_t *preg, const char *pattern, - int cflags); - - int regexec(regex_t *preg, const char *string, - size_t nmatch, regmatch_t pmatch[], int eflags); - - size_t regerror(int errcode, const regex_t *preg, - char *errbuf, size_t errbuf_size); - - void regfree(regex_t *preg); - - - -DESCRIPTION - This set of functions provides a POSIX-style API to the PCRE - regular expression package. See the pcre documentation for a - description of the native API, which contains additional - functionality. - - The functions described here are just wrapper functions that - ultimately call the native API. Their prototypes are defined - in the pcreposix.h header file, and on Unix systems the - library itself is called pcreposix.a, so can be accessed by - adding -lpcreposix to the command for linking an application - which uses them. Because the POSIX functions call the native - ones, it is also necessary to add -lpcre. - - I have implemented only those option bits that can be rea- - sonably mapped to PCRE native options. In addition, the - options REG_EXTENDED and REG_NOSUB are defined with the - value zero. They have no effect, but since programs that are - written to the POSIX interface often use them, this makes it - easier to slot in PCRE as a replacement library. Other POSIX - options are not even defined. - - When PCRE is called via these functions, it is only the API - that is POSIX-like in style. The syntax and semantics of the - regular expressions themselves are still those of Perl, sub- - ject to the setting of various PCRE options, as described - below. - - The header for these functions is supplied as pcreposix.h to - avoid any potential clash with other POSIX libraries. It - can, of course, be renamed or aliased as regex.h, which is - the "correct" name. It provides two structure types, regex_t - for compiled internal forms, and regmatch_t for returning - captured substrings. It also defines some constants whose - names start with "REG_"; these are used for setting options - and identifying error codes. - - - -COMPILING A PATTERN - The function regcomp() is called to compile a pattern into - an internal form. The pattern is a C string terminated by a - binary zero, and is passed in the argument pattern. The preg - argument is a pointer to a regex_t structure which is used - as a base for storing information about the compiled expres- - sion. - - The argument cflags is either zero, or contains one or more - of the bits defined by the following macros: - - REG_ICASE - - The PCRE_CASELESS option is set when the expression is - passed for compilation to the native function. - - REG_NEWLINE - - The PCRE_MULTILINE option is set when the expression is - passed for compilation to the native function. - - The yield of regcomp() is zero on success, and non-zero oth- - erwise. The preg structure is filled in on success, and one - member of the structure is publicized: re_nsub contains the - number of capturing subpatterns in the regular expression. - Various error codes are defined in the header file. - - - -MATCHING A PATTERN - The function regexec() is called to match a pre-compiled - pattern preg against a given string, which is terminated by - a zero byte, subject to the options in eflags. These can be: - - REG_NOTBOL - - The PCRE_NOTBOL option is set when calling the underlying - PCRE matching function. - - REG_NOTEOL - - The PCRE_NOTEOL option is set when calling the underlying - PCRE matching function. - - The portion of the string that was matched, and also any - captured substrings, are returned via the pmatch argument, - which points to an array of nmatch structures of type - regmatch_t, containing the members rm_so and rm_eo. These - contain the offset to the first character of each substring - and the offset to the first character after the end of each - substring, respectively. The 0th element of the vector - relates to the entire portion of string that was matched; - subsequent elements relate to the capturing subpatterns of - the regular expression. Unused entries in the array have - both structure members set to -1. - - A successful match yields a zero return; various error codes - are defined in the header file, of which REG_NOMATCH is the - "expected" failure code. - - - -ERROR MESSAGES - The regerror() function maps a non-zero errorcode from - either regcomp or regexec to a printable message. If preg is - not NULL, the error should have arisen from the use of that - structure. A message terminated by a binary zero is placed - in errbuf. The length of the message, including the zero, is - limited to errbuf_size. The yield of the function is the - size of buffer needed to hold the whole message. - - - -STORAGE - Compiling a regular expression causes memory to be allocated - and associated with the preg structure. The function reg- - free() frees all such memory, after which preg may no longer - be used as a compiled expression. - - - -AUTHOR - Philip Hazel - University Computing Service, - New Museums Site, - Cambridge CB2 3QG, England. - Phone: +44 1223 334714 - - Copyright (c) 1997-1999 University of Cambridge. diff --git a/srclib/pcre/doc/pcretest.txt b/srclib/pcre/doc/pcretest.txt deleted file mode 100644 index 0e6783af0c..0000000000 --- a/srclib/pcre/doc/pcretest.txt +++ /dev/null @@ -1,217 +0,0 @@ -The pcretest program --------------------- - -This program is intended for testing PCRE, but it can also be used for -experimenting with regular expressions. - -If it is given two filename arguments, it reads from the first and writes to -the second. If it is given only one filename argument, it reads from that file -and writes to stdout. Otherwise, it reads from stdin and writes to stdout, and -prompts for each line of input, using "re>" to prompt for regular expressions, -and "data>" to prompt for data lines. - -The program handles any number of sets of input on a single input file. Each -set starts with a regular expression, and continues with any number of data -lines to be matched against the pattern. An empty line signals the end of the -data lines, at which point a new regular expression is read. The regular -expressions are given enclosed in any non-alphameric delimiters other than -backslash, for example - - /(a|bc)x+yz/ - -White space before the initial delimiter is ignored. A regular expression may -be continued over several input lines, in which case the newline characters are -included within it. See the test input files in the testdata directory for many -examples. It is possible to include the delimiter within the pattern by -escaping it, for example - - /abc\/def/ - -If you do so, the escape and the delimiter form part of the pattern, but since -delimiters are always non-alphameric, this does not affect its interpretation. -If the terminating delimiter is immediately followed by a backslash, for -example, - - /abc/\ - -then a backslash is added to the end of the pattern. This is done to provide a -way of testing the error condition that arises if a pattern finishes with a -backslash, because - - /abc\/ - -is interpreted as the first line of a pattern that starts with "abc/", causing -pcretest to read the next line as a continuation of the regular expression. - -The pattern may be followed by i, m, s, or x to set the PCRE_CASELESS, -PCRE_MULTILINE, PCRE_DOTALL, or PCRE_EXTENDED options, respectively. For -example: - - /caseless/i - -These modifier letters have the same effect as they do in Perl. There are -others which set PCRE options that do not correspond to anything in Perl: /A, -/E, and /X set PCRE_ANCHORED, PCRE_DOLLAR_ENDONLY, and PCRE_EXTRA respectively. - -Searching for all possible matches within each subject string can be requested -by the /g or /G modifier. After finding a match, PCRE is called again to search -the remainder of the subject string. The difference between /g and /G is that -the former uses the startoffset argument to pcre_exec() to start searching at -a new point within the entire string (which is in effect what Perl does), -whereas the latter passes over a shortened substring. This makes a difference -to the matching process if the pattern begins with a lookbehind assertion -(including \b or \B). - -If any call to pcre_exec() in a /g or /G sequence matches an empty string, the -next call is done with the PCRE_NOTEMPTY and PCRE_ANCHORED flags set in order -to search for another, non-empty, match at the same point. If this second match -fails, the start offset is advanced by one, and the normal match is retried. -This imitates the way Perl handles such cases when using the /g modifier or the -split() function. - -There are a number of other modifiers for controlling the way pcretest -operates. - -The /+ modifier requests that as well as outputting the substring that matched -the entire pattern, pcretest should in addition output the remainder of the -subject string. This is useful for tests where the subject contains multiple -copies of the same substring. - -The /L modifier must be followed directly by the name of a locale, for example, - - /pattern/Lfr - -For this reason, it must be the last modifier letter. The given locale is set, -pcre_maketables() is called to build a set of character tables for the locale, -and this is then passed to pcre_compile() when compiling the regular -expression. Without an /L modifier, NULL is passed as the tables pointer; that -is, /L applies only to the expression on which it appears. - -The /I modifier requests that pcretest output information about the compiled -expression (whether it is anchored, has a fixed first character, and so on). It -does this by calling pcre_fullinfo() after compiling an expression, and -outputting the information it gets back. If the pattern is studied, the results -of that are also output. - -The /D modifier is a PCRE debugging feature, which also assumes /I. It causes -the internal form of compiled regular expressions to be output after -compilation. - -The /S modifier causes pcre_study() to be called after the expression has been -compiled, and the results used when the expression is matched. - -The /M modifier causes the size of memory block used to hold the compiled -pattern to be output. - -Finally, the /P modifier causes pcretest to call PCRE via the POSIX wrapper API -rather than its native API. When this is done, all other modifiers except /i, -/m, and /+ are ignored. REG_ICASE is set if /i is present, and REG_NEWLINE is -set if /m is present. The wrapper functions force PCRE_DOLLAR_ENDONLY always, -and PCRE_DOTALL unless REG_NEWLINE is set. - -Before each data line is passed to pcre_exec(), leading and trailing whitespace -is removed, and it is then scanned for \ escapes. The following are recognized: - - \a alarm (= BEL) - \b backspace - \e escape - \f formfeed - \n newline - \r carriage return - \t tab - \v vertical tab - \nnn octal character (up to 3 octal digits) - \xhh hexadecimal character (up to 2 hex digits) - - \A pass the PCRE_ANCHORED option to pcre_exec() - \B pass the PCRE_NOTBOL option to pcre_exec() - \Cdd call pcre_copy_substring() for substring dd after a successful match - (any decimal number less than 32) - \Gdd call pcre_get_substring() for substring dd after a successful match - (any decimal number less than 32) - \L call pcre_get_substringlist() after a successful match - \N pass the PCRE_NOTEMPTY option to pcre_exec() - \Odd set the size of the output vector passed to pcre_exec() to dd - (any number of decimal digits) - \Z pass the PCRE_NOTEOL option to pcre_exec() - -A backslash followed by anything else just escapes the anything else. If the -very last character is a backslash, it is ignored. This gives a way of passing -an empty line as data, since a real empty line terminates the data input. - -If /P was present on the regex, causing the POSIX wrapper API to be used, only -\B, and \Z have any effect, causing REG_NOTBOL and REG_NOTEOL to be passed to -regexec() respectively. - -When a match succeeds, pcretest outputs the list of captured substrings that -pcre_exec() returns, starting with number 0 for the string that matched the -whole pattern. Here is an example of an interactive pcretest run. - - $ pcretest - PCRE version 2.06 08-Jun-1999 - - re> /^abc(\d+)/ - data> abc123 - 0: abc123 - 1: 123 - data> xyz - No match - -If the strings contain any non-printing characters, they are output as \0x -escapes. If the pattern has the /+ modifier, then the output for substring 0 is -followed by the the rest of the subject string, identified by "0+" like this: - - re> /cat/+ - data> cataract - 0: cat - 0+ aract - -If the pattern has the /g or /G modifier, the results of successive matching -attempts are output in sequence, like this: - - re> /\Bi(\w\w)/g - data> Mississippi - 0: iss - 1: ss - 0: iss - 1: ss - 0: ipp - 1: pp - -"No match" is output only if the first match attempt fails. - -If any of \C, \G, or \L are present in a data line that is successfully -matched, the substrings extracted by the convenience functions are output with -C, G, or L after the string number instead of a colon. This is in addition to -the normal full list. The string length (that is, the return from the -extraction function) is given in parentheses after each string for \C and \G. - -Note that while patterns can be continued over several lines (a plain ">" -prompt is used for continuations), data lines may not. However newlines can be -included in data by means of the \n escape. - -If the -p option is given to pcretest, it is equivalent to adding /P to each -regular expression: the POSIX wrapper API is used to call PCRE. None of the -following flags has any effect in this case. - -If the option -d is given to pcretest, it is equivalent to adding /D to each -regular expression: the internal form is output after compilation. - -If the option -i is given to pcretest, it is equivalent to adding /I to each -regular expression: information about the compiled pattern is given after -compilation. - -If the option -m is given to pcretest, it outputs the size of each compiled -pattern after it has been compiled. It is equivalent to adding /M to each -regular expression. For compatibility with earlier versions of pcretest, -s is -a synonym for -m. - -If the -t option is given, each compile, study, and match is run 20000 times -while being timed, and the resulting time per compile or match is output in -milliseconds. Do not set -t with -s, because you will then get the size output -20000 times and the timing will be distorted. If you want to change the number -of repetitions used for timing, edit the definition of LOOPREPEAT at the top of -pcretest.c - -Philip Hazel -January 2000 diff --git a/srclib/pcre/doc/perltest.txt b/srclib/pcre/doc/perltest.txt deleted file mode 100644 index 6c38ebe19f..0000000000 --- a/srclib/pcre/doc/perltest.txt +++ /dev/null @@ -1,23 +0,0 @@ -The perltest program --------------------- - -The perltest program tests Perl's regular expressions; it has the same -specification as pcretest, and so can be given identical input, except that -input patterns can be followed only by Perl's lower case modifiers and /+ (as -used by pcretest), which is recognized and handled by the program. - -The data lines are processed as Perl double-quoted strings, so if they contain -" \ $ or @ characters, these have to be escaped. For this reason, all such -characters in testinput1 and testinput3 are escaped so that they can be used -for perltest as well as for pcretest, and the special upper case modifiers such -as /A that pcretest recognizes are not used in these files. The output should -be identical, apart from the initial identifying banner. - -The testinput2 and testinput4 files are not suitable for feeding to perltest, -since they do make use of the special upper case modifiers and escapes that -pcretest uses to test some features of PCRE. The first of these files also -contains malformed regular expressions, in order to check that PCRE diagnoses -them correctly. - -Philip Hazel -January 2000 diff --git a/srclib/pcre/doc/pgrep.1 b/srclib/pcre/doc/pgrep.1 deleted file mode 100644 index d9e9b575e0..0000000000 --- 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 54efed6785..0000000000 --- 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 bcd08c0aab..0000000000 --- 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/get.c b/srclib/pcre/get.c deleted file mode 100644 index 035668e301..0000000000 --- a/srclib/pcre/get.c +++ /dev/null @@ -1,189 +0,0 @@ -/************************************************* -* Perl-Compatible Regular Expressions * -*************************************************/ - -/* -This is a library of functions to support regular expressions whose syntax -and semantics are as close as possible to those of the Perl 5 language. See -the file Tech.Notes for some information on the internals. - -Written by: Philip Hazel - - Copyright (c) 1997-1999 University of Cambridge - ------------------------------------------------------------------------------ -Permission is granted to anyone to use this software for any purpose on any -computer system, and to redistribute it freely, subject to the following -restrictions: - -1. This software 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. - -2. The origin of this software must not be misrepresented, either by - explicit claim or by omission. - -3. Altered versions must be plainly marked as such, and must not be - misrepresented as being the original software. - -4. If PCRE is embedded in any software that is released under the GNU - General Purpose Licence (GPL), then the terms of that licence shall - supersede any condition above with which it is incompatible. ------------------------------------------------------------------------------ -*/ - -/* This module contains some convenience functions for extracting substrings -from the subject string after a regex match has succeeded. The original idea -for these functions came from Scott Wimer . */ - - -/* Include the internals header, which itself includes Standard C headers plus -the external pcre header. */ - -#include "internal.h" - - - -/************************************************* -* Copy captured string to given buffer * -*************************************************/ - -/* This function copies a single captured substring into a given buffer. -Note that we use memcpy() rather than strncpy() in case there are binary zeros -in the string. - -Arguments: - subject the subject string that was matched - ovector pointer to the offsets table - stringcount the number of substrings that were captured - (i.e. the yield of the pcre_exec call, unless - that was zero, in which case it should be 1/3 - of the offset table size) - stringnumber the number of the required substring - buffer where to put the substring - size the size of the buffer - -Returns: if successful: - the length of the copied string, not including the zero - that is put on the end; can be zero - if not successful: - PCRE_ERROR_NOMEMORY (-6) buffer too small - PCRE_ERROR_NOSUBSTRING (-7) no such captured substring -*/ - -int -pcre_copy_substring(const char *subject, int *ovector, int stringcount, - int stringnumber, char *buffer, int size) -{ -int yield; -if (stringnumber < 0 || stringnumber >= stringcount) - return PCRE_ERROR_NOSUBSTRING; -stringnumber *= 2; -yield = ovector[stringnumber+1] - ovector[stringnumber]; -if (size < yield + 1) return PCRE_ERROR_NOMEMORY; -memcpy(buffer, subject + ovector[stringnumber], yield); -buffer[yield] = 0; -return yield; -} - - - -/************************************************* -* Copy all captured strings to new store * -*************************************************/ - -/* This function gets one chunk of store and builds a list of pointers and all -of the captured substrings in it. A NULL pointer is put on the end of the list. - -Arguments: - subject the subject string that was matched - ovector pointer to the offsets table - stringcount the number of substrings that were captured - (i.e. the yield of the pcre_exec call, unless - that was zero, in which case it should be 1/3 - of the offset table size) - listptr set to point to the list of pointers - -Returns: if successful: 0 - if not successful: - PCRE_ERROR_NOMEMORY (-6) failed to get store -*/ - -int -pcre_get_substring_list(const char *subject, int *ovector, int stringcount, - const char ***listptr) -{ -int i; -int size = sizeof(char *); -int double_count = stringcount * 2; -char **stringlist; -char *p; - -for (i = 0; i < double_count; i += 2) - size += sizeof(char *) + ovector[i+1] - ovector[i] + 1; - -stringlist = (char **)(pcre_malloc)(size); -if (stringlist == NULL) return PCRE_ERROR_NOMEMORY; - -*listptr = (const char **)stringlist; -p = (char *)(stringlist + stringcount + 1); - -for (i = 0; i < double_count; i += 2) - { - int len = ovector[i+1] - ovector[i]; - memcpy(p, subject + ovector[i], len); - *stringlist++ = p; - p += len; - *p++ = 0; - } - -*stringlist = NULL; -return 0; -} - - - -/************************************************* -* Copy captured string to new store * -*************************************************/ - -/* This function copies a single captured substring into a piece of new -store - -Arguments: - subject the subject string that was matched - ovector pointer to the offsets table - stringcount the number of substrings that were captured - (i.e. the yield of the pcre_exec call, unless - that was zero, in which case it should be 1/3 - of the offset table size) - stringnumber the number of the required substring - stringptr where to put a pointer to the substring - -Returns: if successful: - the length of the string, not including the zero that - is put on the end; can be zero - if not successful: - PCRE_ERROR_NOMEMORY (-6) failed to get store - PCRE_ERROR_NOSUBSTRING (-7) substring not present -*/ - -int -pcre_get_substring(const char *subject, int *ovector, int stringcount, - int stringnumber, const char **stringptr) -{ -int yield; -char *substring; -if (stringnumber < 0 || stringnumber >= stringcount) - return PCRE_ERROR_NOSUBSTRING; -stringnumber *= 2; -yield = ovector[stringnumber+1] - ovector[stringnumber]; -substring = (char *)(pcre_malloc)(yield + 1); -if (substring == NULL) return PCRE_ERROR_NOMEMORY; -memcpy(substring, subject + ovector[stringnumber], yield); -substring[yield] = 0; -*stringptr = substring; -return yield; -} - -/* End of get.c */ diff --git a/srclib/pcre/install-sh b/srclib/pcre/install-sh deleted file mode 100755 index e9de23842d..0000000000 --- a/srclib/pcre/install-sh +++ /dev/null @@ -1,251 +0,0 @@ -#!/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/internal.h b/srclib/pcre/internal.h deleted file mode 100644 index b4b750f6c6..0000000000 --- a/srclib/pcre/internal.h +++ /dev/null @@ -1,376 +0,0 @@ -/************************************************* -* Perl-Compatible Regular Expressions * -*************************************************/ - - -/* This is a library of functions to support regular expressions whose syntax -and semantics are as close as possible to those of the Perl 5 language. See -the file Tech.Notes for some information on the internals. - -Written by: Philip Hazel - - Copyright (c) 1997-2000 University of Cambridge - ------------------------------------------------------------------------------ -Permission is granted to anyone to use this software for any purpose on any -computer system, and to redistribute it freely, subject to the following -restrictions: - -1. This software 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. - -2. The origin of this software must not be misrepresented, either by - explicit claim or by omission. - -3. Altered versions must be plainly marked as such, and must not be - misrepresented as being the original software. - -4. If PCRE is embedded in any software that is released under the GNU - General Purpose Licence (GPL), then the terms of that licence shall - supersede any condition above with which it is incompatible. ------------------------------------------------------------------------------ -*/ - -/* This header contains definitions that are shared between the different -modules, but which are not relevant to the outside. */ - -/* Get the definitions provided by running "configure" */ - -#include "config.h" - -/* To cope with SunOS4 and other systems that lack memmove() but have bcopy(), -define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY -is set. Otherwise, include an emulating function for those systems that have -neither (there some non-Unix environments where this is the case). This assumes -that all calls to memmove are moving strings upwards in store, which is the -case in PCRE. */ - -#if ! HAVE_MEMMOVE -#undef memmove /* some systems may have a macro */ -#if HAVE_BCOPY -#define memmove(a, b, c) bcopy(b, a, c) -#else -void * -pcre_memmove(unsigned char *dest, const unsigned char *src, size_t n) -{ -int i; -dest += n; -src += n; -for (i = 0; i < n; ++i) *(--dest) = *(--src); -} -#define memmove(a, b, c) pcre_memmove(a, b, c) -#endif -#endif - -/* Standard C headers plus the external interface definition */ - -#include -#include -#include -#include -#include -#include -#include "pcre.h" - -/* In case there is no definition of offsetof() provided - though any proper -Standard C system should have one. */ - -#ifndef offsetof -#define offsetof(p_type,field) ((size_t)&(((p_type *)0)->field)) -#endif - -/* These are the public options that can change during matching. */ - -#define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL) - -/* Private options flags start at the most significant end of the four bytes, -but skip the top bit so we can use ints for convenience without getting tangled -with negative values. The public options defined in pcre.h start at the least -significant end. Make sure they don't overlap, though now that we have expanded -to four bytes there is plenty of space. */ - -#define PCRE_FIRSTSET 0x40000000 /* first_char is set */ -#define PCRE_REQCHSET 0x20000000 /* req_char is set */ -#define PCRE_STARTLINE 0x10000000 /* start after \n for multiline */ -#define PCRE_INGROUP 0x08000000 /* compiling inside a group */ -#define PCRE_ICHANGED 0x04000000 /* i option changes within regex */ - -/* Options for the "extra" block produced by pcre_study(). */ - -#define PCRE_STUDY_MAPPED 0x01 /* a map of starting chars exists */ - -/* Masks for identifying the public options which are permitted at compile -time, run time or study time, respectively. */ - -#define PUBLIC_OPTIONS \ - (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \ - PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY) - -#define PUBLIC_EXEC_OPTIONS \ - (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY) - -#define PUBLIC_STUDY_OPTIONS 0 /* None defined */ - -/* Magic number to provide a small check against being handed junk. */ - -#define MAGIC_NUMBER 0x50435245UL /* 'PCRE' */ - -/* Miscellaneous definitions */ - -typedef int BOOL; - -#define FALSE 0 -#define TRUE 1 - -/* These are escaped items that aren't just an encoding of a particular data -value such as \n. They must have non-zero values, as check_escape() returns -their negation. Also, they must appear in the same order as in the opcode -definitions below, up to ESC_z. The final one must be ESC_REF as subsequent -values are used for \1, \2, \3, etc. There is a test in the code for an escape -greater than ESC_b and less than ESC_X to detect the types that may be -repeated. If any new escapes are put in-between that don't consume a character, -that code will have to change. */ - -enum { ESC_A = 1, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, ESC_W, ESC_w, - ESC_Z, ESC_z, ESC_REF }; - -/* Opcode table: OP_BRA must be last, as all values >= it are used for brackets -that extract substrings. Starting from 1 (i.e. after OP_END), the values up to -OP_EOD must correspond in order to the list of escapes immediately above. */ - -enum { - OP_END, /* End of pattern */ - - /* Values corresponding to backslashed metacharacters */ - - OP_SOD, /* Start of data: \A */ - OP_NOT_WORD_BOUNDARY, /* \B */ - OP_WORD_BOUNDARY, /* \b */ - OP_NOT_DIGIT, /* \D */ - OP_DIGIT, /* \d */ - OP_NOT_WHITESPACE, /* \S */ - OP_WHITESPACE, /* \s */ - OP_NOT_WORDCHAR, /* \W */ - OP_WORDCHAR, /* \w */ - OP_EODN, /* End of data or \n at end of data: \Z. */ - OP_EOD, /* End of data: \z */ - - OP_OPT, /* Set runtime options */ - OP_CIRC, /* Start of line - varies with multiline switch */ - OP_DOLL, /* End of line - varies with multiline switch */ - OP_ANY, /* Match any character */ - OP_CHARS, /* Match string of characters */ - OP_NOT, /* Match anything but the following char */ - - OP_STAR, /* The maximizing and minimizing versions of */ - OP_MINSTAR, /* all these opcodes must come in pairs, with */ - OP_PLUS, /* the minimizing one second. */ - OP_MINPLUS, /* This first set applies to single characters */ - OP_QUERY, - OP_MINQUERY, - OP_UPTO, /* From 0 to n matches */ - OP_MINUPTO, - OP_EXACT, /* Exactly n matches */ - - OP_NOTSTAR, /* The maximizing and minimizing versions of */ - OP_NOTMINSTAR, /* all these opcodes must come in pairs, with */ - OP_NOTPLUS, /* the minimizing one second. */ - OP_NOTMINPLUS, /* This first set applies to "not" single characters */ - OP_NOTQUERY, - OP_NOTMINQUERY, - OP_NOTUPTO, /* From 0 to n matches */ - OP_NOTMINUPTO, - OP_NOTEXACT, /* Exactly n matches */ - - OP_TYPESTAR, /* The maximizing and minimizing versions of */ - OP_TYPEMINSTAR, /* all these opcodes must come in pairs, with */ - OP_TYPEPLUS, /* the minimizing one second. These codes must */ - OP_TYPEMINPLUS, /* be in exactly the same order as those above. */ - OP_TYPEQUERY, /* This set applies to character types such as \d */ - OP_TYPEMINQUERY, - OP_TYPEUPTO, /* From 0 to n matches */ - OP_TYPEMINUPTO, - OP_TYPEEXACT, /* Exactly n matches */ - - OP_CRSTAR, /* The maximizing and minimizing versions of */ - OP_CRMINSTAR, /* all these opcodes must come in pairs, with */ - OP_CRPLUS, /* the minimizing one second. These codes must */ - OP_CRMINPLUS, /* be in exactly the same order as those above. */ - OP_CRQUERY, /* These are for character classes and back refs */ - OP_CRMINQUERY, - OP_CRRANGE, /* These are different to the three seta above. */ - OP_CRMINRANGE, - - OP_CLASS, /* Match a character class */ - OP_REF, /* Match a back reference */ - OP_RECURSE, /* Match this pattern recursively */ - - OP_ALT, /* Start of alternation */ - OP_KET, /* End of group that doesn't have an unbounded repeat */ - OP_KETRMAX, /* These two must remain together and in this */ - OP_KETRMIN, /* order. They are for groups the repeat for ever. */ - - /* The assertions must come before ONCE and COND */ - - OP_ASSERT, /* Positive lookahead */ - OP_ASSERT_NOT, /* Negative lookahead */ - OP_ASSERTBACK, /* Positive lookbehind */ - OP_ASSERTBACK_NOT, /* Negative lookbehind */ - OP_REVERSE, /* Move pointer back - used in lookbehind assertions */ - - /* ONCE and COND must come after the assertions, with ONCE first, as there's - a test for >= ONCE for a subpattern that isn't an assertion. */ - - OP_ONCE, /* Once matched, don't back up into the subpattern */ - OP_COND, /* Conditional group */ - OP_CREF, /* Used to hold an extraction string number */ - - OP_BRAZERO, /* These two must remain together and in this */ - OP_BRAMINZERO, /* order. */ - - OP_BRA /* This and greater values are used for brackets that - extract substrings. */ -}; - -/* The highest extraction number. This is limited by the number of opcodes -left after OP_BRA, i.e. 255 - OP_BRA. We actually set it somewhat lower. */ - -#define EXTRACT_MAX 99 - -/* The texts of compile-time error messages are defined as macros here so that -they can be accessed by the POSIX wrapper and converted into error codes. Yes, -I could have used error codes in the first place, but didn't feel like changing -just to accommodate the POSIX wrapper. */ - -#define ERR1 "\\ at end of pattern" -#define ERR2 "\\c at end of pattern" -#define ERR3 "unrecognized character follows \\" -#define ERR4 "numbers out of order in {} quantifier" -#define ERR5 "number too big in {} quantifier" -#define ERR6 "missing terminating ] for character class" -#define ERR7 "invalid escape sequence in character class" -#define ERR8 "range out of order in character class" -#define ERR9 "nothing to repeat" -#define ERR10 "operand of unlimited repeat could match the empty string" -#define ERR11 "internal error: unexpected repeat" -#define ERR12 "unrecognized character after (?" -#define ERR13 "too many capturing parenthesized sub-patterns" -#define ERR14 "missing )" -#define ERR15 "back reference to non-existent subpattern" -#define ERR16 "erroffset passed as NULL" -#define ERR17 "unknown option bit(s) set" -#define ERR18 "missing ) after comment" -#define ERR19 "too many sets of parentheses" -#define ERR20 "regular expression too large" -#define ERR21 "failed to get memory" -#define ERR22 "unmatched parentheses" -#define ERR23 "internal error: code overflow" -#define ERR24 "unrecognized character after (?<" -#define ERR25 "lookbehind assertion is not fixed length" -#define ERR26 "malformed number after (?(" -#define ERR27 "conditional group contains more than two branches" -#define ERR28 "assertion expected after (?(" -#define ERR29 "(?p must be followed by )" -#define ERR30 "unknown POSIX class name" -#define ERR31 "POSIX collating elements are not supported" - -/* All character handling must be done as unsigned characters. Otherwise there -are problems with top-bit-set characters and functions such as isspace(). -However, we leave the interface to the outside world as char *, because that -should make things easier for callers. We define a short type for unsigned char -to save lots of typing. I tried "uchar", but it causes problems on Digital -Unix, where it is defined in sys/types, so use "uschar" instead. */ - -typedef unsigned char uschar; - -/* The real format of the start of the pcre block; the actual code vector -runs on as long as necessary after the end. */ - -typedef struct real_pcre { - unsigned long int magic_number; - size_t size; - const unsigned char *tables; - unsigned long int options; - uschar top_bracket; - uschar top_backref; - uschar first_char; - uschar req_char; - uschar code[1]; -} real_pcre; - -/* The real format of the extra block returned by pcre_study(). */ - -typedef struct real_pcre_extra { - uschar options; - uschar start_bits[32]; -} real_pcre_extra; - - -/* Structure for passing "static" information around between the functions -doing the compiling, so that they are thread-safe. */ - -typedef struct compile_data { - const uschar *lcc; /* Points to lower casing table */ - const uschar *fcc; /* Points to case-flipping table */ - const uschar *cbits; /* Points to character type table */ - const uschar *ctypes; /* Points to table of type maps */ -} compile_data; - -/* Structure for passing "static" information around between the functions -doing the matching, so that they are thread-safe. */ - -typedef struct match_data { - int errorcode; /* As it says */ - int *offset_vector; /* Offset vector */ - int offset_end; /* One past the end */ - int offset_max; /* The maximum usable for return data */ - const uschar *lcc; /* Points to lower casing table */ - const uschar *ctypes; /* Points to table of type maps */ - BOOL offset_overflow; /* Set if too many extractions */ - BOOL notbol; /* NOTBOL flag */ - BOOL noteol; /* NOTEOL flag */ - BOOL endonly; /* Dollar not before final \n */ - BOOL notempty; /* Empty string match not wanted */ - const uschar *start_pattern; /* For use when recursing */ - const uschar *start_subject; /* Start of the subject string */ - const uschar *end_subject; /* End of the subject string */ - const uschar *start_match; /* Start of this match attempt */ - const uschar *end_match_ptr; /* Subject position at end match */ - int end_offset_top; /* Highwater mark at end of match */ -} match_data; - -/* Bit definitions for entries in the pcre_ctypes table. */ - -#define ctype_space 0x01 -#define ctype_letter 0x02 -#define ctype_digit 0x04 -#define ctype_xdigit 0x08 -#define ctype_word 0x10 /* alphameric or '_' */ -#define ctype_meta 0x80 /* regexp meta char or zero (end pattern) */ - -/* Offsets for the bitmap tables in pcre_cbits. Each table contains a set -of bits for a class map. Some classes are built by combining these tables. */ - -#define cbit_space 0 /* [:space:] or \s */ -#define cbit_xdigit 32 /* [:xdigit:] */ -#define cbit_digit 64 /* [:digit:] or \d */ -#define cbit_upper 96 /* [:upper:] */ -#define cbit_lower 128 /* [:lower:] */ -#define cbit_word 160 /* [:word:] or \w */ -#define cbit_graph 192 /* [:graph:] */ -#define cbit_print 224 /* [:print:] */ -#define cbit_punct 256 /* [:punct:] */ -#define cbit_cntrl 288 /* [:cntrl:] */ -#define cbit_length 320 /* Length of the cbits table */ - -/* Offsets of the various tables from the base tables pointer, and -total length. */ - -#define lcc_offset 0 -#define fcc_offset 256 -#define cbits_offset 512 -#define ctypes_offset (cbits_offset + cbit_length) -#define tables_length (ctypes_offset + 256) - -/* End of internal.h */ diff --git a/srclib/pcre/ltconfig b/srclib/pcre/ltconfig deleted file mode 100755 index a01334f921..0000000000 --- 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/ltmain.sh b/srclib/pcre/ltmain.sh deleted file mode 100644 index 50515ad0b9..0000000000 --- a/srclib/pcre/ltmain.sh +++ /dev/null @@ -1,4012 +0,0 @@ -# ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun ltconfig. -# -# 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. - -# Check that we have a working $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, and then maybe $echo will work. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 -fi - -if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - echo "$modename: not configured to build any kind of library" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 -fi - -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" - -# Parse our command line options once, thoroughly. -while test $# -gt 0 -do - arg="$1" - shift - - case "$arg" in - -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case "$prev" in - execute_dlfiles) - eval "$prev=\"\$$prev \$arg\"" - ;; - *) - eval "$prev=\$arg" - ;; - esac - - prev= - prevopt= - continue - fi - - # Have we seen a non-optional argument yet? - case "$arg" in - --help) - show_help=yes - ;; - - --version) - echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - exit 0 - ;; - - --config) - sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 - exit 0 - ;; - - --debug) - echo "$progname: enabling shell trace mode" - set -x - ;; - - --dry-run | -n) - run=: - ;; - - --features) - echo "host: $host" - if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" - else - echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - echo "enable static libraries" - else - echo "disable static libraries" - fi - exit 0 - ;; - - --finish) mode="finish" ;; - - --mode) prevopt="--mode" prev=mode ;; - --mode=*) mode="$optarg" ;; - - --quiet | --silent) - show=: - ;; - - -dlopen) - prevopt="-dlopen" - prev=execute_dlfiles - ;; - - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - - *) - nonopt="$arg" - break - ;; - esac -done - -if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 -fi - -if test -z "$show_help"; then - - # Infer the operation mode. - if test -z "$mode"; then - case "$nonopt" in - *cc | *++ | gcc* | *-gcc*) - mode=link - for arg - do - case "$arg" in - -c) - mode=compile - break - ;; - esac - done - ;; - *db | *dbx | *strace | *truss) - mode=execute - ;; - *install*|cp|mv) - mode=install - ;; - *rm) - mode=uninstall - ;; - *) - # If we have no mode, but dlfiles were specified, then do execute mode. - test -n "$execute_dlfiles" && mode=execute - - # Just use the default operation mode. - if test -z "$mode"; then - if test -n "$nonopt"; then - $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 - else - $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 - fi - fi - ;; - esac - fi - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - $echo "$modename: unrecognized option \`-dlopen'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$modename --help --mode=$mode' for more information." - - # These modes are in order of execution frequency so that they run quickly. - case "$mode" in - # libtool compile mode - compile) - modename="$modename: compile" - # Get the compilation command and the source file. - base_compile= - lastarg= - srcfile="$nonopt" - suppress_output= - - user_target=no - for arg - do - # Accept any command-line options. - case "$arg" in - -o) - if test "$user_target" != "no"; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit 1 - fi - user_target=next - ;; - - -static) - build_old_libs=yes - continue - ;; - esac - - case "$user_target" in - next) - # The next one is the -o target name - user_target=yes - continue - ;; - yes) - # We got the output file - user_target=set - libobj="$arg" - continue - ;; - esac - - # Accept the current argument as the source file. - lastarg="$srcfile" - srcfile="$arg" - - # Aesthetically quote the previous argument. - - # Backslashify any backslashes, double quotes, and dollar signs. - # These are the only characters that are still specially - # interpreted inside of double-quoted scrings. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly in scan - # sets, so we specify it separately. - case "$lastarg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - lastarg="\"$lastarg\"" - ;; - esac - - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi - done - - case "$user_target" in - set) - ;; - no) - # Get the name of the library object. - libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - *) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit 1 - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSfmso]' - case "$libobj" in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case "$libobj" in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit 1 - ;; - esac - - if test -z "$base_compile"; then - $echo "$modename: you must specify a compilation command" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $libobj" - else - removelist="$libobj" - fi - - $run $rm $removelist - trap "$run $rm $removelist; exit 1" 1 2 15 - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext} - lockfile="$output_obj.lock" - removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit 1" 1 2 15 - else - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until ln "$0" "$lockfile" 2>/dev/null; do - $show "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - echo "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - echo $srcfile > "$lockfile" - fi - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - # All platforms use -DPIC, to notify preprocessed assembler code. - command="$base_compile $srcfile $pic_flag -DPIC" - if test "$build_old_libs" = yes; then - lo_libobj="$libobj" - dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$libobj"; then - dir="$objdir" - else - dir="$dir/$objdir" - fi - libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` - - if test -d "$dir"; then - $show "$rm $libobj" - $run $rm $libobj - else - $show "$mkdir $dir" - $run $mkdir $dir - status=$? - if test $status -ne 0 && test ! -d $dir; then - exit $status - fi - fi - fi - if test "$compiler_o_lo" = yes; then - output_obj="$libobj" - command="$command -o $output_obj" - elif test "$compiler_c_o" = yes; then - output_obj="$obj" - command="$command -o $output_obj" - fi - - $run $rm "$output_obj" - $show "$command" - if $run eval "$command"; then : - else - test -n "$output_obj" && $run $rm $removelist - exit 1 - fi - - if test "$need_locks" = warn && - test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then - echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - - # Just move the object if needed, then go on to compile the next one - if test x"$output_obj" != x"$libobj"; then - $show "$mv $output_obj $libobj" - if $run $mv $output_obj $libobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # If we have no pic_flag, then copy the object into place and finish. - if test -z "$pic_flag" && test "$build_old_libs" = yes; then - # Rename the .lo from within objdir to obj - if test -f $obj; then - $show $rm $obj - $run $rm $obj - fi - - $show "$mv $libobj $obj" - if $run $mv $libobj $obj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` - libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` - # Now arrange that obj and lo_libobj become the same file - $show "(cd $xdir && $LN_S $baseobj $libobj)" - if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then - exit 0 - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Allow error messages only from the first compilation. - suppress_output=' >/dev/null 2>&1' - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - command="$base_compile $srcfile" - if test "$compiler_c_o" = yes; then - command="$command -o $obj" - output_obj="$obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - command="$command$suppress_output" - $run $rm "$output_obj" - $show "$command" - if $run eval "$command"; then : - else - $run $rm $removelist - exit 1 - fi - - if test "$need_locks" = warn && - test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then - echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - - # Just move the object if needed - if test x"$output_obj" != x"$obj"; then - $show "$mv $output_obj $obj" - if $run $mv $output_obj $obj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Create an invalid libtool object if no PIC, so that we do not - # accidentally link it into a program. - if test "$build_libtool_libs" != yes; then - $show "echo timestamp > $libobj" - $run eval "echo timestamp > \$libobj" || exit $? - else - # Move the .lo from within objdir - $show "$mv $libobj $lo_libobj" - if $run $mv $libobj $lo_libobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - fi - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - $rm "$lockfile" - fi - - exit 0 - ;; - - # libtool link mode - link) - modename="$modename: link" - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invokation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - - # 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 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() */ -# -# 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) -# 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&2 - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - else - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - fi - build_libtool_libs=no - build_old_libs=yes - prefer_static_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test $# -gt 0; do - arg="$1" - shift - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case "$prev" in - output) - compile_command="$compile_command @OUTPUT@" - finalize_command="$finalize_command @OUTPUT@" - ;; - esac - - case "$prev" in - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - compile_command="$compile_command @SYMFILE@" - finalize_command="$finalize_command @SYMFILE@" - preload=yes - fi - case "$arg" in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - else - dlprefiles="$dlprefiles $arg" - fi - prev= - ;; - esac - ;; - expsyms) - export_symbols="$arg" - if test ! -f "$arg"; then - $echo "$modename: symbol file \`$arg' does not exist" - exit 1 - fi - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case "$arg" in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) rpath="$rpath $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; - esac - fi - prev= - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi - - prevarg="$arg" - - case "$arg" in - -all-static) - if test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 - continue - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: not more than one -exported-symbols argument allowed" - exit 1 - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -L*) - dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` - # We need an absolute path. - case "$dir" in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - absdir="$dir" - fi - dir="$absdir" - ;; - esac - case " $deplibs " in - *" $arg "*) ;; - *) deplibs="$deplibs $arg";; - esac - case " $lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir";; - esac - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2*) - dllsearchdir=`cd "$dir" && pwd || echo "$dir"` - case ":$dllsearchpath:" in - ::) dllsearchpath="$dllsearchdir";; - *":$dllsearchdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dllsearchdir";; - esac - ;; - esac - ;; - - -l*) - if test "$arg" = "-lc"; then - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) - # These systems don't actually have c library (as such) - continue - ;; - esac - elif test "$arg" = "-lm"; then - case "$host" in - *-*-cygwin* | *-*-beos*) - # These systems don't actually have math library (as such) - continue - ;; - esac - fi - deplibs="$deplibs $arg" - ;; - - -module) - module=yes - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -o) prev=output ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` - # We need an absolute path. - case "$dir" in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -static) - # If we have no pic_flag, then this is the same as -all-static. - if test -z "$pic_flag" && test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - - # Some other compiler flag. - -* | +*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - ;; - - *.o | *.obj | *.a | *.lib) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A library object. - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` - prev= - fi - libobjs="$libobjs $arg" - ;; - - *.la) - # A libtool-controlled library. - - dlname= - libdir= - library_names= - old_library= - - # Check to see that this really is a libtool archive. - if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 - exit 1 - fi - - # If the library was installed with an old release of libtool, - # it will not redefine variable installed. - installed=yes - - # Read the .la file - # If there is no directory component, then add one. - case "$arg" in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 - exit 1 - fi - - # Find the relevant object directory and library name. - name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` - - if test "X$installed" = Xyes; then - dir="$libdir" - else - dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$arg"; then - dir="$objdir" - else - dir="$dir/$objdir" - fi - fi - - if test -n "$dependency_libs"; then - # Extract -R and -L from dependency_libs - temp_deplibs= - for deplib in $dependency_libs; do - case "$deplib" in - -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` - case " $rpath $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - -L*) case "$compile_command $temp_deplibs " in - *" $deplib "*) ;; - *) temp_deplibs="$temp_deplibs $deplib";; - esac - temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'` - case " $lib_search_path " in - *" $temp_dir "*) ;; - *) lib_search_path="$lib_search_path $temp_dir";; - esac - ;; - *) temp_deplibs="$temp_deplibs $deplib";; - esac - done - dependency_libs="$temp_deplibs" - fi - - if test -z "$libdir"; then - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" - deplibs="$deplibs$dependency_libs" - compile_command="$compile_command $dir/$old_library$dependency_libs" - finalize_command="$finalize_command $dir/$old_library$dependency_libs" - continue - fi - - # This library was specified with -dlopen. - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking statically, - # we need to preload. - prev=dlprefiles - else - # We should not create a dependency on this library, but we - # may need any libraries it requires. - compile_command="$compile_command$dependency_libs" - finalize_command="$finalize_command$dependency_libs" - prev= - continue - fi - fi - - # The library was specified with -dlpreopen. - if test "$prev" = dlprefiles; then - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - dlprefiles="$dlprefiles $dir/$old_library" - else - dlprefiles="$dlprefiles $dir/$linklib" - fi - prev= - fi - - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - link_against_libtool_libs="$link_against_libtool_libs $arg" - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - - # We need an absolute path. - case "$dir" in - [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - absdir="$dir" - fi - ;; - esac - - # This is the magic to use -rpath. - # Skip directories that are in the system default run-time - # search path, unless they have been requested with -R. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - - lib_linked=yes - case "$hardcode_action" in - immediate | unsupported) - if test "$hardcode_direct" = no; then - compile_command="$compile_command $dir/$linklib" - deplibs="$deplibs $dir/$linklib" - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2*) - dllsearchdir=`cd "$dir" && pwd || echo "$dir"` - if test -n "$dllsearchpath"; then - dllsearchpath="$dllsearchpath:$dllsearchdir" - else - dllsearchpath="$dllsearchdir" - fi - ;; - esac - elif test "$hardcode_minus_L" = no; then - case "$host" in - *-*-sunos*) - compile_shlibpath="$compile_shlibpath$dir:" - ;; - esac - case "$compile_command " in - *" -L$dir "*) ;; - *) compile_command="$compile_command -L$dir";; - esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -L$dir -l$name" - elif test "$hardcode_shlibpath_var" = no; then - case ":$compile_shlibpath:" in - *":$dir:"*) ;; - *) compile_shlibpath="$compile_shlibpath$dir:";; - esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -l$name" - else - lib_linked=no - fi - ;; - - relink) - if test "$hardcode_direct" = yes; then - compile_command="$compile_command $absdir/$linklib" - deplibs="$deplibs $absdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - case "$compile_command " in - *" -L$absdir "*) ;; - *) compile_command="$compile_command -L$absdir";; - esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -L$absdir -l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case ":$compile_shlibpath:" in - *":$absdir:"*) ;; - *) compile_shlibpath="$compile_shlibpath$absdir:";; - esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -l$name" - else - lib_linked=no - fi - ;; - - *) - lib_linked=no - ;; - esac - - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit 1 - fi - - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - finalize_command="$finalize_command $libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - case "$finalize_command " in - *" -L$libdir "*) ;; - *) finalize_command="$finalize_command -L$libdir";; - esac - finalize_command="$finalize_command -l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case ":$finalize_shlibpath:" in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:";; - esac - finalize_command="$finalize_command -l$name" - else - # We cannot seem to hardcode it, guess we'll fake it. - case "$finalize_command " in - *" -L$dir "*) ;; - *) finalize_command="$finalize_command -L$libdir";; - esac - finalize_command="$finalize_command -l$name" - fi - else - # Transform directly to old archives if we don't build new libraries. - if test -n "$pic_flag" && test -z "$old_library"; then - $echo "$modename: cannot find static library for \`$arg'" 1>&2 - exit 1 - fi - - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_command="$compile_command $dir/$linklib" - finalize_command="$finalize_command $dir/$linklib" - else - case "$compile_command " in - *" -L$dir "*) ;; - *) compile_command="$compile_command -L$dir";; - esac - compile_command="$compile_command -l$name" - case "$finalize_command " in - *" -L$dir "*) ;; - *) finalize_command="$finalize_command -L$dir";; - esac - finalize_command="$finalize_command -l$name" - fi - fi - - # Add in any libraries that this one depends upon. - compile_command="$compile_command$dependency_libs" - finalize_command="$finalize_command$dependency_libs" - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - ;; - esac - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - done - - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` - libobjs_save="$libobjs" - - case "$output" in - "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - - *.a | *.lib) - if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 - exit 1 - fi - - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 - fi - - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 - fi - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - ;; - - *.la) - # Make sure we only generate libraries of the form `libNAME.la'. - case "$outputname" in - lib*) - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval libname=\"$libname_spec\" - ;; - *) - if test "$module" = no; then - $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval libname=\"$libname_spec\" - else - libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - fi - ;; - esac - - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - - if test -n "$objs"; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 - exit 1 - fi - - # How the heck are we supposed to write a wrapper for a shared library? - if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 - exit 1 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 - fi - - set dummy $rpath - if test $# -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 - fi - install_libdir="$2" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - libext=al - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - dependency_libs="$deplibs" - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 - fi - else - - # Parse the version information argument. - IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - IFS="$save_ifs" - - if test -n "$8"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - current="$2" - revision="$3" - age="$4" - - # Check that each of the things are valid numbers. - case "$current" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case "$revision" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case "$age" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - if test $age -gt $current; then - $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case "$version_type" in - none) ;; - - irix) - major=`expr $current - $age + 1` - versuffix="$major.$revision" - verstring="sgi$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test $loop != 0; do - iface=`expr $revision - $loop` - loop=`expr $loop - 1` - verstring="sgi$major.$iface:$verstring" - done - ;; - - linux) - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - ;; - - osf) - major=`expr $current - $age` - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test $loop != 0; do - iface=`expr $current - $loop` - loop=`expr $loop - 1` - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current"; - ;; - - windows) - # Like Linux, but with '-' rather than '.', since we only - # want one extension on Windows 95. - major=`expr $current - $age` - versuffix="-$major-$age-$revision" - ;; - - *) - $echo "$modename: unknown library version type \`$version_type'" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - verstring="0.0" - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - - dependency_libs="$deplibs" - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) - # these systems don't actually have a c library (as such)! - ;; - *) - # Add libc to deplibs on all other systems. - deplibs="$deplibs -lc" - ;; - esac - fi - - # Create the output directory, or remove our outputs if we need to. - if test -d $output_objdir; then - $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" - $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* - else - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test $status -ne 0 && test ! -d $output_objdir; then - exit $status - fi - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` - fi - - if test "$build_libtool_libs" = yes; then - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case "$deplibs_check_method" in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behaviour. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $rm conftest.c - cat > conftest.c </dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null \ - | grep " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | sed 's/.* -> //'` - case "$potliblink" in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ - | sed 10q \ - | egrep "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - echo "*** Warning: This library needs some functionality provided by $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | - grep . >/dev/null; then - echo - if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." - else - echo "*** Warning: inter-library dependencies are not known to be supported." - fi - echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - fi - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - echo "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - # Get the real and link names of the library. - eval library_names=\"$library_names_spec\" - set dummy $library_names - realname="$2" - shift; shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - lib="$output_objdir/$realname" - for link - do - linknames="$linknames $link" - done - - # Ensure that we have .o objects for linkers which dislike .lo - # (e.g. aix) in case we are running --disable-static - for obj in $libobjs; do - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - if test ! -f $xdir/$oldobj; then - $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" - $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? - fi - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - eval cmds=\"$export_symbols_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - if test -n "$export_symbols_regex"; then - $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - $show "$mv \"${export_symbols}T\" \"$export_symbols\"" - $run eval '$mv "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' - fi - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case "$xlib" in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` - done - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - linkopts="$linkopts $flag" - fi - - # Do each of the archive commands. - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" - else - eval cmds=\"$archive_cmds\" - fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - *.lo | *.o | *.obj) - if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 - exit 1 - fi - - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 - fi - - case "$output" in - *.lo) - if test -n "$objs"; then - $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit 1 - fi - libobj="$output" - obj=`$echo "X$output" | $Xsed -e "$lo2o"` - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $run $rm $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${obj}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case "$xlib" in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` - done - fi - fi - - # Create the old-style object. - reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" - - output="$obj" - eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit 0 - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - $show "echo timestamp > $libobj" - $run eval "echo timestamp > $libobj" || exit $? - exit 0 - fi - - if test -n "$pic_flag"; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - else - # Just create a symlink. - $show $rm $libobj - $run $rm $libobj - xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$libobj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - $show "(cd $xdir && $LN_S $oldobj $baseobj)" - $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? - fi - - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit 0 - ;; - - # Anything else should be a program. - *) - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 - fi - - if test "$preload" = yes; then - if test "$dlopen" = unknown && test "$dlopen_self" = unknown && - test "$dlopen_self_static" = unknown; then - $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." - fi - fi - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$compile_rpath " in - *" $libdir "*) ;; - *) compile_rpath="$compile_rpath $libdir" ;; - esac - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - - # Create the binary in the object directory, then wrap it. - if test ! -d $output_objdir; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test $status -ne 0 && test ! -d $output_objdir; then - exit $status - fi - fi - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - fi - - dlsyms= - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - dlsyms="${outputname}S.c" - else - $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 - fi - fi - - if test -n "$dlsyms"; then - case "$dlsyms" in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${outputname}.nm" - - $show "$rm $nlist ${nlist}S ${nlist}T" - $run $rm "$nlist" "${nlist}S" "${nlist}T" - - # Parse the name list into a source file. - $show "creating $output_objdir/$dlsyms" - - test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ -/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ -/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -/* Prevent the only kind of declaration conflicts we can make. */ -#define lt_preloaded_symbols some_other_symbol - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - $show "generating symbol list for \`$output'" - - test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - for arg in $progfiles; do - $show "extracting global C symbols from \`$arg'" - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - if test -n "$export_symbols_regex"; then - $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$output.exp" - $run $rm $export_symbols - $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - else - $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' - $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' - $run eval 'mv "$nlist"T "$nlist"' - fi - fi - - for arg in $dlprefiles; do - $show "extracting global C symbols from \`$arg'" - name=`echo "$arg" | sed -e 's%^.*/%%'` - $run eval 'echo ": $name " >> "$nlist"' - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -z "$run"; then - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $mv "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then - : - else - grep -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' - else - echo '/* NONE */' >> "$output_objdir/$dlsyms" - fi - - $echo >> "$output_objdir/$dlsyms" "\ - -#undef lt_preloaded_symbols - -#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[] = -{\ -" - - sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ - -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ - < "$nlist" >> "$output_objdir/$dlsyms" - - $echo >> "$output_objdir/$dlsyms" "\ - {0, (lt_ptr_t) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - fi - - pic_flag_for_symtable= - case "$host" in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; - esac;; - *-*-hpux*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC";; - esac - esac - - # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? - - # Clean up the generated files. - $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" - $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" - - # Transform the symbol file into the correct name. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - ;; - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit 1 - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then - # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - $show "$link_command" - $run eval "$link_command" - status=$? - - # Delete the generated files. - if test -n "$dlsyms"; then - $show "$rm $output_objdir/${outputname}S.${objext}" - $run $rm "$output_objdir/${outputname}S.${objext}" - fi - - exit $status - fi - - if test -n "$shlibpath_var"; then - # We should set the shlibpath_var - rpath= - for dir in $temp_rpath; do - case "$dir" in - [\\/]* | [A-Za-z]:[\\/]*) - # Absolute path. - rpath="$rpath$dir:" - ;; - *) - # Relative path: add a thisdir entry. - rpath="$rpath\$thisdir/$dir:" - ;; - esac - done - temp_rpath="$rpath" - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 - $echo "$modename: \`$output' will be relinked during installation" 1>&2 - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname - - $show "$link_command" - $run eval "$link_command" || exit $? - - # Now create the wrapper script. - $show "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $0 --fallback-echo"; then - case "$0" in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; - *) qecho="$SHELL `pwd`/$0 --fallback-echo";; - esac - qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` - else - qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` - fi - - # Only actually do things if our run command is non-null. - if test -z "$run"; then - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) output=`echo $output|sed 's,.exe$,,'` ;; - esac - $rm $output - trap "$rm $output; exit 1" 1 2 15 - - $echo > $output "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' -sed_quote_subst='$sed_quote_subst' - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variable: - link_against_libtool_libs='$link_against_libtool_libs' -else - # When we are sourced in execute mode, \$file and \$echo are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - echo=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$echo works! - : - else - # Restart under the correct shell, and then maybe \$echo will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ -" - $echo >> $output "\ - - # Find the directory that this script lives in. - thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` - done - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - echo >> $output "\ - program=lt-'$outputname' - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || \\ - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $mkdir \"\$progdir\" - else - $rm \"\$progdir/\$file\" - fi" - - echo >> $output "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if (cd \"\$thisdir\" && eval \$relink_command); then : - else - $rm \"\$progdir/\$file\" - exit 1 - fi - fi - - $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $rm \"\$progdir/\$program\"; - $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $rm \"\$progdir/\$file\" - fi" - else - echo >> $output "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - echo >> $output "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $echo >> $output "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $echo >> $output "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $echo >> $output "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - *-*-cygwin* | *-*-mingw | *-*-os2*) - # win32 systems need to use the prog path for dll - # lookup to work - $echo >> $output "\ - exec \$progdir\\\\\$program \${1+\"\$@\"} -" - ;; - *) - $echo >> $output "\ - # Export the path to the program. - PATH=\"\$progdir:\$PATH\" - export PATH - - exec \$program \${1+\"\$@\"} -" - ;; - esac - $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit 1 - fi - else - # The program doesn't exist. - \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 - \$echo \"This script is just a wrapper for \$program.\" 1>&2 - echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" - chmod +x $output - fi - exit 0 - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - # Add in members from convenience archives. - for xlib in $addlibs; do - # Extract the objects. - case "$xlib" in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` - done - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - eval cmds=\"$old_archive_from_new_cmds\" - else - # Ensure that we have .o objects in place in case we decided - # not to build a shared library, and have fallen back to building - # static libs even though --disable-static was passed! - for oldobj in $oldobjs; do - if test ! -f $oldobj; then - xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$oldobj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` - obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` - $show "(cd $xdir && ${LN_S} $obj $baseobj)" - $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? - fi - done - - eval cmds=\"$old_archive_cmds\" - fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$generated"; then - $show "${rm}r$generated" - $run ${rm}r$generated - fi - - # Now create the libtool archive. - case "$output" in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - $show "creating $output" - - if test -n "$xrpath"; then - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - done - dependency_libs="$temp_xrpath $dependency_libs" - fi - - # Only create the output if not a dry run. - if test -z "$run"; then - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - fi - $rm $output - $echo > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$dlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Directory that this library needs to be installed in: -libdir='$install_libdir'\ -" - done - fi - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" - $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $? - ;; - esac - exit 0 - ;; - - # libtool install mode - install) - modename="$modename: install" - - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then - # Aesthetically quote it. - arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$arg " - arg="$1" - shift - else - install_prog= - arg="$nonopt" - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog$arg" - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - for arg - do - if test -n "$dest"; then - files="$files $dest" - dest="$arg" - continue - fi - - case "$arg" in - -d) isdir=yes ;; - -f) prev="-f" ;; - -g) prev="-g" ;; - -m) prev="-m" ;; - -o) prev="-o" ;; - -s) - stripme=" -s" - continue - ;; - -*) ;; - - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - prev= - else - dest="$arg" - continue - fi - ;; - esac - - # Aesthetically quote the argument. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog $arg" - done - - if test -z "$install_prog"; then - $echo "$modename: you must specify an install program" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -z "$files"; then - if test -z "$dest"; then - $echo "$modename: no file or destination specified" 1>&2 - else - $echo "$modename: you must specify a destination" 1>&2 - fi - $echo "$help" 1>&2 - exit 1 - fi - - # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` - test "X$destdir" = "X$dest" && destdir=. - destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` - - # Not a directory, so check to see that there is only one file specified. - set dummy $files - if test $# -gt 2; then - $echo "$modename: \`$dest' is not a directory" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - fi - case "$destdir" in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case "$file" in - *.lo) ;; - *) - $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case "$file" in - *.a | *.lib) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - library_names= - old_library= - # If there is no directory component, then add one. - case "$file" in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" - test "X$dir" = "X$file/" && dir= - dir="$dir$objdir" - - # See the names of the shared library. - set dummy $library_names - if test -n "$2"; then - realname="$2" - shift - shift - - # Install the shared library and build the symlinks. - $show "$install_prog $dir/$realname $destdir/$realname" - $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? - - if test $# -gt 0; then - # Delete the old symlinks, and create new ones. - for linkname - do - if test "$linkname" != "$realname"; then - $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - fi - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - eval cmds=\"$postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Install the pseudo-library for information purposes. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - instname="$dir/$name"i - $show "$install_prog $instname $destdir/$name" - $run eval "$install_prog $instname $destdir/$name" || exit $? - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case "$destfile" in - *.lo) - staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` - ;; - *.o | *.obj) - staticdest="$destfile" - destfile= - ;; - *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - - # Install the libtool object if requested. - if test -n "$destfile"; then - $show "$install_prog $file $destfile" - $run eval "$install_prog $file $destfile" || exit $? - fi - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` - - $show "$install_prog $staticobj $staticdest" - $run eval "$install_prog \$staticobj \$staticdest" || exit $? - fi - exit 0 - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Do a test to see if this is really a libtool program. - if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - link_against_libtool_libs= - relink_command= - - # If there is no directory component, then add one. - case "$file" in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Check the variables that should have been set. - if test -z "$link_against_libtool_libs"; then - $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 - exit 1 - fi - - finalize=yes - for lib in $link_against_libtool_libs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - # If there is no directory component, then add one. - case "$lib" in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - fi - libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" - if test -n "$libdir" && test ! -f "$libfile"; then - $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 - finalize=no - fi - done - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - if test "$finalize" = yes && test -z "$run"; then - tmpdir="/tmp" - test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" - if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : - else - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue - fi - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - ${rm}r "$tmpdir" - continue - fi - file="$outputname" - else - $echo "$modename: warning: cannot relink \`$file'" 1>&2 - fi - else - # Install the binary that we compiled earlier. - file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - $show "$install_prog$stripme $file $destfile" - $run eval "$install_prog\$stripme \$file \$destfile" || exit $? - test -n "$outputname" && ${rm}r "$tmpdir" - ;; - esac - done - - for file in $staticlibs; do - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? - - # Do each command in the postinstall commands. - eval cmds=\"$old_postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$future_libdirs"; then - $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 - fi - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - test -n "$run" && current_libdirs=" -n$current_libdirs" - exec $SHELL $0 --finish$current_libdirs - exit 1 - fi - - exit 0 - ;; - - # libtool finish mode - finish) - modename="$modename: finish" - libdirs="$nonopt" - admincmds= - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - eval cmds=\"$finish_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || admincmds="$admincmds - $cmd" - done - IFS="$save_ifs" - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $run eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - test "$show" = : && exit 0 - - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" - for libdir in $libdirs; do - echo " $libdir" - done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" - fi - if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - echo " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - echo " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - echo - echo "See any operating system documentation about shared libraries for" - echo "more information, such as the ld(1) and ld.so(8) manual pages." - echo "----------------------------------------------------------------------" - exit 0 - ;; - - # libtool execute mode - execute) - modename="$modename: execute" - - # The first argument is the command name. - cmd="$nonopt" - if test -z "$cmd"; then - $echo "$modename: you must specify a COMMAND" 1>&2 - $echo "$help" - exit 1 - fi - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - if test ! -f "$file"; then - $echo "$modename: \`$file' is not a file" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - dir= - case "$file" in - *.la) - # Check to see that this really is a libtool archive. - if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Read the libtool library. - dlname= - library_names= - - # If there is no directory component, then add one. - case "$file" in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" - continue - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit 1 - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - ;; - - *) - $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case "$file" in - -*) ;; - *) - # Do a test to see if this is really a libtool program. - if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - # If there is no directory component, then add one. - case "$file" in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` - args="$args \"$file\"" - done - - if test -z "$run"; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved enviroment variables - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi - if test "${save_LANG+set}" = set; then - LANG="$save_LANG"; export LANG - fi - - # Now actually exec the command. - eval "exec \$cmd$args" - - $echo "$modename: cannot exec \$cmd$args" - exit 1 - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" - fi - $echo "$cmd$args" - exit 0 - fi - ;; - - # libtool uninstall mode - uninstall) - modename="$modename: uninstall" - rm="$nonopt" - files= - - for arg - do - case "$arg" in - -*) rm="$rm $arg" ;; - *) files="$files $arg" ;; - esac - done - - if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - for file in $files; do - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - rmfiles="$file" - - case "$name" in - *.la) - # Possibly a libtool archive, so verify it. - if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - . $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $dir/$n" - done - test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" - - $show "$rm $rmfiles" - $run $rm $rmfiles - - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - eval cmds=\"$postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - done - IFS="$save_ifs" - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - eval cmds=\"$old_postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - done - IFS="$save_ifs" - fi - - # FIXME: should reinstall the best remaining shared library. - fi - ;; - - *.lo) - if test "$build_old_libs" = yes; then - oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` - rmfiles="$rmfiles $dir/$oldobj" - fi - $show "$rm $rmfiles" - $run $rm $rmfiles - ;; - - *) - $show "$rm $rmfiles" - $run $rm $rmfiles - ;; - esac - done - exit 0 - ;; - - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 - ;; - esac - - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 -fi # test -z "$show_help" - -# We need to display help for each of the modes. -case "$mode" in -"") $echo \ -"Usage: $modename [OPTION]... [MODE-ARG]... - -Provide generalized library-building support services. - - --config show all configuration variables - --debug enable verbose shell tracing --n, --dry-run display commands without modifying any files - --features display basic configuration information and exit - --finish same as \`--mode=finish' - --help display this help message and exit - --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] - --quiet same as \`--silent' - --silent don't print informational messages - --version print version information - -MODE must be one of the following: - - compile compile a source file into a libtool object - execute automatically set library path, then run a program - finish complete the installation of libtool libraries - install install libraries or executables - link create a library or an executable - uninstall remove libraries from an installed directory - -MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE." - exit 0 - ;; - -compile) - $echo \ -"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -static always build a \`.o' file suitable for static linking - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - -execute) - $echo \ -"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - -finish) - $echo \ -"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - -install) - $echo \ -"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - -link) - $echo \ -"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -static do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - -uninstall) - $echo \ -"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - -*) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; -esac - -echo -$echo "Try \`$modename --help' for more information about other modes." - -exit 0 - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: diff --git a/srclib/pcre/maketables.c b/srclib/pcre/maketables.c deleted file mode 100644 index c0f06c0375..0000000000 --- a/srclib/pcre/maketables.c +++ /dev/null @@ -1,132 +0,0 @@ -/************************************************* -* Perl-Compatible Regular Expressions * -*************************************************/ - -/* -PCRE is a library of functions to support regular expressions whose syntax -and semantics are as close as possible to those of the Perl 5 language. - -Written by: Philip Hazel - - Copyright (c) 1997-2000 University of Cambridge - ------------------------------------------------------------------------------ -Permission is granted to anyone to use this software for any purpose on any -computer system, and to redistribute it freely, subject to the following -restrictions: - -1. This software 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. - -2. The origin of this software must not be misrepresented, either by - explicit claim or by omission. - -3. Altered versions must be plainly marked as such, and must not be - misrepresented as being the original software. - -4. If PCRE is embedded in any software that is released under the GNU - General Purpose Licence (GPL), then the terms of that licence shall - supersede any condition above with which it is incompatible. ------------------------------------------------------------------------------ - -See the file Tech.Notes for some information on the internals. -*/ - - -/* This file is compiled on its own as part of the PCRE library. However, -it is also included in the compilation of dftables.c, in which case the macro -DFTABLES is defined. */ - -#ifndef DFTABLES -#include "internal.h" -#endif - - - -/************************************************* -* Create PCRE character tables * -*************************************************/ - -/* This function builds a set of character tables for use by PCRE and returns -a pointer to them. They are build using the ctype functions, and consequently -their contents will depend upon the current locale setting. When compiled as -part of the library, the store is obtained via pcre_malloc(), but when compiled -inside dftables, use malloc(). - -Arguments: none -Returns: pointer to the contiguous block of data -*/ - -unsigned const char * -pcre_maketables(void) -{ -unsigned char *yield, *p; -int i; - -#ifndef DFTABLES -yield = (unsigned char*)(pcre_malloc)(tables_length); -#else -yield = (unsigned char*)malloc(tables_length); -#endif - -if (yield == NULL) return NULL; -p = yield; - -/* First comes the lower casing table */ - -for (i = 0; i < 256; i++) *p++ = tolower(i); - -/* Next the case-flipping table */ - -for (i = 0; i < 256; i++) *p++ = islower(i)? toupper(i) : tolower(i); - -/* Then the character class tables. Don't try to be clever and save effort -on exclusive ones - in some locales things may be different. */ - -memset(p, 0, cbit_length); -for (i = 0; i < 256; i++) - { - if (isdigit(i)) - { - p[cbit_digit + i/8] |= 1 << (i&7); - p[cbit_word + i/8] |= 1 << (i&7); - } - if (isupper(i)) - { - p[cbit_upper + i/8] |= 1 << (i&7); - p[cbit_word + i/8] |= 1 << (i&7); - } - if (islower(i)) - { - p[cbit_lower + i/8] |= 1 << (i&7); - p[cbit_word + i/8] |= 1 << (i&7); - } - if (i == '_') p[cbit_word + i/8] |= 1 << (i&7); - if (isspace(i)) p[cbit_space + i/8] |= 1 << (i&7); - if (isxdigit(i))p[cbit_xdigit + i/8] |= 1 << (i&7); - if (isgraph(i)) p[cbit_graph + i/8] |= 1 << (i&7); - if (isprint(i)) p[cbit_print + i/8] |= 1 << (i&7); - if (ispunct(i)) p[cbit_punct + i/8] |= 1 << (i&7); - if (iscntrl(i)) p[cbit_cntrl + i/8] |= 1 << (i&7); - } -p += cbit_length; - -/* Finally, the character type table */ - -for (i = 0; i < 256; i++) - { - int x = 0; - if (isspace(i)) x += ctype_space; - if (isalpha(i)) x += ctype_letter; - if (isdigit(i)) x += ctype_digit; - if (isxdigit(i)) x += ctype_xdigit; - if (isalnum(i) || i == '_') x += ctype_word; - if (strchr("*+?{^.$|()[", i) != 0) x += ctype_meta; - *p++ = x; - } - -return yield; -} - -/* End of maketables.c */ diff --git a/srclib/pcre/pcre-config.in b/srclib/pcre/pcre-config.in deleted file mode 100644 index 8daded9fe1..0000000000 --- a/srclib/pcre/pcre-config.in +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -exec_prefix_set=no - -usage="\ -Usage: pcre-config [--prefix] [--exec-prefix] [--version] [--libs] [--libs-posix] [--cflags] [--cflags-posix]" - -if test $# -eq 0; then - echo "${usage}" 1>&2 - exit 1 -fi - -while test $# -gt 0; do - case "$1" in - -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - case $1 in - --prefix=*) - prefix=$optarg - if test $exec_prefix_set = no ; then - exec_prefix=$optarg - fi - ;; - --prefix) - echo $prefix - ;; - --exec-prefix=*) - exec_prefix=$optarg - exec_prefix_set=yes - ;; - --exec-prefix) - echo $exec_prefix - ;; - --version) - echo @PCRE_VERSION@ - ;; - --cflags | --cflags-posix) - if test @includedir@ != /usr/include ; then - includes=-I@includedir@ - fi - echo $includes - ;; - --libs-posix) - echo -L@libdir@ -lpcreposix -lpcre - ;; - --libs) - echo -L@libdir@ -lpcre - ;; - *) - echo "${usage}" 1>&2 - exit 1 - ;; - esac - shift -done diff --git a/srclib/pcre/pcre.c b/srclib/pcre/pcre.c deleted file mode 100644 index e3fdde9114..0000000000 --- a/srclib/pcre/pcre.c +++ /dev/null @@ -1,4828 +0,0 @@ -/************************************************* -* Perl-Compatible Regular Expressions * -*************************************************/ - -/* -This is a library of functions to support regular expressions whose syntax -and semantics are as close as possible to those of the Perl 5 language. See -the file Tech.Notes for some information on the internals. - -Written by: Philip Hazel - - Copyright (c) 1997-2000 University of Cambridge - ------------------------------------------------------------------------------ -Permission is granted to anyone to use this software for any purpose on any -computer system, and to redistribute it freely, subject to the following -restrictions: - -1. This software 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. - -2. The origin of this software must not be misrepresented, either by - explicit claim or by omission. - -3. Altered versions must be plainly marked as such, and must not be - misrepresented as being the original software. - -4. If PCRE is embedded in any software that is released under the GNU - General Purpose Licence (GPL), then the terms of that licence shall - supersede any condition above with which it is incompatible. ------------------------------------------------------------------------------ -*/ - - -/* Define DEBUG to get debugging output on stdout. */ - -/* #define DEBUG */ - -/* Use a macro for debugging printing, 'cause that eliminates the use of #ifdef -inline, and there are *still* stupid compilers about that don't like indented -pre-processor statements. I suppose it's only been 10 years... */ - -#ifdef DEBUG -#define DPRINTF(p) printf p -#else -#define DPRINTF(p) /*nothing*/ -#endif - -/* Include the internals header, which itself includes Standard C headers plus -the external pcre header. */ - -#include "internal.h" - - -/* Allow compilation as C++ source code, should anybody want to do that. */ - -#ifdef __cplusplus -#define class pcre_class -#endif - - -/* Number of items on the nested bracket stacks at compile time. This should -not be set greater than 200. */ - -#define BRASTACK_SIZE 200 - - -/* Min and max values for the common repeats; for the maxima, 0 => infinity */ - -static const char rep_min[] = { 0, 0, 1, 1, 0, 0 }; -static const char rep_max[] = { 0, 0, 0, 0, 1, 1 }; - -/* Text forms of OP_ values and things, for debugging (not all used) */ - -#ifdef DEBUG -static const char *OP_names[] = { - "End", "\\A", "\\B", "\\b", "\\D", "\\d", - "\\S", "\\s", "\\W", "\\w", "\\Z", "\\z", - "Opt", "^", "$", "Any", "chars", "not", - "*", "*?", "+", "+?", "?", "??", "{", "{", "{", - "*", "*?", "+", "+?", "?", "??", "{", "{", "{", - "*", "*?", "+", "+?", "?", "??", "{", "{", "{", - "*", "*?", "+", "+?", "?", "??", "{", "{", - "class", "Ref", "Recurse", - "Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not", - "AssertB", "AssertB not", "Reverse", "Once", "Cond", "Cref", - "Brazero", "Braminzero", "Bra" -}; -#endif - -/* Table for handling escaped characters in the range '0'-'z'. Positive returns -are simple data values; negative values are for special things like \d and so -on. Zero means further processing is needed (for things like \x), or the escape -is invalid. */ - -static const short int escapes[] = { - 0, 0, 0, 0, 0, 0, 0, 0, /* 0 - 7 */ - 0, 0, ':', ';', '<', '=', '>', '?', /* 8 - ? */ - '@', -ESC_A, -ESC_B, 0, -ESC_D, 0, 0, 0, /* @ - G */ - 0, 0, 0, 0, 0, 0, 0, 0, /* H - O */ - 0, 0, 0, -ESC_S, 0, 0, 0, -ESC_W, /* P - W */ - 0, 0, -ESC_Z, '[', '\\', ']', '^', '_', /* X - _ */ - '`', 7, -ESC_b, 0, -ESC_d, 27, '\f', 0, /* ` - g */ - 0, 0, 0, 0, 0, 0, '\n', 0, /* h - o */ - 0, 0, '\r', -ESC_s, '\t', 0, 0, -ESC_w, /* p - w */ - 0, 0, -ESC_z /* x - z */ -}; - -/* Tables of names of POSIX character classes and their lengths. The list is -terminated by a zero length entry. The first three must be alpha, upper, lower, -as this is assumed for handling case independence. */ - -static const char *posix_names[] = { - "alpha", "lower", "upper", - "alnum", "ascii", "cntrl", "digit", "graph", - "print", "punct", "space", "word", "xdigit" }; - -static const uschar posix_name_lengths[] = { - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 6, 0 }; - -/* Table of class bit maps for each POSIX class; up to three may be combined -to form the class. */ - -static const int posix_class_maps[] = { - cbit_lower, cbit_upper, -1, /* alpha */ - cbit_lower, -1, -1, /* lower */ - cbit_upper, -1, -1, /* upper */ - cbit_digit, cbit_lower, cbit_upper, /* alnum */ - cbit_print, cbit_cntrl, -1, /* ascii */ - cbit_cntrl, -1, -1, /* cntrl */ - cbit_digit, -1, -1, /* digit */ - cbit_graph, -1, -1, /* graph */ - cbit_print, -1, -1, /* print */ - cbit_punct, -1, -1, /* punct */ - cbit_space, -1, -1, /* space */ - cbit_word, -1, -1, /* word */ - cbit_xdigit,-1, -1 /* xdigit */ -}; - - -/* Definition to allow mutual recursion */ - -static BOOL - compile_regex(int, int, int *, uschar **, const uschar **, const char **, - BOOL, int, int *, int *, compile_data *); - -/* Structure for building a chain of data that actually lives on the -stack, for holding the values of the subject pointer at the start of each -subpattern, so as to detect when an empty string has been matched by a -subpattern - to break infinite loops. */ - -typedef struct eptrblock { - struct eptrblock *prev; - const uschar *saved_eptr; -} eptrblock; - -/* Flag bits for the match() function */ - -#define match_condassert 0x01 /* Called to check a condition assertion */ -#define match_isgroup 0x02 /* Set if start of bracketed group */ - - - -/************************************************* -* Global variables * -*************************************************/ - -/* PCRE is thread-clean and doesn't use any global variables in the normal -sense. However, it calls memory allocation and free functions via the two -indirections below, which are can be changed by the caller, but are shared -between all threads. */ - -void *(*pcre_malloc)(size_t) = malloc; -void (*pcre_free)(void *) = free; - - - - -/************************************************* -* Default character tables * -*************************************************/ - -/* A default set of character tables is included in the PCRE binary. Its source -is built by the maketables auxiliary program, which uses the default C ctypes -functions, and put in the file chartables.c. These tables are used by PCRE -whenever the caller of pcre_compile() does not provide an alternate set of -tables. */ - -#include "chartables.c" - - - -/************************************************* -* Return version string * -*************************************************/ - -#define STRING(a) # a -#define XSTRING(s) STRING(s) - -const char * -pcre_version(void) -{ -return XSTRING(PCRE_MAJOR) "." XSTRING(PCRE_MINOR) " " XSTRING(PCRE_DATE); -} - - - - -/************************************************* -* (Obsolete) Return info about compiled pattern * -*************************************************/ - -/* This is the original "info" function. It picks potentially useful data out -of the private structure, but its interface was too rigid. It remains for -backwards compatibility. The public options are passed back in an int - though -the re->options field has been expanded to a long int, all the public options -at the low end of it, and so even on 16-bit systems this will still be OK. -Therefore, I haven't changed the API for pcre_info(). - -Arguments: - external_re points to compiled code - optptr where to pass back the options - first_char where to pass back the first character, - or -1 if multiline and all branches start ^, - or -2 otherwise - -Returns: number of capturing subpatterns - or negative values on error -*/ - -int -pcre_info(const pcre *external_re, int *optptr, int *first_char) -{ -const real_pcre *re = (const real_pcre *)external_re; -if (re == NULL) return PCRE_ERROR_NULL; -if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC; -if (optptr != NULL) *optptr = (int)(re->options & PUBLIC_OPTIONS); -if (first_char != NULL) - *first_char = ((re->options & PCRE_FIRSTSET) != 0)? re->first_char : - ((re->options & PCRE_STARTLINE) != 0)? -1 : -2; -return re->top_bracket; -} - - - -/************************************************* -* Return info about compiled pattern * -*************************************************/ - -/* This is a newer "info" function which has an extensible interface so -that additional items can be added compatibly. - -Arguments: - external_re points to compiled code - external_study points to study data, or NULL - what what information is required - where where to put the information - -Returns: 0 if data returned, negative on error -*/ - -int -pcre_fullinfo(const pcre *external_re, const pcre_extra *study_data, int what, - void *where) -{ -const real_pcre *re = (const real_pcre *)external_re; -const real_pcre_extra *study = (const real_pcre_extra *)study_data; - -if (re == NULL || where == NULL) return PCRE_ERROR_NULL; -if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC; - -switch (what) - { - case PCRE_INFO_OPTIONS: - *((unsigned long int *)where) = re->options & PUBLIC_OPTIONS; - break; - - case PCRE_INFO_SIZE: - *((size_t *)where) = re->size; - break; - - case PCRE_INFO_CAPTURECOUNT: - *((int *)where) = re->top_bracket; - break; - - case PCRE_INFO_BACKREFMAX: - *((int *)where) = re->top_backref; - break; - - case PCRE_INFO_FIRSTCHAR: - *((int *)where) = - ((re->options & PCRE_FIRSTSET) != 0)? re->first_char : - ((re->options & PCRE_STARTLINE) != 0)? -1 : -2; - break; - - case PCRE_INFO_FIRSTTABLE: - *((const uschar **)where) = - (study != NULL && (study->options & PCRE_STUDY_MAPPED) != 0)? - study->start_bits : NULL; - break; - - case PCRE_INFO_LASTLITERAL: - *((int *)where) = - ((re->options & PCRE_REQCHSET) != 0)? re->req_char : -1; - break; - - default: return PCRE_ERROR_BADOPTION; - } - -return 0; -} - - - -#ifdef DEBUG -/************************************************* -* Debugging function to print chars * -*************************************************/ - -/* Print a sequence of chars in printable format, stopping at the end of the -subject if the requested. - -Arguments: - p points to characters - length number to print - is_subject TRUE if printing from within md->start_subject - md pointer to matching data block, if is_subject is TRUE - -Returns: nothing -*/ - -static void -pchars(const uschar *p, int length, BOOL is_subject, match_data *md) -{ -int c; -if (is_subject && length > md->end_subject - p) length = md->end_subject - p; -while (length-- > 0) - if (isprint(c = *(p++))) printf("%c", c); else printf("\\x%02x", c); -} -#endif - - - - -/************************************************* -* Handle escapes * -*************************************************/ - -/* This function is called when a \ has been encountered. It either returns a -positive value for a simple escape such as \n, or a negative value which -encodes one of the more complicated things such as \d. On entry, ptr is -pointing at the \. On exit, it is on the final character of the escape -sequence. - -Arguments: - ptrptr points to the pattern position pointer - errorptr points to the pointer to the error message - bracount number of previous extracting brackets - options the options bits - isclass TRUE if inside a character class - cd pointer to char tables block - -Returns: zero or positive => a data character - negative => a special escape sequence - on error, errorptr is set -*/ - -static int -check_escape(const uschar **ptrptr, const char **errorptr, int bracount, - int options, BOOL isclass, compile_data *cd) -{ -const uschar *ptr = *ptrptr; -int c, i; - -c = *(++ptr) & 255; /* Ensure > 0 on signed-char systems */ -if (c == 0) *errorptr = ERR1; - -/* Digits or letters may have special meaning; all others are literals. */ - -else if (c < '0' || c > 'z') {} - -/* Do an initial lookup in a table. A non-zero result is something that can be -returned immediately. Otherwise further processing may be required. */ - -else if ((i = escapes[c - '0']) != 0) c = i; - -/* Escapes that need further processing, or are illegal. */ - -else - { - const uschar *oldptr; - switch (c) - { - /* The handling of escape sequences consisting of a string of digits - starting with one that is not zero is not straightforward. By experiment, - the way Perl works seems to be as follows: - - Outside a character class, the digits are read as a decimal number. If the - number is less than 10, or if there are that many previous extracting - left brackets, then it is a back reference. Otherwise, up to three octal - digits are read to form an escaped byte. Thus \123 is likely to be octal - 123 (cf \0123, which is octal 012 followed by the literal 3). If the octal - value is greater than 377, the least significant 8 bits are taken. Inside a - character class, \ followed by a digit is always an octal number. */ - - case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - - if (!isclass) - { - oldptr = ptr; - c -= '0'; - while ((cd->ctypes[ptr[1]] & ctype_digit) != 0) - c = c * 10 + *(++ptr) - '0'; - if (c < 10 || c <= bracount) - { - c = -(ESC_REF + c); - break; - } - ptr = oldptr; /* Put the pointer back and fall through */ - } - - /* Handle an octal number following \. If the first digit is 8 or 9, Perl - generates a binary zero byte and treats the digit as a following literal. - Thus we have to pull back the pointer by one. */ - - if ((c = *ptr) >= '8') - { - ptr--; - c = 0; - break; - } - - /* \0 always starts an octal number, but we may drop through to here with a - larger first octal digit */ - - case '0': - c -= '0'; - while(i++ < 2 && (cd->ctypes[ptr[1]] & ctype_digit) != 0 && - ptr[1] != '8' && ptr[1] != '9') - c = c * 8 + *(++ptr) - '0'; - break; - - /* Special escapes not starting with a digit are straightforward */ - - case 'x': - c = 0; - while (i++ < 2 && (cd->ctypes[ptr[1]] & ctype_xdigit) != 0) - { - ptr++; - c = c * 16 + cd->lcc[*ptr] - - (((cd->ctypes[*ptr] & ctype_digit) != 0)? '0' : 'W'); - } - break; - - case 'c': - c = *(++ptr); - if (c == 0) - { - *errorptr = ERR2; - return 0; - } - - /* A letter is upper-cased; then the 0x40 bit is flipped */ - - if (c >= 'a' && c <= 'z') c = cd->fcc[c]; - c ^= 0x40; - break; - - /* PCRE_EXTRA enables extensions to Perl in the matter of escapes. Any - other alphameric following \ is an error if PCRE_EXTRA was set; otherwise, - for Perl compatibility, it is a literal. This code looks a bit odd, but - there used to be some cases other than the default, and there may be again - in future, so I haven't "optimized" it. */ - - default: - if ((options & PCRE_EXTRA) != 0) switch(c) - { - default: - *errorptr = ERR3; - break; - } - break; - } - } - -*ptrptr = ptr; -return c; -} - - - -/************************************************* -* Check for counted repeat * -*************************************************/ - -/* This function is called when a '{' is encountered in a place where it might -start a quantifier. It looks ahead to see if it really is a quantifier or not. -It is only a quantifier if it is one of the forms {ddd} {ddd,} or {ddd,ddd} -where the ddds are digits. - -Arguments: - p pointer to the first char after '{' - cd pointer to char tables block - -Returns: TRUE or FALSE -*/ - -static BOOL -is_counted_repeat(const uschar *p, compile_data *cd) -{ -if ((cd->ctypes[*p++] & ctype_digit) == 0) return FALSE; -while ((cd->ctypes[*p] & ctype_digit) != 0) p++; -if (*p == '}') return TRUE; - -if (*p++ != ',') return FALSE; -if (*p == '}') return TRUE; - -if ((cd->ctypes[*p++] & ctype_digit) == 0) return FALSE; -while ((cd->ctypes[*p] & ctype_digit) != 0) p++; -return (*p == '}'); -} - - - -/************************************************* -* Read repeat counts * -*************************************************/ - -/* Read an item of the form {n,m} and return the values. This is called only -after is_counted_repeat() has confirmed that a repeat-count quantifier exists, -so the syntax is guaranteed to be correct, but we need to check the values. - -Arguments: - p pointer to first char after '{' - minp pointer to int for min - maxp pointer to int for max - returned as -1 if no max - errorptr points to pointer to error message - cd pointer to character tables clock - -Returns: pointer to '}' on success; - current ptr on error, with errorptr set -*/ - -static const uschar * -read_repeat_counts(const uschar *p, int *minp, int *maxp, - const char **errorptr, compile_data *cd) -{ -int min = 0; -int max = -1; - -while ((cd->ctypes[*p] & ctype_digit) != 0) min = min * 10 + *p++ - '0'; - -if (*p == '}') max = min; else - { - if (*(++p) != '}') - { - max = 0; - while((cd->ctypes[*p] & ctype_digit) != 0) max = max * 10 + *p++ - '0'; - if (max < min) - { - *errorptr = ERR4; - return p; - } - } - } - -/* Do paranoid checks, then fill in the required variables, and pass back the -pointer to the terminating '}'. */ - -if (min > 65535 || max > 65535) - *errorptr = ERR5; -else - { - *minp = min; - *maxp = max; - } -return p; -} - - - -/************************************************* -* Find the fixed length of a pattern * -*************************************************/ - -/* Scan a pattern and compute the fixed length of subject that will match it, -if the length is fixed. This is needed for dealing with backward assertions. - -Arguments: - code points to the start of the pattern (the bracket) - -Returns: the fixed length, or -1 if there is no fixed length -*/ - -static int -find_fixedlength(uschar *code) -{ -int length = -1; - -register int branchlength = 0; -register uschar *cc = code + 3; - -/* Scan along the opcodes for this branch. If we get to the end of the -branch, check the length against that of the other branches. */ - -for (;;) - { - int d; - register int op = *cc; - if (op >= OP_BRA) op = OP_BRA; - - switch (op) - { - case OP_BRA: - case OP_ONCE: - case OP_COND: - d = find_fixedlength(cc); - if (d < 0) return -1; - branchlength += d; - do cc += (cc[1] << 8) + cc[2]; while (*cc == OP_ALT); - cc += 3; - break; - - /* Reached end of a branch; if it's a ket it is the end of a nested - call. If it's ALT it is an alternation in a nested call. If it is - END it's the end of the outer call. All can be handled by the same code. */ - - case OP_ALT: - case OP_KET: - case OP_KETRMAX: - case OP_KETRMIN: - case OP_END: - if (length < 0) length = branchlength; - else if (length != branchlength) return -1; - if (*cc != OP_ALT) return length; - cc += 3; - branchlength = 0; - break; - - /* Skip over assertive subpatterns */ - - case OP_ASSERT: - case OP_ASSERT_NOT: - case OP_ASSERTBACK: - case OP_ASSERTBACK_NOT: - do cc += (cc[1] << 8) + cc[2]; while (*cc == OP_ALT); - cc += 3; - break; - - /* Skip over things that don't match chars */ - - case OP_REVERSE: - cc++; - /* Fall through */ - - case OP_CREF: - case OP_OPT: - cc++; - /* Fall through */ - - case OP_SOD: - case OP_EOD: - case OP_EODN: - case OP_CIRC: - case OP_DOLL: - case OP_NOT_WORD_BOUNDARY: - case OP_WORD_BOUNDARY: - cc++; - break; - - /* Handle char strings */ - - case OP_CHARS: - branchlength += *(++cc); - cc += *cc + 1; - break; - - /* Handle exact repetitions */ - - case OP_EXACT: - case OP_TYPEEXACT: - branchlength += (cc[1] << 8) + cc[2]; - cc += 4; - break; - - /* Handle single-char matchers */ - - case OP_NOT_DIGIT: - case OP_DIGIT: - case OP_NOT_WHITESPACE: - case OP_WHITESPACE: - case OP_NOT_WORDCHAR: - case OP_WORDCHAR: - case OP_ANY: - branchlength++; - cc++; - break; - - - /* Check a class for variable quantification */ - - case OP_CLASS: - cc += (*cc == OP_REF)? 2 : 33; - - switch (*cc) - { - case OP_CRSTAR: - case OP_CRMINSTAR: - case OP_CRQUERY: - case OP_CRMINQUERY: - return -1; - - case OP_CRRANGE: - case OP_CRMINRANGE: - if ((cc[1] << 8) + cc[2] != (cc[3] << 8) + cc[4]) return -1; - branchlength += (cc[1] << 8) + cc[2]; - cc += 5; - break; - - default: - branchlength++; - } - break; - - /* Anything else is variable length */ - - default: - return -1; - } - } -/* Control never gets here */ -} - - - - -/************************************************* -* Check for POSIX class syntax * -*************************************************/ - -/* This function is called when the sequence "[:" or "[." or "[=" is -encountered in a character class. It checks whether this is followed by an -optional ^ and then a sequence of letters, terminated by a matching ":]" or -".]" or "=]". - -Argument: - ptr pointer to the initial [ - endptr where to return the end pointer - cd pointer to compile data - -Returns: TRUE or FALSE -*/ - -static BOOL -check_posix_syntax(const uschar *ptr, const uschar **endptr, compile_data *cd) -{ -int terminator; /* Don't combine these lines; the Solaris cc */ -terminator = *(++ptr); /* compiler warns about "non-constant" initializer. */ -if (*(++ptr) == '^') ptr++; -while ((cd->ctypes[*ptr] & ctype_letter) != 0) ptr++; -if (*ptr == terminator && ptr[1] == ']') - { - *endptr = ptr; - return TRUE; - } -return FALSE; -} - - - - -/************************************************* -* Check POSIX class name * -*************************************************/ - -/* This function is called to check the name given in a POSIX-style class entry -such as [:alnum:]. - -Arguments: - ptr points to the first letter - len the length of the name - -Returns: a value representing the name, or -1 if unknown -*/ - -static int -check_posix_name(const uschar *ptr, int len) -{ -register int yield = 0; -while (posix_name_lengths[yield] != 0) - { - if (len == posix_name_lengths[yield] && - strncmp((const char *)ptr, posix_names[yield], len) == 0) return yield; - yield++; - } -return -1; -} - - - - -/************************************************* -* Compile one branch * -*************************************************/ - -/* Scan the pattern, compiling it into the code vector. - -Arguments: - options the option bits - brackets points to number of brackets used - code points to the pointer to the current code point - ptrptr points to the current pattern pointer - errorptr points to pointer to error message - optchanged set to the value of the last OP_OPT item compiled - reqchar set to the last literal character required, else -1 - countlits set to count of mandatory literal characters - cd contains pointers to tables - -Returns: TRUE on success - FALSE, with *errorptr set on error -*/ - -static BOOL -compile_branch(int options, int *brackets, uschar **codeptr, - const uschar **ptrptr, const char **errorptr, int *optchanged, - int *reqchar, int *countlits, compile_data *cd) -{ -int repeat_type, op_type; -int repeat_min, repeat_max; -int bravalue, length; -int greedy_default, greedy_non_default; -int prevreqchar; -int condcount = 0; -int subcountlits = 0; -register int c; -register uschar *code = *codeptr; -uschar *tempcode; -const uschar *ptr = *ptrptr; -const uschar *tempptr; -uschar *previous = NULL; -uschar class[32]; - -/* Set up the default and non-default settings for greediness */ - -greedy_default = ((options & PCRE_UNGREEDY) != 0); -greedy_non_default = greedy_default ^ 1; - -/* Initialize no required char, and count of literals */ - -*reqchar = prevreqchar = -1; -*countlits = 0; - -/* Switch on next character until the end of the branch */ - -for (;; ptr++) - { - BOOL negate_class; - int class_charcount; - int class_lastchar; - int newoptions; - int condref; - int subreqchar; - - c = *ptr; - if ((options & PCRE_EXTENDED) != 0) - { - if ((cd->ctypes[c] & ctype_space) != 0) continue; - if (c == '#') - { - /* The space before the ; is to avoid a warning on a silly compiler - on the Macintosh. */ - while ((c = *(++ptr)) != 0 && c != '\n') ; - continue; - } - } - - switch(c) - { - /* The branch terminates at end of string, |, or ). */ - - case 0: - case '|': - case ')': - *codeptr = code; - *ptrptr = ptr; - return TRUE; - - /* Handle single-character metacharacters */ - - case '^': - previous = NULL; - *code++ = OP_CIRC; - break; - - case '$': - previous = NULL; - *code++ = OP_DOLL; - break; - - case '.': - previous = code; - *code++ = OP_ANY; - break; - - /* Character classes. These always build a 32-byte bitmap of the permitted - characters, except in the special case where there is only one character. - For negated classes, we build the map as usual, then invert it at the end. - */ - - case '[': - previous = code; - *code++ = OP_CLASS; - - /* If the first character is '^', set the negation flag and skip it. */ - - if ((c = *(++ptr)) == '^') - { - negate_class = TRUE; - c = *(++ptr); - } - else negate_class = FALSE; - - /* Keep a count of chars so that we can optimize the case of just a single - character. */ - - class_charcount = 0; - class_lastchar = -1; - - /* Initialize the 32-char bit map to all zeros. We have to build the - map in a temporary bit of store, in case the class contains only 1 - character, because in that case the compiled code doesn't use the - bit map. */ - - memset(class, 0, 32 * sizeof(uschar)); - - /* Process characters until ] is reached. By writing this as a "do" it - means that an initial ] is taken as a data character. */ - - do - { - if (c == 0) - { - *errorptr = ERR6; - goto FAILED; - } - - /* Handle POSIX class names. Perl allows a negation extension of the - form [:^name]. A square bracket that doesn't match the syntax is - treated as a literal. We also recognize the POSIX constructions - [.ch.] and [=ch=] ("collating elements") and fault them, as Perl - 5.6 does. */ - - if (c == '[' && - (ptr[1] == ':' || ptr[1] == '.' || ptr[1] == '=') && - check_posix_syntax(ptr, &tempptr, cd)) - { - BOOL local_negate = FALSE; - int posix_class, i; - register const uschar *cbits = cd->cbits; - - if (ptr[1] != ':') - { - *errorptr = ERR31; - goto FAILED; - } - - ptr += 2; - if (*ptr == '^') - { - local_negate = TRUE; - ptr++; - } - - posix_class = check_posix_name(ptr, tempptr - ptr); - if (posix_class < 0) - { - *errorptr = ERR30; - goto FAILED; - } - - /* If matching is caseless, upper and lower are converted to - alpha. This relies on the fact that the class table starts with - alpha, lower, upper as the first 3 entries. */ - - if ((options & PCRE_CASELESS) != 0 && posix_class <= 2) - posix_class = 0; - - /* Or into the map we are building up to 3 of the static class - tables, or their negations. */ - - posix_class *= 3; - for (i = 0; i < 3; i++) - { - int taboffset = posix_class_maps[posix_class + i]; - if (taboffset < 0) break; - if (local_negate) - for (c = 0; c < 32; c++) class[c] |= ~cbits[c+taboffset]; - else - for (c = 0; c < 32; c++) class[c] |= cbits[c+taboffset]; - } - - ptr = tempptr + 1; - class_charcount = 10; /* Set > 1; assumes more than 1 per class */ - continue; - } - - /* Backslash may introduce a single character, or it may introduce one - of the specials, which just set a flag. Escaped items are checked for - validity in the pre-compiling pass. The sequence \b is a special case. - Inside a class (and only there) it is treated as backspace. Elsewhere - it marks a word boundary. Other escapes have preset maps ready to - or into the one we are building. We assume they have more than one - character in them, so set class_count bigger than one. */ - - if (c == '\\') - { - c = check_escape(&ptr, errorptr, *brackets, options, TRUE, cd); - if (-c == ESC_b) c = '\b'; - else if (c < 0) - { - register const uschar *cbits = cd->cbits; - class_charcount = 10; - switch (-c) - { - case ESC_d: - for (c = 0; c < 32; c++) class[c] |= cbits[c+cbit_digit]; - continue; - - case ESC_D: - for (c = 0; c < 32; c++) class[c] |= ~cbits[c+cbit_digit]; - continue; - - case ESC_w: - for (c = 0; c < 32; c++) class[c] |= cbits[c+cbit_word]; - continue; - - case ESC_W: - for (c = 0; c < 32; c++) class[c] |= ~cbits[c+cbit_word]; - continue; - - case ESC_s: - for (c = 0; c < 32; c++) class[c] |= cbits[c+cbit_space]; - continue; - - case ESC_S: - for (c = 0; c < 32; c++) class[c] |= ~cbits[c+cbit_space]; - continue; - - default: - *errorptr = ERR7; - goto FAILED; - } - } - /* Fall through if single character */ - } - - /* A single character may be followed by '-' to form a range. However, - Perl does not permit ']' to be the end of the range. A '-' character - here is treated as a literal. */ - - if (ptr[1] == '-' && ptr[2] != ']') - { - int d; - ptr += 2; - d = *ptr; - - if (d == 0) - { - *errorptr = ERR6; - goto FAILED; - } - - /* The second part of a range can be a single-character escape, but - not any of the other escapes. */ - - if (d == '\\') - { - d = check_escape(&ptr, errorptr, *brackets, options, TRUE, cd); - if (d < 0) - { - if (d == -ESC_b) d = '\b'; else - { - *errorptr = ERR7; - goto FAILED; - } - } - } - - if (d < c) - { - *errorptr = ERR8; - goto FAILED; - } - - for (; c <= d; c++) - { - class[c/8] |= (1 << (c&7)); - if ((options & PCRE_CASELESS) != 0) - { - int uc = cd->fcc[c]; /* flip case */ - class[uc/8] |= (1 << (uc&7)); - } - class_charcount++; /* in case a one-char range */ - class_lastchar = c; - } - continue; /* Go get the next char in the class */ - } - - /* Handle a lone single character - we can get here for a normal - non-escape char, or after \ that introduces a single character. */ - - class [c/8] |= (1 << (c&7)); - if ((options & PCRE_CASELESS) != 0) - { - c = cd->fcc[c]; /* flip case */ - class[c/8] |= (1 << (c&7)); - } - class_charcount++; - class_lastchar = c; - } - - /* Loop until ']' reached; the check for end of string happens inside the - loop. This "while" is the end of the "do" above. */ - - while ((c = *(++ptr)) != ']'); - - /* If class_charcount is 1 and class_lastchar is not negative, we saw - precisely one character. This doesn't need the whole 32-byte bit map. - We turn it into a 1-character OP_CHAR if it's positive, or OP_NOT if - it's negative. */ - - if (class_charcount == 1 && class_lastchar >= 0) - { - if (negate_class) - { - code[-1] = OP_NOT; - } - else - { - code[-1] = OP_CHARS; - *code++ = 1; - } - *code++ = class_lastchar; - } - - /* Otherwise, negate the 32-byte map if necessary, and copy it into - the code vector. */ - - else - { - if (negate_class) - for (c = 0; c < 32; c++) code[c] = ~class[c]; - else - memcpy(code, class, 32); - code += 32; - } - break; - - /* Various kinds of repeat */ - - case '{': - if (!is_counted_repeat(ptr+1, cd)) goto NORMAL_CHAR; - ptr = read_repeat_counts(ptr+1, &repeat_min, &repeat_max, errorptr, cd); - if (*errorptr != NULL) goto FAILED; - goto REPEAT; - - case '*': - repeat_min = 0; - repeat_max = -1; - goto REPEAT; - - case '+': - repeat_min = 1; - repeat_max = -1; - goto REPEAT; - - case '?': - repeat_min = 0; - repeat_max = 1; - - REPEAT: - if (previous == NULL) - { - *errorptr = ERR9; - goto FAILED; - } - - /* If the next character is '?' this is a minimizing repeat, by default, - but if PCRE_UNGREEDY is set, it works the other way round. Advance to the - next character. */ - - if (ptr[1] == '?') - { repeat_type = greedy_non_default; ptr++; } - else repeat_type = greedy_default; - - /* If previous was a string of characters, chop off the last one and use it - as the subject of the repeat. If there was only one character, we can - abolish the previous item altogether. A repeat with a zero minimum wipes - out any reqchar setting, backing up to the previous value. We must also - adjust the countlits value. */ - - if (*previous == OP_CHARS) - { - int len = previous[1]; - - if (repeat_min == 0) *reqchar = prevreqchar; - *countlits += repeat_min - 1; - - if (len == 1) - { - c = previous[2]; - code = previous; - } - else - { - c = previous[len+1]; - previous[1]--; - code--; - } - op_type = 0; /* Use single-char op codes */ - goto OUTPUT_SINGLE_REPEAT; /* Code shared with single character types */ - } - - /* If previous was a single negated character ([^a] or similar), we use - one of the special opcodes, replacing it. The code is shared with single- - character repeats by adding a suitable offset into repeat_type. */ - - else if ((int)*previous == OP_NOT) - { - op_type = OP_NOTSTAR - OP_STAR; /* Use "not" opcodes */ - c = previous[1]; - code = previous; - goto OUTPUT_SINGLE_REPEAT; - } - - /* If previous was a character type match (\d or similar), abolish it and - create a suitable repeat item. The code is shared with single-character - repeats by adding a suitable offset into repeat_type. */ - - else if ((int)*previous < OP_EODN || *previous == OP_ANY) - { - op_type = OP_TYPESTAR - OP_STAR; /* Use type opcodes */ - c = *previous; - code = previous; - - OUTPUT_SINGLE_REPEAT: - - /* If the maximum is zero then the minimum must also be zero; Perl allows - this case, so we do too - by simply omitting the item altogether. */ - - if (repeat_max == 0) goto END_REPEAT; - - /* Combine the op_type with the repeat_type */ - - repeat_type += op_type; - - /* A minimum of zero is handled either as the special case * or ?, or as - an UPTO, with the maximum given. */ - - if (repeat_min == 0) - { - if (repeat_max == -1) *code++ = OP_STAR + repeat_type; - else if (repeat_max == 1) *code++ = OP_QUERY + repeat_type; - else - { - *code++ = OP_UPTO + repeat_type; - *code++ = repeat_max >> 8; - *code++ = (repeat_max & 255); - } - } - - /* The case {1,} is handled as the special case + */ - - else if (repeat_min == 1 && repeat_max == -1) - *code++ = OP_PLUS + repeat_type; - - /* The case {n,n} is just an EXACT, while the general case {n,m} is - handled as an EXACT followed by an UPTO. An EXACT of 1 is optimized. */ - - else - { - if (repeat_min != 1) - { - *code++ = OP_EXACT + op_type; /* NB EXACT doesn't have repeat_type */ - *code++ = repeat_min >> 8; - *code++ = (repeat_min & 255); - } - - /* If the mininum is 1 and the previous item was a character string, - we either have to put back the item that got cancelled if the string - length was 1, or add the character back onto the end of a longer - string. For a character type nothing need be done; it will just get - put back naturally. Note that the final character is always going to - get added below. */ - - else if (*previous == OP_CHARS) - { - if (code == previous) code += 2; else previous[1]++; - } - - /* For a single negated character we also have to put back the - item that got cancelled. */ - - else if (*previous == OP_NOT) code++; - - /* If the maximum is unlimited, insert an OP_STAR. */ - - if (repeat_max < 0) - { - *code++ = c; - *code++ = OP_STAR + repeat_type; - } - - /* Else insert an UPTO if the max is greater than the min. */ - - else if (repeat_max != repeat_min) - { - *code++ = c; - repeat_max -= repeat_min; - *code++ = OP_UPTO + repeat_type; - *code++ = repeat_max >> 8; - *code++ = (repeat_max & 255); - } - } - - /* The character or character type itself comes last in all cases. */ - - *code++ = c; - } - - /* If previous was a character class or a back reference, we put the repeat - stuff after it, but just skip the item if the repeat was {0,0}. */ - - else if (*previous == OP_CLASS || *previous == OP_REF) - { - if (repeat_max == 0) - { - code = previous; - goto END_REPEAT; - } - if (repeat_min == 0 && repeat_max == -1) - *code++ = OP_CRSTAR + repeat_type; - else if (repeat_min == 1 && repeat_max == -1) - *code++ = OP_CRPLUS + repeat_type; - else if (repeat_min == 0 && repeat_max == 1) - *code++ = OP_CRQUERY + repeat_type; - else - { - *code++ = OP_CRRANGE + repeat_type; - *code++ = repeat_min >> 8; - *code++ = repeat_min & 255; - if (repeat_max == -1) repeat_max = 0; /* 2-byte encoding for max */ - *code++ = repeat_max >> 8; - *code++ = repeat_max & 255; - } - } - - /* If previous was a bracket group, we may have to replicate it in certain - cases. */ - - else if ((int)*previous >= OP_BRA || (int)*previous == OP_ONCE || - (int)*previous == OP_COND) - { - register int i; - int ketoffset = 0; - int len = code - previous; - uschar *bralink = NULL; - - /* If the maximum repeat count is unlimited, find the end of the bracket - by scanning through from the start, and compute the offset back to it - from the current code pointer. There may be an OP_OPT setting following - the final KET, so we can't find the end just by going back from the code - pointer. */ - - if (repeat_max == -1) - { - register uschar *ket = previous; - do ket += (ket[1] << 8) + ket[2]; while (*ket != OP_KET); - ketoffset = code - ket; - } - - /* The case of a zero minimum is special because of the need to stick - OP_BRAZERO in front of it, and because the group appears once in the - data, whereas in other cases it appears the minimum number of times. For - this reason, it is simplest to treat this case separately, as otherwise - the code gets far too mess. There are several special subcases when the - minimum is zero. */ - - if (repeat_min == 0) - { - /* If we set up a required char from the bracket, we must back off - to the previous value and reset the countlits value too. */ - - if (subcountlits > 0) - { - *reqchar = prevreqchar; - *countlits -= subcountlits; - } - - /* If the maximum is also zero, we just omit the group from the output - altogether. */ - - if (repeat_max == 0) - { - code = previous; - goto END_REPEAT; - } - - /* If the maximum is 1 or unlimited, we just have to stick in the - BRAZERO and do no more at this point. */ - - if (repeat_max <= 1) - { - memmove(previous+1, previous, len); - code++; - *previous++ = OP_BRAZERO + repeat_type; - } - - /* If the maximum is greater than 1 and limited, we have to replicate - in a nested fashion, sticking OP_BRAZERO before each set of brackets. - The first one has to be handled carefully because it's the original - copy, which has to be moved up. The remainder can be handled by code - that is common with the non-zero minimum case below. We just have to - adjust the value or repeat_max, since one less copy is required. */ - - else - { - int offset; - memmove(previous+4, previous, len); - code += 4; - *previous++ = OP_BRAZERO + repeat_type; - *previous++ = OP_BRA; - - /* We chain together the bracket offset fields that have to be - filled in later when the ends of the brackets are reached. */ - - offset = (bralink == NULL)? 0 : previous - bralink; - bralink = previous; - *previous++ = offset >> 8; - *previous++ = offset & 255; - } - - repeat_max--; - } - - /* If the minimum is greater than zero, replicate the group as many - times as necessary, and adjust the maximum to the number of subsequent - copies that we need. */ - - else - { - for (i = 1; i < repeat_min; i++) - { - memcpy(code, previous, len); - code += len; - } - if (repeat_max > 0) repeat_max -= repeat_min; - } - - /* This code is common to both the zero and non-zero minimum cases. If - the maximum is limited, it replicates the group in a nested fashion, - remembering the bracket starts on a stack. In the case of a zero minimum, - the first one was set up above. In all cases the repeat_max now specifies - the number of additional copies needed. */ - - if (repeat_max >= 0) - { - for (i = repeat_max - 1; i >= 0; i--) - { - *code++ = OP_BRAZERO + repeat_type; - - /* All but the final copy start a new nesting, maintaining the - chain of brackets outstanding. */ - - if (i != 0) - { - int offset; - *code++ = OP_BRA; - offset = (bralink == NULL)? 0 : code - bralink; - bralink = code; - *code++ = offset >> 8; - *code++ = offset & 255; - } - - memcpy(code, previous, len); - code += len; - } - - /* Now chain through the pending brackets, and fill in their length - fields (which are holding the chain links pro tem). */ - - while (bralink != NULL) - { - int oldlinkoffset; - int offset = code - bralink + 1; - uschar *bra = code - offset; - oldlinkoffset = (bra[1] << 8) + bra[2]; - bralink = (oldlinkoffset == 0)? NULL : bralink - oldlinkoffset; - *code++ = OP_KET; - *code++ = bra[1] = offset >> 8; - *code++ = bra[2] = (offset & 255); - } - } - - /* If the maximum is unlimited, set a repeater in the final copy. We - can't just offset backwards from the current code point, because we - don't know if there's been an options resetting after the ket. The - correct offset was computed above. */ - - else code[-ketoffset] = OP_KETRMAX + repeat_type; - } - - /* Else there's some kind of shambles */ - - else - { - *errorptr = ERR11; - goto FAILED; - } - - /* In all case we no longer have a previous item. */ - - END_REPEAT: - previous = NULL; - break; - - - /* Start of nested bracket sub-expression, or comment or lookahead or - lookbehind or option setting or condition. First deal with special things - that can come after a bracket; all are introduced by ?, and the appearance - of any of them means that this is not a referencing group. They were - checked for validity in the first pass over the string, so we don't have to - check for syntax errors here. */ - - case '(': - newoptions = options; - condref = -1; - - if (*(++ptr) == '?') - { - int set, unset; - int *optset; - - switch (*(++ptr)) - { - case '#': /* Comment; skip to ket */ - ptr++; - while (*ptr != ')') ptr++; - continue; - - case ':': /* Non-extracting bracket */ - bravalue = OP_BRA; - ptr++; - break; - - case '(': - bravalue = OP_COND; /* Conditional group */ - if ((cd->ctypes[*(++ptr)] & ctype_digit) != 0) - { - condref = *ptr - '0'; - while (*(++ptr) != ')') condref = condref*10 + *ptr - '0'; - ptr++; - } - else ptr--; - break; - - case '=': /* Positive lookahead */ - bravalue = OP_ASSERT; - ptr++; - break; - - case '!': /* Negative lookahead */ - bravalue = OP_ASSERT_NOT; - ptr++; - break; - - case '<': /* Lookbehinds */ - switch (*(++ptr)) - { - case '=': /* Positive lookbehind */ - bravalue = OP_ASSERTBACK; - ptr++; - break; - - case '!': /* Negative lookbehind */ - bravalue = OP_ASSERTBACK_NOT; - ptr++; - break; - - default: /* Syntax error */ - *errorptr = ERR24; - goto FAILED; - } - break; - - case '>': /* One-time brackets */ - bravalue = OP_ONCE; - ptr++; - break; - - case 'R': /* Pattern recursion */ - *code++ = OP_RECURSE; - ptr++; - continue; - - default: /* Option setting */ - set = unset = 0; - optset = &set; - - while (*ptr != ')' && *ptr != ':') - { - switch (*ptr++) - { - case '-': optset = &unset; break; - - case 'i': *optset |= PCRE_CASELESS; break; - case 'm': *optset |= PCRE_MULTILINE; break; - case 's': *optset |= PCRE_DOTALL; break; - case 'x': *optset |= PCRE_EXTENDED; break; - case 'U': *optset |= PCRE_UNGREEDY; break; - case 'X': *optset |= PCRE_EXTRA; break; - - default: - *errorptr = ERR12; - goto FAILED; - } - } - - /* Set up the changed option bits, but don't change anything yet. */ - - newoptions = (options | set) & (~unset); - - /* If the options ended with ')' this is not the start of a nested - group with option changes, so the options change at this level. At top - level there is nothing else to be done (the options will in fact have - been set from the start of compiling as a result of the first pass) but - at an inner level we must compile code to change the ims options if - necessary, and pass the new setting back so that it can be put at the - start of any following branches, and when this group ends, a resetting - item can be compiled. */ - - if (*ptr == ')') - { - if ((options & PCRE_INGROUP) != 0 && - (options & PCRE_IMS) != (newoptions & PCRE_IMS)) - { - *code++ = OP_OPT; - *code++ = *optchanged = newoptions & PCRE_IMS; - } - options = newoptions; /* Change options at this level */ - previous = NULL; /* This item can't be repeated */ - continue; /* It is complete */ - } - - /* If the options ended with ':' we are heading into a nested group - with possible change of options. Such groups are non-capturing and are - not assertions of any kind. All we need to do is skip over the ':'; - the newoptions value is handled below. */ - - bravalue = OP_BRA; - ptr++; - } - } - - /* Else we have a referencing group; adjust the opcode. */ - - else - { - if (++(*brackets) > EXTRACT_MAX) - { - *errorptr = ERR13; - goto FAILED; - } - bravalue = OP_BRA + *brackets; - } - - /* Process nested bracketed re. Assertions may not be repeated, but other - kinds can be. We copy code into a non-register variable in order to be able - to pass its address because some compilers complain otherwise. Pass in a - new setting for the ims options if they have changed. */ - - previous = (bravalue >= OP_ONCE)? code : NULL; - *code = bravalue; - tempcode = code; - - if (!compile_regex( - options | PCRE_INGROUP, /* Set for all nested groups */ - ((options & PCRE_IMS) != (newoptions & PCRE_IMS))? - newoptions & PCRE_IMS : -1, /* Pass ims options if changed */ - brackets, /* Bracket level */ - &tempcode, /* Where to put code (updated) */ - &ptr, /* Input pointer (updated) */ - errorptr, /* Where to put an error message */ - (bravalue == OP_ASSERTBACK || - bravalue == OP_ASSERTBACK_NOT), /* TRUE if back assert */ - condref, /* Condition reference number */ - &subreqchar, /* For possible last char */ - &subcountlits, /* For literal count */ - cd)) /* Tables block */ - goto FAILED; - - /* At the end of compiling, code is still pointing to the start of the - group, while tempcode has been updated to point past the end of the group - and any option resetting that may follow it. The pattern pointer (ptr) - is on the bracket. */ - - /* If this is a conditional bracket, check that there are no more than - two branches in the group. */ - - if (bravalue == OP_COND) - { - uschar *tc = code; - condcount = 0; - - do { - condcount++; - tc += (tc[1] << 8) | tc[2]; - } - while (*tc != OP_KET); - - if (condcount > 2) - { - *errorptr = ERR27; - goto FAILED; - } - } - - /* Handle updating of the required character. If the subpattern didn't - set one, leave it as it was. Otherwise, update it for normal brackets of - all kinds, forward assertions, and conditions with two branches. Don't - update the literal count for forward assertions, however. If the bracket - is followed by a quantifier with zero repeat, we have to back off. Hence - the definition of prevreqchar and subcountlits outside the main loop so - that they can be accessed for the back off. */ - - if (subreqchar > 0 && - (bravalue >= OP_BRA || bravalue == OP_ONCE || bravalue == OP_ASSERT || - (bravalue == OP_COND && condcount == 2))) - { - prevreqchar = *reqchar; - *reqchar = subreqchar; - if (bravalue != OP_ASSERT) *countlits += subcountlits; - } - - /* Now update the main code pointer to the end of the group. */ - - code = tempcode; - - /* Error if hit end of pattern */ - - if (*ptr != ')') - { - *errorptr = ERR14; - goto FAILED; - } - break; - - /* Check \ for being a real metacharacter; if not, fall through and handle - it as a data character at the start of a string. Escape items are checked - for validity in the pre-compiling pass. */ - - case '\\': - tempptr = ptr; - c = check_escape(&ptr, errorptr, *brackets, options, FALSE, cd); - - /* Handle metacharacters introduced by \. For ones like \d, the ESC_ values - are arranged to be the negation of the corresponding OP_values. For the - back references, the values are ESC_REF plus the reference number. Only - back references and those types that consume a character may be repeated. - We can test for values between ESC_b and ESC_Z for the latter; this may - have to change if any new ones are ever created. */ - - if (c < 0) - { - if (-c >= ESC_REF) - { - previous = code; - *code++ = OP_REF; - *code++ = -c - ESC_REF; - } - else - { - previous = (-c > ESC_b && -c < ESC_Z)? code : NULL; - *code++ = -c; - } - continue; - } - - /* Data character: reset and fall through */ - - ptr = tempptr; - c = '\\'; - - /* Handle a run of data characters until a metacharacter is encountered. - The first character is guaranteed not to be whitespace or # when the - extended flag is set. */ - - NORMAL_CHAR: - default: - previous = code; - *code = OP_CHARS; - code += 2; - length = 0; - - do - { - if ((options & PCRE_EXTENDED) != 0) - { - if ((cd->ctypes[c] & ctype_space) != 0) continue; - if (c == '#') - { - /* The space before the ; is to avoid a warning on a silly compiler - on the Macintosh. */ - while ((c = *(++ptr)) != 0 && c != '\n') ; - if (c == 0) break; - continue; - } - } - - /* Backslash may introduce a data char or a metacharacter. Escaped items - are checked for validity in the pre-compiling pass. Stop the string - before a metaitem. */ - - if (c == '\\') - { - tempptr = ptr; - c = check_escape(&ptr, errorptr, *brackets, options, FALSE, cd); - if (c < 0) { ptr = tempptr; break; } - } - - /* Ordinary character or single-char escape */ - - *code++ = c; - length++; - } - - /* This "while" is the end of the "do" above. */ - - while (length < 255 && (cd->ctypes[c = *(++ptr)] & ctype_meta) == 0); - - /* Update the last character and the count of literals */ - - prevreqchar = (length > 1)? code[-2] : *reqchar; - *reqchar = code[-1]; - *countlits += length; - - /* Compute the length and set it in the data vector, and advance to - the next state. */ - - previous[1] = length; - if (length < 255) ptr--; - break; - } - } /* end of big loop */ - -/* Control never reaches here by falling through, only by a goto for all the -error states. Pass back the position in the pattern so that it can be displayed -to the user for diagnosing the error. */ - -FAILED: -*ptrptr = ptr; -return FALSE; -} - - - - -/************************************************* -* Compile sequence of alternatives * -*************************************************/ - -/* On entry, ptr is pointing past the bracket character, but on return -it points to the closing bracket, or vertical bar, or end of string. -The code variable is pointing at the byte into which the BRA operator has been -stored. If the ims options are changed at the start (for a (?ims: group) or -during any branch, we need to insert an OP_OPT item at the start of every -following branch to ensure they get set correctly at run time, and also pass -the new options into every subsequent branch compile. - -Argument: - options the option bits - optchanged new ims options to set as if (?ims) were at the start, or -1 - for no change - brackets -> int containing the number of extracting brackets used - codeptr -> the address of the current code pointer - ptrptr -> the address of the current pattern pointer - errorptr -> pointer to error message - lookbehind TRUE if this is a lookbehind assertion - condref > 0 for OPT_CREF setting at start of conditional group - reqchar -> place to put the last required character, or a negative number - countlits -> place to put the shortest literal count of any branch - cd points to the data block with tables pointers - -Returns: TRUE on success -*/ - -static BOOL -compile_regex(int options, int optchanged, int *brackets, uschar **codeptr, - const uschar **ptrptr, const char **errorptr, BOOL lookbehind, int condref, - int *reqchar, int *countlits, compile_data *cd) -{ -const uschar *ptr = *ptrptr; -uschar *code = *codeptr; -uschar *last_branch = code; -uschar *start_bracket = code; -uschar *reverse_count = NULL; -int oldoptions = options & PCRE_IMS; -int branchreqchar, branchcountlits; - -*reqchar = -1; -*countlits = INT_MAX; -code += 3; - -/* At the start of a reference-based conditional group, insert the reference -number as an OP_CREF item. */ - -if (condref > 0) - { - *code++ = OP_CREF; - *code++ = condref; - } - -/* Loop for each alternative branch */ - -for (;;) - { - int length; - - /* Handle change of options */ - - if (optchanged >= 0) - { - *code++ = OP_OPT; - *code++ = optchanged; - options = (options & ~PCRE_IMS) | optchanged; - } - - /* Set up dummy OP_REVERSE if lookbehind assertion */ - - if (lookbehind) - { - *code++ = OP_REVERSE; - reverse_count = code; - *code++ = 0; - *code++ = 0; - } - - /* Now compile the branch */ - - if (!compile_branch(options, brackets, &code, &ptr, errorptr, &optchanged, - &branchreqchar, &branchcountlits, cd)) - { - *ptrptr = ptr; - return FALSE; - } - - /* Fill in the length of the last branch */ - - length = code - last_branch; - last_branch[1] = length >> 8; - last_branch[2] = length & 255; - - /* Save the last required character if all branches have the same; a current - value of -1 means unset, while -2 means "previous branch had no last required - char". */ - - if (*reqchar != -2) - { - if (branchreqchar >= 0) - { - if (*reqchar == -1) *reqchar = branchreqchar; - else if (*reqchar != branchreqchar) *reqchar = -2; - } - else *reqchar = -2; - } - - /* Keep the shortest literal count */ - - if (branchcountlits < *countlits) *countlits = branchcountlits; - DPRINTF(("literal count = %d min=%d\n", branchcountlits, *countlits)); - - /* If lookbehind, check that this branch matches a fixed-length string, - and put the length into the OP_REVERSE item. Temporarily mark the end of - the branch with OP_END. */ - - if (lookbehind) - { - *code = OP_END; - length = find_fixedlength(last_branch); - DPRINTF(("fixed length = %d\n", length)); - if (length < 0) - { - *errorptr = ERR25; - *ptrptr = ptr; - return FALSE; - } - reverse_count[0] = (length >> 8); - reverse_count[1] = length & 255; - } - - /* Reached end of expression, either ')' or end of pattern. Insert a - terminating ket and the length of the whole bracketed item, and return, - leaving the pointer at the terminating char. If any of the ims options - were changed inside the group, compile a resetting op-code following. */ - - if (*ptr != '|') - { - length = code - start_bracket; - *code++ = OP_KET; - *code++ = length >> 8; - *code++ = length & 255; - if (optchanged >= 0) - { - *code++ = OP_OPT; - *code++ = oldoptions; - } - *codeptr = code; - *ptrptr = ptr; - return TRUE; - } - - /* Another branch follows; insert an "or" node and advance the pointer. */ - - *code = OP_ALT; - last_branch = code; - code += 3; - ptr++; - } -/* Control never reaches here */ -} - - - - -/************************************************* -* Find first significant op code * -*************************************************/ - -/* This is called by several functions that scan a compiled expression looking -for a fixed first character, or an anchoring op code etc. It skips over things -that do not influence this. For one application, a change of caseless option is -important. - -Arguments: - code pointer to the start of the group - options pointer to external options - optbit the option bit whose changing is significant, or - zero if none are - optstop TRUE to return on option change, otherwise change the options - value and continue - -Returns: pointer to the first significant opcode -*/ - -static const uschar* -first_significant_code(const uschar *code, int *options, int optbit, - BOOL optstop) -{ -for (;;) - { - switch ((int)*code) - { - case OP_OPT: - if (optbit > 0 && ((int)code[1] & optbit) != (*options & optbit)) - { - if (optstop) return code; - *options = (int)code[1]; - } - code += 2; - break; - - case OP_CREF: - code += 2; - break; - - case OP_WORD_BOUNDARY: - case OP_NOT_WORD_BOUNDARY: - code++; - break; - - case OP_ASSERT_NOT: - case OP_ASSERTBACK: - case OP_ASSERTBACK_NOT: - do code += (code[1] << 8) + code[2]; while (*code == OP_ALT); - code += 3; - break; - - default: - return code; - } - } -/* Control never reaches here */ -} - - - - -/************************************************* -* Check for anchored expression * -*************************************************/ - -/* Try to find out if this is an anchored regular expression. Consider each -alternative branch. If they all start with OP_SOD or OP_CIRC, or with a bracket -all of whose alternatives start with OP_SOD or OP_CIRC (recurse ad lib), then -it's anchored. However, if this is a multiline pattern, then only OP_SOD -counts, since OP_CIRC can match in the middle. - -A branch is also implicitly anchored if it starts with .* and DOTALL is set, -because that will try the rest of the pattern at all possible matching points, -so there is no point trying them again. - -Arguments: - code points to start of expression (the bracket) - options points to the options setting - -Returns: TRUE or FALSE -*/ - -static BOOL -is_anchored(register const uschar *code, int *options) -{ -do { - const uschar *scode = first_significant_code(code + 3, options, - PCRE_MULTILINE, FALSE); - register int op = *scode; - if (op >= OP_BRA || op == OP_ASSERT || op == OP_ONCE || op == OP_COND) - { if (!is_anchored(scode, options)) return FALSE; } - else if ((op == OP_TYPESTAR || op == OP_TYPEMINSTAR) && - (*options & PCRE_DOTALL) != 0) - { if (scode[1] != OP_ANY) return FALSE; } - else if (op != OP_SOD && - ((*options & PCRE_MULTILINE) != 0 || op != OP_CIRC)) - return FALSE; - code += (code[1] << 8) + code[2]; - } -while (*code == OP_ALT); -return TRUE; -} - - - -/************************************************* -* Check for starting with ^ or .* * -*************************************************/ - -/* This is called to find out if every branch starts with ^ or .* so that -"first char" processing can be done to speed things up in multiline -matching and for non-DOTALL patterns that start with .* (which must start at -the beginning or after \n). - -Argument: points to start of expression (the bracket) -Returns: TRUE or FALSE -*/ - -static BOOL -is_startline(const uschar *code) -{ -do { - const uschar *scode = first_significant_code(code + 3, NULL, 0, FALSE); - register int op = *scode; - if (op >= OP_BRA || op == OP_ASSERT || op == OP_ONCE || op == OP_COND) - { if (!is_startline(scode)) return FALSE; } - else if (op == OP_TYPESTAR || op == OP_TYPEMINSTAR) - { if (scode[1] != OP_ANY) return FALSE; } - else if (op != OP_CIRC) return FALSE; - code += (code[1] << 8) + code[2]; - } -while (*code == OP_ALT); -return TRUE; -} - - - -/************************************************* -* Check for fixed first char * -*************************************************/ - -/* Try to find out if there is a fixed first character. This is called for -unanchored expressions, as it speeds up their processing quite considerably. -Consider each alternative branch. If they all start with the same char, or with -a bracket all of whose alternatives start with the same char (recurse ad lib), -then we return that char, otherwise -1. - -Arguments: - code points to start of expression (the bracket) - options pointer to the options (used to check casing changes) - -Returns: -1 or the fixed first char -*/ - -static int -find_firstchar(const uschar *code, int *options) -{ -register int c = -1; -do { - int d; - const uschar *scode = first_significant_code(code + 3, options, - PCRE_CASELESS, TRUE); - register int op = *scode; - - if (op >= OP_BRA) op = OP_BRA; - - switch(op) - { - default: - return -1; - - case OP_BRA: - case OP_ASSERT: - case OP_ONCE: - case OP_COND: - if ((d = find_firstchar(scode, options)) < 0) return -1; - if (c < 0) c = d; else if (c != d) return -1; - break; - - case OP_EXACT: /* Fall through */ - scode++; - - case OP_CHARS: /* Fall through */ - scode++; - - case OP_PLUS: - case OP_MINPLUS: - if (c < 0) c = scode[1]; else if (c != scode[1]) return -1; - break; - } - - code += (code[1] << 8) + code[2]; - } -while (*code == OP_ALT); -return c; -} - - - - - -/************************************************* -* Compile a Regular Expression * -*************************************************/ - -/* This function takes a string and returns a pointer to a block of store -holding a compiled version of the expression. - -Arguments: - pattern the regular expression - options various option bits - errorptr pointer to pointer to error text - erroroffset ptr offset in pattern where error was detected - tables pointer to character tables or NULL - -Returns: pointer to compiled data block, or NULL on error, - with errorptr and erroroffset set -*/ - -pcre * -pcre_compile(const char *pattern, int options, const char **errorptr, - int *erroroffset, const unsigned char *tables) -{ -real_pcre *re; -int length = 3; /* For initial BRA plus length */ -int runlength; -int c, reqchar, countlits; -int bracount = 0; -int top_backref = 0; -int branch_extra = 0; -int branch_newextra; -unsigned int brastackptr = 0; -size_t size; -uschar *code; -const uschar *ptr; -compile_data compile_block; -int brastack[BRASTACK_SIZE]; -uschar bralenstack[BRASTACK_SIZE]; - -#ifdef DEBUG -uschar *code_base, *code_end; -#endif - -/* We can't pass back an error message if errorptr is NULL; I guess the best we -can do is just return NULL. */ - -if (errorptr == NULL) return NULL; -*errorptr = NULL; - -/* However, we can give a message for this error */ - -if (erroroffset == NULL) - { - *errorptr = ERR16; - return NULL; - } -*erroroffset = 0; - -if ((options & ~PUBLIC_OPTIONS) != 0) - { - *errorptr = ERR17; - return NULL; - } - -/* Set up pointers to the individual character tables */ - -if (tables == NULL) tables = pcre_default_tables; -compile_block.lcc = tables + lcc_offset; -compile_block.fcc = tables + fcc_offset; -compile_block.cbits = tables + cbits_offset; -compile_block.ctypes = tables + ctypes_offset; - -/* Reflect pattern for debugging output */ - -DPRINTF(("------------------------------------------------------------------\n")); -DPRINTF(("%s\n", pattern)); - -/* The first thing to do is to make a pass over the pattern to compute the -amount of store required to hold the compiled code. This does not have to be -perfect as long as errors are overestimates. At the same time we can detect any -internal flag settings. Make an attempt to correct for any counted white space -if an "extended" flag setting appears late in the pattern. We can't be so -clever for #-comments. */ - -ptr = (const uschar *)(pattern - 1); -while ((c = *(++ptr)) != 0) - { - int min, max; - int class_charcount; - - if ((options & PCRE_EXTENDED) != 0) - { - if ((compile_block.ctypes[c] & ctype_space) != 0) continue; - if (c == '#') - { - /* The space before the ; is to avoid a warning on a silly compiler - on the Macintosh. */ - while ((c = *(++ptr)) != 0 && c != '\n') ; - continue; - } - } - - switch(c) - { - /* A backslashed item may be an escaped "normal" character or a - character type. For a "normal" character, put the pointers and - character back so that tests for whitespace etc. in the input - are done correctly. */ - - case '\\': - { - const uschar *save_ptr = ptr; - c = check_escape(&ptr, errorptr, bracount, options, FALSE, &compile_block); - if (*errorptr != NULL) goto PCRE_ERROR_RETURN; - if (c >= 0) - { - ptr = save_ptr; - c = '\\'; - goto NORMAL_CHAR; - } - } - length++; - - /* A back reference needs an additional char, plus either one or 5 - bytes for a repeat. We also need to keep the value of the highest - back reference. */ - - if (c <= -ESC_REF) - { - int refnum = -c - ESC_REF; - if (refnum > top_backref) top_backref = refnum; - length++; /* For single back reference */ - if (ptr[1] == '{' && is_counted_repeat(ptr+2, &compile_block)) - { - ptr = read_repeat_counts(ptr+2, &min, &max, errorptr, &compile_block); - if (*errorptr != NULL) goto PCRE_ERROR_RETURN; - if ((min == 0 && (max == 1 || max == -1)) || - (min == 1 && max == -1)) - length++; - else length += 5; - if (ptr[1] == '?') ptr++; - } - } - continue; - - case '^': - case '.': - case '$': - case '*': /* These repeats won't be after brackets; */ - case '+': /* those are handled separately */ - case '?': - length++; - continue; - - /* This covers the cases of repeats after a single char, metachar, class, - or back reference. */ - - case '{': - if (!is_counted_repeat(ptr+1, &compile_block)) goto NORMAL_CHAR; - ptr = read_repeat_counts(ptr+1, &min, &max, errorptr, &compile_block); - if (*errorptr != NULL) goto PCRE_ERROR_RETURN; - if ((min == 0 && (max == 1 || max == -1)) || - (min == 1 && max == -1)) - length++; - else - { - length--; /* Uncount the original char or metachar */ - if (min == 1) length++; else if (min > 0) length += 4; - if (max > 0) length += 4; else length += 2; - } - if (ptr[1] == '?') ptr++; - continue; - - /* An alternation contains an offset to the next branch or ket. If any ims - options changed in the previous branch(es), and/or if we are in a - lookbehind assertion, extra space will be needed at the start of the - branch. This is handled by branch_extra. */ - - case '|': - length += 3 + branch_extra; - continue; - - /* A character class uses 33 characters. Don't worry about character types - that aren't allowed in classes - they'll get picked up during the compile. - A character class that contains only one character uses 2 or 3 bytes, - depending on whether it is negated or not. Notice this where we can. */ - - case '[': - class_charcount = 0; - if (*(++ptr) == '^') ptr++; - do - { - if (*ptr == '\\') - { - int ch = check_escape(&ptr, errorptr, bracount, options, TRUE, - &compile_block); - if (*errorptr != NULL) goto PCRE_ERROR_RETURN; - if (-ch == ESC_b) class_charcount++; else class_charcount = 10; - } - else class_charcount++; - ptr++; - } - while (*ptr != 0 && *ptr != ']'); - - /* Repeats for negated single chars are handled by the general code */ - - if (class_charcount == 1) length += 3; else - { - length += 33; - - /* A repeat needs either 1 or 5 bytes. */ - - if (*ptr != 0 && ptr[1] == '{' && is_counted_repeat(ptr+2, &compile_block)) - { - ptr = read_repeat_counts(ptr+2, &min, &max, errorptr, &compile_block); - if (*errorptr != NULL) goto PCRE_ERROR_RETURN; - if ((min == 0 && (max == 1 || max == -1)) || - (min == 1 && max == -1)) - length++; - else length += 5; - if (ptr[1] == '?') ptr++; - } - } - continue; - - /* Brackets may be genuine groups or special things */ - - case '(': - branch_newextra = 0; - - /* Handle special forms of bracket, which all start (? */ - - if (ptr[1] == '?') - { - int set, unset; - int *optset; - - switch (c = ptr[2]) - { - /* Skip over comments entirely */ - case '#': - ptr += 3; - while (*ptr != 0 && *ptr != ')') ptr++; - if (*ptr == 0) - { - *errorptr = ERR18; - goto PCRE_ERROR_RETURN; - } - continue; - - /* Non-referencing groups and lookaheads just move the pointer on, and - then behave like a non-special bracket, except that they don't increment - the count of extracting brackets. Ditto for the "once only" bracket, - which is in Perl from version 5.005. */ - - case ':': - case '=': - case '!': - case '>': - ptr += 2; - break; - - /* A recursive call to the regex is an extension, to provide the - facility which can be obtained by $(?p{perl-code}) in Perl 5.6. */ - - case 'R': - if (ptr[3] != ')') - { - *errorptr = ERR29; - goto PCRE_ERROR_RETURN; - } - ptr += 3; - length += 1; - break; - - /* Lookbehinds are in Perl from version 5.005 */ - - case '<': - if (ptr[3] == '=' || ptr[3] == '!') - { - ptr += 3; - branch_newextra = 3; - length += 3; /* For the first branch */ - break; - } - *errorptr = ERR24; - goto PCRE_ERROR_RETURN; - - /* Conditionals are in Perl from version 5.005. The bracket must either - be followed by a number (for bracket reference) or by an assertion - group. */ - - case '(': - if ((compile_block.ctypes[ptr[3]] & ctype_digit) != 0) - { - ptr += 4; - length += 2; - while ((compile_block.ctypes[*ptr] & ctype_digit) != 0) ptr++; - if (*ptr != ')') - { - *errorptr = ERR26; - goto PCRE_ERROR_RETURN; - } - } - else /* An assertion must follow */ - { - ptr++; /* Can treat like ':' as far as spacing is concerned */ - if (ptr[2] != '?' || - (ptr[3] != '=' && ptr[3] != '!' && ptr[3] != '<') ) - { - ptr += 2; /* To get right offset in message */ - *errorptr = ERR28; - goto PCRE_ERROR_RETURN; - } - } - break; - - /* Else loop checking valid options until ) is met. Anything else is an - error. If we are without any brackets, i.e. at top level, the settings - act as if specified in the options, so massage the options immediately. - This is for backward compatibility with Perl 5.004. */ - - default: - set = unset = 0; - optset = &set; - ptr += 2; - - for (;; ptr++) - { - c = *ptr; - switch (c) - { - case 'i': - *optset |= PCRE_CASELESS; - continue; - - case 'm': - *optset |= PCRE_MULTILINE; - continue; - - case 's': - *optset |= PCRE_DOTALL; - continue; - - case 'x': - *optset |= PCRE_EXTENDED; - continue; - - case 'X': - *optset |= PCRE_EXTRA; - continue; - - case 'U': - *optset |= PCRE_UNGREEDY; - continue; - - case '-': - optset = &unset; - continue; - - /* A termination by ')' indicates an options-setting-only item; - this is global at top level; otherwise nothing is done here and - it is handled during the compiling process on a per-bracket-group - basis. */ - - case ')': - if (brastackptr == 0) - { - options = (options | set) & (~unset); - set = unset = 0; /* To save length */ - } - /* Fall through */ - - /* A termination by ':' indicates the start of a nested group with - the given options set. This is again handled at compile time, but - we must allow for compiled space if any of the ims options are - set. We also have to allow for resetting space at the end of - the group, which is why 4 is added to the length and not just 2. - If there are several changes of options within the same group, this - will lead to an over-estimate on the length, but this shouldn't - matter very much. We also have to allow for resetting options at - the start of any alternations, which we do by setting - branch_newextra to 2. Finally, we record whether the case-dependent - flag ever changes within the regex. This is used by the "required - character" code. */ - - case ':': - if (((set|unset) & PCRE_IMS) != 0) - { - length += 4; - branch_newextra = 2; - if (((set|unset) & PCRE_CASELESS) != 0) options |= PCRE_ICHANGED; - } - goto END_OPTIONS; - - /* Unrecognized option character */ - - default: - *errorptr = ERR12; - goto PCRE_ERROR_RETURN; - } - } - - /* If we hit a closing bracket, that's it - this is a freestanding - option-setting. We need to ensure that branch_extra is updated if - necessary. The only values branch_newextra can have here are 0 or 2. - If the value is 2, then branch_extra must either be 2 or 5, depending - on whether this is a lookbehind group or not. */ - - END_OPTIONS: - if (c == ')') - { - if (branch_newextra == 2 && (branch_extra == 0 || branch_extra == 3)) - branch_extra += branch_newextra; - continue; - } - - /* If options were terminated by ':' control comes here. Fall through - to handle the group below. */ - } - } - - /* Extracting brackets must be counted so we can process escapes in a - Perlish way. */ - - else bracount++; - - /* Non-special forms of bracket. Save length for computing whole length - at end if there's a repeat that requires duplication of the group. Also - save the current value of branch_extra, and start the new group with - the new value. If non-zero, this will either be 2 for a (?imsx: group, or 3 - for a lookbehind assertion. */ - - if (brastackptr >= sizeof(brastack)/sizeof(int)) - { - *errorptr = ERR19; - goto PCRE_ERROR_RETURN; - } - - bralenstack[brastackptr] = branch_extra; - branch_extra = branch_newextra; - - brastack[brastackptr++] = length; - length += 3; - continue; - - /* Handle ket. Look for subsequent max/min; for certain sets of values we - have to replicate this bracket up to that many times. If brastackptr is - 0 this is an unmatched bracket which will generate an error, but take care - not to try to access brastack[-1] when computing the length and restoring - the branch_extra value. */ - - case ')': - length += 3; - { - int minval = 1; - int maxval = 1; - int duplength; - - if (brastackptr > 0) - { - duplength = length - brastack[--brastackptr]; - branch_extra = bralenstack[brastackptr]; - } - else duplength = 0; - - /* Leave ptr at the final char; for read_repeat_counts this happens - automatically; for the others we need an increment. */ - - if ((c = ptr[1]) == '{' && is_counted_repeat(ptr+2, &compile_block)) - { - ptr = read_repeat_counts(ptr+2, &minval, &maxval, errorptr, - &compile_block); - if (*errorptr != NULL) goto PCRE_ERROR_RETURN; - } - else if (c == '*') { minval = 0; maxval = -1; ptr++; } - else if (c == '+') { maxval = -1; ptr++; } - else if (c == '?') { minval = 0; ptr++; } - - /* If the minimum is zero, we have to allow for an OP_BRAZERO before the - group, and if the maximum is greater than zero, we have to replicate - maxval-1 times; each replication acquires an OP_BRAZERO plus a nesting - bracket set - hence the 7. */ - - if (minval == 0) - { - length++; - if (maxval > 0) length += (maxval - 1) * (duplength + 7); - } - - /* When the minimum is greater than zero, 1 we have to replicate up to - minval-1 times, with no additions required in the copies. Then, if - there is a limited maximum we have to replicate up to maxval-1 times - allowing for a BRAZERO item before each optional copy and nesting - brackets for all but one of the optional copies. */ - - else - { - length += (minval - 1) * duplength; - if (maxval > minval) /* Need this test as maxval=-1 means no limit */ - length += (maxval - minval) * (duplength + 7) - 6; - } - } - continue; - - /* Non-special character. For a run of such characters the length required - is the number of characters + 2, except that the maximum run length is 255. - We won't get a skipped space or a non-data escape or the start of a # - comment as the first character, so the length can't be zero. */ - - NORMAL_CHAR: - default: - length += 2; - runlength = 0; - do - { - if ((options & PCRE_EXTENDED) != 0) - { - if ((compile_block.ctypes[c] & ctype_space) != 0) continue; - if (c == '#') - { - /* The space before the ; is to avoid a warning on a silly compiler - on the Macintosh. */ - while ((c = *(++ptr)) != 0 && c != '\n') ; - continue; - } - } - - /* Backslash may introduce a data char or a metacharacter; stop the - string before the latter. */ - - if (c == '\\') - { - const uschar *saveptr = ptr; - c = check_escape(&ptr, errorptr, bracount, options, FALSE, - &compile_block); - if (*errorptr != NULL) goto PCRE_ERROR_RETURN; - if (c < 0) { ptr = saveptr; break; } - } - - /* Ordinary character or single-char escape */ - - runlength++; - } - - /* This "while" is the end of the "do" above. */ - - while (runlength < 255 && - (compile_block.ctypes[c = *(++ptr)] & ctype_meta) == 0); - - ptr--; - length += runlength; - continue; - } - } - -length += 4; /* For final KET and END */ - -if (length > 65539) - { - *errorptr = ERR20; - return NULL; - } - -/* Compute the size of data block needed and get it, either from malloc or -externally provided function. We specify "code[0]" in the offsetof() expression -rather than just "code", because it has been reported that one broken compiler -fails on "code" because it is also an independent variable. It should make no -difference to the value of the offsetof(). */ - -size = length + offsetof(real_pcre, code[0]); -re = (real_pcre *)(pcre_malloc)(size); - -if (re == NULL) - { - *errorptr = ERR21; - return NULL; - } - -/* Put in the magic number, and save the size, options, and table pointer */ - -re->magic_number = MAGIC_NUMBER; -re->size = size; -re->options = options; -re->tables = tables; - -/* Set up a starting, non-extracting bracket, then compile the expression. On -error, *errorptr will be set non-NULL, so we don't need to look at the result -of the function here. */ - -ptr = (const uschar *)pattern; -code = re->code; -*code = OP_BRA; -bracount = 0; -(void)compile_regex(options, -1, &bracount, &code, &ptr, errorptr, FALSE, -1, - &reqchar, &countlits, &compile_block); -re->top_bracket = bracount; -re->top_backref = top_backref; - -/* If not reached end of pattern on success, there's an excess bracket. */ - -if (*errorptr == NULL && *ptr != 0) *errorptr = ERR22; - -/* Fill in the terminating state and check for disastrous overflow, but -if debugging, leave the test till after things are printed out. */ - -*code++ = OP_END; - -#ifndef DEBUG -if (code - re->code > length) *errorptr = ERR23; -#endif - -/* Give an error if there's back reference to a non-existent capturing -subpattern. */ - -if (top_backref > re->top_bracket) *errorptr = ERR15; - -/* Failed to compile */ - -if (*errorptr != NULL) - { - (pcre_free)(re); - PCRE_ERROR_RETURN: - *erroroffset = ptr - (const uschar *)pattern; - return NULL; - } - -/* If the anchored option was not passed, set flag if we can determine that the -pattern is anchored by virtue of ^ characters or \A or anything else (such as -starting with .* when DOTALL is set). - -Otherwise, see if we can determine what the first character has to be, because -that speeds up unanchored matches no end. If not, see if we can set the -PCRE_STARTLINE flag. This is helpful for multiline matches when all branches -start with ^. and also when all branches start with .* for non-DOTALL matches. -*/ - -if ((options & PCRE_ANCHORED) == 0) - { - int temp_options = options; - if (is_anchored(re->code, &temp_options)) - re->options |= PCRE_ANCHORED; - else - { - int ch = find_firstchar(re->code, &temp_options); - if (ch >= 0) - { - re->first_char = ch; - re->options |= PCRE_FIRSTSET; - } - else if (is_startline(re->code)) - re->options |= PCRE_STARTLINE; - } - } - -/* Save the last required character if there are at least two literal -characters on all paths, or if there is no first character setting. */ - -if (reqchar >= 0 && (countlits > 1 || (re->options & PCRE_FIRSTSET) == 0)) - { - re->req_char = reqchar; - re->options |= PCRE_REQCHSET; - } - -/* Print out the compiled data for debugging */ - -#ifdef DEBUG - -printf("Length = %d top_bracket = %d top_backref = %d\n", - length, re->top_bracket, re->top_backref); - -if (re->options != 0) - { - printf("%s%s%s%s%s%s%s%s%s\n", - ((re->options & PCRE_ANCHORED) != 0)? "anchored " : "", - ((re->options & PCRE_CASELESS) != 0)? "caseless " : "", - ((re->options & PCRE_ICHANGED) != 0)? "case state changed " : "", - ((re->options & PCRE_EXTENDED) != 0)? "extended " : "", - ((re->options & PCRE_MULTILINE) != 0)? "multiline " : "", - ((re->options & PCRE_DOTALL) != 0)? "dotall " : "", - ((re->options & PCRE_DOLLAR_ENDONLY) != 0)? "endonly " : "", - ((re->options & PCRE_EXTRA) != 0)? "extra " : "", - ((re->options & PCRE_UNGREEDY) != 0)? "ungreedy " : ""); - } - -if ((re->options & PCRE_FIRSTSET) != 0) - { - if (isprint(re->first_char)) printf("First char = %c\n", re->first_char); - else printf("First char = \\x%02x\n", re->first_char); - } - -if ((re->options & PCRE_REQCHSET) != 0) - { - if (isprint(re->req_char)) printf("Req char = %c\n", re->req_char); - else printf("Req char = \\x%02x\n", re->req_char); - } - -code_end = code; -code_base = code = re->code; - -while (code < code_end) - { - int charlength; - - printf("%3d ", code - code_base); - - if (*code >= OP_BRA) - { - printf("%3d Bra %d", (code[1] << 8) + code[2], *code - OP_BRA); - code += 2; - } - - else switch(*code) - { - case OP_OPT: - printf(" %.2x %s", code[1], OP_names[*code]); - code++; - break; - - case OP_COND: - printf("%3d Cond", (code[1] << 8) + code[2]); - code += 2; - break; - - case OP_CREF: - printf(" %.2d %s", code[1], OP_names[*code]); - code++; - break; - - case OP_CHARS: - charlength = *(++code); - printf("%3d ", charlength); - while (charlength-- > 0) - if (isprint(c = *(++code))) printf("%c", c); else printf("\\x%02x", c); - break; - - case OP_KETRMAX: - case OP_KETRMIN: - case OP_ALT: - case OP_KET: - case OP_ASSERT: - case OP_ASSERT_NOT: - case OP_ASSERTBACK: - case OP_ASSERTBACK_NOT: - case OP_ONCE: - printf("%3d %s", (code[1] << 8) + code[2], OP_names[*code]); - code += 2; - break; - - case OP_REVERSE: - printf("%3d %s", (code[1] << 8) + code[2], OP_names[*code]); - code += 2; - break; - - case OP_STAR: - case OP_MINSTAR: - case OP_PLUS: - case OP_MINPLUS: - case OP_QUERY: - case OP_MINQUERY: - case OP_TYPESTAR: - case OP_TYPEMINSTAR: - case OP_TYPEPLUS: - case OP_TYPEMINPLUS: - case OP_TYPEQUERY: - case OP_TYPEMINQUERY: - if (*code >= OP_TYPESTAR) - printf(" %s", OP_names[code[1]]); - else if (isprint(c = code[1])) printf(" %c", c); - else printf(" \\x%02x", c); - printf("%s", OP_names[*code++]); - break; - - case OP_EXACT: - case OP_UPTO: - case OP_MINUPTO: - if (isprint(c = code[3])) printf(" %c{", c); - else printf(" \\x%02x{", c); - if (*code != OP_EXACT) printf("0,"); - printf("%d}", (code[1] << 8) + code[2]); - if (*code == OP_MINUPTO) printf("?"); - code += 3; - break; - - case OP_TYPEEXACT: - case OP_TYPEUPTO: - case OP_TYPEMINUPTO: - printf(" %s{", OP_names[code[3]]); - if (*code != OP_TYPEEXACT) printf(","); - printf("%d}", (code[1] << 8) + code[2]); - if (*code == OP_TYPEMINUPTO) printf("?"); - code += 3; - break; - - case OP_NOT: - if (isprint(c = *(++code))) printf(" [^%c]", c); - else printf(" [^\\x%02x]", c); - break; - - case OP_NOTSTAR: - case OP_NOTMINSTAR: - case OP_NOTPLUS: - case OP_NOTMINPLUS: - case OP_NOTQUERY: - case OP_NOTMINQUERY: - if (isprint(c = code[1])) printf(" [^%c]", c); - else printf(" [^\\x%02x]", c); - printf("%s", OP_names[*code++]); - break; - - case OP_NOTEXACT: - case OP_NOTUPTO: - case OP_NOTMINUPTO: - if (isprint(c = code[3])) printf(" [^%c]{", c); - else printf(" [^\\x%02x]{", c); - if (*code != OP_NOTEXACT) printf(","); - printf("%d}", (code[1] << 8) + code[2]); - if (*code == OP_NOTMINUPTO) printf("?"); - code += 3; - break; - - case OP_REF: - printf(" \\%d", *(++code)); - code ++; - goto CLASS_REF_REPEAT; - - case OP_CLASS: - { - int i, min, max; - code++; - printf(" ["); - - for (i = 0; i < 256; i++) - { - if ((code[i/8] & (1 << (i&7))) != 0) - { - int j; - for (j = i+1; j < 256; j++) - if ((code[j/8] & (1 << (j&7))) == 0) break; - if (i == '-' || i == ']') printf("\\"); - if (isprint(i)) printf("%c", i); else printf("\\x%02x", i); - if (--j > i) - { - printf("-"); - if (j == '-' || j == ']') printf("\\"); - if (isprint(j)) printf("%c", j); else printf("\\x%02x", j); - } - i = j; - } - } - printf("]"); - code += 32; - - CLASS_REF_REPEAT: - - switch(*code) - { - case OP_CRSTAR: - case OP_CRMINSTAR: - case OP_CRPLUS: - case OP_CRMINPLUS: - case OP_CRQUERY: - case OP_CRMINQUERY: - printf("%s", OP_names[*code]); - break; - - case OP_CRRANGE: - case OP_CRMINRANGE: - min = (code[1] << 8) + code[2]; - max = (code[3] << 8) + code[4]; - if (max == 0) printf("{%d,}", min); - else printf("{%d,%d}", min, max); - if (*code == OP_CRMINRANGE) printf("?"); - code += 4; - break; - - default: - code--; - } - } - break; - - /* Anything else is just a one-node item */ - - default: - printf(" %s", OP_names[*code]); - break; - } - - code++; - printf("\n"); - } -printf("------------------------------------------------------------------\n"); - -/* This check is done here in the debugging case so that the code that -was compiled can be seen. */ - -if (code - re->code > length) - { - *errorptr = ERR23; - (pcre_free)(re); - *erroroffset = ptr - (uschar *)pattern; - return NULL; - } -#endif - -return (pcre *)re; -} - - - -/************************************************* -* Match a back-reference * -*************************************************/ - -/* If a back reference hasn't been set, the length that is passed is greater -than the number of characters left in the string, so the match fails. - -Arguments: - offset index into the offset vector - eptr points into the subject - length length to be matched - md points to match data block - ims the ims flags - -Returns: TRUE if matched -*/ - -static BOOL -match_ref(int offset, register const uschar *eptr, int length, match_data *md, - unsigned long int ims) -{ -const uschar *p = md->start_subject + md->offset_vector[offset]; - -#ifdef DEBUG -if (eptr >= md->end_subject) - printf("matching subject "); -else - { - printf("matching subject "); - pchars(eptr, length, TRUE, md); - } -printf(" against backref "); -pchars(p, length, FALSE, md); -printf("\n"); -#endif - -/* Always fail if not enough characters left */ - -if (length > md->end_subject - eptr) return FALSE; - -/* Separate the caselesss case for speed */ - -if ((ims & PCRE_CASELESS) != 0) - { - while (length-- > 0) - if (md->lcc[*p++] != md->lcc[*eptr++]) return FALSE; - } -else - { while (length-- > 0) if (*p++ != *eptr++) return FALSE; } - -return TRUE; -} - - - -/************************************************* -* Match from current position * -*************************************************/ - -/* On entry ecode points to the first opcode, and eptr to the first character -in the subject string, while eptrb holds the value of eptr at the start of the -last bracketed group - used for breaking infinite loops matching zero-length -strings. - -Arguments: - eptr pointer in subject - ecode position in code - offset_top current top pointer - md pointer to "static" info for the match - ims current /i, /m, and /s options - eptrb pointer to chain of blocks containing eptr at start of - brackets - for testing for empty matches - flags can contain - match_condassert - this is an assertion condition - match_isgroup - this is the start of a bracketed group - -Returns: TRUE if matched -*/ - -static BOOL -match(register const uschar *eptr, register const uschar *ecode, - int offset_top, match_data *md, unsigned long int ims, eptrblock *eptrb, - int flags) -{ -unsigned long int original_ims = ims; /* Save for resetting on ')' */ -eptrblock newptrb; - -/* At the start of a bracketed group, add the current subject pointer to the -stack of such pointers, to be re-instated at the end of the group when we hit -the closing ket. When match() is called in other circumstances, we don't add to -the stack. */ - -if ((flags & match_isgroup) != 0) - { - newptrb.prev = eptrb; - newptrb.saved_eptr = eptr; - eptrb = &newptrb; - } - -/* Now start processing the operations. */ - -for (;;) - { - int op = (int)*ecode; - int min, max, ctype; - register int i; - register int c; - BOOL minimize = FALSE; - - /* Opening capturing bracket. If there is space in the offset vector, save - the current subject position in the working slot at the top of the vector. We - mustn't change the current values of the data slot, because they may be set - from a previous iteration of this group, and be referred to by a reference - inside the group. - - If the bracket fails to match, we need to restore this value and also the - values of the final offsets, in case they were set by a previous iteration of - the same bracket. - - If there isn't enough space in the offset vector, treat this as if it were a - non-capturing bracket. Don't worry about setting the flag for the error case - here; that is handled in the code for KET. */ - - if (op > OP_BRA) - { - int number = op - OP_BRA; - int offset = number << 1; - -#ifdef DEBUG - printf("start bracket %d subject=", number); - pchars(eptr, 16, TRUE, md); - printf("\n"); -#endif - - if (offset < md->offset_max) - { - int save_offset1 = md->offset_vector[offset]; - int save_offset2 = md->offset_vector[offset+1]; - int save_offset3 = md->offset_vector[md->offset_end - number]; - - DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3)); - md->offset_vector[md->offset_end - number] = eptr - md->start_subject; - - do - { - if (match(eptr, ecode+3, offset_top, md, ims, eptrb, match_isgroup)) - return TRUE; - ecode += (ecode[1] << 8) + ecode[2]; - } - while (*ecode == OP_ALT); - - DPRINTF(("bracket %d failed\n", number)); - - md->offset_vector[offset] = save_offset1; - md->offset_vector[offset+1] = save_offset2; - md->offset_vector[md->offset_end - number] = save_offset3; - return FALSE; - } - - /* Insufficient room for saving captured contents */ - - else op = OP_BRA; - } - - /* Other types of node can be handled by a switch */ - - switch(op) - { - case OP_BRA: /* Non-capturing bracket: optimized */ - DPRINTF(("start bracket 0\n")); - do - { - if (match(eptr, ecode+3, offset_top, md, ims, eptrb, match_isgroup)) - return TRUE; - ecode += (ecode[1] << 8) + ecode[2]; - } - while (*ecode == OP_ALT); - DPRINTF(("bracket 0 failed\n")); - return FALSE; - - /* Conditional group: compilation checked that there are no more than - two branches. If the condition is false, skipping the first branch takes us - past the end if there is only one branch, but that's OK because that is - exactly what going to the ket would do. */ - - case OP_COND: - if (ecode[3] == OP_CREF) /* Condition is extraction test */ - { - int offset = ecode[4] << 1; /* Doubled reference number */ - return match(eptr, - ecode + ((offset < offset_top && md->offset_vector[offset] >= 0)? - 5 : 3 + (ecode[1] << 8) + ecode[2]), - offset_top, md, ims, eptrb, match_isgroup); - } - - /* The condition is an assertion. Call match() to evaluate it - setting - the final argument TRUE causes it to stop at the end of an assertion. */ - - else - { - if (match(eptr, ecode+3, offset_top, md, ims, NULL, - match_condassert | match_isgroup)) - { - ecode += 3 + (ecode[4] << 8) + ecode[5]; - while (*ecode == OP_ALT) ecode += (ecode[1] << 8) + ecode[2]; - } - else ecode += (ecode[1] << 8) + ecode[2]; - return match(eptr, ecode+3, offset_top, md, ims, eptrb, match_isgroup); - } - /* Control never reaches here */ - - /* Skip over conditional reference data if encountered (should not be) */ - - case OP_CREF: - ecode += 2; - break; - - /* End of the pattern. If PCRE_NOTEMPTY is set, fail if we have matched - an empty string - recursion will then try other alternatives, if any. */ - - case OP_END: - if (md->notempty && eptr == md->start_match) return FALSE; - md->end_match_ptr = eptr; /* Record where we ended */ - md->end_offset_top = offset_top; /* and how many extracts were taken */ - return TRUE; - - /* Change option settings */ - - case OP_OPT: - ims = ecode[1]; - ecode += 2; - DPRINTF(("ims set to %02lx\n", ims)); - break; - - /* Assertion brackets. Check the alternative branches in turn - the - matching won't pass the KET for an assertion. If any one branch matches, - the assertion is true. Lookbehind assertions have an OP_REVERSE item at the - start of each branch to move the current point backwards, so the code at - this level is identical to the lookahead case. */ - - case OP_ASSERT: - case OP_ASSERTBACK: - do - { - if (match(eptr, ecode+3, offset_top, md, ims, NULL, match_isgroup)) break; - ecode += (ecode[1] << 8) + ecode[2]; - } - while (*ecode == OP_ALT); - if (*ecode == OP_KET) return FALSE; - - /* If checking an assertion for a condition, return TRUE. */ - - if ((flags & match_condassert) != 0) return TRUE; - - /* Continue from after the assertion, updating the offsets high water - mark, since extracts may have been taken during the assertion. */ - - do ecode += (ecode[1] << 8) + ecode[2]; while (*ecode == OP_ALT); - ecode += 3; - offset_top = md->end_offset_top; - continue; - - /* Negative assertion: all branches must fail to match */ - - case OP_ASSERT_NOT: - case OP_ASSERTBACK_NOT: - do - { - if (match(eptr, ecode+3, offset_top, md, ims, NULL, match_isgroup)) - return FALSE; - ecode += (ecode[1] << 8) + ecode[2]; - } - while (*ecode == OP_ALT); - - if ((flags & match_condassert) != 0) return TRUE; - - ecode += 3; - continue; - - /* Move the subject pointer back. This occurs only at the start of - each branch of a lookbehind assertion. If we are too close to the start to - move back, this match function fails. */ - - case OP_REVERSE: - eptr -= (ecode[1] << 8) + ecode[2]; - if (eptr < md->start_subject) return FALSE; - ecode += 3; - break; - - /* Recursion matches the current regex, nested. If there are any capturing - brackets started but not finished, we have to save their starting points - and reinstate them after the recursion. However, we don't know how many - such there are (offset_top records the completed total) so we just have - to save all the potential data. There may be up to 99 such values, which - is a bit large to put on the stack, but using malloc for small numbers - seems expensive. As a compromise, the stack is used when there are fewer - than 16 values to store; otherwise malloc is used. A problem is what to do - if the malloc fails ... there is no way of returning to the top level with - an error. Save the top 15 values on the stack, and accept that the rest - may be wrong. */ - - case OP_RECURSE: - { - BOOL rc; - int *save; - int stacksave[15]; - - c = md->offset_max; - - if (c < 16) save = stacksave; else - { - save = (int *)(pcre_malloc)((c+1) * sizeof(int)); - if (save == NULL) - { - save = stacksave; - c = 15; - } - } - - for (i = 1; i <= c; i++) - save[i] = md->offset_vector[md->offset_end - i]; - rc = match(eptr, md->start_pattern, offset_top, md, ims, eptrb, - match_isgroup); - for (i = 1; i <= c; i++) - md->offset_vector[md->offset_end - i] = save[i]; - if (save != stacksave) (pcre_free)(save); - if (!rc) return FALSE; - - /* In case the recursion has set more capturing values, save the final - number, then move along the subject till after the recursive match, - and advance one byte in the pattern code. */ - - offset_top = md->end_offset_top; - eptr = md->end_match_ptr; - ecode++; - } - break; - - /* "Once" brackets are like assertion brackets except that after a match, - the point in the subject string is not moved back. Thus there can never be - a move back into the brackets. Check the alternative branches in turn - the - matching won't pass the KET for this kind of subpattern. If any one branch - matches, we carry on as at the end of a normal bracket, leaving the subject - pointer. */ - - case OP_ONCE: - { - const uschar *prev = ecode; - const uschar *saved_eptr = eptr; - - do - { - if (match(eptr, ecode+3, offset_top, md, ims, eptrb, match_isgroup)) - break; - ecode += (ecode[1] << 8) + ecode[2]; - } - while (*ecode == OP_ALT); - - /* If hit the end of the group (which could be repeated), fail */ - - if (*ecode != OP_ONCE && *ecode != OP_ALT) return FALSE; - - /* Continue as from after the assertion, updating the offsets high water - mark, since extracts may have been taken. */ - - do ecode += (ecode[1] << 8) + ecode[2]; while (*ecode == OP_ALT); - - offset_top = md->end_offset_top; - eptr = md->end_match_ptr; - - /* For a non-repeating ket, just continue at this level. This also - happens for a repeating ket if no characters were matched in the group. - This is the forcible breaking of infinite loops as implemented in Perl - 5.005. If there is an options reset, it will get obeyed in the normal - course of events. */ - - if (*ecode == OP_KET || eptr == saved_eptr) - { - ecode += 3; - break; - } - - /* The repeating kets try the rest of the pattern or restart from the - preceding bracket, in the appropriate order. We need to reset any options - that changed within the bracket before re-running it, so check the next - opcode. */ - - if (ecode[3] == OP_OPT) - { - ims = (ims & ~PCRE_IMS) | ecode[4]; - DPRINTF(("ims set to %02lx at group repeat\n", ims)); - } - - if (*ecode == OP_KETRMIN) - { - if (match(eptr, ecode+3, offset_top, md, ims, eptrb, 0) || - match(eptr, prev, offset_top, md, ims, eptrb, match_isgroup)) - return TRUE; - } - else /* OP_KETRMAX */ - { - if (match(eptr, prev, offset_top, md, ims, eptrb, match_isgroup) || - match(eptr, ecode+3, offset_top, md, ims, eptrb, 0)) return TRUE; - } - } - return FALSE; - - /* An alternation is the end of a branch; scan along to find the end of the - bracketed group and go to there. */ - - case OP_ALT: - do ecode += (ecode[1] << 8) + ecode[2]; while (*ecode == OP_ALT); - break; - - /* BRAZERO and BRAMINZERO occur just before a bracket group, indicating - that it may occur zero times. It may repeat infinitely, or not at all - - i.e. it could be ()* or ()? in the pattern. Brackets with fixed upper - repeat limits are compiled as a number of copies, with the optional ones - preceded by BRAZERO or BRAMINZERO. */ - - case OP_BRAZERO: - { - const uschar *next = ecode+1; - if (match(eptr, next, offset_top, md, ims, eptrb, match_isgroup)) - return TRUE; - do next += (next[1] << 8) + next[2]; while (*next == OP_ALT); - ecode = next + 3; - } - break; - - case OP_BRAMINZERO: - { - const uschar *next = ecode+1; - do next += (next[1] << 8) + next[2]; while (*next == OP_ALT); - if (match(eptr, next+3, offset_top, md, ims, eptrb, match_isgroup)) - return TRUE; - ecode++; - } - break; - - /* End of a group, repeated or non-repeating. If we are at the end of - an assertion "group", stop matching and return TRUE, but record the - current high water mark for use by positive assertions. Do this also - for the "once" (not-backup up) groups. */ - - case OP_KET: - case OP_KETRMIN: - case OP_KETRMAX: - { - const uschar *prev = ecode - (ecode[1] << 8) - ecode[2]; - const uschar *saved_eptr = eptrb->saved_eptr; - - eptrb = eptrb->prev; /* Back up the stack of bracket start pointers */ - - if (*prev == OP_ASSERT || *prev == OP_ASSERT_NOT || - *prev == OP_ASSERTBACK || *prev == OP_ASSERTBACK_NOT || - *prev == OP_ONCE) - { - md->end_match_ptr = eptr; /* For ONCE */ - md->end_offset_top = offset_top; - return TRUE; - } - - /* In all other cases except a conditional group we have to check the - group number back at the start and if necessary complete handling an - extraction by setting the offsets and bumping the high water mark. */ - - if (*prev != OP_COND) - { - int number = *prev - OP_BRA; - int offset = number << 1; - -#ifdef DEBUG - printf("end bracket %d", number); - printf("\n"); -#endif - - if (number > 0) - { - if (offset >= md->offset_max) md->offset_overflow = TRUE; else - { - md->offset_vector[offset] = - md->offset_vector[md->offset_end - number]; - md->offset_vector[offset+1] = eptr - md->start_subject; - if (offset_top <= offset) offset_top = offset + 2; - } - } - } - - /* Reset the value of the ims flags, in case they got changed during - the group. */ - - ims = original_ims; - DPRINTF(("ims reset to %02lx\n", ims)); - - /* For a non-repeating ket, just continue at this level. This also - happens for a repeating ket if no characters were matched in the group. - This is the forcible breaking of infinite loops as implemented in Perl - 5.005. If there is an options reset, it will get obeyed in the normal - course of events. */ - - if (*ecode == OP_KET || eptr == saved_eptr) - { - ecode += 3; - break; - } - - /* The repeating kets try the rest of the pattern or restart from the - preceding bracket, in the appropriate order. */ - - if (*ecode == OP_KETRMIN) - { - if (match(eptr, ecode+3, offset_top, md, ims, eptrb, 0) || - match(eptr, prev, offset_top, md, ims, eptrb, match_isgroup)) - return TRUE; - } - else /* OP_KETRMAX */ - { - if (match(eptr, prev, offset_top, md, ims, eptrb, match_isgroup) || - match(eptr, ecode+3, offset_top, md, ims, eptrb, 0)) return TRUE; - } - } - return FALSE; - - /* Start of subject unless notbol, or after internal newline if multiline */ - - case OP_CIRC: - if (md->notbol && eptr == md->start_subject) return FALSE; - if ((ims & PCRE_MULTILINE) != 0) - { - if (eptr != md->start_subject && eptr[-1] != '\n') return FALSE; - ecode++; - break; - } - /* ... else fall through */ - - /* Start of subject assertion */ - - case OP_SOD: - if (eptr != md->start_subject) return FALSE; - ecode++; - break; - - /* Assert before internal newline if multiline, or before a terminating - newline unless endonly is set, else end of subject unless noteol is set. */ - - case OP_DOLL: - if ((ims & PCRE_MULTILINE) != 0) - { - if (eptr < md->end_subject) { if (*eptr != '\n') return FALSE; } - else { if (md->noteol) return FALSE; } - ecode++; - break; - } - else - { - if (md->noteol) return FALSE; - if (!md->endonly) - { - if (eptr < md->end_subject - 1 || - (eptr == md->end_subject - 1 && *eptr != '\n')) return FALSE; - - ecode++; - break; - } - } - /* ... else fall through */ - - /* End of subject assertion (\z) */ - - case OP_EOD: - if (eptr < md->end_subject) return FALSE; - ecode++; - break; - - /* End of subject or ending \n assertion (\Z) */ - - case OP_EODN: - if (eptr < md->end_subject - 1 || - (eptr == md->end_subject - 1 && *eptr != '\n')) return FALSE; - ecode++; - break; - - /* Word boundary assertions */ - - case OP_NOT_WORD_BOUNDARY: - case OP_WORD_BOUNDARY: - { - BOOL prev_is_word = (eptr != md->start_subject) && - ((md->ctypes[eptr[-1]] & ctype_word) != 0); - BOOL cur_is_word = (eptr < md->end_subject) && - ((md->ctypes[*eptr] & ctype_word) != 0); - if ((*ecode++ == OP_WORD_BOUNDARY)? - cur_is_word == prev_is_word : cur_is_word != prev_is_word) - return FALSE; - } - break; - - /* Match a single character type; inline for speed */ - - case OP_ANY: - if ((ims & PCRE_DOTALL) == 0 && eptr < md->end_subject && *eptr == '\n') - return FALSE; - if (eptr++ >= md->end_subject) return FALSE; - ecode++; - break; - - case OP_NOT_DIGIT: - if (eptr >= md->end_subject || - (md->ctypes[*eptr++] & ctype_digit) != 0) - return FALSE; - ecode++; - break; - - case OP_DIGIT: - if (eptr >= md->end_subject || - (md->ctypes[*eptr++] & ctype_digit) == 0) - return FALSE; - ecode++; - break; - - case OP_NOT_WHITESPACE: - if (eptr >= md->end_subject || - (md->ctypes[*eptr++] & ctype_space) != 0) - return FALSE; - ecode++; - break; - - case OP_WHITESPACE: - if (eptr >= md->end_subject || - (md->ctypes[*eptr++] & ctype_space) == 0) - return FALSE; - ecode++; - break; - - case OP_NOT_WORDCHAR: - if (eptr >= md->end_subject || - (md->ctypes[*eptr++] & ctype_word) != 0) - return FALSE; - ecode++; - break; - - case OP_WORDCHAR: - if (eptr >= md->end_subject || - (md->ctypes[*eptr++] & ctype_word) == 0) - return FALSE; - ecode++; - break; - - /* Match a back reference, possibly repeatedly. Look past the end of the - item to see if there is repeat information following. The code is similar - to that for character classes, but repeated for efficiency. Then obey - similar code to character type repeats - written out again for speed. - However, if the referenced string is the empty string, always treat - it as matched, any number of times (otherwise there could be infinite - loops). */ - - case OP_REF: - { - int length; - int offset = ecode[1] << 1; /* Doubled reference number */ - ecode += 2; /* Advance past the item */ - - /* If the reference is unset, set the length to be longer than the amount - of subject left; this ensures that every attempt at a match fails. We - can't just fail here, because of the possibility of quantifiers with zero - minima. */ - - length = (offset >= offset_top || md->offset_vector[offset] < 0)? - md->end_subject - eptr + 1 : - md->offset_vector[offset+1] - md->offset_vector[offset]; - - /* Set up for repetition, or handle the non-repeated case */ - - switch (*ecode) - { - case OP_CRSTAR: - case OP_CRMINSTAR: - case OP_CRPLUS: - case OP_CRMINPLUS: - case OP_CRQUERY: - case OP_CRMINQUERY: - c = *ecode++ - OP_CRSTAR; - minimize = (c & 1) != 0; - min = rep_min[c]; /* Pick up values from tables; */ - max = rep_max[c]; /* zero for max => infinity */ - if (max == 0) max = INT_MAX; - break; - - case OP_CRRANGE: - case OP_CRMINRANGE: - minimize = (*ecode == OP_CRMINRANGE); - min = (ecode[1] << 8) + ecode[2]; - max = (ecode[3] << 8) + ecode[4]; - if (max == 0) max = INT_MAX; - ecode += 5; - break; - - default: /* No repeat follows */ - if (!match_ref(offset, eptr, length, md, ims)) return FALSE; - eptr += length; - continue; /* With the main loop */ - } - - /* If the length of the reference is zero, just continue with the - main loop. */ - - if (length == 0) continue; - - /* First, ensure the minimum number of matches are present. We get back - the length of the reference string explicitly rather than passing the - address of eptr, so that eptr can be a register variable. */ - - for (i = 1; i <= min; i++) - { - if (!match_ref(offset, eptr, length, md, ims)) return FALSE; - eptr += length; - } - - /* If min = max, continue at the same level without recursion. - They are not both allowed to be zero. */ - - if (min == max) continue; - - /* If minimizing, keep trying and advancing the pointer */ - - if (minimize) - { - for (i = min;; i++) - { - if (match(eptr, ecode, offset_top, md, ims, eptrb, 0)) - return TRUE; - if (i >= max || !match_ref(offset, eptr, length, md, ims)) - return FALSE; - eptr += length; - } - /* Control never gets here */ - } - - /* If maximizing, find the longest string and work backwards */ - - else - { - const uschar *pp = eptr; - for (i = min; i < max; i++) - { - if (!match_ref(offset, eptr, length, md, ims)) break; - eptr += length; - } - while (eptr >= pp) - { - if (match(eptr, ecode, offset_top, md, ims, eptrb, 0)) - return TRUE; - eptr -= length; - } - return FALSE; - } - } - /* Control never gets here */ - - - - /* Match a character class, possibly repeatedly. Look past the end of the - item to see if there is repeat information following. Then obey similar - code to character type repeats - written out again for speed. */ - - case OP_CLASS: - { - const uschar *data = ecode + 1; /* Save for matching */ - ecode += 33; /* Advance past the item */ - - switch (*ecode) - { - case OP_CRSTAR: - case OP_CRMINSTAR: - case OP_CRPLUS: - case OP_CRMINPLUS: - case OP_CRQUERY: - case OP_CRMINQUERY: - c = *ecode++ - OP_CRSTAR; - minimize = (c & 1) != 0; - min = rep_min[c]; /* Pick up values from tables; */ - max = rep_max[c]; /* zero for max => infinity */ - if (max == 0) max = INT_MAX; - break; - - case OP_CRRANGE: - case OP_CRMINRANGE: - minimize = (*ecode == OP_CRMINRANGE); - min = (ecode[1] << 8) + ecode[2]; - max = (ecode[3] << 8) + ecode[4]; - if (max == 0) max = INT_MAX; - ecode += 5; - break; - - default: /* No repeat follows */ - min = max = 1; - break; - } - - /* First, ensure the minimum number of matches are present. */ - - for (i = 1; i <= min; i++) - { - if (eptr >= md->end_subject) return FALSE; - c = *eptr++; - if ((data[c/8] & (1 << (c&7))) != 0) continue; - return FALSE; - } - - /* If max == min we can continue with the main loop without the - need to recurse. */ - - if (min == max) continue; - - /* If minimizing, keep testing the rest of the expression and advancing - the pointer while it matches the class. */ - - if (minimize) - { - for (i = min;; i++) - { - if (match(eptr, ecode, offset_top, md, ims, eptrb, 0)) - return TRUE; - if (i >= max || eptr >= md->end_subject) return FALSE; - c = *eptr++; - if ((data[c/8] & (1 << (c&7))) != 0) continue; - return FALSE; - } - /* Control never gets here */ - } - - /* If maximizing, find the longest possible run, then work backwards. */ - - else - { - const uschar *pp = eptr; - for (i = min; i < max; eptr++, i++) - { - if (eptr >= md->end_subject) break; - c = *eptr; - if ((data[c/8] & (1 << (c&7))) != 0) continue; - break; - } - - while (eptr >= pp) - if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0)) - return TRUE; - return FALSE; - } - } - /* Control never gets here */ - - /* Match a run of characters */ - - case OP_CHARS: - { - register int length = ecode[1]; - ecode += 2; - -#ifdef DEBUG /* Sigh. Some compilers never learn. */ - if (eptr >= md->end_subject) - printf("matching subject against pattern "); - else - { - printf("matching subject "); - pchars(eptr, length, TRUE, md); - printf(" against pattern "); - } - pchars(ecode, length, FALSE, md); - printf("\n"); -#endif - - if (length > md->end_subject - eptr) return FALSE; - if ((ims & PCRE_CASELESS) != 0) - { - while (length-- > 0) - if (md->lcc[*ecode++] != md->lcc[*eptr++]) - return FALSE; - } - else - { - while (length-- > 0) if (*ecode++ != *eptr++) return FALSE; - } - } - break; - - /* Match a single character repeatedly; different opcodes share code. */ - - case OP_EXACT: - min = max = (ecode[1] << 8) + ecode[2]; - ecode += 3; - goto REPEATCHAR; - - case OP_UPTO: - case OP_MINUPTO: - min = 0; - max = (ecode[1] << 8) + ecode[2]; - minimize = *ecode == OP_MINUPTO; - ecode += 3; - goto REPEATCHAR; - - case OP_STAR: - case OP_MINSTAR: - case OP_PLUS: - case OP_MINPLUS: - case OP_QUERY: - case OP_MINQUERY: - c = *ecode++ - OP_STAR; - minimize = (c & 1) != 0; - min = rep_min[c]; /* Pick up values from tables; */ - max = rep_max[c]; /* zero for max => infinity */ - if (max == 0) max = INT_MAX; - - /* Common code for all repeated single-character matches. We can give - up quickly if there are fewer than the minimum number of characters left in - the subject. */ - - REPEATCHAR: - if (min > md->end_subject - eptr) return FALSE; - c = *ecode++; - - /* The code is duplicated for the caseless and caseful cases, for speed, - since matching characters is likely to be quite common. First, ensure the - minimum number of matches are present. If min = max, continue at the same - level without recursing. Otherwise, if minimizing, keep trying the rest of - the expression and advancing one matching character if failing, up to the - maximum. Alternatively, if maximizing, find the maximum number of - characters and work backwards. */ - - DPRINTF(("matching %c{%d,%d} against subject %.*s\n", c, min, max, - max, eptr)); - - if ((ims & PCRE_CASELESS) != 0) - { - c = md->lcc[c]; - for (i = 1; i <= min; i++) - if (c != md->lcc[*eptr++]) return FALSE; - if (min == max) continue; - if (minimize) - { - for (i = min;; i++) - { - if (match(eptr, ecode, offset_top, md, ims, eptrb, 0)) - return TRUE; - if (i >= max || eptr >= md->end_subject || - c != md->lcc[*eptr++]) - return FALSE; - } - /* Control never gets here */ - } - else - { - const uschar *pp = eptr; - for (i = min; i < max; i++) - { - if (eptr >= md->end_subject || c != md->lcc[*eptr]) break; - eptr++; - } - while (eptr >= pp) - if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0)) - return TRUE; - return FALSE; - } - /* Control never gets here */ - } - - /* Caseful comparisons */ - - else - { - for (i = 1; i <= min; i++) if (c != *eptr++) return FALSE; - if (min == max) continue; - if (minimize) - { - for (i = min;; i++) - { - if (match(eptr, ecode, offset_top, md, ims, eptrb, 0)) - return TRUE; - if (i >= max || eptr >= md->end_subject || c != *eptr++) return FALSE; - } - /* Control never gets here */ - } - else - { - const uschar *pp = eptr; - for (i = min; i < max; i++) - { - if (eptr >= md->end_subject || c != *eptr) break; - eptr++; - } - while (eptr >= pp) - if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0)) - return TRUE; - return FALSE; - } - } - /* Control never gets here */ - - /* Match a negated single character */ - - case OP_NOT: - if (eptr >= md->end_subject) return FALSE; - ecode++; - if ((ims & PCRE_CASELESS) != 0) - { - if (md->lcc[*ecode++] == md->lcc[*eptr++]) return FALSE; - } - else - { - if (*ecode++ == *eptr++) return FALSE; - } - break; - - /* Match a negated single character repeatedly. This is almost a repeat of - the code for a repeated single character, but I haven't found a nice way of - commoning these up that doesn't require a test of the positive/negative - option for each character match. Maybe that wouldn't add very much to the - time taken, but character matching *is* what this is all about... */ - - case OP_NOTEXACT: - min = max = (ecode[1] << 8) + ecode[2]; - ecode += 3; - goto REPEATNOTCHAR; - - case OP_NOTUPTO: - case OP_NOTMINUPTO: - min = 0; - max = (ecode[1] << 8) + ecode[2]; - minimize = *ecode == OP_NOTMINUPTO; - ecode += 3; - goto REPEATNOTCHAR; - - case OP_NOTSTAR: - case OP_NOTMINSTAR: - case OP_NOTPLUS: - case OP_NOTMINPLUS: - case OP_NOTQUERY: - case OP_NOTMINQUERY: - c = *ecode++ - OP_NOTSTAR; - minimize = (c & 1) != 0; - min = rep_min[c]; /* Pick up values from tables; */ - max = rep_max[c]; /* zero for max => infinity */ - if (max == 0) max = INT_MAX; - - /* Common code for all repeated single-character matches. We can give - up quickly if there are fewer than the minimum number of characters left in - the subject. */ - - REPEATNOTCHAR: - if (min > md->end_subject - eptr) return FALSE; - c = *ecode++; - - /* The code is duplicated for the caseless and caseful cases, for speed, - since matching characters is likely to be quite common. First, ensure the - minimum number of matches are present. If min = max, continue at the same - level without recursing. Otherwise, if minimizing, keep trying the rest of - the expression and advancing one matching character if failing, up to the - maximum. Alternatively, if maximizing, find the maximum number of - characters and work backwards. */ - - DPRINTF(("negative matching %c{%d,%d} against subject %.*s\n", c, min, max, - max, eptr)); - - if ((ims & PCRE_CASELESS) != 0) - { - c = md->lcc[c]; - for (i = 1; i <= min; i++) - if (c == md->lcc[*eptr++]) return FALSE; - if (min == max) continue; - if (minimize) - { - for (i = min;; i++) - { - if (match(eptr, ecode, offset_top, md, ims, eptrb, 0)) - return TRUE; - if (i >= max || eptr >= md->end_subject || - c == md->lcc[*eptr++]) - return FALSE; - } - /* Control never gets here */ - } - else - { - const uschar *pp = eptr; - for (i = min; i < max; i++) - { - if (eptr >= md->end_subject || c == md->lcc[*eptr]) break; - eptr++; - } - while (eptr >= pp) - if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0)) - return TRUE; - return FALSE; - } - /* Control never gets here */ - } - - /* Caseful comparisons */ - - else - { - for (i = 1; i <= min; i++) if (c == *eptr++) return FALSE; - if (min == max) continue; - if (minimize) - { - for (i = min;; i++) - { - if (match(eptr, ecode, offset_top, md, ims, eptrb, 0)) - return TRUE; - if (i >= max || eptr >= md->end_subject || c == *eptr++) return FALSE; - } - /* Control never gets here */ - } - else - { - const uschar *pp = eptr; - for (i = min; i < max; i++) - { - if (eptr >= md->end_subject || c == *eptr) break; - eptr++; - } - while (eptr >= pp) - if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0)) - return TRUE; - return FALSE; - } - } - /* Control never gets here */ - - /* Match a single character type repeatedly; several different opcodes - share code. This is very similar to the code for single characters, but we - repeat it in the interests of efficiency. */ - - case OP_TYPEEXACT: - min = max = (ecode[1] << 8) + ecode[2]; - minimize = TRUE; - ecode += 3; - goto REPEATTYPE; - - case OP_TYPEUPTO: - case OP_TYPEMINUPTO: - min = 0; - max = (ecode[1] << 8) + ecode[2]; - minimize = *ecode == OP_TYPEMINUPTO; - ecode += 3; - goto REPEATTYPE; - - case OP_TYPESTAR: - case OP_TYPEMINSTAR: - case OP_TYPEPLUS: - case OP_TYPEMINPLUS: - case OP_TYPEQUERY: - case OP_TYPEMINQUERY: - c = *ecode++ - OP_TYPESTAR; - minimize = (c & 1) != 0; - min = rep_min[c]; /* Pick up values from tables; */ - max = rep_max[c]; /* zero for max => infinity */ - if (max == 0) max = INT_MAX; - - /* Common code for all repeated single character type matches */ - - REPEATTYPE: - ctype = *ecode++; /* Code for the character type */ - - /* First, ensure the minimum number of matches are present. Use inline - code for maximizing the speed, and do the type test once at the start - (i.e. keep it out of the loop). Also test that there are at least the - minimum number of characters before we start. */ - - if (min > md->end_subject - eptr) return FALSE; - if (min > 0) switch(ctype) - { - case OP_ANY: - if ((ims & PCRE_DOTALL) == 0) - { for (i = 1; i <= min; i++) if (*eptr++ == '\n') return FALSE; } - else eptr += min; - break; - - case OP_NOT_DIGIT: - for (i = 1; i <= min; i++) - if ((md->ctypes[*eptr++] & ctype_digit) != 0) return FALSE; - break; - - case OP_DIGIT: - for (i = 1; i <= min; i++) - if ((md->ctypes[*eptr++] & ctype_digit) == 0) return FALSE; - break; - - case OP_NOT_WHITESPACE: - for (i = 1; i <= min; i++) - if ((md->ctypes[*eptr++] & ctype_space) != 0) return FALSE; - break; - - case OP_WHITESPACE: - for (i = 1; i <= min; i++) - if ((md->ctypes[*eptr++] & ctype_space) == 0) return FALSE; - break; - - case OP_NOT_WORDCHAR: - for (i = 1; i <= min; i++) - if ((md->ctypes[*eptr++] & ctype_word) != 0) - return FALSE; - break; - - case OP_WORDCHAR: - for (i = 1; i <= min; i++) - if ((md->ctypes[*eptr++] & ctype_word) == 0) - return FALSE; - break; - } - - /* If min = max, continue at the same level without recursing */ - - if (min == max) continue; - - /* If minimizing, we have to test the rest of the pattern before each - subsequent match. */ - - if (minimize) - { - for (i = min;; i++) - { - if (match(eptr, ecode, offset_top, md, ims, eptrb, 0)) return TRUE; - if (i >= max || eptr >= md->end_subject) return FALSE; - - c = *eptr++; - switch(ctype) - { - case OP_ANY: - if ((ims & PCRE_DOTALL) == 0 && c == '\n') return FALSE; - break; - - case OP_NOT_DIGIT: - if ((md->ctypes[c] & ctype_digit) != 0) return FALSE; - break; - - case OP_DIGIT: - if ((md->ctypes[c] & ctype_digit) == 0) return FALSE; - break; - - case OP_NOT_WHITESPACE: - if ((md->ctypes[c] & ctype_space) != 0) return FALSE; - break; - - case OP_WHITESPACE: - if ((md->ctypes[c] & ctype_space) == 0) return FALSE; - break; - - case OP_NOT_WORDCHAR: - if ((md->ctypes[c] & ctype_word) != 0) return FALSE; - break; - - case OP_WORDCHAR: - if ((md->ctypes[c] & ctype_word) == 0) return FALSE; - break; - } - } - /* Control never gets here */ - } - - /* If maximizing it is worth using inline code for speed, doing the type - test once at the start (i.e. keep it out of the loop). */ - - else - { - const uschar *pp = eptr; - switch(ctype) - { - case OP_ANY: - if ((ims & PCRE_DOTALL) == 0) - { - for (i = min; i < max; i++) - { - if (eptr >= md->end_subject || *eptr == '\n') break; - eptr++; - } - } - else - { - c = max - min; - if (c > md->end_subject - eptr) c = md->end_subject - eptr; - eptr += c; - } - break; - - case OP_NOT_DIGIT: - for (i = min; i < max; i++) - { - if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_digit) != 0) - break; - eptr++; - } - break; - - case OP_DIGIT: - for (i = min; i < max; i++) - { - if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_digit) == 0) - break; - eptr++; - } - break; - - case OP_NOT_WHITESPACE: - for (i = min; i < max; i++) - { - if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_space) != 0) - break; - eptr++; - } - break; - - case OP_WHITESPACE: - for (i = min; i < max; i++) - { - if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_space) == 0) - break; - eptr++; - } - break; - - case OP_NOT_WORDCHAR: - for (i = min; i < max; i++) - { - if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_word) != 0) - break; - eptr++; - } - break; - - case OP_WORDCHAR: - for (i = min; i < max; i++) - { - if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_word) == 0) - break; - eptr++; - } - break; - } - - while (eptr >= pp) - if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0)) - return TRUE; - return FALSE; - } - /* Control never gets here */ - - /* There's been some horrible disaster. */ - - default: - DPRINTF(("Unknown opcode %d\n", *ecode)); - md->errorcode = PCRE_ERROR_UNKNOWN_NODE; - return FALSE; - } - - /* Do not stick any code in here without much thought; it is assumed - that "continue" in the code above comes out to here to repeat the main - loop. */ - - } /* End of main loop */ -/* Control never reaches here */ -} - - - - -/************************************************* -* Execute a Regular Expression * -*************************************************/ - -/* This function applies a compiled re to a subject string and picks out -portions of the string if it matches. Two elements in the vector are set for -each substring: the offsets to the start and end of the substring. - -Arguments: - external_re points to the compiled expression - external_extra points to "hints" from pcre_study() or is NULL - subject points to the subject string - length length of subject string (may contain binary zeros) - start_offset where to start in the subject string - options option bits - offsets points to a vector of ints to be filled in with offsets - offsetcount the number of elements in the vector - -Returns: > 0 => success; value is the number of elements filled in - = 0 => success, but offsets is not big enough - -1 => failed to match - < -1 => some kind of unexpected problem -*/ - -int -pcre_exec(const pcre *external_re, const pcre_extra *external_extra, - const char *subject, int length, int start_offset, int options, int *offsets, - int offsetcount) -{ -int resetcount, ocount; -int first_char = -1; -int req_char = -1; -int req_char2 = -1; -unsigned long int ims = 0; -match_data match_block; -const uschar *start_bits = NULL; -const uschar *start_match = (const uschar *)subject + start_offset; -const uschar *end_subject; -const uschar *req_char_ptr = start_match - 1; -const real_pcre *re = (const real_pcre *)external_re; -const real_pcre_extra *extra = (const real_pcre_extra *)external_extra; -BOOL using_temporary_offsets = FALSE; -BOOL anchored = ((re->options | options) & PCRE_ANCHORED) != 0; -BOOL startline = (re->options & PCRE_STARTLINE) != 0; - -if ((options & ~PUBLIC_EXEC_OPTIONS) != 0) return PCRE_ERROR_BADOPTION; - -if (re == NULL || subject == NULL || - (offsets == NULL && offsetcount > 0)) return PCRE_ERROR_NULL; -if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC; - -match_block.start_pattern = re->code; -match_block.start_subject = (const uschar *)subject; -match_block.end_subject = match_block.start_subject + length; -end_subject = match_block.end_subject; - -match_block.endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0; - -match_block.notbol = (options & PCRE_NOTBOL) != 0; -match_block.noteol = (options & PCRE_NOTEOL) != 0; -match_block.notempty = (options & PCRE_NOTEMPTY) != 0; - -match_block.errorcode = PCRE_ERROR_NOMATCH; /* Default error */ - -match_block.lcc = re->tables + lcc_offset; -match_block.ctypes = re->tables + ctypes_offset; - -/* The ims options can vary during the matching as a result of the presence -of (?ims) items in the pattern. They are kept in a local variable so that -restoring at the exit of a group is easy. */ - -ims = re->options & (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL); - -/* If the expression has got more back references than the offsets supplied can -hold, we get a temporary bit of working store to use during the matching. -Otherwise, we can use the vector supplied, rounding down its size to a multiple -of 3. */ - -ocount = offsetcount - (offsetcount % 3); - -if (re->top_backref > 0 && re->top_backref >= ocount/3) - { - ocount = re->top_backref * 3 + 3; - match_block.offset_vector = (int *)(pcre_malloc)(ocount * sizeof(int)); - if (match_block.offset_vector == NULL) return PCRE_ERROR_NOMEMORY; - using_temporary_offsets = TRUE; - DPRINTF(("Got memory to hold back references\n")); - } -else match_block.offset_vector = offsets; - -match_block.offset_end = ocount; -match_block.offset_max = (2*ocount)/3; -match_block.offset_overflow = FALSE; - -/* Compute the minimum number of offsets that we need to reset each time. Doing -this makes a huge difference to execution time when there aren't many brackets -in the pattern. */ - -resetcount = 2 + re->top_bracket * 2; -if (resetcount > offsetcount) resetcount = ocount; - -/* Reset the working variable associated with each extraction. These should -never be used unless previously set, but they get saved and restored, and so we -initialize them to avoid reading uninitialized locations. */ - -if (match_block.offset_vector != NULL) - { - register int *iptr = match_block.offset_vector + ocount; - register int *iend = iptr - resetcount/2 + 1; - while (--iptr >= iend) *iptr = -1; - } - -/* Set up the first character to match, if available. The first_char value is -never set for an anchored regular expression, but the anchoring may be forced -at run time, so we have to test for anchoring. The first char may be unset for -an unanchored pattern, of course. If there's no first char and the pattern was -studied, there may be a bitmap of possible first characters. */ - -if (!anchored) - { - if ((re->options & PCRE_FIRSTSET) != 0) - { - first_char = re->first_char; - if ((ims & PCRE_CASELESS) != 0) first_char = match_block.lcc[first_char]; - } - else - if (!startline && extra != NULL && - (extra->options & PCRE_STUDY_MAPPED) != 0) - start_bits = extra->start_bits; - } - -/* For anchored or unanchored matches, there may be a "last known required -character" set. If the PCRE_CASELESS is set, implying that the match starts -caselessly, or if there are any changes of this flag within the regex, set up -both cases of the character. Otherwise set the two values the same, which will -avoid duplicate testing (which takes significant time). This covers the vast -majority of cases. It will be suboptimal when the case flag changes in a regex -and the required character in fact is caseful. */ - -if ((re->options & PCRE_REQCHSET) != 0) - { - req_char = re->req_char; - req_char2 = ((re->options & (PCRE_CASELESS | PCRE_ICHANGED)) != 0)? - (re->tables + fcc_offset)[req_char] : req_char; - } - -/* Loop for handling unanchored repeated matching attempts; for anchored regexs -the loop runs just once. */ - -do - { - int rc; - register int *iptr = match_block.offset_vector; - register int *iend = iptr + resetcount; - - /* Reset the maximum number of extractions we might see. */ - - while (iptr < iend) *iptr++ = -1; - - /* Advance to a unique first char if possible */ - - if (first_char >= 0) - { - if ((ims & PCRE_CASELESS) != 0) - while (start_match < end_subject && - match_block.lcc[*start_match] != first_char) - start_match++; - else - while (start_match < end_subject && *start_match != first_char) - start_match++; - } - - /* Or to just after \n for a multiline match if possible */ - - else if (startline) - { - if (start_match > match_block.start_subject + start_offset) - { - while (start_match < end_subject && start_match[-1] != '\n') - start_match++; - } - } - - /* Or to a non-unique first char after study */ - - else if (start_bits != NULL) - { - while (start_match < end_subject) - { - register int c = *start_match; - if ((start_bits[c/8] & (1 << (c&7))) == 0) start_match++; else break; - } - } - -#ifdef DEBUG /* Sigh. Some compilers never learn. */ - printf(">>>> Match against: "); - pchars(start_match, end_subject - start_match, TRUE, &match_block); - printf("\n"); -#endif - - /* If req_char is set, we know that that character must appear in the subject - for the match to succeed. If the first character is set, req_char must be - later in the subject; otherwise the test starts at the match point. This - optimization can save a huge amount of backtracking in patterns with nested - unlimited repeats that aren't going to match. We don't know what the state of - case matching may be when this character is hit, so test for it in both its - cases if necessary. However, the different cased versions will not be set up - unless PCRE_CASELESS was given or the casing state changes within the regex. - Writing separate code makes it go faster, as does using an autoincrement and - backing off on a match. */ - - if (req_char >= 0) - { - register const uschar *p = start_match + ((first_char >= 0)? 1 : 0); - - /* We don't need to repeat the search if we haven't yet reached the - place we found it at last time. */ - - if (p > req_char_ptr) - { - /* Do a single test if no case difference is set up */ - - if (req_char == req_char2) - { - while (p < end_subject) - { - if (*p++ == req_char) { p--; break; } - } - } - - /* Otherwise test for either case */ - - else - { - while (p < end_subject) - { - register int pp = *p++; - if (pp == req_char || pp == req_char2) { p--; break; } - } - } - - /* If we can't find the required character, break the matching loop */ - - if (p >= end_subject) break; - - /* If we have found the required character, save the point where we - found it, so that we don't search again next time round the loop if - the start hasn't passed this character yet. */ - - req_char_ptr = p; - } - } - - /* When a match occurs, substrings will be set for all internal extractions; - we just need to set up the whole thing as substring 0 before returning. If - there were too many extractions, set the return code to zero. In the case - where we had to get some local store to hold offsets for backreferences, copy - those back references that we can. In this case there need not be overflow - if certain parts of the pattern were not used. */ - - match_block.start_match = start_match; - if (!match(start_match, re->code, 2, &match_block, ims, NULL, match_isgroup)) - continue; - - /* Copy the offset information from temporary store if necessary */ - - if (using_temporary_offsets) - { - if (offsetcount >= 4) - { - memcpy(offsets + 2, match_block.offset_vector + 2, - (offsetcount - 2) * sizeof(int)); - DPRINTF(("Copied offsets from temporary memory\n")); - } - if (match_block.end_offset_top > offsetcount) - match_block.offset_overflow = TRUE; - - DPRINTF(("Freeing temporary memory\n")); - (pcre_free)(match_block.offset_vector); - } - - rc = match_block.offset_overflow? 0 : match_block.end_offset_top/2; - - if (match_block.offset_end < 2) rc = 0; else - { - offsets[0] = start_match - match_block.start_subject; - offsets[1] = match_block.end_match_ptr - match_block.start_subject; - } - - DPRINTF((">>>> returning %d\n", rc)); - return rc; - } - -/* This "while" is the end of the "do" above */ - -while (!anchored && - match_block.errorcode == PCRE_ERROR_NOMATCH && - start_match++ < end_subject); - -if (using_temporary_offsets) - { - DPRINTF(("Freeing temporary memory\n")); - (pcre_free)(match_block.offset_vector); - } - -DPRINTF((">>>> returning %d\n", match_block.errorcode)); - -return match_block.errorcode; -} - -/* End of pcre.c */ diff --git a/srclib/pcre/pcre.def b/srclib/pcre/pcre.def deleted file mode 100644 index 0e8cf3f442..0000000000 --- a/srclib/pcre/pcre.def +++ /dev/null @@ -1,19 +0,0 @@ -EXPORTS - -pcre_malloc DATA -pcre_free DATA - -pcre_compile -pcre_copy_substring -pcre_exec -pcre_get_substring -pcre_get_substring_list -pcre_info -pcre_maketables -pcre_study -pcre_version - -regcomp -regexec -regerror -regfree diff --git a/srclib/pcre/pcre.dsp b/srclib/pcre/pcre.dsp deleted file mode 100644 index 6aa9cc2d5b..0000000000 --- a/srclib/pcre/pcre.dsp +++ /dev/null @@ -1,200 +0,0 @@ -# Microsoft Developer Studio Project File - Name="pcre" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.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 AllowPerConfigDependencies 0 -# 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 "" -RSC=rc.exe -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -# ADD BASE CPP /nologo /MD /W3 /O2 /D "_WIN32" /D "NDEBUG" /D "_WINDOWS" /D "STATIC" /Fd"LibR/pcre" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /D "_WIN32" /D "NDEBUG" /D "_WINDOWS" /D "STATIC" /Fd"LibR/pcre" /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 "" -RSC=rc.exe -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /D "_WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STATIC" /Fd"LibD/pcre" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /D "_WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STATIC" /Fd"LibD/pcre" /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)" - copy .\config.hw .\config.h >nul - echo Created pcre config.h from config.hw - -# End Custom Build - -!ELSEIF "$(CFG)" == "pcre - Win32 Debug" - -# Begin Custom Build -InputPath=.\config.hw - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\config.hw .\config.h >nul - echo Created pcre config.h from config.hw - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\internal.h -# 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)" - copy .\pcre.hw .\pcre.h >nul - echo Created pcre.h from pcre.hw - -# End Custom Build - -!ELSEIF "$(CFG)" == "pcre - Win32 Debug" - -# Begin Custom Build -InputPath=.\pcre.hw - -".\pcre.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\pcre.hw .\pcre.h >nul - echo Created pcre.h from pcre.hw - -# End Custom Build - -!ENDIF - -# 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 eb6d3bbbed..0000000000 --- a/srclib/pcre/pcre.hw +++ /dev/null @@ -1,107 +0,0 @@ -/************************************************* -* Perl-Compatible Regular Expressions * -*************************************************/ - -/* Copyright (c) 1997-2000 University of Cambridge */ - -#ifndef _PCRE_H -#define _PCRE_H - -/* The file pcre.h is build by "configure" or copied from pcre.hw -Do not edit it; instead make changes to pcre.in and/or pcre.hw */ - -#define PCRE_MAJOR 3 -#define PCRE_MINOR 2 -#define PCRE_DATE 12-May-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 - -/* 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/pcre.in b/srclib/pcre/pcre.in deleted file mode 100644 index 020dba702f..0000000000 --- a/srclib/pcre/pcre.in +++ /dev/null @@ -1,107 +0,0 @@ -/************************************************* -* Perl-Compatible Regular Expressions * -*************************************************/ - -/* Copyright (c) 1997-2000 University of Cambridge */ - -#ifndef _PCRE_H -#define _PCRE_H - -/* The file pcre.h is build by "configure" or copied from pcre.hw -Do not edit it; instead make changes to pcre.in and/or pcre.hw */ - -#define PCRE_MAJOR @PCRE_MAJOR@ -#define PCRE_MINOR @PCRE_MINOR@ -#define PCRE_DATE @PCRE_DATE@ - -/* 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 - -/* 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/pcre.mak b/srclib/pcre/pcre.mak deleted file mode 100644 index f2a54b4cdc..0000000000 --- a/srclib/pcre/pcre.mak +++ /dev/null @@ -1,348 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on pcre.dsp -!IF "$(CFG)" == "" -CFG=pcre - Win32 Debug -!MESSAGE No configuration specified. Defaulting to pcre - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "pcre - Win32 Release" && "$(CFG)" != "pcre - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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 -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "pcre - Win32 Release" - -OUTDIR=.\LibR -INTDIR=.\LibR -# Begin Custom Macros -OutDir=.\LibR -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\pcre.lib" - -!ELSE - -ALL : "dftables - Win32 Release" "$(OUTDIR)\pcre.lib" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"dftables - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\get.obj" - -@erase "$(INTDIR)\maketables.obj" - -@erase "$(INTDIR)\pcre.idb" - -@erase "$(INTDIR)\pcre.obj" - -@erase "$(INTDIR)\study.obj" - -@erase "$(OUTDIR)\pcre.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -RSC=rc.exe -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /D "_WIN32" /D "NDEBUG" /D "_WINDOWS" /D "STATIC"\ - /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\pcre" /FD /c -CPP_OBJS=.\LibR/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\pcre.bsc" -BSC32_SBRS= \ - -LIB32=link.exe -lib -LIB32_FLAGS=/nologo /out:"$(OUTDIR)\pcre.lib" -LIB32_OBJS= \ - "$(INTDIR)\get.obj" \ - "$(INTDIR)\maketables.obj" \ - "$(INTDIR)\pcre.obj" \ - "$(INTDIR)\study.obj" - -"$(OUTDIR)\pcre.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ELSEIF "$(CFG)" == "pcre - Win32 Debug" - -OUTDIR=.\LibD -INTDIR=.\LibD -# Begin Custom Macros -OutDir=.\LibD -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\pcre.lib" - -!ELSE - -ALL : "dftables - Win32 Debug" "$(OUTDIR)\pcre.lib" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"dftables - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\get.obj" - -@erase "$(INTDIR)\maketables.obj" - -@erase "$(INTDIR)\pcre.idb" - -@erase "$(INTDIR)\pcre.obj" - -@erase "$(INTDIR)\pcre.pdb" - -@erase "$(INTDIR)\study.obj" - -@erase "$(OUTDIR)\pcre.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -RSC=rc.exe -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Zi /Od /D "_WIN32" /D "_DEBUG" /D "_WINDOWS" /D\ - "STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\pcre" /FD /c -CPP_OBJS=.\LibD/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\pcre.bsc" -BSC32_SBRS= \ - -LIB32=link.exe -lib -LIB32_FLAGS=/nologo /out:"$(OUTDIR)\pcre.lib" -LIB32_OBJS= \ - "$(INTDIR)\get.obj" \ - "$(INTDIR)\maketables.obj" \ - "$(INTDIR)\pcre.obj" \ - "$(INTDIR)\study.obj" - -"$(OUTDIR)\pcre.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "pcre - Win32 Release" || "$(CFG)" == "pcre - Win32 Debug" -SOURCE=.\dftables.exe - -!IF "$(CFG)" == "pcre - Win32 Release" - -InputPath=.\dftables.exe - -".\chartables.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - .\dftables.exe >.\chartables.c - Echo Creating pcre chartables.c from dftables - - -!ELSEIF "$(CFG)" == "pcre - Win32 Debug" - -InputPath=.\dftables.exe - -".\chartables.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - .\dftables.exe >.\chartables.c - Echo Creating pcre chartables.c from dftables - - -!ENDIF - -SOURCE=.\get.c -DEP_CPP_GET_C=\ - ".\config.h"\ - ".\internal.h"\ - ".\pcre.h"\ - - -"$(INTDIR)\get.obj" : $(SOURCE) $(DEP_CPP_GET_C) "$(INTDIR)" ".\config.h"\ - ".\pcre.h" - - -SOURCE=.\maketables.c -DEP_CPP_MAKET=\ - ".\config.h"\ - ".\internal.h"\ - ".\pcre.h"\ - - -"$(INTDIR)\maketables.obj" : $(SOURCE) $(DEP_CPP_MAKET) "$(INTDIR)"\ - ".\config.h" ".\pcre.h" - - -SOURCE=.\pcre.c -DEP_CPP_PCRE_=\ - ".\chartables.c"\ - ".\config.h"\ - ".\internal.h"\ - ".\pcre.h"\ - - -"$(INTDIR)\pcre.obj" : $(SOURCE) $(DEP_CPP_PCRE_) "$(INTDIR)" ".\chartables.c"\ - ".\config.h" ".\pcre.h" - - -SOURCE=.\study.c -DEP_CPP_STUDY=\ - ".\config.h"\ - ".\internal.h"\ - ".\pcre.h"\ - - -"$(INTDIR)\study.obj" : $(SOURCE) $(DEP_CPP_STUDY) "$(INTDIR)" ".\config.h"\ - ".\pcre.h" - - -SOURCE=.\config.hw - -!IF "$(CFG)" == "pcre - Win32 Release" - -InputPath=.\config.hw - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\config.hw .\config.h >nul - echo Created pcre config.h from config.hw - - -!ELSEIF "$(CFG)" == "pcre - Win32 Debug" - -InputPath=.\config.hw - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\config.hw .\config.h >nul - echo Created pcre config.h from config.hw - - -!ENDIF - -SOURCE=.\pcre.hw - -!IF "$(CFG)" == "pcre - Win32 Release" - -InputPath=.\pcre.hw - -".\pcre.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\pcre.hw .\pcre.h >nul - echo Created pcre.h from pcre.hw - - -!ELSEIF "$(CFG)" == "pcre - Win32 Debug" - -InputPath=.\pcre.hw - -".\pcre.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\pcre.hw .\pcre.h >nul - echo Created pcre.h from pcre.hw - - -!ENDIF - -!IF "$(CFG)" == "pcre - Win32 Release" - -"dftables - Win32 Release" : - cd "." - $(MAKE) /$(MAKEFLAGS) /F .\dftables.mak CFG="dftables - Win32 Release" - cd "." - -"dftables - Win32 ReleaseCLEAN" : - cd "." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\dftables.mak CFG="dftables - Win32 Release"\ - RECURSE=1 - cd "." - -!ELSEIF "$(CFG)" == "pcre - Win32 Debug" - -"dftables - Win32 Debug" : - cd "." - $(MAKE) /$(MAKEFLAGS) /F .\dftables.mak CFG="dftables - Win32 Debug" - cd "." - -"dftables - Win32 DebugCLEAN" : - cd "." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\dftables.mak CFG="dftables - Win32 Debug"\ - RECURSE=1 - cd "." - -!ENDIF - - -!ENDIF - diff --git a/srclib/pcre/pcreposix.c b/srclib/pcre/pcreposix.c deleted file mode 100644 index c6edb7dbec..0000000000 --- a/srclib/pcre/pcreposix.c +++ /dev/null @@ -1,276 +0,0 @@ -/************************************************* -* Perl-Compatible Regular Expressions * -*************************************************/ - -/* -This is a library of functions to support regular expressions whose syntax -and semantics are as close as possible to those of the Perl 5 language. See -the file Tech.Notes for some information on the internals. - -This module is a wrapper that provides a POSIX API to the underlying PCRE -functions. - -Written by: Philip Hazel - - Copyright (c) 1997-2000 University of Cambridge - ------------------------------------------------------------------------------ -Permission is granted to anyone to use this software for any purpose on any -computer system, and to redistribute it freely, subject to the following -restrictions: - -1. This software 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. - -2. The origin of this software must not be misrepresented, either by - explicit claim or by omission. - -3. Altered versions must be plainly marked as such, and must not be - misrepresented as being the original software. - -4. If PCRE is embedded in any software that is released under the GNU - General Purpose Licence (GPL), then the terms of that licence shall - supersede any condition above with which it is incompatible. ------------------------------------------------------------------------------ -*/ - -#include "internal.h" -#include "pcreposix.h" -#include "stdlib.h" - - - -/* Corresponding tables of PCRE error messages and POSIX error codes. */ - -static const char *estring[] = { - ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9, ERR10, - ERR11, ERR12, ERR13, ERR14, ERR15, ERR16, ERR17, ERR18, ERR19, ERR20, - ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR29, ERR29, ERR30, - ERR31 }; - -static int eint[] = { - REG_EESCAPE, /* "\\ at end of pattern" */ - REG_EESCAPE, /* "\\c at end of pattern" */ - REG_EESCAPE, /* "unrecognized character follows \\" */ - REG_BADBR, /* "numbers out of order in {} quantifier" */ - REG_BADBR, /* "number too big in {} quantifier" */ - REG_EBRACK, /* "missing terminating ] for character class" */ - REG_ECTYPE, /* "invalid escape sequence in character class" */ - REG_ERANGE, /* "range out of order in character class" */ - REG_BADRPT, /* "nothing to repeat" */ - REG_BADRPT, /* "operand of unlimited repeat could match the empty string" */ - REG_ASSERT, /* "internal error: unexpected repeat" */ - REG_BADPAT, /* "unrecognized character after (?" */ - REG_ESIZE, /* "too many capturing parenthesized sub-patterns" */ - REG_EPAREN, /* "missing )" */ - REG_ESUBREG, /* "back reference to non-existent subpattern" */ - REG_INVARG, /* "erroffset passed as NULL" */ - REG_INVARG, /* "unknown option bit(s) set" */ - REG_EPAREN, /* "missing ) after comment" */ - REG_ESIZE, /* "too many sets of parentheses" */ - REG_ESIZE, /* "regular expression too large" */ - REG_ESPACE, /* "failed to get memory" */ - REG_EPAREN, /* "unmatched brackets" */ - REG_ASSERT, /* "internal error: code overflow" */ - REG_BADPAT, /* "unrecognized character after (?<" */ - REG_BADPAT, /* "lookbehind assertion is not fixed length" */ - REG_BADPAT, /* "malformed number after (?(" */ - REG_BADPAT, /* "conditional group containe more than two branches" */ - REG_BADPAT, /* "assertion expected after (?(" */ - REG_BADPAT, /* "(?p must be followed by )" */ - REG_ECTYPE, /* "unknown POSIX class name" */ - REG_BADPAT /* "POSIX collating elements are not supported" */ -}; - -/* Table of texts corresponding to POSIX error codes */ - -static const char *pstring[] = { - "", /* Dummy for value 0 */ - "internal error", /* REG_ASSERT */ - "invalid repeat counts in {}", /* BADBR */ - "pattern error", /* BADPAT */ - "? * + invalid", /* BADRPT */ - "unbalanced {}", /* EBRACE */ - "unbalanced []", /* EBRACK */ - "collation error - not relevant", /* ECOLLATE */ - "bad class", /* ECTYPE */ - "bad escape sequence", /* EESCAPE */ - "empty expression", /* EMPTY */ - "unbalanced ()", /* EPAREN */ - "bad range inside []", /* ERANGE */ - "expression too big", /* ESIZE */ - "failed to get memory", /* ESPACE */ - "bad back reference", /* ESUBREG */ - "bad argument", /* INVARG */ - "match failed" /* NOMATCH */ -}; - - - - -/************************************************* -* Translate PCRE text code to int * -*************************************************/ - -/* PCRE compile-time errors are given as strings defined as macros. We can just -look them up in a table to turn them into POSIX-style error codes. */ - -static int -pcre_posix_error_code(const char *s) -{ -size_t i; -for (i = 0; i < sizeof(estring)/sizeof(char *); i++) - if (strcmp(s, estring[i]) == 0) return eint[i]; -return REG_ASSERT; -} - - - -/************************************************* -* Translate error code to string * -*************************************************/ - -size_t -regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size) -{ -const char *message, *addmessage; -size_t length, addlength; - -message = (errcode >= (int)(sizeof(pstring)/sizeof(char *)))? - "unknown error code" : pstring[errcode]; -length = strlen(message) + 1; - -addmessage = " at offset "; -addlength = (preg != NULL && (int)preg->re_erroffset != -1)? - strlen(addmessage) + 6 : 0; - -if (errbuf_size > 0) - { - if (addlength > 0 && errbuf_size >= length + addlength) - sprintf(errbuf, "%s%s%-6d", message, addmessage, (int)preg->re_erroffset); - else - { - strncpy(errbuf, message, errbuf_size - 1); - errbuf[errbuf_size-1] = 0; - } - } - -return length + addlength; -} - - - - -/************************************************* -* Free store held by a regex * -*************************************************/ - -void -regfree(regex_t *preg) -{ -(pcre_free)(preg->re_pcre); -} - - - - -/************************************************* -* Compile a regular expression * -*************************************************/ - -/* -Arguments: - preg points to a structure for recording the compiled expression - pattern the pattern to compile - cflags compilation flags - -Returns: 0 on success - various non-zero codes on failure -*/ - -int -regcomp(regex_t *preg, const char *pattern, int cflags) -{ -const char *errorptr; -int erroffset; -int options = 0; - -if ((cflags & REG_ICASE) != 0) options |= PCRE_CASELESS; -if ((cflags & REG_NEWLINE) != 0) options |= PCRE_MULTILINE; - -preg->re_pcre = pcre_compile(pattern, options, &errorptr, &erroffset, NULL); -preg->re_erroffset = erroffset; - -if (preg->re_pcre == NULL) return pcre_posix_error_code(errorptr); - -preg->re_nsub = pcre_info(preg->re_pcre, NULL, NULL); -return 0; -} - - - - -/************************************************* -* Match a regular expression * -*************************************************/ - -/* Unfortunately, PCRE requires 3 ints of working space for each captured -substring, so we have to get and release working store instead of just using -the POSIX structures as was done in earlier releases when PCRE needed only 2 -ints. */ - -int -regexec(regex_t *preg, const char *string, size_t nmatch, - regmatch_t pmatch[], int eflags) -{ -int rc; -int options = 0; -int *ovector = NULL; - -if ((eflags & REG_NOTBOL) != 0) options |= PCRE_NOTBOL; -if ((eflags & REG_NOTEOL) != 0) options |= PCRE_NOTEOL; - -preg->re_erroffset = (size_t)(-1); /* Only has meaning after compile */ - -if (nmatch > 0) - { - ovector = (int *)malloc(sizeof(int) * nmatch * 3); - if (ovector == NULL) return REG_ESPACE; - } - -rc = pcre_exec(preg->re_pcre, NULL, string, (int)strlen(string), 0, options, - ovector, nmatch * 3); - -if (rc == 0) rc = nmatch; /* All captured slots were filled in */ - -if (rc >= 0) - { - size_t i; - for (i = 0; i < (size_t) rc; i++) - { - pmatch[i].rm_so = ovector[i*2]; - pmatch[i].rm_eo = ovector[i*2+1]; - } - if (ovector != NULL) free(ovector); - for (; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1; - return 0; - } - -else - { - if (ovector != NULL) free(ovector); - switch(rc) - { - case PCRE_ERROR_NOMATCH: return REG_NOMATCH; - case PCRE_ERROR_NULL: return REG_INVARG; - case PCRE_ERROR_BADOPTION: return REG_INVARG; - case PCRE_ERROR_BADMAGIC: return REG_INVARG; - case PCRE_ERROR_UNKNOWN_NODE: return REG_ASSERT; - case PCRE_ERROR_NOMEMORY: return REG_ESPACE; - default: return REG_ASSERT; - } - } -} - -/* End of pcreposix.c */ diff --git a/srclib/pcre/pcreposix.dsp b/srclib/pcre/pcreposix.dsp deleted file mode 100644 index caf2278cb9..0000000000 --- a/srclib/pcre/pcreposix.dsp +++ /dev/null @@ -1,159 +0,0 @@ -# Microsoft Developer Studio Project File - Name="pcreposix" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.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 AllowPerConfigDependencies 0 -# 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" -# PROP Target_Dir "" -RSC=rc.exe -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -# ADD BASE CPP /nologo /MD /W3 /O2 /D "_WIN32" /D "NDEBUG" /D "_WINDOWS" /D "STATIC" /Fd"LibR/pcreposix" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /D "_WIN32" /D "NDEBUG" /D "_WINDOWS" /D "STATIC" /Fd"LibR/pcreposix" /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" -# PROP Target_Dir "" -RSC=rc.exe -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /D "_WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STATIC" /Fd"LibD/pcreposix" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /D "_WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STATIC" /Fd"LibD/pcreposix" /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)" - copy .\config.hw .\config.h >nul - echo Created pcre config.h from config.hw - -# End Custom Build - -!ELSEIF "$(CFG)" == "pcreposix - Win32 Debug" - -# Begin Custom Build -InputPath=.\config.hw - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\config.hw .\config.h >nul - echo Created pcre config.h from config.hw - -# End Custom Build - -!ENDIF - -# 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)" - copy .\pcre.hw .\pcre.h >nul - echo Created pcre.h from pcre.hw - -# End Custom Build - -!ELSEIF "$(CFG)" == "pcreposix - Win32 Debug" - -# Begin Custom Build -InputPath=.\pcre.hw - -".\pcre.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\pcre.hw .\pcre.h >nul - echo Created pcre.h from pcre.hw - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\pcreposix.h -# End Source File -# End Group -# End Target -# End Project diff --git a/srclib/pcre/pcreposix.h b/srclib/pcre/pcreposix.h deleted file mode 100644 index 7660acbd55..0000000000 --- a/srclib/pcre/pcreposix.h +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************* -* Perl-Compatible Regular Expressions * -*************************************************/ - -/* Copyright (c) 1997-2000 University of Cambridge */ - -#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/srclib/pcre/pcreposix.mak b/srclib/pcre/pcreposix.mak deleted file mode 100644 index 2269064f1a..0000000000 --- a/srclib/pcre/pcreposix.mak +++ /dev/null @@ -1,285 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on pcreposix.dsp -!IF "$(CFG)" == "" -CFG=pcreposix - Win32 Debug -!MESSAGE No configuration specified. Defaulting to pcreposix - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "pcreposix - Win32 Release" && "$(CFG)" !=\ - "pcreposix - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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 -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "pcreposix - Win32 Release" - -OUTDIR=.\LibR -INTDIR=.\LibR -# Begin Custom Macros -OutDir=.\LibR -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\pcreposix.lib" - -!ELSE - -ALL : "pcre - Win32 Release" "$(OUTDIR)\pcreposix.lib" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"pcre - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\pcreposix.idb" - -@erase "$(INTDIR)\pcreposix.obj" - -@erase "$(OUTDIR)\pcreposix.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -RSC=rc.exe -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /D "_WIN32" /D "NDEBUG" /D "_WINDOWS" /D "STATIC"\ - /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\pcreposix" /FD /c -CPP_OBJS=.\LibR/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\pcreposix.bsc" -BSC32_SBRS= \ - -LIB32=link.exe -lib -LIB32_FLAGS=/nologo /out:"$(OUTDIR)\pcreposix.lib" -LIB32_OBJS= \ - "$(INTDIR)\pcreposix.obj" \ - "$(OUTDIR)\pcre.lib" - -"$(OUTDIR)\pcreposix.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ELSEIF "$(CFG)" == "pcreposix - Win32 Debug" - -OUTDIR=.\LibD -INTDIR=.\LibD -# Begin Custom Macros -OutDir=.\LibD -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\pcreposix.lib" - -!ELSE - -ALL : "pcre - Win32 Debug" "$(OUTDIR)\pcreposix.lib" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"pcre - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\pcreposix.idb" - -@erase "$(INTDIR)\pcreposix.obj" - -@erase "$(INTDIR)\pcreposix.pdb" - -@erase "$(OUTDIR)\pcreposix.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -RSC=rc.exe -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Zi /Od /D "_WIN32" /D "_DEBUG" /D "_WINDOWS" /D\ - "STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\pcreposix" /FD /c -CPP_OBJS=.\LibD/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\pcreposix.bsc" -BSC32_SBRS= \ - -LIB32=link.exe -lib -LIB32_FLAGS=/nologo /out:"$(OUTDIR)\pcreposix.lib" -LIB32_OBJS= \ - "$(INTDIR)\pcreposix.obj" \ - "$(OUTDIR)\pcre.lib" - -"$(OUTDIR)\pcreposix.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "pcreposix - Win32 Release" || "$(CFG)" ==\ - "pcreposix - Win32 Debug" -SOURCE=.\pcreposix.c -DEP_CPP_PCREP=\ - ".\config.h"\ - ".\internal.h"\ - ".\pcre.h"\ - ".\pcreposix.h"\ - - -"$(INTDIR)\pcreposix.obj" : $(SOURCE) $(DEP_CPP_PCREP) "$(INTDIR)" ".\config.h"\ - ".\pcre.h" - - -SOURCE=.\config.hw - -!IF "$(CFG)" == "pcreposix - Win32 Release" - -InputPath=.\config.hw - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\config.hw .\config.h >nul - echo Created pcre config.h from config.hw - - -!ELSEIF "$(CFG)" == "pcreposix - Win32 Debug" - -InputPath=.\config.hw - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\config.hw .\config.h >nul - echo Created pcre config.h from config.hw - - -!ENDIF - -SOURCE=.\pcre.hw - -!IF "$(CFG)" == "pcreposix - Win32 Release" - -InputPath=.\pcre.hw - -".\pcre.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\pcre.hw .\pcre.h >nul - echo Created pcre.h from pcre.hw - - -!ELSEIF "$(CFG)" == "pcreposix - Win32 Debug" - -InputPath=.\pcre.hw - -".\pcre.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy .\pcre.hw .\pcre.h >nul - echo Created pcre.h from pcre.hw - - -!ENDIF - -!IF "$(CFG)" == "pcreposix - Win32 Release" - -"pcre - Win32 Release" : - cd "." - $(MAKE) /$(MAKEFLAGS) /F .\pcre.mak CFG="pcre - Win32 Release" - cd "." - -"pcre - Win32 ReleaseCLEAN" : - cd "." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\pcre.mak CFG="pcre - Win32 Release"\ - RECURSE=1 - cd "." - -!ELSEIF "$(CFG)" == "pcreposix - Win32 Debug" - -"pcre - Win32 Debug" : - cd "." - $(MAKE) /$(MAKEFLAGS) /F .\pcre.mak CFG="pcre - Win32 Debug" - cd "." - -"pcre - Win32 DebugCLEAN" : - cd "." - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\pcre.mak CFG="pcre - Win32 Debug" RECURSE=1\ - - cd "." - -!ENDIF - - -!ENDIF - diff --git a/srclib/pcre/pcretest.c b/srclib/pcre/pcretest.c deleted file mode 100644 index bbe9bdd109..0000000000 --- a/srclib/pcre/pcretest.c +++ /dev/null @@ -1,1072 +0,0 @@ -/************************************************* -* PCRE testing program * -*************************************************/ - -#include -#include -#include -#include -#include -#include - -/* Use the internal info for displaying the results of pcre_study(). */ - -#include "internal.h" - -/* It is possible to compile this test program without including support for -testing the POSIX interface, though this is not available via the standard -Makefile. */ - -#if !defined NOPOSIX -#include "pcreposix.h" -#endif - -#ifndef CLOCKS_PER_SEC -#ifdef CLK_TCK -#define CLOCKS_PER_SEC CLK_TCK -#else -#define CLOCKS_PER_SEC 100 -#endif -#endif - -#define LOOPREPEAT 20000 - - -static FILE *outfile; -static int log_store = 0; -static size_t gotten_store; - - - -/* Debugging function to print the internal form of the regex. This is the same -code as contained in pcre.c under the DEBUG macro. */ - -static const char *OP_names[] = { - "End", "\\A", "\\B", "\\b", "\\D", "\\d", - "\\S", "\\s", "\\W", "\\w", "\\Z", "\\z", - "Opt", "^", "$", "Any", "chars", "not", - "*", "*?", "+", "+?", "?", "??", "{", "{", "{", - "*", "*?", "+", "+?", "?", "??", "{", "{", "{", - "*", "*?", "+", "+?", "?", "??", "{", "{", "{", - "*", "*?", "+", "+?", "?", "??", "{", "{", - "class", "Ref", "Recurse", - "Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not", - "AssertB", "AssertB not", "Reverse", "Once", "Cond", "Cref", - "Brazero", "Braminzero", "Bra" -}; - - -static void print_internals(pcre *re) -{ -unsigned char *code = ((real_pcre *)re)->code; - -fprintf(outfile, "------------------------------------------------------------------\n"); - -for(;;) - { - int c; - int charlength; - - fprintf(outfile, "%3d ", (int)(code - ((real_pcre *)re)->code)); - - if (*code >= OP_BRA) - { - fprintf(outfile, "%3d Bra %d", (code[1] << 8) + code[2], *code - OP_BRA); - code += 2; - } - - else switch(*code) - { - case OP_END: - fprintf(outfile, " %s\n", OP_names[*code]); - fprintf(outfile, "------------------------------------------------------------------\n"); - return; - - case OP_OPT: - fprintf(outfile, " %.2x %s", code[1], OP_names[*code]); - code++; - break; - - case OP_COND: - fprintf(outfile, "%3d Cond", (code[1] << 8) + code[2]); - code += 2; - break; - - case OP_CREF: - fprintf(outfile, " %.2d %s", code[1], OP_names[*code]); - code++; - break; - - case OP_CHARS: - charlength = *(++code); - fprintf(outfile, "%3d ", charlength); - while (charlength-- > 0) - if (isprint(c = *(++code))) fprintf(outfile, "%c", c); - else fprintf(outfile, "\\x%02x", c); - break; - - case OP_KETRMAX: - case OP_KETRMIN: - case OP_ALT: - case OP_KET: - case OP_ASSERT: - case OP_ASSERT_NOT: - case OP_ASSERTBACK: - case OP_ASSERTBACK_NOT: - case OP_ONCE: - fprintf(outfile, "%3d %s", (code[1] << 8) + code[2], OP_names[*code]); - code += 2; - break; - - case OP_REVERSE: - fprintf(outfile, "%3d %s", (code[1] << 8) + code[2], OP_names[*code]); - code += 2; - break; - - case OP_STAR: - case OP_MINSTAR: - case OP_PLUS: - case OP_MINPLUS: - case OP_QUERY: - case OP_MINQUERY: - case OP_TYPESTAR: - case OP_TYPEMINSTAR: - case OP_TYPEPLUS: - case OP_TYPEMINPLUS: - case OP_TYPEQUERY: - case OP_TYPEMINQUERY: - if (*code >= OP_TYPESTAR) - fprintf(outfile, " %s", OP_names[code[1]]); - else if (isprint(c = code[1])) fprintf(outfile, " %c", c); - else fprintf(outfile, " \\x%02x", c); - fprintf(outfile, "%s", OP_names[*code++]); - break; - - case OP_EXACT: - case OP_UPTO: - case OP_MINUPTO: - if (isprint(c = code[3])) fprintf(outfile, " %c{", c); - else fprintf(outfile, " \\x%02x{", c); - if (*code != OP_EXACT) fprintf(outfile, ","); - fprintf(outfile, "%d}", (code[1] << 8) + code[2]); - if (*code == OP_MINUPTO) fprintf(outfile, "?"); - code += 3; - break; - - case OP_TYPEEXACT: - case OP_TYPEUPTO: - case OP_TYPEMINUPTO: - fprintf(outfile, " %s{", OP_names[code[3]]); - if (*code != OP_TYPEEXACT) fprintf(outfile, "0,"); - fprintf(outfile, "%d}", (code[1] << 8) + code[2]); - if (*code == OP_TYPEMINUPTO) fprintf(outfile, "?"); - code += 3; - break; - - case OP_NOT: - if (isprint(c = *(++code))) fprintf(outfile, " [^%c]", c); - else fprintf(outfile, " [^\\x%02x]", c); - break; - - case OP_NOTSTAR: - case OP_NOTMINSTAR: - case OP_NOTPLUS: - case OP_NOTMINPLUS: - case OP_NOTQUERY: - case OP_NOTMINQUERY: - if (isprint(c = code[1])) fprintf(outfile, " [^%c]", c); - else fprintf(outfile, " [^\\x%02x]", c); - fprintf(outfile, "%s", OP_names[*code++]); - break; - - case OP_NOTEXACT: - case OP_NOTUPTO: - case OP_NOTMINUPTO: - if (isprint(c = code[3])) fprintf(outfile, " [^%c]{", c); - else fprintf(outfile, " [^\\x%02x]{", c); - if (*code != OP_NOTEXACT) fprintf(outfile, ","); - fprintf(outfile, "%d}", (code[1] << 8) + code[2]); - if (*code == OP_NOTMINUPTO) fprintf(outfile, "?"); - code += 3; - break; - - case OP_REF: - fprintf(outfile, " \\%d", *(++code)); - code++; - goto CLASS_REF_REPEAT; - - case OP_CLASS: - { - int i, min, max; - code++; - fprintf(outfile, " ["); - - for (i = 0; i < 256; i++) - { - if ((code[i/8] & (1 << (i&7))) != 0) - { - int j; - for (j = i+1; j < 256; j++) - if ((code[j/8] & (1 << (j&7))) == 0) break; - if (i == '-' || i == ']') fprintf(outfile, "\\"); - if (isprint(i)) fprintf(outfile, "%c", i); else fprintf(outfile, "\\x%02x", i); - if (--j > i) - { - fprintf(outfile, "-"); - if (j == '-' || j == ']') fprintf(outfile, "\\"); - if (isprint(j)) fprintf(outfile, "%c", j); else fprintf(outfile, "\\x%02x", j); - } - i = j; - } - } - fprintf(outfile, "]"); - code += 32; - - CLASS_REF_REPEAT: - - switch(*code) - { - case OP_CRSTAR: - case OP_CRMINSTAR: - case OP_CRPLUS: - case OP_CRMINPLUS: - case OP_CRQUERY: - case OP_CRMINQUERY: - fprintf(outfile, "%s", OP_names[*code]); - break; - - case OP_CRRANGE: - case OP_CRMINRANGE: - min = (code[1] << 8) + code[2]; - max = (code[3] << 8) + code[4]; - if (max == 0) fprintf(outfile, "{%d,}", min); - else fprintf(outfile, "{%d,%d}", min, max); - if (*code == OP_CRMINRANGE) fprintf(outfile, "?"); - code += 4; - break; - - default: - code--; - } - } - break; - - /* Anything else is just a one-node item */ - - default: - fprintf(outfile, " %s", OP_names[*code]); - break; - } - - code++; - fprintf(outfile, "\n"); - } -} - - - -/* Character string printing function. */ - -static void pchars(unsigned char *p, int length) -{ -int c; -while (length-- > 0) - if (isprint(c = *(p++))) fprintf(outfile, "%c", c); - else fprintf(outfile, "\\x%02x", c); -} - - - -/* Alternative malloc function, to test functionality and show the size of the -compiled re. */ - -static void *new_malloc(size_t size) -{ -gotten_store = size; -if (log_store) - fprintf(outfile, "Memory allocation (code space): %d\n", - (int)((int)size - offsetof(real_pcre, code[0]))); -return malloc(size); -} - - - - -/* Get one piece of information from the pcre_fullinfo() function */ - -static void new_info(pcre *re, pcre_extra *study, int option, void *ptr) -{ -int rc; -if ((rc = pcre_fullinfo(re, study, option, ptr)) < 0) - fprintf(outfile, "Error %d from pcre_fullinfo(%d)\n", rc, option); -} - - - - -/* Read lines from named file or stdin and write to named file or stdout; lines -consist of a regular expression, in delimiters and optionally followed by -options, followed by a set of test data, terminated by an empty line. */ - -int main(int argc, char **argv) -{ -FILE *infile = stdin; -int options = 0; -int study_options = 0; -int op = 1; -int timeit = 0; -int showinfo = 0; -int showstore = 0; -int posix = 0; -int debug = 0; -int done = 0; -unsigned char buffer[30000]; -unsigned char dbuffer[1024]; - -/* Static so that new_malloc can use it. */ - -outfile = stdout; - -/* Scan options */ - -while (argc > 1 && argv[op][0] == '-') - { - if (strcmp(argv[op], "-s") == 0 || strcmp(argv[op], "-m") == 0) - showstore = 1; - else if (strcmp(argv[op], "-t") == 0) timeit = 1; - else if (strcmp(argv[op], "-i") == 0) showinfo = 1; - else if (strcmp(argv[op], "-d") == 0) showinfo = debug = 1; - else if (strcmp(argv[op], "-p") == 0) posix = 1; - else - { - printf("*** Unknown option %s\n", argv[op]); - printf("Usage: pcretest [-d] [-i] [-p] [-s] [-t] [ []]\n"); - printf(" -d debug: show compiled code; implies -i\n" - " -i show information about compiled pattern\n" - " -p use POSIX interface\n" - " -s output store information\n" - " -t time compilation and execution\n"); - return 1; - } - op++; - argc--; - } - -/* Sort out the input and output files */ - -if (argc > 1) - { - infile = fopen(argv[op], "r"); - if (infile == NULL) - { - printf("** Failed to open %s\n", argv[op]); - return 1; - } - } - -if (argc > 2) - { - outfile = fopen(argv[op+1], "w"); - if (outfile == NULL) - { - printf("** Failed to open %s\n", argv[op+1]); - return 1; - } - } - -/* Set alternative malloc function */ - -pcre_malloc = new_malloc; - -/* Heading line, then prompt for first regex if stdin */ - -fprintf(outfile, "PCRE version %s\n\n", pcre_version()); - -/* Main loop */ - -while (!done) - { - pcre *re = NULL; - pcre_extra *extra = NULL; - -#if !defined NOPOSIX /* There are still compilers that require no indent */ - regex_t preg; - int do_posix = 0; -#endif - - const char *error; - unsigned char *p, *pp, *ppp; - unsigned const char *tables = NULL; - int do_study = 0; - int do_debug = debug; - int do_G = 0; - int do_g = 0; - int do_showinfo = showinfo; - int do_showrest = 0; - int erroroffset, len, delimiter; - - if (infile == stdin) printf(" re> "); - if (fgets((char *)buffer, sizeof(buffer), infile) == NULL) break; - if (infile != stdin) fprintf(outfile, "%s", (char *)buffer); - - p = buffer; - while (isspace(*p)) p++; - if (*p == 0) continue; - - /* Get the delimiter and seek the end of the pattern; if is isn't - complete, read more. */ - - delimiter = *p++; - - if (isalnum(delimiter) || delimiter == '\\') - { - fprintf(outfile, "** Delimiter must not be alphameric or \\\n"); - goto SKIP_DATA; - } - - pp = p; - - for(;;) - { - while (*pp != 0) - { - if (*pp == '\\' && pp[1] != 0) pp++; - else if (*pp == delimiter) break; - pp++; - } - if (*pp != 0) break; - - len = sizeof(buffer) - (pp - buffer); - if (len < 256) - { - fprintf(outfile, "** Expression too long - missing delimiter?\n"); - goto SKIP_DATA; - } - - if (infile == stdin) printf(" > "); - if (fgets((char *)pp, len, infile) == NULL) - { - fprintf(outfile, "** Unexpected EOF\n"); - done = 1; - goto CONTINUE; - } - if (infile != stdin) fprintf(outfile, "%s", (char *)pp); - } - - /* If the first character after the delimiter is backslash, make - the pattern end with backslash. This is purely to provide a way - of testing for the error message when a pattern ends with backslash. */ - - if (pp[1] == '\\') *pp++ = '\\'; - - /* Terminate the pattern at the delimiter */ - - *pp++ = 0; - - /* Look for options after final delimiter */ - - options = 0; - study_options = 0; - log_store = showstore; /* default from command line */ - - while (*pp != 0) - { - switch (*pp++) - { - case 'g': do_g = 1; break; - case 'i': options |= PCRE_CASELESS; break; - case 'm': options |= PCRE_MULTILINE; break; - case 's': options |= PCRE_DOTALL; break; - case 'x': options |= PCRE_EXTENDED; break; - - case '+': do_showrest = 1; break; - case 'A': options |= PCRE_ANCHORED; break; - case 'D': do_debug = do_showinfo = 1; break; - case 'E': options |= PCRE_DOLLAR_ENDONLY; break; - case 'G': do_G = 1; break; - case 'I': do_showinfo = 1; break; - case 'M': log_store = 1; break; - -#if !defined NOPOSIX - case 'P': do_posix = 1; break; -#endif - - case 'S': do_study = 1; break; - case 'U': options |= PCRE_UNGREEDY; break; - case 'X': options |= PCRE_EXTRA; break; - - case 'L': - ppp = pp; - while (*ppp != '\n' && *ppp != ' ') ppp++; - *ppp = 0; - if (setlocale(LC_CTYPE, (const char *)pp) == NULL) - { - fprintf(outfile, "** Failed to set locale \"%s\"\n", pp); - goto SKIP_DATA; - } - tables = pcre_maketables(); - pp = ppp; - break; - - case '\n': case ' ': break; - default: - fprintf(outfile, "** Unknown option '%c'\n", pp[-1]); - goto SKIP_DATA; - } - } - - /* Handle compiling via the POSIX interface, which doesn't support the - timing, showing, or debugging options, nor the ability to pass over - local character tables. */ - -#if !defined NOPOSIX - if (posix || do_posix) - { - int rc; - int cflags = 0; - if ((options & PCRE_CASELESS) != 0) cflags |= REG_ICASE; - if ((options & PCRE_MULTILINE) != 0) cflags |= REG_NEWLINE; - rc = regcomp(&preg, (char *)p, cflags); - - /* Compilation failed; go back for another re, skipping to blank line - if non-interactive. */ - - if (rc != 0) - { - (void)regerror(rc, &preg, (char *)buffer, sizeof(buffer)); - fprintf(outfile, "Failed: POSIX code %d: %s\n", rc, buffer); - goto SKIP_DATA; - } - } - - /* Handle compiling via the native interface */ - - else -#endif /* !defined NOPOSIX */ - - { - if (timeit) - { - register int i; - clock_t time_taken; - clock_t start_time = clock(); - for (i = 0; i < LOOPREPEAT; i++) - { - re = pcre_compile((char *)p, options, &error, &erroroffset, tables); - if (re != NULL) free(re); - } - time_taken = clock() - start_time; - fprintf(outfile, "Compile time %.3f milliseconds\n", - ((double)time_taken * 1000.0) / - ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC)); - } - - re = pcre_compile((char *)p, options, &error, &erroroffset, tables); - - /* Compilation failed; go back for another re, skipping to blank line - if non-interactive. */ - - if (re == NULL) - { - fprintf(outfile, "Failed: %s at offset %d\n", error, erroroffset); - SKIP_DATA: - if (infile != stdin) - { - for (;;) - { - if (fgets((char *)buffer, sizeof(buffer), infile) == NULL) - { - done = 1; - goto CONTINUE; - } - len = (int)strlen((char *)buffer); - while (len > 0 && isspace(buffer[len-1])) len--; - if (len == 0) break; - } - fprintf(outfile, "\n"); - } - goto CONTINUE; - } - - /* Compilation succeeded; print data if required. There are now two - info-returning functions. The old one has a limited interface and - returns only limited data. Check that it agrees with the newer one. */ - - if (do_showinfo) - { - int old_first_char, old_options, old_count; - int count, backrefmax, first_char, need_char; - size_t size; - - if (do_debug) print_internals(re); - - new_info(re, NULL, PCRE_INFO_OPTIONS, &options); - new_info(re, NULL, PCRE_INFO_SIZE, &size); - new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count); - new_info(re, NULL, PCRE_INFO_BACKREFMAX, &backrefmax); - new_info(re, NULL, PCRE_INFO_FIRSTCHAR, &first_char); - new_info(re, NULL, PCRE_INFO_LASTLITERAL, &need_char); - - old_count = pcre_info(re, &old_options, &old_first_char); - if (count < 0) fprintf(outfile, - "Error %d from pcre_info()\n", count); - else - { - if (old_count != count) fprintf(outfile, - "Count disagreement: pcre_fullinfo=%d pcre_info=%d\n", count, - old_count); - - if (old_first_char != first_char) fprintf(outfile, - "First char disagreement: pcre_fullinfo=%d pcre_info=%d\n", - first_char, old_first_char); - - if (old_options != options) fprintf(outfile, - "Options disagreement: pcre_fullinfo=%d pcre_info=%d\n", options, - old_options); - } - - if (size != gotten_store) fprintf(outfile, - "Size disagreement: pcre_fullinfo=%d call to malloc for %d\n", - size, gotten_store); - - fprintf(outfile, "Capturing subpattern count = %d\n", count); - if (backrefmax > 0) - fprintf(outfile, "Max back reference = %d\n", backrefmax); - if (options == 0) fprintf(outfile, "No options\n"); - else fprintf(outfile, "Options:%s%s%s%s%s%s%s%s\n", - ((options & PCRE_ANCHORED) != 0)? " anchored" : "", - ((options & PCRE_CASELESS) != 0)? " caseless" : "", - ((options & PCRE_EXTENDED) != 0)? " extended" : "", - ((options & PCRE_MULTILINE) != 0)? " multiline" : "", - ((options & PCRE_DOTALL) != 0)? " dotall" : "", - ((options & PCRE_DOLLAR_ENDONLY) != 0)? " dollar_endonly" : "", - ((options & PCRE_EXTRA) != 0)? " extra" : "", - ((options & PCRE_UNGREEDY) != 0)? " ungreedy" : ""); - - if (((((real_pcre *)re)->options) & PCRE_ICHANGED) != 0) - fprintf(outfile, "Case state changes\n"); - - if (first_char == -1) - { - fprintf(outfile, "First char at start or follows \\n\n"); - } - else if (first_char < 0) - { - fprintf(outfile, "No first char\n"); - } - else - { - if (isprint(first_char)) - fprintf(outfile, "First char = \'%c\'\n", first_char); - else - fprintf(outfile, "First char = %d\n", first_char); - } - - if (need_char < 0) - { - fprintf(outfile, "No need char\n"); - } - else - { - if (isprint(need_char)) - fprintf(outfile, "Need char = \'%c\'\n", need_char); - else - fprintf(outfile, "Need char = %d\n", need_char); - } - } - - /* If /S was present, study the regexp to generate additional info to - help with the matching. */ - - if (do_study) - { - if (timeit) - { - register int i; - clock_t time_taken; - clock_t start_time = clock(); - for (i = 0; i < LOOPREPEAT; i++) - extra = pcre_study(re, study_options, &error); - time_taken = clock() - start_time; - if (extra != NULL) free(extra); - fprintf(outfile, " Study time %.3f milliseconds\n", - ((double)time_taken * 1000.0)/ - ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC)); - } - - extra = pcre_study(re, study_options, &error); - if (error != NULL) - fprintf(outfile, "Failed to study: %s\n", error); - else if (extra == NULL) - fprintf(outfile, "Study returned NULL\n"); - - else if (do_showinfo) - { - uschar *start_bits = NULL; - new_info(re, extra, PCRE_INFO_FIRSTTABLE, &start_bits); - if (start_bits == NULL) - fprintf(outfile, "No starting character set\n"); - else - { - int i; - int c = 24; - fprintf(outfile, "Starting character set: "); - for (i = 0; i < 256; i++) - { - if ((start_bits[i/8] & (1<<(i%8))) != 0) - { - if (c > 75) - { - fprintf(outfile, "\n "); - c = 2; - } - if (isprint(i) && i != ' ') - { - fprintf(outfile, "%c ", i); - c += 2; - } - else - { - fprintf(outfile, "\\x%02x ", i); - c += 5; - } - } - } - fprintf(outfile, "\n"); - } - } - } - } - - /* Read data lines and test them */ - - for (;;) - { - unsigned char *q; - unsigned char *bptr = dbuffer; - int count, c; - int copystrings = 0; - int getstrings = 0; - int getlist = 0; - int gmatched = 0; - int start_offset = 0; - int g_notempty = 0; - int offsets[45]; - int size_offsets = sizeof(offsets)/sizeof(int); - - options = 0; - - if (infile == stdin) printf("data> "); - if (fgets((char *)buffer, sizeof(buffer), infile) == NULL) - { - done = 1; - goto CONTINUE; - } - if (infile != stdin) fprintf(outfile, "%s", (char *)buffer); - - len = (int)strlen((char *)buffer); - while (len > 0 && isspace(buffer[len-1])) len--; - buffer[len] = 0; - if (len == 0) break; - - p = buffer; - while (isspace(*p)) p++; - - q = dbuffer; - while ((c = *p++) != 0) - { - int i = 0; - int n = 0; - if (c == '\\') switch ((c = *p++)) - { - case 'a': c = 7; break; - case 'b': c = '\b'; break; - case 'e': c = 27; break; - case 'f': c = '\f'; break; - case 'n': c = '\n'; break; - case 'r': c = '\r'; break; - case 't': c = '\t'; break; - case 'v': c = '\v'; break; - - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - c -= '0'; - while (i++ < 2 && isdigit(*p) && *p != '8' && *p != '9') - c = c * 8 + *p++ - '0'; - break; - - case 'x': - c = 0; - while (i++ < 2 && isxdigit(*p)) - { - c = c * 16 + tolower(*p) - ((isdigit(*p))? '0' : 'W'); - p++; - } - break; - - case 0: /* Allows for an empty line */ - p--; - continue; - - case 'A': /* Option setting */ - options |= PCRE_ANCHORED; - continue; - - case 'B': - options |= PCRE_NOTBOL; - continue; - - case 'C': - while(isdigit(*p)) n = n * 10 + *p++ - '0'; - copystrings |= 1 << n; - continue; - - case 'G': - while(isdigit(*p)) n = n * 10 + *p++ - '0'; - getstrings |= 1 << n; - continue; - - case 'L': - getlist = 1; - continue; - - case 'N': - options |= PCRE_NOTEMPTY; - continue; - - case 'O': - while(isdigit(*p)) n = n * 10 + *p++ - '0'; - if (n <= (int)(sizeof(offsets)/sizeof(int))) size_offsets = n; - continue; - - case 'Z': - options |= PCRE_NOTEOL; - continue; - } - *q++ = c; - } - *q = 0; - len = q - dbuffer; - - /* Handle matching via the POSIX interface, which does not - support timing. */ - -#if !defined NOPOSIX - if (posix || do_posix) - { - int rc; - int eflags = 0; - regmatch_t pmatch[sizeof(offsets)/sizeof(int)]; - if ((options & PCRE_NOTBOL) != 0) eflags |= REG_NOTBOL; - if ((options & PCRE_NOTEOL) != 0) eflags |= REG_NOTEOL; - - rc = regexec(&preg, (const char *)bptr, size_offsets, pmatch, eflags); - - if (rc != 0) - { - (void)regerror(rc, &preg, (char *)buffer, sizeof(buffer)); - fprintf(outfile, "No match: POSIX code %d: %s\n", rc, buffer); - } - else - { - size_t i; - for (i = 0; i < size_offsets; i++) - { - if (pmatch[i].rm_so >= 0) - { - fprintf(outfile, "%2d: ", (int)i); - pchars(dbuffer + pmatch[i].rm_so, - pmatch[i].rm_eo - pmatch[i].rm_so); - fprintf(outfile, "\n"); - if (i == 0 && do_showrest) - { - fprintf(outfile, " 0+ "); - pchars(dbuffer + pmatch[i].rm_eo, len - pmatch[i].rm_eo); - fprintf(outfile, "\n"); - } - } - } - } - } - - /* Handle matching via the native interface - repeats for /g and /G */ - - else -#endif /* !defined NOPOSIX */ - - for (;; gmatched++) /* Loop for /g or /G */ - { - if (timeit) - { - register int i; - clock_t time_taken; - clock_t start_time = clock(); - for (i = 0; i < LOOPREPEAT; i++) - count = pcre_exec(re, extra, (char *)bptr, len, - start_offset, options | g_notempty, offsets, size_offsets); - time_taken = clock() - start_time; - fprintf(outfile, "Execute time %.3f milliseconds\n", - ((double)time_taken * 1000.0)/ - ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC)); - } - - count = pcre_exec(re, extra, (char *)bptr, len, - start_offset, options | g_notempty, offsets, size_offsets); - - if (count == 0) - { - fprintf(outfile, "Matched, but too many substrings\n"); - count = size_offsets/3; - } - - /* Matched */ - - if (count >= 0) - { - int i; - for (i = 0; i < count * 2; i += 2) - { - if (offsets[i] < 0) - fprintf(outfile, "%2d: \n", i/2); - else - { - fprintf(outfile, "%2d: ", i/2); - pchars(bptr + offsets[i], offsets[i+1] - offsets[i]); - fprintf(outfile, "\n"); - if (i == 0) - { - if (do_showrest) - { - fprintf(outfile, " 0+ "); - pchars(bptr + offsets[i+1], len - offsets[i+1]); - fprintf(outfile, "\n"); - } - } - } - } - - for (i = 0; i < 32; i++) - { - if ((copystrings & (1 << i)) != 0) - { - char copybuffer[16]; - int rc = pcre_copy_substring((char *)bptr, offsets, count, - i, copybuffer, sizeof(copybuffer)); - if (rc < 0) - fprintf(outfile, "copy substring %d failed %d\n", i, rc); - else - fprintf(outfile, "%2dC %s (%d)\n", i, copybuffer, rc); - } - } - - for (i = 0; i < 32; i++) - { - if ((getstrings & (1 << i)) != 0) - { - const char *substring; - int rc = pcre_get_substring((char *)bptr, offsets, count, - i, &substring); - if (rc < 0) - fprintf(outfile, "get substring %d failed %d\n", i, rc); - else - { - fprintf(outfile, "%2dG %s (%d)\n", i, substring, rc); - free((void *)substring); - } - } - } - - if (getlist) - { - const char **stringlist; - int rc = pcre_get_substring_list((char *)bptr, offsets, count, - &stringlist); - if (rc < 0) - fprintf(outfile, "get substring list failed %d\n", rc); - else - { - for (i = 0; i < count; i++) - fprintf(outfile, "%2dL %s\n", i, stringlist[i]); - if (stringlist[i] != NULL) - fprintf(outfile, "string list not terminated by NULL\n"); - free((void *)stringlist); - } - } - } - - /* Failed to match. If this is a /g or /G loop and we previously set - g_notempty after a null match, this is not necessarily the end. - We want to advance the start offset, and continue. Fudge the offset - values to achieve this. We won't be at the end of the string - that - was checked before setting g_notempty. */ - - else - { - if (g_notempty != 0) - { - offsets[0] = start_offset; - offsets[1] = start_offset + 1; - } - else - { - if (gmatched == 0) /* Error if no previous matches */ - { - if (count == -1) fprintf(outfile, "No match\n"); - else fprintf(outfile, "Error %d\n", count); - } - break; /* Out of the /g loop */ - } - } - - /* If not /g or /G we are done */ - - if (!do_g && !do_G) break; - - /* If we have matched an empty string, first check to see if we are at - the end of the subject. If so, the /g loop is over. Otherwise, mimic - what Perl's /g options does. This turns out to be rather cunning. First - we set PCRE_NOTEMPTY and PCRE_ANCHORED and try the match again at the - same point. If this fails (picked up above) we advance to the next - character. */ - - g_notempty = 0; - if (offsets[0] == offsets[1]) - { - if (offsets[0] == len) break; - g_notempty = PCRE_NOTEMPTY | PCRE_ANCHORED; - } - - /* For /g, update the start offset, leaving the rest alone */ - - if (do_g) start_offset = offsets[1]; - - /* For /G, update the pointer and length */ - - else - { - bptr += offsets[1]; - len -= offsets[1]; - } - } /* End of loop for /g and /G */ - } /* End of loop for data lines */ - - CONTINUE: - -#if !defined NOPOSIX - if (posix || do_posix) regfree(&preg); -#endif - - if (re != NULL) free(re); - if (extra != NULL) free(extra); - if (tables != NULL) - { - free((void *)tables); - setlocale(LC_CTYPE, "C"); - } - } - -fprintf(outfile, "\n"); -return 0; -} - -/* End */ diff --git a/srclib/pcre/perltest b/srclib/pcre/perltest deleted file mode 100755 index 1e96c792b9..0000000000 --- a/srclib/pcre/perltest +++ /dev/null @@ -1,169 +0,0 @@ -#! /usr/bin/perl - -# Program for testing regular expressions with perl to check that PCRE handles -# them the same. - - -# Function for turning a string into a string of printing chars - -sub pchars { -my($t) = ""; - -foreach $c (split(//, @_[0])) - { - if (ord $c >= 32 && ord $c < 127) { $t .= $c; } - else { $t .= sprintf("\\x%02x", ord $c); } - } -$t; -} - - - -# Read lines from named file or stdin and write to named file or stdout; lines -# consist of a regular expression, in delimiters and optionally followed by -# options, followed by a set of test data, terminated by an empty line. - -# Sort out the input and output files - -if (@ARGV > 0) - { - open(INFILE, "<$ARGV[0]") || die "Failed to open $ARGV[0]\n"; - $infile = "INFILE"; - } -else { $infile = "STDIN"; } - -if (@ARGV > 1) - { - open(OUTFILE, ">$ARGV[1]") || die "Failed to open $ARGV[1]\n"; - $outfile = "OUTFILE"; - } -else { $outfile = "STDOUT"; } - -printf($outfile "Perl $] Regular Expressions\n\n"); - -# Main loop - -NEXT_RE: -for (;;) - { - printf " re> " if $infile eq "STDIN"; - last if ! ($_ = <$infile>); - printf $outfile "$_" if $infile ne "STDIN"; - next if ($_ eq ""); - - $pattern = $_; - - while ($pattern !~ /^\s*(.).*\1/s) - { - printf " > " if $infile eq "STDIN"; - last if ! ($_ = <$infile>); - printf $outfile "$_" if $infile ne "STDIN"; - $pattern .= $_; - } - - chomp($pattern); - $pattern =~ s/\s+$//; - - # The private /+ modifier means "print $' afterwards". We use it - # only on the end of patterns to make it easy to chop off here. - - $showrest = ($pattern =~ s/\+(?=[a-z]*$)//); - - # Check that the pattern is valid - - eval "\$_ =~ ${pattern}"; - if ($@) - { - printf $outfile "Error: $@"; - next NEXT_RE; - } - - # If the /g modifier is present, we want to put a loop round the matching; - # otherwise just a single "if". - - $cmd = ($pattern =~ /g[a-z]*$/)? "while" : "if"; - - # If the pattern is actually the null string, Perl uses the most recently - # executed (and successfully compiled) regex is used instead. This is a - # nasty trap for the unwary! The PCRE test suite does contain null strings - # in places - if they are allowed through here all sorts of weird and - # unexpected effects happen. To avoid this, we replace such patterns with - # a non-null pattern that has the same effect. - - $pattern = "/(?#)/$2" if ($pattern =~ /^(.)\1(.*)$/); - - # Read data lines and test them - - for (;;) - { - printf "data> " if $infile eq "STDIN"; - last NEXT_RE if ! ($_ = <$infile>); - chomp; - printf $outfile "$_\n" if $infile ne "STDIN"; - - s/\s+$//; - s/^\s+//; - - last if ($_ eq ""); - - $x = eval "\"$_\""; # To get escapes processed - - # Empty array for holding results, then do the matching. - - @subs = (); - - eval "${cmd} (\$x =~ ${pattern}) {" . - "push \@subs,\$&;" . - "push \@subs,\$1;" . - "push \@subs,\$2;" . - "push \@subs,\$3;" . - "push \@subs,\$4;" . - "push \@subs,\$5;" . - "push \@subs,\$6;" . - "push \@subs,\$7;" . - "push \@subs,\$8;" . - "push \@subs,\$9;" . - "push \@subs,\$10;" . - "push \@subs,\$11;" . - "push \@subs,\$12;" . - "push \@subs,\$13;" . - "push \@subs,\$14;" . - "push \@subs,\$15;" . - "push \@subs,\$16;" . - "push \@subs,\$'; }"; - - if ($@) - { - printf $outfile "Error: $@\n"; - next NEXT_RE; - } - elsif (scalar(@subs) == 0) - { - printf $outfile "No match\n"; - } - else - { - while (scalar(@subs) != 0) - { - printf $outfile (" 0: %s\n", &pchars($subs[0])); - printf $outfile (" 0+ %s\n", &pchars($subs[17])) if $showrest; - $last_printed = 0; - for ($i = 1; $i <= 16; $i++) - { - if (defined $subs[$i]) - { - while ($last_printed++ < $i-1) - { printf $outfile ("%2d: \n", $last_printed); } - printf $outfile ("%2d: %s\n", $i, &pchars($subs[$i])); - $last_printed = $i; - } - } - splice(@subs, 0, 18); - } - } - } - } - -printf $outfile "\n"; - -# End diff --git a/srclib/pcre/pgrep.c b/srclib/pcre/pgrep.c deleted file mode 100644 index ad1b87eae9..0000000000 --- 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/srclib/pcre/study.c b/srclib/pcre/study.c deleted file mode 100644 index 676db94665..0000000000 --- a/srclib/pcre/study.c +++ /dev/null @@ -1,397 +0,0 @@ -/************************************************* -* Perl-Compatible Regular Expressions * -*************************************************/ - -/* -This is a library of functions to support regular expressions whose syntax -and semantics are as close as possible to those of the Perl 5 language. See -the file Tech.Notes for some information on the internals. - -Written by: Philip Hazel - - Copyright (c) 1997-2000 University of Cambridge - ------------------------------------------------------------------------------ -Permission is granted to anyone to use this software for any purpose on any -computer system, and to redistribute it freely, subject to the following -restrictions: - -1. This software 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. - -2. The origin of this software must not be misrepresented, either by - explicit claim or by omission. - -3. Altered versions must be plainly marked as such, and must not be - misrepresented as being the original software. - -4. If PCRE is embedded in any software that is released under the GNU - General Purpose Licence (GPL), then the terms of that licence shall - supersede any condition above with which it is incompatible. ------------------------------------------------------------------------------ -*/ - - -/* Include the internals header, which itself includes Standard C headers plus -the external pcre header. */ - -#include "internal.h" - - - -/************************************************* -* Set a bit and maybe its alternate case * -*************************************************/ - -/* Given a character, set its bit in the table, and also the bit for the other -version of a letter if we are caseless. - -Arguments: - start_bits points to the bit map - c is the character - caseless the caseless flag - cd the block with char table pointers - -Returns: nothing -*/ - -static void -set_bit(uschar *start_bits, int c, BOOL caseless, compile_data *cd) -{ -start_bits[c/8] |= (1 << (c&7)); -if (caseless && (cd->ctypes[c] & ctype_letter) != 0) - start_bits[cd->fcc[c]/8] |= (1 << (cd->fcc[c]&7)); -} - - - -/************************************************* -* Create bitmap of starting chars * -*************************************************/ - -/* This function scans a compiled unanchored expression and attempts to build a -bitmap of the set of initial characters. If it can't, it returns FALSE. As time -goes by, we may be able to get more clever at doing this. - -Arguments: - code points to an expression - start_bits points to a 32-byte table, initialized to 0 - caseless the current state of the caseless flag - cd the block with char table pointers - -Returns: TRUE if table built, FALSE otherwise -*/ - -static BOOL -set_start_bits(const uschar *code, uschar *start_bits, BOOL caseless, - compile_data *cd) -{ -register int c; - -/* This next statement and the later reference to dummy are here in order to -trick the optimizer of the IBM C compiler for OS/2 into generating correct -code. Apparently IBM isn't going to fix the problem, and we would rather not -disable optimization (in this module it actually makes a big difference, and -the pcre module can use all the optimization it can get). */ - -volatile int dummy; - -do - { - const uschar *tcode = code + 3; - BOOL try_next = TRUE; - - while (try_next) - { - try_next = FALSE; - - /* If a branch starts with a bracket or a positive lookahead assertion, - recurse to set bits from within them. That's all for this branch. */ - - if ((int)*tcode >= OP_BRA || *tcode == OP_ASSERT) - { - if (!set_start_bits(tcode, start_bits, caseless, cd)) - return FALSE; - } - - else switch(*tcode) - { - default: - return FALSE; - - /* Skip over lookbehind and negative lookahead assertions */ - - case OP_ASSERT_NOT: - case OP_ASSERTBACK: - case OP_ASSERTBACK_NOT: - try_next = TRUE; - do tcode += (tcode[1] << 8) + tcode[2]; while (*tcode == OP_ALT); - tcode += 3; - break; - - /* Skip over an option setting, changing the caseless flag */ - - case OP_OPT: - caseless = (tcode[1] & PCRE_CASELESS) != 0; - tcode += 2; - try_next = TRUE; - break; - - /* BRAZERO does the bracket, but carries on. */ - - case OP_BRAZERO: - case OP_BRAMINZERO: - if (!set_start_bits(++tcode, start_bits, caseless, cd)) - return FALSE; - dummy = 1; - do tcode += (tcode[1] << 8) + tcode[2]; while (*tcode == OP_ALT); - tcode += 3; - try_next = TRUE; - break; - - /* Single-char * or ? sets the bit and tries the next item */ - - case OP_STAR: - case OP_MINSTAR: - case OP_QUERY: - case OP_MINQUERY: - set_bit(start_bits, tcode[1], caseless, cd); - tcode += 2; - try_next = TRUE; - break; - - /* Single-char upto sets the bit and tries the next */ - - case OP_UPTO: - case OP_MINUPTO: - set_bit(start_bits, tcode[3], caseless, cd); - tcode += 4; - try_next = TRUE; - break; - - /* At least one single char sets the bit and stops */ - - case OP_EXACT: /* Fall through */ - tcode++; - - case OP_CHARS: /* Fall through */ - tcode++; - - case OP_PLUS: - case OP_MINPLUS: - set_bit(start_bits, tcode[1], caseless, cd); - break; - - /* Single character type sets the bits and stops */ - - case OP_NOT_DIGIT: - for (c = 0; c < 32; c++) - start_bits[c] |= ~cd->cbits[c+cbit_digit]; - break; - - case OP_DIGIT: - for (c = 0; c < 32; c++) - start_bits[c] |= cd->cbits[c+cbit_digit]; - break; - - case OP_NOT_WHITESPACE: - for (c = 0; c < 32; c++) - start_bits[c] |= ~cd->cbits[c+cbit_space]; - break; - - case OP_WHITESPACE: - for (c = 0; c < 32; c++) - start_bits[c] |= cd->cbits[c+cbit_space]; - break; - - case OP_NOT_WORDCHAR: - for (c = 0; c < 32; c++) - start_bits[c] |= ~cd->cbits[c+cbit_word]; - break; - - case OP_WORDCHAR: - for (c = 0; c < 32; c++) - start_bits[c] |= cd->cbits[c+cbit_word]; - break; - - /* One or more character type fudges the pointer and restarts, knowing - it will hit a single character type and stop there. */ - - case OP_TYPEPLUS: - case OP_TYPEMINPLUS: - tcode++; - try_next = TRUE; - break; - - case OP_TYPEEXACT: - tcode += 3; - try_next = TRUE; - break; - - /* Zero or more repeats of character types set the bits and then - try again. */ - - case OP_TYPEUPTO: - case OP_TYPEMINUPTO: - tcode += 2; /* Fall through */ - - case OP_TYPESTAR: - case OP_TYPEMINSTAR: - case OP_TYPEQUERY: - case OP_TYPEMINQUERY: - switch(tcode[1]) - { - case OP_NOT_DIGIT: - for (c = 0; c < 32; c++) - start_bits[c] |= ~cd->cbits[c+cbit_digit]; - break; - - case OP_DIGIT: - for (c = 0; c < 32; c++) - start_bits[c] |= cd->cbits[c+cbit_digit]; - break; - - case OP_NOT_WHITESPACE: - for (c = 0; c < 32; c++) - start_bits[c] |= ~cd->cbits[c+cbit_space]; - break; - - case OP_WHITESPACE: - for (c = 0; c < 32; c++) - start_bits[c] |= cd->cbits[c+cbit_space]; - break; - - case OP_NOT_WORDCHAR: - for (c = 0; c < 32; c++) - start_bits[c] |= ~cd->cbits[c+cbit_word]; - break; - - case OP_WORDCHAR: - for (c = 0; c < 32; c++) - start_bits[c] |= cd->cbits[c+cbit_word]; - break; - } - - tcode += 2; - try_next = TRUE; - break; - - /* Character class: set the bits and either carry on or not, - according to the repeat count. */ - - case OP_CLASS: - { - tcode++; - for (c = 0; c < 32; c++) start_bits[c] |= tcode[c]; - tcode += 32; - switch (*tcode) - { - case OP_CRSTAR: - case OP_CRMINSTAR: - case OP_CRQUERY: - case OP_CRMINQUERY: - tcode++; - try_next = TRUE; - break; - - case OP_CRRANGE: - case OP_CRMINRANGE: - if (((tcode[1] << 8) + tcode[2]) == 0) - { - tcode += 5; - try_next = TRUE; - } - break; - } - } - break; /* End of class handling */ - - } /* End of switch */ - } /* End of try_next loop */ - - code += (code[1] << 8) + code[2]; /* Advance to next branch */ - } -while (*code == OP_ALT); -return TRUE; -} - - - -/************************************************* -* Study a compiled expression * -*************************************************/ - -/* This function is handed a compiled expression that it must study to produce -information that will speed up the matching. It returns a pcre_extra block -which then gets handed back to pcre_exec(). - -Arguments: - re points to the compiled expression - options contains option bits - errorptr points to where to place error messages; - set NULL unless error - -Returns: pointer to a pcre_extra block, - NULL on error or if no optimization possible -*/ - -pcre_extra * -pcre_study(const pcre *external_re, int options, const char **errorptr) -{ -uschar start_bits[32]; -real_pcre_extra *extra; -const real_pcre *re = (const real_pcre *)external_re; -compile_data compile_block; - -*errorptr = NULL; - -if (re == NULL || re->magic_number != MAGIC_NUMBER) - { - *errorptr = "argument is not a compiled regular expression"; - return NULL; - } - -if ((options & ~PUBLIC_STUDY_OPTIONS) != 0) - { - *errorptr = "unknown or incorrect option bit(s) set"; - return NULL; - } - -/* For an anchored pattern, or an unchored pattern that has a first char, or a -multiline pattern that matches only at "line starts", no further processing at -present. */ - -if ((re->options & (PCRE_ANCHORED|PCRE_FIRSTSET|PCRE_STARTLINE)) != 0) - return NULL; - -/* Set the character tables in the block which is passed around */ - -compile_block.lcc = re->tables + lcc_offset; -compile_block.fcc = re->tables + fcc_offset; -compile_block.cbits = re->tables + cbits_offset; -compile_block.ctypes = re->tables + ctypes_offset; - -/* See if we can find a fixed set of initial characters for the pattern. */ - -memset(start_bits, 0, 32 * sizeof(uschar)); -if (!set_start_bits(re->code, start_bits, (re->options & PCRE_CASELESS) != 0, - &compile_block)) return NULL; - -/* Get an "extra" block and put the information therein. */ - -extra = (real_pcre_extra *)(pcre_malloc)(sizeof(real_pcre_extra)); - -if (extra == NULL) - { - *errorptr = "failed to get memory"; - return NULL; - } - -extra->options = PCRE_STUDY_MAPPED; -memcpy(extra->start_bits, start_bits, sizeof(start_bits)); - -return (pcre_extra *)extra; -} - -/* End of study.c */ diff --git a/srclib/pcre/testdata/testinput1 b/srclib/pcre/testdata/testinput1 deleted file mode 100644 index d72a2c580b..0000000000 --- a/srclib/pcre/testdata/testinput1 +++ /dev/null @@ -1,1901 +0,0 @@ -/the quick brown fox/ - the quick brown fox - The quick brown FOX - What do you know about the quick brown fox? - What do you know about THE QUICK BROWN FOX? - -/The quick brown fox/i - the quick brown fox - The quick brown FOX - What do you know about the quick brown fox? - What do you know about THE QUICK BROWN FOX? - -/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/ - abcd\t\n\r\f\a\e9;\$\\?caxyz - -/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/ - abxyzpqrrrabbxyyyypqAzz - abxyzpqrrrabbxyyyypqAzz - aabxyzpqrrrabbxyyyypqAzz - aaabxyzpqrrrabbxyyyypqAzz - aaaabxyzpqrrrabbxyyyypqAzz - abcxyzpqrrrabbxyyyypqAzz - aabcxyzpqrrrabbxyyyypqAzz - aaabcxyzpqrrrabbxyyyypAzz - aaabcxyzpqrrrabbxyyyypqAzz - aaabcxyzpqrrrabbxyyyypqqAzz - aaabcxyzpqrrrabbxyyyypqqqAzz - aaabcxyzpqrrrabbxyyyypqqqqAzz - aaabcxyzpqrrrabbxyyyypqqqqqAzz - aaabcxyzpqrrrabbxyyyypqqqqqqAzz - aaaabcxyzpqrrrabbxyyyypqAzz - abxyzzpqrrrabbxyyyypqAzz - aabxyzzzpqrrrabbxyyyypqAzz - aaabxyzzzzpqrrrabbxyyyypqAzz - aaaabxyzzzzpqrrrabbxyyyypqAzz - abcxyzzpqrrrabbxyyyypqAzz - aabcxyzzzpqrrrabbxyyyypqAzz - aaabcxyzzzzpqrrrabbxyyyypqAzz - aaaabcxyzzzzpqrrrabbxyyyypqAzz - aaaabcxyzzzzpqrrrabbbxyyyypqAzz - aaaabcxyzzzzpqrrrabbbxyyyyypqAzz - aaabcxyzpqrrrabbxyyyypABzz - aaabcxyzpqrrrabbxyyyypABBzz - >>>aaabxyzpqrrrabbxyyyypqAzz - >aaaabxyzpqrrrabbxyyyypqAzz - >>>>abcxyzpqrrrabbxyyyypqAzz - *** Failers - abxyzpqrrabbxyyyypqAzz - abxyzpqrrrrabbxyyyypqAzz - abxyzpqrrrabxyyyypqAzz - aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz - aaaabcxyzzzzpqrrrabbbxyyypqAzz - aaabcxyzpqrrrabbxyyyypqqqqqqqAzz - -/^(abc){1,2}zz/ - abczz - abcabczz - *** Failers - zz - abcabcabczz - >>abczz - -/^(b+?|a){1,2}?c/ - bc - bbc - bbbc - bac - bbac - aac - abbbbbbbbbbbc - bbbbbbbbbbbac - *** Failers - aaac - abbbbbbbbbbbac - -/^(b+|a){1,2}c/ - bc - bbc - bbbc - bac - bbac - aac - abbbbbbbbbbbc - bbbbbbbbbbbac - *** Failers - aaac - abbbbbbbbbbbac - -/^(b+|a){1,2}?bc/ - bbc - -/^(b*|ba){1,2}?bc/ - babc - bbabc - bababc - *** Failers - bababbc - babababc - -/^(ba|b*){1,2}?bc/ - babc - bbabc - bababc - *** Failers - bababbc - babababc - -/^\ca\cA\c[\c{\c:/ - \x01\x01\e;z - -/^[ab\]cde]/ - athing - bthing - ]thing - cthing - dthing - ething - *** Failers - fthing - [thing - \\thing - -/^[]cde]/ - ]thing - cthing - dthing - ething - *** Failers - athing - fthing - -/^[^ab\]cde]/ - fthing - [thing - \\thing - *** Failers - athing - bthing - ]thing - cthing - dthing - ething - -/^[^]cde]/ - athing - fthing - *** Failers - ]thing - cthing - dthing - ething - -/^\/ - - -/^ÿ/ - ÿ - -/^[0-9]+$/ - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 100 - *** Failers - abc - -/^.*nter/ - enter - inter - uponter - -/^xxx[0-9]+$/ - xxx0 - xxx1234 - *** Failers - xxx - -/^.+[0-9][0-9][0-9]$/ - x123 - xx123 - 123456 - *** Failers - 123 - x1234 - -/^.+?[0-9][0-9][0-9]$/ - x123 - xx123 - 123456 - *** Failers - 123 - x1234 - -/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/ - abc!pqr=apquxz.ixr.zzz.ac.uk - *** Failers - !pqr=apquxz.ixr.zzz.ac.uk - abc!=apquxz.ixr.zzz.ac.uk - abc!pqr=apquxz:ixr.zzz.ac.uk - abc!pqr=apquxz.ixr.zzz.ac.ukk - -/:/ - Well, we need a colon: somewhere - *** Fail if we don't - -/([\da-f:]+)$/i - 0abc - abc - fed - E - :: - 5f03:12C0::932e - fed def - Any old stuff - *** Failers - 0zzz - gzzz - fed\x20 - Any old rubbish - -/^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/ - .1.2.3 - A.12.123.0 - *** Failers - .1.2.3333 - 1.2.3 - 1234.2.3 - -/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/ - 1 IN SOA non-sp1 non-sp2( - 1 IN SOA non-sp1 non-sp2 ( - *** Failers - 1IN SOA non-sp1 non-sp2( - -/^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/ - a. - Z. - 2. - ab-c.pq-r. - sxk.zzz.ac.uk. - x-.y-. - *** Failers - -abc.peq. - -/^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/ - *.a - *.b0-a - *.c3-b.c - *.c-a.b-c - *** Failers - *.0 - *.a- - *.a-b.c- - *.c-a.0-c - -/^(?=ab(de))(abd)(e)/ - abde - -/^(?!(ab)de|x)(abd)(f)/ - abdf - -/^(?=(ab(cd)))(ab)/ - abcd - -/^[\da-f](\.[\da-f])*$/i - a.b.c.d - A.B.C.D - a.b.c.1.2.3.C - -/^\".*\"\s*(;.*)?$/ - \"1234\" - \"abcd\" ; - \"\" ; rhubarb - *** Failers - \"1234\" : things - -/^$/ - \ - *** Failers - -/ ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/x - ab c - *** Failers - abc - ab cde - -/(?x) ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/ - ab c - *** Failers - abc - ab cde - -/^ a\ b[c ]d $/x - a bcd - a b d - *** Failers - abcd - ab d - -/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/ - abcdefhijklm - -/^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/ - abcdefhijklm - -/^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/ - a+ Z0+\x08\n\x1d\x12 - -/^[.^$|()*+?{,}]+/ - .^\$(*+)|{?,?} - -/^a*\w/ - z - az - aaaz - a - aa - aaaa - a+ - aa+ - -/^a*?\w/ - z - az - aaaz - a - aa - aaaa - a+ - aa+ - -/^a+\w/ - az - aaaz - aa - aaaa - aa+ - -/^a+?\w/ - az - aaaz - aa - aaaa - aa+ - -/^\d{8}\w{2,}/ - 1234567890 - 12345678ab - 12345678__ - *** Failers - 1234567 - -/^[aeiou\d]{4,5}$/ - uoie - 1234 - 12345 - aaaaa - *** Failers - 123456 - -/^[aeiou\d]{4,5}?/ - uoie - 1234 - 12345 - aaaaa - 123456 - -/\A(abc|def)=(\1){2,3}\Z/ - abc=abcabc - def=defdefdef - *** Failers - abc=defdef - -/^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/ - abcdefghijkcda2 - abcdefghijkkkkcda2 - -/(cat(a(ract|tonic)|erpillar)) \1()2(3)/ - cataract cataract23 - catatonic catatonic23 - caterpillar caterpillar23 - - -/^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/ - From abcd Mon Sep 01 12:33:02 1997 - -/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/ - From abcd Mon Sep 01 12:33:02 1997 - From abcd Mon Sep 1 12:33:02 1997 - *** Failers - From abcd Sep 01 12:33:02 1997 - -/^12.34/s - 12\n34 - 12\r34 - -/\w+(?=\t)/ - the quick brown\t fox - -/foo(?!bar)(.*)/ - foobar is foolish see? - -/(?:(?!foo)...|^.{0,2})bar(.*)/ - foobar crowbar etc - barrel - 2barrel - A barrel - -/^(\D*)(?=\d)(?!123)/ - abc456 - *** Failers - abc123 - -/^1234(?# test newlines - inside)/ - 1234 - -/^1234 #comment in extended re - /x - 1234 - -/#rhubarb - abcd/x - abcd - -/^abcd#rhubarb/x - abcd - -/^(a)\1{2,3}(.)/ - aaab - aaaab - aaaaab - aaaaaab - -/(?!^)abc/ - the abc - *** Failers - abc - -/(?=^)abc/ - abc - *** Failers - the abc - -/^[ab]{1,3}(ab*|b)/ - aabbbbb - -/^[ab]{1,3}?(ab*|b)/ - aabbbbb - -/^[ab]{1,3}?(ab*?|b)/ - aabbbbb - -/^[ab]{1,3}(ab*?|b)/ - aabbbbb - -/ (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* # optional leading comment -(?: (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -" (?: # opening quote... -[^\\\x80-\xff\n\015"] # Anything except backslash and quote -| # or -\\ [^\x80-\xff] # Escaped something (something != CR) -)* " # closing quote -) # initial word -(?: (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* \. (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -" (?: # opening quote... -[^\\\x80-\xff\n\015"] # Anything except backslash and quote -| # or -\\ [^\x80-\xff] # Escaped something (something != CR) -)* " # closing quote -) )* # further okay, if led by a period -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* @ (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| \[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) # initial subdomain -(?: # -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* \. # if led by a period... -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| \[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) # ...further okay -)* -# address -| # or -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -" (?: # opening quote... -[^\\\x80-\xff\n\015"] # Anything except backslash and quote -| # or -\\ [^\x80-\xff] # Escaped something (something != CR) -)* " # closing quote -) # one word, optionally followed by.... -(?: -[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] | # atom and space parts, or... -\( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) | # comments, or... - -" (?: # opening quote... -[^\\\x80-\xff\n\015"] # Anything except backslash and quote -| # or -\\ [^\x80-\xff] # Escaped something (something != CR) -)* " # closing quote -# quoted strings -)* -< (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* # leading < -(?: @ (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| \[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) # initial subdomain -(?: # -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* \. # if led by a period... -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| \[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) # ...further okay -)* - -(?: (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* , (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* @ (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| \[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) # initial subdomain -(?: # -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* \. # if led by a period... -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| \[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) # ...further okay -)* -)* # further okay, if led by comma -: # closing colon -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* )? # optional route -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -" (?: # opening quote... -[^\\\x80-\xff\n\015"] # Anything except backslash and quote -| # or -\\ [^\x80-\xff] # Escaped something (something != CR) -)* " # closing quote -) # initial word -(?: (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* \. (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -" (?: # opening quote... -[^\\\x80-\xff\n\015"] # Anything except backslash and quote -| # or -\\ [^\x80-\xff] # Escaped something (something != CR) -)* " # closing quote -) )* # further okay, if led by a period -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* @ (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| \[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) # initial subdomain -(?: # -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* \. # if led by a period... -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| \[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) # ...further okay -)* -# address spec -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* > # trailing > -# name and address -) (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* # optional trailing comment -/x - Alan Other - - user\@dom.ain - \"A. Other\" (a comment) - A. Other (a comment) - \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay - A missing angle @,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -# Atom -| # or -" # " -[^\\\x80-\xff\n\015"] * # normal -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* -" # " -# Quoted string -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -\. -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -# Atom -| # or -" # " -[^\\\x80-\xff\n\015"] * # normal -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* -" # " -# Quoted string -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# additional words -)* -@ -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -\[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -(?: -\. -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -\[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -)* -# address -| # or -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -# Atom -| # or -" # " -[^\\\x80-\xff\n\015"] * # normal -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* -" # " -# Quoted string -) -# leading word -[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # "normal" atoms and or spaces -(?: -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -| -" # " -[^\\\x80-\xff\n\015"] * # normal -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* -" # " -) # "special" comment or quoted string -[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # more "normal" -)* -< -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# < -(?: -@ -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -\[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -(?: -\. -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -\[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -)* -(?: , -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -@ -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -\[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -(?: -\. -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -\[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -)* -)* # additional domains -: -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -)? # optional route -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -# Atom -| # or -" # " -[^\\\x80-\xff\n\015"] * # normal -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* -" # " -# Quoted string -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -\. -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -# Atom -| # or -" # " -[^\\\x80-\xff\n\015"] * # normal -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* -" # " -# Quoted string -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# additional words -)* -@ -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -\[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -(?: -\. -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -\[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -)* -# address spec -> # > -# name and address -) -/x - Alan Other - - user\@dom.ain - \"A. Other\" (a comment) - A. Other (a comment) - \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay - A missing angle / - abcghinop - -/<.*?>/ - abcghinop - -/<.*>/U - abcghinop - -/<.*>(?U)/ - abcghinop - -/<.*?>/U - abcghinop - -/={3,}/U - abc========def - -/(?U)={3,}?/ - abc========def - -/(?^abc)/m - abc - def\nabc - *** Failers - defabc - -/(?<=ab(c+)d)ef/ - -/(?<=ab(?<=c+)d)ef/ - -/(?<=ab(c|de)f)g/ - -/The next three are in testinput2 because they have variable length branches/ - -/(?<=bullock|donkey)-cart/ - the bullock-cart - a donkey-cart race - *** Failers - cart - horse-and-cart - -/(?<=ab(?i)x|y|z)/ - -/(?>.*)(?<=(abcd)|(xyz))/ - alphabetabcd - endingxyz - -/(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/ - abxyZZ - abXyZZ - ZZZ - zZZ - bZZ - BZZ - *** Failers - ZZ - abXYZZ - zzz - bzz - -/(?[^()]+) # Either a sequence of non-brackets (no backtracking) - | # Or - (?R) # Recurse - i.e. nested bracketed string - )* # Zero or more contents - \) # Closing ) - /x - (abcd) - (abcd)xyz - xyz(abcd) - (ab(xy)cd)pqr - (ab(xycd)pqr - () abc () - 12(abcde(fsh)xyz(foo(bar))lmno)89 - *** Failers - abcd - abcd) - (abcd - -/\( ( (?>[^()]+) | (?R) )* \) /xg - (ab(xy)cd)pqr - 1(abcd)(x(y)z)pqr - -/\( (?: (?>[^()]+) | (?R) ) \) /x - (abcd) - (ab(xy)cd) - (a(b(c)d)e) - ((ab)) - *** Failers - () - -/\( (?: (?>[^()]+) | (?R) )? \) /x - () - 12(abcde(fsh)xyz(foo(bar))lmno)89 - -/\( ( (?>[^()]+) | (?R) )* \) /x - (ab(xy)cd) - -/\( ( ( (?>[^()]+) | (?R) )* ) \) /x - (ab(xy)cd) - -/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /x - (ab(xy)cd) - (123ab(xy)cd) - -/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /x - (ab(xy)cd) - (123ab(xy)cd) - -/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /x - (ab(xy)cd) - -/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /x - (abcd(xyz

    qrs)123) - -/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /x - (ab(cd)ef) - (ab(cd(ef)gh)ij) - -/^[[:alnum:]]/D - -/^[[:alpha:]]/D - -/^[[:ascii:]]/D - -/^[[:cntrl:]]/D - -/^[[:digit:]]/D - -/^[[:graph:]]/D - -/^[[:lower:]]/D - -/^[[:print:]]/D - -/^[[:punct:]]/D - -/^[[:space:]]/D - -/^[[:upper:]]/D - -/^[[:xdigit:]]/D - -/^[[:word:]]/D - -/^[[:^cntrl:]]/D - -/^[12[:^digit:]]/D - -/[01[:alpha:]%]/D - -/[[.ch.]]/ - -/[[=ch=]]/ - -/[[:rhubarb:]]/ - -/[[:upper:]]/i - A - a - -/[[:lower:]]/i - A - a - -/((?-i)[[:lower:]])[[:lower:]]/i - ab - aB - *** Failers - Ab - AB - -/ End of test input / diff --git a/srclib/pcre/testdata/testinput3 b/srclib/pcre/testdata/testinput3 deleted file mode 100644 index 67d39f3ac5..0000000000 --- a/srclib/pcre/testdata/testinput3 +++ /dev/null @@ -1,1710 +0,0 @@ -/(?.*/)foo" - /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/ - -"(?>.*/)foo" - /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo - -/(?>(\.\d\d[1-9]?))\d+/ - 1.230003938 - 1.875000282 - *** Failers - 1.235 - -/^((?>\w+)|(?>\s+))*$/ - now is the time for all good men to come to the aid of the party - *** Failers - this is not a line with only words and spaces! - -/(\d+)(\w)/ - 12345a - 12345+ - -/((?>\d+))(\w)/ - 12345a - *** Failers - 12345+ - -/(?>a+)b/ - aaab - -/((?>a+)b)/ - aaab - -/(?>(a+))b/ - aaab - -/(?>b)+/ - aaabbbccc - -/(?>a+|b+|c+)*c/ - aaabbbbccccd - -/((?>[^()]+)|\([^()]*\))+/ - ((abc(ade)ufh()()x - -/\(((?>[^()]+)|\([^()]+\))+\)/ - (abc) - (abc(def)xyz) - *** Failers - ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - -/a(?-i)b/i - ab - *** Failers - Ab - aB - AB - -/(a (?x)b c)d e/ - a bcd e - *** Failers - a b cd e - abcd e - a bcde - -/(a b(?x)c d (?-x)e f)/ - a bcde f - *** Failers - abcdef - -/(a(?i)b)c/ - abc - aBc - *** Failers - abC - aBC - Abc - ABc - ABC - AbC - -/a(?i:b)c/ - abc - aBc - *** Failers - ABC - abC - aBC - -/a(?i:b)*c/ - aBc - aBBc - *** Failers - aBC - aBBC - -/a(?=b(?i)c)\w\wd/ - abcd - abCd - *** Failers - aBCd - abcD - -/(?s-i:more.*than).*million/i - more than million - more than MILLION - more \n than Million - *** Failers - MORE THAN MILLION - more \n than \n million - -/(?:(?s-i)more.*than).*million/i - more than million - more than MILLION - more \n than Million - *** Failers - MORE THAN MILLION - more \n than \n million - -/(?>a(?i)b+)+c/ - abc - aBbc - aBBc - *** Failers - Abc - abAb - abbC - -/(?=a(?i)b)\w\wc/ - abc - aBc - *** Failers - Ab - abC - aBC - -/(?<=a(?i)b)(\w\w)c/ - abxxc - aBxxc - *** Failers - Abxxc - ABxxc - abxxC - -/(?:(a)|b)(?(1)A|B)/ - aA - bB - *** Failers - aB - bA - -/^(a)?(?(1)a|b)+$/ - aa - b - bb - *** Failers - ab - -/^(?(?=abc)\w{3}:|\d\d)$/ - abc: - 12 - *** Failers - 123 - xyz - -/^(?(?!abc)\d\d|\w{3}:)$/ - abc: - 12 - *** Failers - 123 - xyz - -/(?(?<=foo)bar|cat)/ - foobar - cat - fcat - focat - *** Failers - foocat - -/(?(?a*)*/ - a - aa - aaaa - -/(abc|)+/ - abc - abcabc - abcabcabc - xyz - -/([a]*)*/ - a - aaaaa - -/([ab]*)*/ - a - b - ababab - aaaabcde - bbbb - -/([^a]*)*/ - b - bbbb - aaa - -/([^ab]*)*/ - cccc - abab - -/([a]*?)*/ - a - aaaa - -/([ab]*?)*/ - a - b - abab - baba - -/([^a]*?)*/ - b - bbbb - aaa - -/([^ab]*?)*/ - c - cccc - baba - -/(?>a*)*/ - a - aaabcde - -/((?>a*))*/ - aaaaa - aabbaa - -/((?>a*?))*/ - aaaaa - aabbaa - -/(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /x - 12-sep-98 - 12-09-98 - *** Failers - sep-12-98 - -/(?<=(foo))bar\1/ - foobarfoo - foobarfootling - *** Failers - foobar - barfoo - -/(?i:saturday|sunday)/ - saturday - sunday - Saturday - Sunday - SATURDAY - SUNDAY - SunDay - -/(a(?i)bc|BB)x/ - abcx - aBCx - bbx - BBx - *** Failers - abcX - aBCX - bbX - BBX - -/^([ab](?i)[cd]|[ef])/ - ac - aC - bD - elephant - Europe - frog - France - *** Failers - Africa - -/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/ - ab - aBd - xy - xY - zebra - Zambesi - *** Failers - aCD - XY - -/(?<=foo\n)^bar/m - foo\nbar - *** Failers - bar - baz\nbar - -/(?<=(?]&/ - <&OUT - -/^(a\1?){4}$/ - aaaaaaaaaa - *** Failers - AB - aaaaaaaaa - aaaaaaaaaaa - -/^(a(?(1)\1)){4}$/ - aaaaaaaaaa - *** Failers - aaaaaaaaa - aaaaaaaaaaa - -/(?:(f)(o)(o)|(b)(a)(r))*/ - foobar - -/(?<=a)b/ - ab - *** Failers - cb - b - -/(?a+)ab/ - -/(?>a+)b/ - aaab - -/([[:]+)/ - a:[b]: - -/([[=]+)/ - a=[b]= - -/([[.]+)/ - a.[b]. - -/((?>a+)b)/ - aaab - -/(?>(a+))b/ - aaab - -/((?>[^()]+)|\([^()]*\))+/ - ((abc(ade)ufh()()x - -/a\Z/ - *** Failers - aaab - a\nb\n - -/b\Z/ - a\nb\n - -/b\z/ - -/b\Z/ - a\nb - -/b\z/ - a\nb - *** Failers - -/^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/ - a - abc - a-b - 0-9 - a.b - 5.6.7 - the.quick.brown.fox - a100.b200.300c - 12-ab.1245 - ***Failers - \ - .a - -a - a- - a. - a_b - a.- - a.. - ab..bc - the.quick.brown.fox- - the.quick.brown.fox. - the.quick.brown.fox_ - the.quick.brown.fox+ - -/(?>.*)(?<=(abcd|wxyz))/ - alphabetabcd - endingwxyz - *** Failers - a rather long string that doesn't end with one of them - -/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/ - word cat dog elephant mussel cow horse canary baboon snake shark otherword - word cat dog elephant mussel cow horse canary baboon snake shark - -/word (?>[a-zA-Z0-9]+ ){0,30}otherword/ - word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope - -/(?<=\d{3}(?!999))foo/ - 999foo - 123999foo - *** Failers - 123abcfoo - -/(?<=(?!...999)\d{3})foo/ - 999foo - 123999foo - *** Failers - 123abcfoo - -/(?<=\d{3}(?!999)...)foo/ - 123abcfoo - 123456foo - *** Failers - 123999foo - -/(?<=\d{3}...)(?\s*)=(?>\s*) # find Z)+|A)*/ - ZABCDEFG - -/((?>)+|A)*/ - ZABCDEFG - -/a*/g - abbab - -/ End of test input / diff --git a/srclib/pcre/testdata/testinput4 b/srclib/pcre/testdata/testinput4 deleted file mode 100644 index c23b52aceb..0000000000 --- a/srclib/pcre/testdata/testinput4 +++ /dev/null @@ -1,64 +0,0 @@ -/^[\w]+/ - *** Failers - École - -/^[\w]+/Lfr - École - -/^[\w]+/ - *** Failers - École - -/^[\W]+/ - École - -/^[\W]+/Lfr - *** Failers - École - -/[\b]/ - \b - *** Failers - a - -/[\b]/Lfr - \b - *** Failers - a - -/^\w+/ - *** Failers - École - -/^\w+/Lfr - École - -/(.+)\b(.+)/ - École - -/(.+)\b(.+)/Lfr - *** Failers - École - -/École/i - École - *** Failers - école - -/École/iLfr - École - école - -/\w/IS - -/\w/ISLfr - -/^[\xc8-\xc9]/iLfr - École - école - -/^[\xc8-\xc9]/Lfr - École - *** Failers - école - diff --git a/srclib/pcre/testdata/testoutput1 b/srclib/pcre/testdata/testoutput1 deleted file mode 100644 index 3ead0561d1..0000000000 --- a/srclib/pcre/testdata/testoutput1 +++ /dev/null @@ -1,2924 +0,0 @@ -PCRE version 3.2 12-May-2000 - -/the quick brown fox/ - the quick brown fox - 0: the quick brown fox - The quick brown FOX -No match - What do you know about the quick brown fox? - 0: the quick brown fox - What do you know about THE QUICK BROWN FOX? -No match - -/The quick brown fox/i - the quick brown fox - 0: the quick brown fox - The quick brown FOX - 0: The quick brown FOX - What do you know about the quick brown fox? - 0: the quick brown fox - What do you know about THE QUICK BROWN FOX? - 0: THE QUICK BROWN FOX - -/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/ - abcd\t\n\r\f\a\e9;\$\\?caxyz - 0: abcd\x09\x0a\x0d\x0c\x07\x1b9;$\?caxyz - -/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/ - abxyzpqrrrabbxyyyypqAzz - 0: abxyzpqrrrabbxyyyypqAzz - abxyzpqrrrabbxyyyypqAzz - 0: abxyzpqrrrabbxyyyypqAzz - aabxyzpqrrrabbxyyyypqAzz - 0: aabxyzpqrrrabbxyyyypqAzz - aaabxyzpqrrrabbxyyyypqAzz - 0: aaabxyzpqrrrabbxyyyypqAzz - aaaabxyzpqrrrabbxyyyypqAzz - 0: aaaabxyzpqrrrabbxyyyypqAzz - abcxyzpqrrrabbxyyyypqAzz - 0: abcxyzpqrrrabbxyyyypqAzz - aabcxyzpqrrrabbxyyyypqAzz - 0: aabcxyzpqrrrabbxyyyypqAzz - aaabcxyzpqrrrabbxyyyypAzz - 0: aaabcxyzpqrrrabbxyyyypAzz - aaabcxyzpqrrrabbxyyyypqAzz - 0: aaabcxyzpqrrrabbxyyyypqAzz - aaabcxyzpqrrrabbxyyyypqqAzz - 0: aaabcxyzpqrrrabbxyyyypqqAzz - aaabcxyzpqrrrabbxyyyypqqqAzz - 0: aaabcxyzpqrrrabbxyyyypqqqAzz - aaabcxyzpqrrrabbxyyyypqqqqAzz - 0: aaabcxyzpqrrrabbxyyyypqqqqAzz - aaabcxyzpqrrrabbxyyyypqqqqqAzz - 0: aaabcxyzpqrrrabbxyyyypqqqqqAzz - aaabcxyzpqrrrabbxyyyypqqqqqqAzz - 0: aaabcxyzpqrrrabbxyyyypqqqqqqAzz - aaaabcxyzpqrrrabbxyyyypqAzz - 0: aaaabcxyzpqrrrabbxyyyypqAzz - abxyzzpqrrrabbxyyyypqAzz - 0: abxyzzpqrrrabbxyyyypqAzz - aabxyzzzpqrrrabbxyyyypqAzz - 0: aabxyzzzpqrrrabbxyyyypqAzz - aaabxyzzzzpqrrrabbxyyyypqAzz - 0: aaabxyzzzzpqrrrabbxyyyypqAzz - aaaabxyzzzzpqrrrabbxyyyypqAzz - 0: aaaabxyzzzzpqrrrabbxyyyypqAzz - abcxyzzpqrrrabbxyyyypqAzz - 0: abcxyzzpqrrrabbxyyyypqAzz - aabcxyzzzpqrrrabbxyyyypqAzz - 0: aabcxyzzzpqrrrabbxyyyypqAzz - aaabcxyzzzzpqrrrabbxyyyypqAzz - 0: aaabcxyzzzzpqrrrabbxyyyypqAzz - aaaabcxyzzzzpqrrrabbxyyyypqAzz - 0: aaaabcxyzzzzpqrrrabbxyyyypqAzz - aaaabcxyzzzzpqrrrabbbxyyyypqAzz - 0: aaaabcxyzzzzpqrrrabbbxyyyypqAzz - aaaabcxyzzzzpqrrrabbbxyyyyypqAzz - 0: aaaabcxyzzzzpqrrrabbbxyyyyypqAzz - aaabcxyzpqrrrabbxyyyypABzz - 0: aaabcxyzpqrrrabbxyyyypABzz - aaabcxyzpqrrrabbxyyyypABBzz - 0: aaabcxyzpqrrrabbxyyyypABBzz - >>>aaabxyzpqrrrabbxyyyypqAzz - 0: aaabxyzpqrrrabbxyyyypqAzz - >aaaabxyzpqrrrabbxyyyypqAzz - 0: aaaabxyzpqrrrabbxyyyypqAzz - >>>>abcxyzpqrrrabbxyyyypqAzz - 0: abcxyzpqrrrabbxyyyypqAzz - *** Failers -No match - abxyzpqrrabbxyyyypqAzz -No match - abxyzpqrrrrabbxyyyypqAzz -No match - abxyzpqrrrabxyyyypqAzz -No match - aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz -No match - aaaabcxyzzzzpqrrrabbbxyyypqAzz -No match - aaabcxyzpqrrrabbxyyyypqqqqqqqAzz -No match - -/^(abc){1,2}zz/ - abczz - 0: abczz - 1: abc - abcabczz - 0: abcabczz - 1: abc - *** Failers -No match - zz -No match - abcabcabczz -No match - >>abczz -No match - -/^(b+?|a){1,2}?c/ - bc - 0: bc - 1: b - bbc - 0: bbc - 1: b - bbbc - 0: bbbc - 1: bb - bac - 0: bac - 1: a - bbac - 0: bbac - 1: a - aac - 0: aac - 1: a - abbbbbbbbbbbc - 0: abbbbbbbbbbbc - 1: bbbbbbbbbbb - bbbbbbbbbbbac - 0: bbbbbbbbbbbac - 1: a - *** Failers -No match - aaac -No match - abbbbbbbbbbbac -No match - -/^(b+|a){1,2}c/ - bc - 0: bc - 1: b - bbc - 0: bbc - 1: bb - bbbc - 0: bbbc - 1: bbb - bac - 0: bac - 1: a - bbac - 0: bbac - 1: a - aac - 0: aac - 1: a - abbbbbbbbbbbc - 0: abbbbbbbbbbbc - 1: bbbbbbbbbbb - bbbbbbbbbbbac - 0: bbbbbbbbbbbac - 1: a - *** Failers -No match - aaac -No match - abbbbbbbbbbbac -No match - -/^(b+|a){1,2}?bc/ - bbc - 0: bbc - 1: b - -/^(b*|ba){1,2}?bc/ - babc - 0: babc - 1: ba - bbabc - 0: bbabc - 1: ba - bababc - 0: bababc - 1: ba - *** Failers -No match - bababbc -No match - babababc -No match - -/^(ba|b*){1,2}?bc/ - babc - 0: babc - 1: ba - bbabc - 0: bbabc - 1: ba - bababc - 0: bababc - 1: ba - *** Failers -No match - bababbc -No match - babababc -No match - -/^\ca\cA\c[\c{\c:/ - \x01\x01\e;z - 0: \x01\x01\x1b;z - -/^[ab\]cde]/ - athing - 0: a - bthing - 0: b - ]thing - 0: ] - cthing - 0: c - dthing - 0: d - ething - 0: e - *** Failers -No match - fthing -No match - [thing -No match - \\thing -No match - -/^[]cde]/ - ]thing - 0: ] - cthing - 0: c - dthing - 0: d - ething - 0: e - *** Failers -No match - athing -No match - fthing -No match - -/^[^ab\]cde]/ - fthing - 0: f - [thing - 0: [ - \\thing - 0: \ - *** Failers - 0: * - athing -No match - bthing -No match - ]thing -No match - cthing -No match - dthing -No match - ething -No match - -/^[^]cde]/ - athing - 0: a - fthing - 0: f - *** Failers - 0: * - ]thing -No match - cthing -No match - dthing -No match - ething -No match - -/^\/ - - 0: \x81 - -/^ÿ/ - ÿ - 0: \xff - -/^[0-9]+$/ - 0 - 0: 0 - 1 - 0: 1 - 2 - 0: 2 - 3 - 0: 3 - 4 - 0: 4 - 5 - 0: 5 - 6 - 0: 6 - 7 - 0: 7 - 8 - 0: 8 - 9 - 0: 9 - 10 - 0: 10 - 100 - 0: 100 - *** Failers -No match - abc -No match - -/^.*nter/ - enter - 0: enter - inter - 0: inter - uponter - 0: uponter - -/^xxx[0-9]+$/ - xxx0 - 0: xxx0 - xxx1234 - 0: xxx1234 - *** Failers -No match - xxx -No match - -/^.+[0-9][0-9][0-9]$/ - x123 - 0: x123 - xx123 - 0: xx123 - 123456 - 0: 123456 - *** Failers -No match - 123 -No match - x1234 - 0: x1234 - -/^.+?[0-9][0-9][0-9]$/ - x123 - 0: x123 - xx123 - 0: xx123 - 123456 - 0: 123456 - *** Failers -No match - 123 -No match - x1234 - 0: x1234 - -/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/ - abc!pqr=apquxz.ixr.zzz.ac.uk - 0: abc!pqr=apquxz.ixr.zzz.ac.uk - 1: abc - 2: pqr - *** Failers -No match - !pqr=apquxz.ixr.zzz.ac.uk -No match - abc!=apquxz.ixr.zzz.ac.uk -No match - abc!pqr=apquxz:ixr.zzz.ac.uk -No match - abc!pqr=apquxz.ixr.zzz.ac.ukk -No match - -/:/ - Well, we need a colon: somewhere - 0: : - *** Fail if we don't -No match - -/([\da-f:]+)$/i - 0abc - 0: 0abc - 1: 0abc - abc - 0: abc - 1: abc - fed - 0: fed - 1: fed - E - 0: E - 1: E - :: - 0: :: - 1: :: - 5f03:12C0::932e - 0: 5f03:12C0::932e - 1: 5f03:12C0::932e - fed def - 0: def - 1: def - Any old stuff - 0: ff - 1: ff - *** Failers -No match - 0zzz -No match - gzzz -No match - fed\x20 -No match - Any old rubbish -No match - -/^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/ - .1.2.3 - 0: .1.2.3 - 1: 1 - 2: 2 - 3: 3 - A.12.123.0 - 0: A.12.123.0 - 1: 12 - 2: 123 - 3: 0 - *** Failers -No match - .1.2.3333 -No match - 1.2.3 -No match - 1234.2.3 -No match - -/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/ - 1 IN SOA non-sp1 non-sp2( - 0: 1 IN SOA non-sp1 non-sp2( - 1: 1 - 2: non-sp1 - 3: non-sp2 - 1 IN SOA non-sp1 non-sp2 ( - 0: 1 IN SOA non-sp1 non-sp2 ( - 1: 1 - 2: non-sp1 - 3: non-sp2 - *** Failers -No match - 1IN SOA non-sp1 non-sp2( -No match - -/^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/ - a. - 0: a. - Z. - 0: Z. - 2. - 0: 2. - ab-c.pq-r. - 0: ab-c.pq-r. - 1: .pq-r - sxk.zzz.ac.uk. - 0: sxk.zzz.ac.uk. - 1: .uk - x-.y-. - 0: x-.y-. - 1: .y- - *** Failers -No match - -abc.peq. -No match - -/^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/ - *.a - 0: *.a - *.b0-a - 0: *.b0-a - 1: 0-a - *.c3-b.c - 0: *.c3-b.c - 1: 3-b - 2: .c - *.c-a.b-c - 0: *.c-a.b-c - 1: -a - 2: .b-c - 3: -c - *** Failers -No match - *.0 -No match - *.a- -No match - *.a-b.c- -No match - *.c-a.0-c -No match - -/^(?=ab(de))(abd)(e)/ - abde - 0: abde - 1: de - 2: abd - 3: e - -/^(?!(ab)de|x)(abd)(f)/ - abdf - 0: abdf - 1: - 2: abd - 3: f - -/^(?=(ab(cd)))(ab)/ - abcd - 0: ab - 1: abcd - 2: cd - 3: ab - -/^[\da-f](\.[\da-f])*$/i - a.b.c.d - 0: a.b.c.d - 1: .d - A.B.C.D - 0: A.B.C.D - 1: .D - a.b.c.1.2.3.C - 0: a.b.c.1.2.3.C - 1: .C - -/^\".*\"\s*(;.*)?$/ - \"1234\" - 0: "1234" - \"abcd\" ; - 0: "abcd" ; - 1: ; - \"\" ; rhubarb - 0: "" ; rhubarb - 1: ; rhubarb - *** Failers -No match - \"1234\" : things -No match - -/^$/ - \ - 0: - *** Failers -No match - -/ ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/x - ab c - 0: ab c - *** Failers -No match - abc -No match - ab cde -No match - -/(?x) ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/ - ab c - 0: ab c - *** Failers -No match - abc -No match - ab cde -No match - -/^ a\ b[c ]d $/x - a bcd - 0: a bcd - a b d - 0: a b d - *** Failers -No match - abcd -No match - ab d -No match - -/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/ - abcdefhijklm - 0: abcdefhijklm - 1: abc - 2: bc - 3: c - 4: def - 5: ef - 6: f - 7: hij - 8: ij - 9: j -10: klm -11: lm -12: m - -/^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/ - abcdefhijklm - 0: abcdefhijklm - 1: bc - 2: c - 3: ef - 4: f - 5: ij - 6: j - 7: lm - 8: m - -/^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/ - a+ Z0+\x08\n\x1d\x12 - 0: a+ Z0+\x08\x0a\x1d\x12 - -/^[.^$|()*+?{,}]+/ - .^\$(*+)|{?,?} - 0: .^$(*+)|{?,?} - -/^a*\w/ - z - 0: z - az - 0: az - aaaz - 0: aaaz - a - 0: a - aa - 0: aa - aaaa - 0: aaaa - a+ - 0: a - aa+ - 0: aa - -/^a*?\w/ - z - 0: z - az - 0: a - aaaz - 0: a - a - 0: a - aa - 0: a - aaaa - 0: a - a+ - 0: a - aa+ - 0: a - -/^a+\w/ - az - 0: az - aaaz - 0: aaaz - aa - 0: aa - aaaa - 0: aaaa - aa+ - 0: aa - -/^a+?\w/ - az - 0: az - aaaz - 0: aa - aa - 0: aa - aaaa - 0: aa - aa+ - 0: aa - -/^\d{8}\w{2,}/ - 1234567890 - 0: 1234567890 - 12345678ab - 0: 12345678ab - 12345678__ - 0: 12345678__ - *** Failers -No match - 1234567 -No match - -/^[aeiou\d]{4,5}$/ - uoie - 0: uoie - 1234 - 0: 1234 - 12345 - 0: 12345 - aaaaa - 0: aaaaa - *** Failers -No match - 123456 -No match - -/^[aeiou\d]{4,5}?/ - uoie - 0: uoie - 1234 - 0: 1234 - 12345 - 0: 1234 - aaaaa - 0: aaaa - 123456 - 0: 1234 - -/\A(abc|def)=(\1){2,3}\Z/ - abc=abcabc - 0: abc=abcabc - 1: abc - 2: abc - def=defdefdef - 0: def=defdefdef - 1: def - 2: def - *** Failers -No match - abc=defdef -No match - -/^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/ - abcdefghijkcda2 - 0: abcdefghijkcda2 - 1: a - 2: b - 3: c - 4: d - 5: e - 6: f - 7: g - 8: h - 9: i -10: j -11: k -12: cd - abcdefghijkkkkcda2 - 0: abcdefghijkkkkcda2 - 1: a - 2: b - 3: c - 4: d - 5: e - 6: f - 7: g - 8: h - 9: i -10: j -11: k -12: cd - -/(cat(a(ract|tonic)|erpillar)) \1()2(3)/ - cataract cataract23 - 0: cataract cataract23 - 1: cataract - 2: aract - 3: ract - 4: - 5: 3 - catatonic catatonic23 - 0: catatonic catatonic23 - 1: catatonic - 2: atonic - 3: tonic - 4: - 5: 3 - caterpillar caterpillar23 - 0: caterpillar caterpillar23 - 1: caterpillar - 2: erpillar - 3: - 4: - 5: 3 - - -/^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/ - From abcd Mon Sep 01 12:33:02 1997 - 0: From abcd Mon Sep 01 12:33 - 1: abcd - -/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/ - From abcd Mon Sep 01 12:33:02 1997 - 0: From abcd Mon Sep 01 12:33 - 1: Sep - From abcd Mon Sep 1 12:33:02 1997 - 0: From abcd Mon Sep 1 12:33 - 1: Sep - *** Failers -No match - From abcd Sep 01 12:33:02 1997 -No match - -/^12.34/s - 12\n34 - 0: 12\x0a34 - 12\r34 - 0: 12\x0d34 - -/\w+(?=\t)/ - the quick brown\t fox - 0: brown - -/foo(?!bar)(.*)/ - foobar is foolish see? - 0: foolish see? - 1: lish see? - -/(?:(?!foo)...|^.{0,2})bar(.*)/ - foobar crowbar etc - 0: rowbar etc - 1: etc - barrel - 0: barrel - 1: rel - 2barrel - 0: 2barrel - 1: rel - A barrel - 0: A barrel - 1: rel - -/^(\D*)(?=\d)(?!123)/ - abc456 - 0: abc - 1: abc - *** Failers -No match - abc123 -No match - -/^1234(?# test newlines - inside)/ - 1234 - 0: 1234 - -/^1234 #comment in extended re - /x - 1234 - 0: 1234 - -/#rhubarb - abcd/x - abcd - 0: abcd - -/^abcd#rhubarb/x - abcd - 0: abcd - -/^(a)\1{2,3}(.)/ - aaab - 0: aaab - 1: a - 2: b - aaaab - 0: aaaab - 1: a - 2: b - aaaaab - 0: aaaaa - 1: a - 2: a - aaaaaab - 0: aaaaa - 1: a - 2: a - -/(?!^)abc/ - the abc - 0: abc - *** Failers -No match - abc -No match - -/(?=^)abc/ - abc - 0: abc - *** Failers -No match - the abc -No match - -/^[ab]{1,3}(ab*|b)/ - aabbbbb - 0: aabb - 1: b - -/^[ab]{1,3}?(ab*|b)/ - aabbbbb - 0: aabbbbb - 1: abbbbb - -/^[ab]{1,3}?(ab*?|b)/ - aabbbbb - 0: aa - 1: a - -/^[ab]{1,3}(ab*?|b)/ - aabbbbb - 0: aabb - 1: b - -/ (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* # optional leading comment -(?: (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -" (?: # opening quote... -[^\\\x80-\xff\n\015"] # Anything except backslash and quote -| # or -\\ [^\x80-\xff] # Escaped something (something != CR) -)* " # closing quote -) # initial word -(?: (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* \. (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -" (?: # opening quote... -[^\\\x80-\xff\n\015"] # Anything except backslash and quote -| # or -\\ [^\x80-\xff] # Escaped something (something != CR) -)* " # closing quote -) )* # further okay, if led by a period -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* @ (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| \[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) # initial subdomain -(?: # -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* \. # if led by a period... -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| \[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) # ...further okay -)* -# address -| # or -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -" (?: # opening quote... -[^\\\x80-\xff\n\015"] # Anything except backslash and quote -| # or -\\ [^\x80-\xff] # Escaped something (something != CR) -)* " # closing quote -) # one word, optionally followed by.... -(?: -[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] | # atom and space parts, or... -\( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) | # comments, or... - -" (?: # opening quote... -[^\\\x80-\xff\n\015"] # Anything except backslash and quote -| # or -\\ [^\x80-\xff] # Escaped something (something != CR) -)* " # closing quote -# quoted strings -)* -< (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* # leading < -(?: @ (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| \[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) # initial subdomain -(?: # -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* \. # if led by a period... -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| \[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) # ...further okay -)* - -(?: (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* , (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* @ (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| \[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) # initial subdomain -(?: # -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* \. # if led by a period... -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| \[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) # ...further okay -)* -)* # further okay, if led by comma -: # closing colon -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* )? # optional route -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -" (?: # opening quote... -[^\\\x80-\xff\n\015"] # Anything except backslash and quote -| # or -\\ [^\x80-\xff] # Escaped something (something != CR) -)* " # closing quote -) # initial word -(?: (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* \. (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -" (?: # opening quote... -[^\\\x80-\xff\n\015"] # Anything except backslash and quote -| # or -\\ [^\x80-\xff] # Escaped something (something != CR) -)* " # closing quote -) )* # further okay, if led by a period -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* @ (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| \[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) # initial subdomain -(?: # -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* \. # if led by a period... -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* (?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| \[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) # ...further okay -)* -# address spec -(?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* > # trailing > -# name and address -) (?: [\040\t] | \( -(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* -\) )* # optional trailing comment -/x - Alan Other - 0: Alan Other - - 0: user@dom.ain - user\@dom.ain - 0: user@dom.ain - \"A. Other\" (a comment) - 0: "A. Other" (a comment) - A. Other (a comment) - 0: Other (a comment) - \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay - 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay - A missing angle @,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -# Atom -| # or -" # " -[^\\\x80-\xff\n\015"] * # normal -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* -" # " -# Quoted string -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -\. -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -# Atom -| # or -" # " -[^\\\x80-\xff\n\015"] * # normal -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* -" # " -# Quoted string -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# additional words -)* -@ -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -\[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -(?: -\. -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -\[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -)* -# address -| # or -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -# Atom -| # or -" # " -[^\\\x80-\xff\n\015"] * # normal -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* -" # " -# Quoted string -) -# leading word -[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # "normal" atoms and or spaces -(?: -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -| -" # " -[^\\\x80-\xff\n\015"] * # normal -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* -" # " -) # "special" comment or quoted string -[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # more "normal" -)* -< -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# < -(?: -@ -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -\[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -(?: -\. -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -\[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -)* -(?: , -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -@ -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -\[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -(?: -\. -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -\[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -)* -)* # additional domains -: -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -)? # optional route -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -# Atom -| # or -" # " -[^\\\x80-\xff\n\015"] * # normal -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* -" # " -# Quoted string -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -\. -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -# Atom -| # or -" # " -[^\\\x80-\xff\n\015"] * # normal -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* -" # " -# Quoted string -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# additional words -)* -@ -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -\[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -(?: -\. -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -(?: -[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... -(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom -| -\[ # [ -(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff -\] # ] -) -[\040\t]* # Nab whitespace. -(?: -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: # ( -(?: \\ [^\x80-\xff] | -\( # ( -[^\\\x80-\xff\n\015()] * # normal* -(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* -\) # ) -) # special -[^\\\x80-\xff\n\015()] * # normal* -)* # )* -\) # ) -[\040\t]* )* # If comment found, allow more spaces. -# optional trailing comments -)* -# address spec -> # > -# name and address -) -/x - Alan Other - 0: Alan Other - - 0: user@dom.ain - user\@dom.ain - 0: user@dom.ain - \"A. Other\" (a comment) - 0: "A. Other" - A. Other (a comment) - 0: Other - \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay - 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay - A missing angle ?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff - -/P[^*]TAIRE[^*]{1,6}?LL/ - xxxxxxxxxxxPSTAIREISLLxxxxxxxxx - 0: PSTAIREISLL - -/P[^*]TAIRE[^*]{1,}?LL/ - xxxxxxxxxxxPSTAIREISLLxxxxxxxxx - 0: PSTAIREISLL - -/(\.\d\d[1-9]?)\d+/ - 1.230003938 - 0: .230003938 - 1: .23 - 1.875000282 - 0: .875000282 - 1: .875 - 1.235 - 0: .235 - 1: .23 - -/(\.\d\d((?=0)|\d(?=\d)))/ - 1.230003938 - 0: .23 - 1: .23 - 2: - 1.875000282 - 0: .875 - 1: .875 - 2: 5 - *** Failers -No match - 1.235 -No match - -/a(?)b/ - ab - 0: ab - -/\b(foo)\s+(\w+)/i - Food is on the foo table - 0: foo table - 1: foo - 2: table - -/foo(.*)bar/ - The food is under the bar in the barn. - 0: food is under the bar in the bar - 1: d is under the bar in the - -/foo(.*?)bar/ - The food is under the bar in the barn. - 0: food is under the bar - 1: d is under the - -/(.*)(\d*)/ - I have 2 numbers: 53147 - 0: I have 2 numbers: 53147 - 1: I have 2 numbers: 53147 - 2: - -/(.*)(\d+)/ - I have 2 numbers: 53147 - 0: I have 2 numbers: 53147 - 1: I have 2 numbers: 5314 - 2: 7 - -/(.*?)(\d*)/ - I have 2 numbers: 53147 - 0: - 1: - 2: - -/(.*?)(\d+)/ - I have 2 numbers: 53147 - 0: I have 2 - 1: I have - 2: 2 - -/(.*)(\d+)$/ - I have 2 numbers: 53147 - 0: I have 2 numbers: 53147 - 1: I have 2 numbers: 5314 - 2: 7 - -/(.*?)(\d+)$/ - I have 2 numbers: 53147 - 0: I have 2 numbers: 53147 - 1: I have 2 numbers: - 2: 53147 - -/(.*)\b(\d+)$/ - I have 2 numbers: 53147 - 0: I have 2 numbers: 53147 - 1: I have 2 numbers: - 2: 53147 - -/(.*\D)(\d+)$/ - I have 2 numbers: 53147 - 0: I have 2 numbers: 53147 - 1: I have 2 numbers: - 2: 53147 - -/^\D*(?!123)/ - ABC123 - 0: AB - -/^(\D*)(?=\d)(?!123)/ - ABC445 - 0: ABC - 1: ABC - *** Failers -No match - ABC123 -No match - -/^[W-]46]/ - W46]789 - 0: W46] - -46]789 - 0: -46] - *** Failers -No match - Wall -No match - Zebra -No match - 42 -No match - [abcd] -No match - ]abcd[ -No match - -/^[W-\]46]/ - W46]789 - 0: W - Wall - 0: W - Zebra - 0: Z - Xylophone - 0: X - 42 - 0: 4 - [abcd] - 0: [ - ]abcd[ - 0: ] - \\backslash - 0: \ - *** Failers -No match - -46]789 -No match - well -No match - -/\d\d\/\d\d\/\d\d\d\d/ - 01/01/2000 - 0: 01/01/2000 - -/word (?:[a-zA-Z0-9]+ ){0,10}otherword/ - word cat dog elephant mussel cow horse canary baboon snake shark otherword - 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword - word cat dog elephant mussel cow horse canary baboon snake shark -No match - -/word (?:[a-zA-Z0-9]+ ){0,300}otherword/ - word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope -No match - -/^(a){0,0}/ - bcd - 0: - abc - 0: - aab - 0: - -/^(a){0,1}/ - bcd - 0: - abc - 0: a - 1: a - aab - 0: a - 1: a - -/^(a){0,2}/ - bcd - 0: - abc - 0: a - 1: a - aab - 0: aa - 1: a - -/^(a){0,3}/ - bcd - 0: - abc - 0: a - 1: a - aab - 0: aa - 1: a - aaa - 0: aaa - 1: a - -/^(a){0,}/ - bcd - 0: - abc - 0: a - 1: a - aab - 0: aa - 1: a - aaa - 0: aaa - 1: a - aaaaaaaa - 0: aaaaaaaa - 1: a - -/^(a){1,1}/ - bcd -No match - abc - 0: a - 1: a - aab - 0: a - 1: a - -/^(a){1,2}/ - bcd -No match - abc - 0: a - 1: a - aab - 0: aa - 1: a - -/^(a){1,3}/ - bcd -No match - abc - 0: a - 1: a - aab - 0: aa - 1: a - aaa - 0: aaa - 1: a - -/^(a){1,}/ - bcd -No match - abc - 0: a - 1: a - aab - 0: aa - 1: a - aaa - 0: aaa - 1: a - aaaaaaaa - 0: aaaaaaaa - 1: a - -/.*\.gif/ - borfle\nbib.gif\nno - 0: bib.gif - -/.{0,}\.gif/ - borfle\nbib.gif\nno - 0: bib.gif - -/.*\.gif/m - borfle\nbib.gif\nno - 0: bib.gif - -/.*\.gif/s - borfle\nbib.gif\nno - 0: borfle\x0abib.gif - -/.*\.gif/ms - borfle\nbib.gif\nno - 0: borfle\x0abib.gif - -/.*$/ - borfle\nbib.gif\nno - 0: no - -/.*$/m - borfle\nbib.gif\nno - 0: borfle - -/.*$/s - borfle\nbib.gif\nno - 0: borfle\x0abib.gif\x0ano - -/.*$/ms - borfle\nbib.gif\nno - 0: borfle\x0abib.gif\x0ano - -/.*$/ - borfle\nbib.gif\nno\n - 0: no - -/.*$/m - borfle\nbib.gif\nno\n - 0: borfle - -/.*$/s - borfle\nbib.gif\nno\n - 0: borfle\x0abib.gif\x0ano\x0a - -/.*$/ms - borfle\nbib.gif\nno\n - 0: borfle\x0abib.gif\x0ano\x0a - -/(.*X|^B)/ - abcde\n1234Xyz - 0: 1234X - 1: 1234X - BarFoo - 0: B - 1: B - *** Failers -No match - abcde\nBar -No match - -/(.*X|^B)/m - abcde\n1234Xyz - 0: 1234X - 1: 1234X - BarFoo - 0: B - 1: B - abcde\nBar - 0: B - 1: B - -/(.*X|^B)/s - abcde\n1234Xyz - 0: abcde\x0a1234X - 1: abcde\x0a1234X - BarFoo - 0: B - 1: B - *** Failers -No match - abcde\nBar -No match - -/(.*X|^B)/ms - abcde\n1234Xyz - 0: abcde\x0a1234X - 1: abcde\x0a1234X - BarFoo - 0: B - 1: B - abcde\nBar - 0: B - 1: B - -/(?s)(.*X|^B)/ - abcde\n1234Xyz - 0: abcde\x0a1234X - 1: abcde\x0a1234X - BarFoo - 0: B - 1: B - *** Failers -No match - abcde\nBar -No match - -/(?s:.*X|^B)/ - abcde\n1234Xyz - 0: abcde\x0a1234X - BarFoo - 0: B - *** Failers -No match - abcde\nBar -No match - -/^.*B/ - **** Failers -No match - abc\nB -No match - -/(?s)^.*B/ - abc\nB - 0: abc\x0aB - -/(?m)^.*B/ - abc\nB - 0: B - -/(?ms)^.*B/ - abc\nB - 0: abc\x0aB - -/(?ms)^B/ - abc\nB - 0: B - -/(?s)B$/ - B\n - 0: B - -/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/ - 123456654321 - 0: 123456654321 - -/^\d\d\d\d\d\d\d\d\d\d\d\d/ - 123456654321 - 0: 123456654321 - -/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/ - 123456654321 - 0: 123456654321 - -/^[abc]{12}/ - abcabcabcabc - 0: abcabcabcabc - -/^[a-c]{12}/ - abcabcabcabc - 0: abcabcabcabc - -/^(a|b|c){12}/ - abcabcabcabc - 0: abcabcabcabc - 1: c - -/^[abcdefghijklmnopqrstuvwxy0123456789]/ - n - 0: n - *** Failers -No match - z -No match - -/abcde{0,0}/ - abcd - 0: abcd - *** Failers -No match - abce -No match - -/ab[cd]{0,0}e/ - abe - 0: abe - *** Failers -No match - abcde -No match - -/ab(c){0,0}d/ - abd - 0: abd - *** Failers -No match - abcd -No match - -/a(b*)/ - a - 0: a - 1: - ab - 0: ab - 1: b - abbbb - 0: abbbb - 1: bbbb - *** Failers - 0: a - 1: - bbbbb -No match - -/ab\d{0}e/ - abe - 0: abe - *** Failers -No match - ab1e -No match - -/"([^\\"]+|\\.)*"/ - the \"quick\" brown fox - 0: "quick" - 1: quick - \"the \\\"quick\\\" brown fox\" - 0: "the \"quick\" brown fox" - 1: brown fox - -/.*?/g+ - abc - 0: - 0+ abc - 0: a - 0+ bc - 0: - 0+ bc - 0: b - 0+ c - 0: - 0+ c - 0: c - 0+ - 0: - 0+ - -/\b/g+ - abc - 0: - 0+ abc - 0: - 0+ - -/\b/+g - abc - 0: - 0+ abc - 0: - 0+ - -//g - abc - 0: - 0: - 0: - 0: - -/ End of test input / - diff --git a/srclib/pcre/testdata/testoutput2 b/srclib/pcre/testdata/testoutput2 deleted file mode 100644 index ba8cf0ed28..0000000000 --- a/srclib/pcre/testdata/testoutput2 +++ /dev/null @@ -1,2072 +0,0 @@ -PCRE version 3.2 12-May-2000 - -/(a)b|/ -Capturing subpattern count = 1 -No options -No first char -No need char - -/abc/ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'c' - abc - 0: abc - defabc - 0: abc - \Aabc - 0: abc - *** Failers -No match - \Adefabc -No match - ABC -No match - -/^abc/ -Capturing subpattern count = 0 -Options: anchored -No first char -Need char = 'c' - abc - 0: abc - \Aabc - 0: abc - *** Failers -No match - defabc -No match - \Adefabc -No match - -/a+bc/ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'c' - -/a*bc/ -Capturing subpattern count = 0 -No options -No first char -Need char = 'c' - -/a{3}bc/ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'c' - -/(abc|a+z)/ -Capturing subpattern count = 1 -No options -First char = 'a' -No need char - -/^abc$/ -Capturing subpattern count = 0 -Options: anchored -No first char -Need char = 'c' - abc - 0: abc - *** Failers -No match - def\nabc -No match - -/ab\gdef/X -Failed: unrecognized character follows \ at offset 3 - -/(?X)ab\gdef/X -Failed: unrecognized character follows \ at offset 7 - -/x{5,4}/ -Failed: numbers out of order in {} quantifier at offset 5 - -/z{65536}/ -Failed: number too big in {} quantifier at offset 7 - -/[abcd/ -Failed: missing terminating ] for character class at offset 5 - -/[\B]/ -Failed: invalid escape sequence in character class at offset 2 - -/[a-\w]/ -Failed: invalid escape sequence in character class at offset 4 - -/[z-a]/ -Failed: range out of order in character class at offset 3 - -/^*/ -Failed: nothing to repeat at offset 1 - -/(abc/ -Failed: missing ) at offset 4 - -/(?# abc/ -Failed: missing ) after comment at offset 7 - -/(?z)abc/ -Failed: unrecognized character after (? at offset 2 - -/.*b/ -Capturing subpattern count = 0 -No options -First char at start or follows \n -Need char = 'b' - -/.*?b/ -Capturing subpattern count = 0 -No options -First char at start or follows \n -Need char = 'b' - -/cat|dog|elephant/ -Capturing subpattern count = 0 -No options -No first char -No need char - this sentence eventually mentions a cat - 0: cat - this sentences rambles on and on for a while and then reaches elephant - 0: elephant - -/cat|dog|elephant/S -Capturing subpattern count = 0 -No options -No first char -No need char -Starting character set: c d e - this sentence eventually mentions a cat - 0: cat - this sentences rambles on and on for a while and then reaches elephant - 0: elephant - -/cat|dog|elephant/iS -Capturing subpattern count = 0 -Options: caseless -No first char -No need char -Starting character set: C D E c d e - this sentence eventually mentions a CAT cat - 0: CAT - this sentences rambles on and on for a while to elephant ElePhant - 0: elephant - -/a|[bcd]/S -Capturing subpattern count = 0 -No options -No first char -No need char -Starting character set: a b c d - -/(a|[^\dZ])/S -Capturing subpattern count = 1 -No options -No first char -No need char -Starting character set: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a - \x0b \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 - \x1a \x1b \x1c \x1d \x1e \x1f \x20 ! " # $ % & ' ( ) * + , - . / : ; < = > - ? @ 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 [ \ ] ^ _ ` 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 { | } ~ \x7f \x80 \x81 \x82 \x83 - \x84 \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92 - \x93 \x94 \x95 \x96 \x97 \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f \xa0 \xa1 - \xa2 \xa3 \xa4 \xa5 \xa6 \xa7 \xa8 \xa9 \xaa \xab \xac \xad \xae \xaf \xb0 - \xb1 \xb2 \xb3 \xb4 \xb5 \xb6 \xb7 \xb8 \xb9 \xba \xbb \xbc \xbd \xbe \xbf - \xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce - \xcf \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd - \xde \xdf \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec - \xed \xee \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb - \xfc \xfd \xfe \xff - -/(a|b)*[\s]/S -Capturing subpattern count = 1 -No options -No first char -No need char -Starting character set: \x09 \x0a \x0b \x0c \x0d \x20 a b - -/(ab\2)/ -Failed: back reference to non-existent subpattern at offset 6 - -/{4,5}abc/ -Failed: nothing to repeat at offset 4 - -/(a)(b)(c)\2/ -Capturing subpattern count = 3 -Max back reference = 2 -No options -First char = 'a' -Need char = 'c' - abcb - 0: abcb - 1: a - 2: b - 3: c - \O0abcb -Matched, but too many substrings - \O3abcb -Matched, but too many substrings - 0: abcb - \O6abcb -Matched, but too many substrings - 0: abcb - 1: a - \O9abcb -Matched, but too many substrings - 0: abcb - 1: a - 2: b - \O12abcb - 0: abcb - 1: a - 2: b - 3: c - -/(a)bc|(a)(b)\2/ -Capturing subpattern count = 3 -Max back reference = 2 -No options -First char = 'a' -No need char - abc - 0: abc - 1: a - \O0abc -Matched, but too many substrings - \O3abc -Matched, but too many substrings - 0: abc - \O6abc - 0: abc - 1: a - aba - 0: aba - 1: - 2: a - 3: b - \O0aba -Matched, but too many substrings - \O3aba -Matched, but too many substrings - 0: aba - \O6aba -Matched, but too many substrings - 0: aba - 1: - \O9aba -Matched, but too many substrings - 0: aba - 1: - 2: a - \O12aba - 0: aba - 1: - 2: a - 3: b - -/abc$/E -Capturing subpattern count = 0 -Options: dollar_endonly -First char = 'a' -Need char = 'c' - abc - 0: abc - *** Failers -No match - abc\n -No match - abc\ndef -No match - -/(a)(b)(c)(d)(e)\6/ -Failed: back reference to non-existent subpattern at offset 17 - -/the quick brown fox/ -Capturing subpattern count = 0 -No options -First char = 't' -Need char = 'x' - the quick brown fox - 0: the quick brown fox - this is a line with the quick brown fox - 0: the quick brown fox - -/the quick brown fox/A -Capturing subpattern count = 0 -Options: anchored -No first char -Need char = 'x' - the quick brown fox - 0: the quick brown fox - *** Failers -No match - this is a line with the quick brown fox -No match - -/ab(?z)cd/ -Failed: unrecognized character after (? at offset 4 - -/^abc|def/ -Capturing subpattern count = 0 -No options -No first char -No need char - abcdef - 0: abc - abcdef\B - 0: def - -/.*((abc)$|(def))/ -Capturing subpattern count = 3 -No options -First char at start or follows \n -No need char - defabc - 0: defabc - 1: abc - 2: abc - \Zdefabc - 0: def - 1: def - 2: - 3: def - -/abc/P - abc - 0: abc - *** Failers -No match: POSIX code 17: match failed - -/^abc|def/P - abcdef - 0: abc - abcdef\B - 0: def - -/.*((abc)$|(def))/P - defabc - 0: defabc - 1: abc - 2: abc - \Zdefabc - 0: def - 1: def - 3: def - -/the quick brown fox/P - the quick brown fox - 0: the quick brown fox - *** Failers -No match: POSIX code 17: match failed - The Quick Brown Fox -No match: POSIX code 17: match failed - -/the quick brown fox/Pi - the quick brown fox - 0: the quick brown fox - The Quick Brown Fox - 0: The Quick Brown Fox - -/abc.def/P - *** Failers -No match: POSIX code 17: match failed - abc\ndef -No match: POSIX code 17: match failed - -/abc$/P - abc - 0: abc - abc\n - 0: abc - -/(abc)\2/P -Failed: POSIX code 15: bad back reference at offset 7 - -/(abc\1)/P - abc -No match: POSIX code 17: match failed - -/)/ -Failed: unmatched parentheses at offset 0 - -/a[]b/ -Failed: missing terminating ] for character class at offset 4 - -/[^aeiou ]{3,}/ -Capturing subpattern count = 0 -No options -No first char -No need char - co-processors, and for - 0: -pr - -/<.*>/ -Capturing subpattern count = 0 -No options -First char = '<' -Need char = '>' - abcghinop - 0: ghi - -/<.*?>/ -Capturing subpattern count = 0 -No options -First char = '<' -Need char = '>' - abcghinop - 0: - -/<.*>/U -Capturing subpattern count = 0 -Options: ungreedy -First char = '<' -Need char = '>' - abcghinop - 0: - -/<.*>(?U)/ -Capturing subpattern count = 0 -Options: ungreedy -First char = '<' -Need char = '>' - abcghinop - 0: - -/<.*?>/U -Capturing subpattern count = 0 -Options: ungreedy -First char = '<' -Need char = '>' - abcghinop - 0: ghi - -/={3,}/U -Capturing subpattern count = 0 -Options: ungreedy -First char = '=' -Need char = '=' - abc========def - 0: === - -/(?U)={3,}?/ -Capturing subpattern count = 0 -Options: ungreedy -First char = '=' -Need char = '=' - abc========def - 0: ======== - -/(?^abc)/m -Capturing subpattern count = 0 -Options: multiline -First char at start or follows \n -Need char = 'c' - abc - 0: abc - def\nabc - 0: abc - *** Failers -No match - defabc -No match - -/(?<=ab(c+)d)ef/ -Failed: lookbehind assertion is not fixed length at offset 11 - -/(?<=ab(?<=c+)d)ef/ -Failed: lookbehind assertion is not fixed length at offset 12 - -/(?<=ab(c|de)f)g/ -Failed: lookbehind assertion is not fixed length at offset 13 - -/The next three are in testinput2 because they have variable length branches/ -Capturing subpattern count = 0 -No options -First char = 'T' -Need char = 's' - -/(?<=bullock|donkey)-cart/ -Capturing subpattern count = 0 -No options -First char = '-' -Need char = 't' - the bullock-cart - 0: -cart - a donkey-cart race - 0: -cart - *** Failers -No match - cart -No match - horse-and-cart -No match - -/(?<=ab(?i)x|y|z)/ -Capturing subpattern count = 0 -No options -Case state changes -No first char -No need char - -/(?>.*)(?<=(abcd)|(xyz))/ -Capturing subpattern count = 2 -No options -First char at start or follows \n -No need char - alphabetabcd - 0: alphabetabcd - 1: abcd - endingxyz - 0: endingxyz - 1: - 2: xyz - -/(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/ -Capturing subpattern count = 0 -No options -Case state changes -First char = 'Z' -Need char = 'Z' - abxyZZ - 0: ZZ - abXyZZ - 0: ZZ - ZZZ - 0: ZZ - zZZ - 0: ZZ - bZZ - 0: ZZ - BZZ - 0: ZZ - *** Failers -No match - ZZ -No match - abXYZZ -No match - zzz -No match - bzz -No match - -/(? - 3: f - 1G a (1) - 2G (0) - 3G f (1) -get substring 4 failed -7 - 0L adef - 1L a - 2L - 3L f - bcdef\G1\G2\G3\G4\L - 0: bcdef - 1: bc - 2: bc - 3: f - 1G bc (2) - 2G bc (2) - 3G f (1) -get substring 4 failed -7 - 0L bcdef - 1L bc - 2L bc - 3L f - adefghijk\C0 - 0: adef - 1: a - 2: - 3: f - 0C adef (4) - -/^abc\00def/ -Capturing subpattern count = 0 -Options: anchored -No first char -Need char = 'f' - abc\00def\L\C0 - 0: abc\x00def - 0C abc (7) - 0L abc - -/word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ -)((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ -)?)?)?)?)?)?)?)?)?otherword/M -Memory allocation (code space): 428 -Capturing subpattern count = 8 -No options -First char = 'w' -Need char = 'd' - -/.*X/D ------------------------------------------------------------------- - 0 8 Bra 0 - 3 Any* - 5 1 X - 8 8 Ket - 11 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -No options -First char at start or follows \n -Need char = 'X' - -/.*X/Ds ------------------------------------------------------------------- - 0 8 Bra 0 - 3 Any* - 5 1 X - 8 8 Ket - 11 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -Options: anchored dotall -No first char -Need char = 'X' - -/(.*X|^B)/D ------------------------------------------------------------------- - 0 21 Bra 0 - 3 8 Bra 1 - 6 Any* - 8 1 X - 11 7 Alt - 14 ^ - 15 1 B - 18 15 Ket - 21 21 Ket - 24 End ------------------------------------------------------------------- -Capturing subpattern count = 1 -No options -First char at start or follows \n -No need char - -/(.*X|^B)/Ds ------------------------------------------------------------------- - 0 21 Bra 0 - 3 8 Bra 1 - 6 Any* - 8 1 X - 11 7 Alt - 14 ^ - 15 1 B - 18 15 Ket - 21 21 Ket - 24 End ------------------------------------------------------------------- -Capturing subpattern count = 1 -Options: anchored dotall -No first char -No need char - -/(?s)(.*X|^B)/D ------------------------------------------------------------------- - 0 21 Bra 0 - 3 8 Bra 1 - 6 Any* - 8 1 X - 11 7 Alt - 14 ^ - 15 1 B - 18 15 Ket - 21 21 Ket - 24 End ------------------------------------------------------------------- -Capturing subpattern count = 1 -Options: anchored dotall -No first char -No need char - -/(?s:.*X|^B)/D ------------------------------------------------------------------- - 0 27 Bra 0 - 3 10 Bra 0 - 6 04 Opt - 8 Any* - 10 1 X - 13 9 Alt - 16 04 Opt - 18 ^ - 19 1 B - 22 19 Ket - 25 00 Opt - 27 27 Ket - 30 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -No options -First char at start or follows \n -No need char - -/\Biss\B/+ -Capturing subpattern count = 0 -No options -First char = 'i' -Need char = 's' - Mississippi - 0: iss - 0+ issippi - -/\Biss\B/+P - Mississippi - 0: iss - 0+ issippi - -/iss/G+ -Capturing subpattern count = 0 -No options -First char = 'i' -Need char = 's' - Mississippi - 0: iss - 0+ issippi - 0: iss - 0+ ippi - -/\Biss\B/G+ -Capturing subpattern count = 0 -No options -First char = 'i' -Need char = 's' - Mississippi - 0: iss - 0+ issippi - -/\Biss\B/g+ -Capturing subpattern count = 0 -No options -First char = 'i' -Need char = 's' - Mississippi - 0: iss - 0+ issippi - 0: iss - 0+ ippi - *** Failers -No match - Mississippi\A -No match - -/(?<=[Ms])iss/g+ -Capturing subpattern count = 0 -No options -First char = 'i' -Need char = 's' - Mississippi - 0: iss - 0+ issippi - 0: iss - 0+ ippi - -/(?<=[Ms])iss/G+ -Capturing subpattern count = 0 -No options -First char = 'i' -Need char = 's' - Mississippi - 0: iss - 0+ issippi - -/^iss/g+ -Capturing subpattern count = 0 -Options: anchored -No first char -Need char = 's' - ississippi - 0: iss - 0+ issippi - -/.*iss/g+ -Capturing subpattern count = 0 -No options -First char at start or follows \n -Need char = 's' - abciss\nxyzisspqr - 0: abciss - 0+ \x0axyzisspqr - 0: xyziss - 0+ pqr - -/.i./+g -Capturing subpattern count = 0 -No options -No first char -Need char = 'i' - Mississippi - 0: Mis - 0+ sissippi - 0: sis - 0+ sippi - 0: sip - 0+ pi - Mississippi\A - 0: Mis - 0+ sissippi - 0: sis - 0+ sippi - 0: sip - 0+ pi - Missouri river - 0: Mis - 0+ souri river - 0: ri - 0+ river - 0: riv - 0+ er - Missouri river\A - 0: Mis - 0+ souri river - -/^.is/+g -Capturing subpattern count = 0 -Options: anchored -No first char -Need char = 's' - Mississippi - 0: Mis - 0+ sissippi - -/^ab\n/g+ -Capturing subpattern count = 0 -Options: anchored -No first char -Need char = 10 - ab\nab\ncd - 0: ab\x0a - 0+ ab\x0acd - -/^ab\n/mg+ -Capturing subpattern count = 0 -Options: multiline -First char at start or follows \n -Need char = 10 - ab\nab\ncd - 0: ab\x0a - 0+ ab\x0acd - 0: ab\x0a - 0+ cd - -/abc/ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'c' - -/abc|bac/ -Capturing subpattern count = 0 -No options -No first char -Need char = 'c' - -/(abc|bac)/ -Capturing subpattern count = 1 -No options -No first char -Need char = 'c' - -/(abc|(c|dc))/ -Capturing subpattern count = 2 -No options -No first char -Need char = 'c' - -/(abc|(d|de)c)/ -Capturing subpattern count = 2 -No options -No first char -Need char = 'c' - -/a*/ -Capturing subpattern count = 0 -No options -No first char -No need char - -/a+/ -Capturing subpattern count = 0 -No options -First char = 'a' -No need char - -/(baa|a+)/ -Capturing subpattern count = 1 -No options -No first char -Need char = 'a' - -/a{0,3}/ -Capturing subpattern count = 0 -No options -No first char -No need char - -/baa{3,}/ -Capturing subpattern count = 0 -No options -First char = 'b' -Need char = 'a' - -/"([^\\"]+|\\.)*"/ -Capturing subpattern count = 1 -No options -First char = '"' -Need char = '"' - -/(abc|ab[cd])/ -Capturing subpattern count = 1 -No options -First char = 'a' -No need char - -/(a|.)/ -Capturing subpattern count = 1 -No options -No first char -No need char - -/a|ba|\w/ -Capturing subpattern count = 0 -No options -No first char -No need char - -/abc(?=pqr)/ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'r' - -/...(?<=abc)/ -Capturing subpattern count = 0 -No options -No first char -No need char - -/abc(?!pqr)/ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'c' - -/ab./ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'b' - -/ab[xyz]/ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'b' - -/abc*/ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'b' - -/ab.c*/ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'b' - -/a.c*/ -Capturing subpattern count = 0 -No options -First char = 'a' -No need char - -/.c*/ -Capturing subpattern count = 0 -No options -No first char -No need char - -/ac*/ -Capturing subpattern count = 0 -No options -First char = 'a' -No need char - -/(a.c*|b.c*)/ -Capturing subpattern count = 1 -No options -No first char -No need char - -/a.c*|aba/ -Capturing subpattern count = 0 -No options -First char = 'a' -No need char - -/.+a/ -Capturing subpattern count = 0 -No options -No first char -Need char = 'a' - -/(?=abcda)a.*/ -Capturing subpattern count = 0 -No options -First char = 'a' -No need char - -/(?=a)a.*/ -Capturing subpattern count = 0 -No options -First char = 'a' -No need char - -/a(b)*/ -Capturing subpattern count = 1 -No options -First char = 'a' -No need char - -/a\d*/ -Capturing subpattern count = 0 -No options -First char = 'a' -No need char - -/ab\d*/ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'b' - -/a(\d)*/ -Capturing subpattern count = 1 -No options -First char = 'a' -No need char - -/abcde{0,0}/ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'd' - -/ab\d+/ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'b' - -/a(?(1)b)/ -Capturing subpattern count = 0 -No options -First char = 'a' -No need char - -/a(?(1)bag|big)/ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'g' - -/a(?(1)bag|big)*/ -Capturing subpattern count = 0 -No options -First char = 'a' -No need char - -/a(?(1)bag|big)+/ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'g' - -/a(?(1)b..|b..)/ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'b' - -/ab\d{0}e/ -Capturing subpattern count = 0 -No options -First char = 'a' -Need char = 'e' - -/a?b?/ -Capturing subpattern count = 0 -No options -No first char -No need char - a - 0: a - b - 0: b - ab - 0: ab - \ - 0: - *** Failers - 0: - \N -No match - -/|-/ -Capturing subpattern count = 0 -No options -No first char -No need char - abcd - 0: - -abc - 0: - \Nab-c - 0: - - *** Failers - 0: - \Nabc -No match - -/a*(b+)(z)(z)/P - aaaabbbbzzzz - 0: aaaabbbbzz - 1: bbbb - 2: z - 3: z - aaaabbbbzzzz\O0 - aaaabbbbzzzz\O1 - 0: aaaabbbbzz - aaaabbbbzzzz\O2 - 0: aaaabbbbzz - 1: bbbb - aaaabbbbzzzz\O3 - 0: aaaabbbbzz - 1: bbbb - 2: z - aaaabbbbzzzz\O4 - 0: aaaabbbbzz - 1: bbbb - 2: z - 3: z - aaaabbbbzzzz\O5 - 0: aaaabbbbzz - 1: bbbb - 2: z - 3: z - -/^.?abcd/S -Capturing subpattern count = 0 -Options: anchored -No first char -Need char = 'd' -Study returned NULL - -/\( # ( at start - (?: # Non-capturing bracket - (?>[^()]+) # Either a sequence of non-brackets (no backtracking) - | # Or - (?R) # Recurse - i.e. nested bracketed string - )* # Zero or more contents - \) # Closing ) - /x -Capturing subpattern count = 0 -Options: extended -First char = '(' -Need char = ')' - (abcd) - 0: (abcd) - (abcd)xyz - 0: (abcd) - xyz(abcd) - 0: (abcd) - (ab(xy)cd)pqr - 0: (ab(xy)cd) - (ab(xycd)pqr - 0: (xycd) - () abc () - 0: () - 12(abcde(fsh)xyz(foo(bar))lmno)89 - 0: (abcde(fsh)xyz(foo(bar))lmno) - *** Failers -No match - abcd -No match - abcd) -No match - (abcd -No match - -/\( ( (?>[^()]+) | (?R) )* \) /xg -Capturing subpattern count = 1 -Options: extended -First char = '(' -Need char = ')' - (ab(xy)cd)pqr - 0: (ab(xy)cd) - 1: cd - 1(abcd)(x(y)z)pqr - 0: (abcd) - 1: abcd - 0: (x(y)z) - 1: z - -/\( (?: (?>[^()]+) | (?R) ) \) /x -Capturing subpattern count = 0 -Options: extended -First char = '(' -Need char = ')' - (abcd) - 0: (abcd) - (ab(xy)cd) - 0: (xy) - (a(b(c)d)e) - 0: (c) - ((ab)) - 0: ((ab)) - *** Failers -No match - () -No match - -/\( (?: (?>[^()]+) | (?R) )? \) /x -Capturing subpattern count = 0 -Options: extended -First char = '(' -Need char = ')' - () - 0: () - 12(abcde(fsh)xyz(foo(bar))lmno)89 - 0: (fsh) - -/\( ( (?>[^()]+) | (?R) )* \) /x -Capturing subpattern count = 1 -Options: extended -First char = '(' -Need char = ')' - (ab(xy)cd) - 0: (ab(xy)cd) - 1: cd - -/\( ( ( (?>[^()]+) | (?R) )* ) \) /x -Capturing subpattern count = 2 -Options: extended -First char = '(' -Need char = ')' - (ab(xy)cd) - 0: (ab(xy)cd) - 1: ab(xy)cd - 2: cd - -/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /x -Capturing subpattern count = 3 -Options: extended -First char = '(' -Need char = ')' - (ab(xy)cd) - 0: (ab(xy)cd) - 1: - 2: ab(xy)cd - 3: cd - (123ab(xy)cd) - 0: (123ab(xy)cd) - 1: 123 - 2: ab(xy)cd - 3: cd - -/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /x -Capturing subpattern count = 3 -Options: extended -First char = '(' -Need char = ')' - (ab(xy)cd) - 0: (ab(xy)cd) - 1: ab(xy)cd - 2: - 3: cd - (123ab(xy)cd) - 0: (123ab(xy)cd) - 1: 123ab(xy)cd - 2: 123 - 3: cd - -/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /x -Capturing subpattern count = 11 -Options: extended -First char = '(' -Need char = ')' - (ab(xy)cd) - 0: (ab(xy)cd) - 1: ab(xy)cd - 2: ab(xy)cd - 3: ab(xy)cd - 4: ab(xy)cd - 5: ab(xy)cd - 6: ab(xy)cd - 7: ab(xy)cd - 8: ab(xy)cd - 9: ab(xy)cd -10: ab(xy)cd -11: cd - -/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /x -Capturing subpattern count = 3 -Options: extended -First char = '(' -Need char = ')' - (abcd(xyz

    qrs)123) - 0: (abcd(xyz

    qrs)123) - 1: abcd(xyz

    qrs)123 - 2: 123 - 3:

    qrs - -/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /x -Capturing subpattern count = 3 -Options: extended -First char = '(' -Need char = ')' - (ab(cd)ef) - 0: (ab(cd)ef) - 1: ab(cd)ef - 2: ef - 3: (cd) - (ab(cd(ef)gh)ij) - 0: (ab(cd(ef)gh)ij) - 1: ab(cd(ef)gh)ij - 2: ij - 3: (cd(ef)gh) - -/^[[:alnum:]]/D ------------------------------------------------------------------- - 0 37 Bra 0 - 3 ^ - 4 [0-9A-Za-z] - 37 37 Ket - 40 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -Options: anchored -No first char -No need char - -/^[[:alpha:]]/D ------------------------------------------------------------------- - 0 37 Bra 0 - 3 ^ - 4 [A-Za-z] - 37 37 Ket - 40 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -Options: anchored -No first char -No need char - -/^[[:ascii:]]/D ------------------------------------------------------------------- - 0 37 Bra 0 - 3 ^ - 4 [\x00-\x7f] - 37 37 Ket - 40 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -Options: anchored -No first char -No need char - -/^[[:cntrl:]]/D ------------------------------------------------------------------- - 0 37 Bra 0 - 3 ^ - 4 [\x00-\x1f\x7f] - 37 37 Ket - 40 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -Options: anchored -No first char -No need char - -/^[[:digit:]]/D ------------------------------------------------------------------- - 0 37 Bra 0 - 3 ^ - 4 [0-9] - 37 37 Ket - 40 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -Options: anchored -No first char -No need char - -/^[[:graph:]]/D ------------------------------------------------------------------- - 0 37 Bra 0 - 3 ^ - 4 [!-~] - 37 37 Ket - 40 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -Options: anchored -No first char -No need char - -/^[[:lower:]]/D ------------------------------------------------------------------- - 0 37 Bra 0 - 3 ^ - 4 [a-z] - 37 37 Ket - 40 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -Options: anchored -No first char -No need char - -/^[[:print:]]/D ------------------------------------------------------------------- - 0 37 Bra 0 - 3 ^ - 4 [ -~] - 37 37 Ket - 40 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -Options: anchored -No first char -No need char - -/^[[:punct:]]/D ------------------------------------------------------------------- - 0 37 Bra 0 - 3 ^ - 4 [!-/:-@[-`{-~] - 37 37 Ket - 40 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -Options: anchored -No first char -No need char - -/^[[:space:]]/D ------------------------------------------------------------------- - 0 37 Bra 0 - 3 ^ - 4 [\x09-\x0d ] - 37 37 Ket - 40 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -Options: anchored -No first char -No need char - -/^[[:upper:]]/D ------------------------------------------------------------------- - 0 37 Bra 0 - 3 ^ - 4 [A-Z] - 37 37 Ket - 40 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -Options: anchored -No first char -No need char - -/^[[:xdigit:]]/D ------------------------------------------------------------------- - 0 37 Bra 0 - 3 ^ - 4 [0-9A-Fa-f] - 37 37 Ket - 40 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -Options: anchored -No first char -No need char - -/^[[:word:]]/D ------------------------------------------------------------------- - 0 37 Bra 0 - 3 ^ - 4 [0-9A-Z_a-z] - 37 37 Ket - 40 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -Options: anchored -No first char -No need char - -/^[[:^cntrl:]]/D ------------------------------------------------------------------- - 0 37 Bra 0 - 3 ^ - 4 [ -~\x80-\xff] - 37 37 Ket - 40 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -Options: anchored -No first char -No need char - -/^[12[:^digit:]]/D ------------------------------------------------------------------- - 0 37 Bra 0 - 3 ^ - 4 [\x00-/1-2:-\xff] - 37 37 Ket - 40 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -Options: anchored -No first char -No need char - -/[01[:alpha:]%]/D ------------------------------------------------------------------- - 0 36 Bra 0 - 3 [%0-1A-Za-z] - 36 36 Ket - 39 End ------------------------------------------------------------------- -Capturing subpattern count = 0 -No options -No first char -No need char - -/[[.ch.]]/ -Failed: POSIX collating elements are not supported at offset 1 - -/[[=ch=]]/ -Failed: POSIX collating elements are not supported at offset 1 - -/[[:rhubarb:]]/ -Failed: unknown POSIX class name at offset 3 - -/[[:upper:]]/i -Capturing subpattern count = 0 -Options: caseless -No first char -No need char - A - 0: A - a - 0: a - -/[[:lower:]]/i -Capturing subpattern count = 0 -Options: caseless -No first char -No need char - A - 0: A - a - 0: a - -/((?-i)[[:lower:]])[[:lower:]]/i -Capturing subpattern count = 1 -Options: caseless -Case state changes -No first char -No need char - ab - 0: ab - 1: a - aB - 0: aB - 1: a - *** Failers - 0: ai - 1: a - Ab -No match - AB -No match - -/ End of test input / -Capturing subpattern count = 0 -No options -First char = ' ' -Need char = ' ' - diff --git a/srclib/pcre/testdata/testoutput3 b/srclib/pcre/testdata/testoutput3 deleted file mode 100644 index 0269f87034..0000000000 --- a/srclib/pcre/testdata/testoutput3 +++ /dev/null @@ -1,2967 +0,0 @@ -PCRE version 3.2 12-May-2000 - -/(?.*/)foo" - /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/ -No match - -"(?>.*/)foo" - /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo - 0: /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo - -/(?>(\.\d\d[1-9]?))\d+/ - 1.230003938 - 0: .230003938 - 1: .23 - 1.875000282 - 0: .875000282 - 1: .875 - *** Failers -No match - 1.235 -No match - -/^((?>\w+)|(?>\s+))*$/ - now is the time for all good men to come to the aid of the party - 0: now is the time for all good men to come to the aid of the party - 1: party - *** Failers -No match - this is not a line with only words and spaces! -No match - -/(\d+)(\w)/ - 12345a - 0: 12345a - 1: 12345 - 2: a - 12345+ - 0: 12345 - 1: 1234 - 2: 5 - -/((?>\d+))(\w)/ - 12345a - 0: 12345a - 1: 12345 - 2: a - *** Failers -No match - 12345+ -No match - -/(?>a+)b/ - aaab - 0: aaab - -/((?>a+)b)/ - aaab - 0: aaab - 1: aaab - -/(?>(a+))b/ - aaab - 0: aaab - 1: aaa - -/(?>b)+/ - aaabbbccc - 0: bbb - -/(?>a+|b+|c+)*c/ - aaabbbbccccd - 0: aaabbbbc - -/((?>[^()]+)|\([^()]*\))+/ - ((abc(ade)ufh()()x - 0: abc(ade)ufh()()x - 1: x - -/\(((?>[^()]+)|\([^()]+\))+\)/ - (abc) - 0: (abc) - 1: abc - (abc(def)xyz) - 0: (abc(def)xyz) - 1: xyz - *** Failers -No match - ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -No match - -/a(?-i)b/i - ab - 0: ab - *** Failers -No match - Ab -No match - aB -No match - AB -No match - -/(a (?x)b c)d e/ - a bcd e - 0: a bcd e - 1: a bc - *** Failers -No match - a b cd e -No match - abcd e -No match - a bcde -No match - -/(a b(?x)c d (?-x)e f)/ - a bcde f - 0: a bcde f - 1: a bcde f - *** Failers -No match - abcdef -No match - -/(a(?i)b)c/ - abc - 0: abc - 1: ab - aBc - 0: aBc - 1: aB - *** Failers -No match - abC -No match - aBC -No match - Abc -No match - ABc -No match - ABC -No match - AbC -No match - -/a(?i:b)c/ - abc - 0: abc - aBc - 0: aBc - *** Failers -No match - ABC -No match - abC -No match - aBC -No match - -/a(?i:b)*c/ - aBc - 0: aBc - aBBc - 0: aBBc - *** Failers -No match - aBC -No match - aBBC -No match - -/a(?=b(?i)c)\w\wd/ - abcd - 0: abcd - abCd - 0: abCd - *** Failers -No match - aBCd -No match - abcD -No match - -/(?s-i:more.*than).*million/i - more than million - 0: more than million - more than MILLION - 0: more than MILLION - more \n than Million - 0: more \x0a than Million - *** Failers -No match - MORE THAN MILLION -No match - more \n than \n million -No match - -/(?:(?s-i)more.*than).*million/i - more than million - 0: more than million - more than MILLION - 0: more than MILLION - more \n than Million - 0: more \x0a than Million - *** Failers -No match - MORE THAN MILLION -No match - more \n than \n million -No match - -/(?>a(?i)b+)+c/ - abc - 0: abc - aBbc - 0: aBbc - aBBc - 0: aBBc - *** Failers -No match - Abc -No match - abAb -No match - abbC -No match - -/(?=a(?i)b)\w\wc/ - abc - 0: abc - aBc - 0: aBc - *** Failers -No match - Ab -No match - abC -No match - aBC -No match - -/(?<=a(?i)b)(\w\w)c/ - abxxc - 0: xxc - 1: xx - aBxxc - 0: xxc - 1: xx - *** Failers -No match - Abxxc -No match - ABxxc -No match - abxxC -No match - -/(?:(a)|b)(?(1)A|B)/ - aA - 0: aA - 1: a - bB - 0: bB - *** Failers -No match - aB -No match - bA -No match - -/^(a)?(?(1)a|b)+$/ - aa - 0: aa - 1: a - b - 0: b - bb - 0: bb - *** Failers -No match - ab -No match - -/^(?(?=abc)\w{3}:|\d\d)$/ - abc: - 0: abc: - 12 - 0: 12 - *** Failers -No match - 123 -No match - xyz -No match - -/^(?(?!abc)\d\d|\w{3}:)$/ - abc: - 0: abc: - 12 - 0: 12 - *** Failers -No match - 123 -No match - xyz -No match - -/(?(?<=foo)bar|cat)/ - foobar - 0: bar - cat - 0: cat - fcat - 0: cat - focat - 0: cat - *** Failers -No match - foocat -No match - -/(?(?a*)*/ - a - 0: a - aa - 0: aa - aaaa - 0: aaaa - -/(abc|)+/ - abc - 0: abc - 1: - abcabc - 0: abcabc - 1: - abcabcabc - 0: abcabcabc - 1: - xyz - 0: - 1: - -/([a]*)*/ - a - 0: a - 1: - aaaaa - 0: aaaaa - 1: - -/([ab]*)*/ - a - 0: a - 1: - b - 0: b - 1: - ababab - 0: ababab - 1: - aaaabcde - 0: aaaab - 1: - bbbb - 0: bbbb - 1: - -/([^a]*)*/ - b - 0: b - 1: - bbbb - 0: bbbb - 1: - aaa - 0: - 1: - -/([^ab]*)*/ - cccc - 0: cccc - 1: - abab - 0: - 1: - -/([a]*?)*/ - a - 0: - 1: - aaaa - 0: - 1: - -/([ab]*?)*/ - a - 0: - 1: - b - 0: - 1: - abab - 0: - 1: - baba - 0: - 1: - -/([^a]*?)*/ - b - 0: - 1: - bbbb - 0: - 1: - aaa - 0: - 1: - -/([^ab]*?)*/ - c - 0: - 1: - cccc - 0: - 1: - baba - 0: - 1: - -/(?>a*)*/ - a - 0: a - aaabcde - 0: aaa - -/((?>a*))*/ - aaaaa - 0: aaaaa - 1: - aabbaa - 0: aa - 1: - -/((?>a*?))*/ - aaaaa - 0: - 1: - aabbaa - 0: - 1: - -/(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /x - 12-sep-98 - 0: 12-sep-98 - 12-09-98 - 0: 12-09-98 - *** Failers -No match - sep-12-98 -No match - -/(?<=(foo))bar\1/ - foobarfoo - 0: barfoo - 1: foo - foobarfootling - 0: barfoo - 1: foo - *** Failers -No match - foobar -No match - barfoo -No match - -/(?i:saturday|sunday)/ - saturday - 0: saturday - sunday - 0: sunday - Saturday - 0: Saturday - Sunday - 0: Sunday - SATURDAY - 0: SATURDAY - SUNDAY - 0: SUNDAY - SunDay - 0: SunDay - -/(a(?i)bc|BB)x/ - abcx - 0: abcx - 1: abc - aBCx - 0: aBCx - 1: aBC - bbx - 0: bbx - 1: bb - BBx - 0: BBx - 1: BB - *** Failers -No match - abcX -No match - aBCX -No match - bbX -No match - BBX -No match - -/^([ab](?i)[cd]|[ef])/ - ac - 0: ac - 1: ac - aC - 0: aC - 1: aC - bD - 0: bD - 1: bD - elephant - 0: e - 1: e - Europe - 0: E - 1: E - frog - 0: f - 1: f - France - 0: F - 1: F - *** Failers -No match - Africa -No match - -/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/ - ab - 0: ab - 1: ab - aBd - 0: aBd - 1: aBd - xy - 0: xy - 1: xy - xY - 0: xY - 1: xY - zebra - 0: z - 1: z - Zambesi - 0: Z - 1: Z - *** Failers -No match - aCD -No match - XY -No match - -/(?<=foo\n)^bar/m - foo\nbar - 0: bar - *** Failers -No match - bar -No match - baz\nbar -No match - -/(?<=(?]&/ - <&OUT - 0: <& - -/^(a\1?){4}$/ - aaaaaaaaaa - 0: aaaaaaaaaa - 1: aaaa - *** Failers -No match - AB -No match - aaaaaaaaa -No match - aaaaaaaaaaa -No match - -/^(a(?(1)\1)){4}$/ - aaaaaaaaaa - 0: aaaaaaaaaa - 1: aaaa - *** Failers -No match - aaaaaaaaa -No match - aaaaaaaaaaa -No match - -/(?:(f)(o)(o)|(b)(a)(r))*/ - foobar - 0: foobar - 1: f - 2: o - 3: o - 4: b - 5: a - 6: r - -/(?<=a)b/ - ab - 0: b - *** Failers -No match - cb -No match - b -No match - -/(? - 2: abcd - xy:z:::abcd - 0: xy:z:::abcd - 1: xy:z::: - 2: abcd - -/^[^bcd]*(c+)/ - aexycd - 0: aexyc - 1: c - -/(a*)b+/ - caab - 0: aab - 1: aa - -/([\w:]+::)?(\w+)$/ - abcd - 0: abcd - 1: - 2: abcd - xy:z:::abcd - 0: xy:z:::abcd - 1: xy:z::: - 2: abcd - *** Failers - 0: Failers - 1: - 2: Failers - abcd: -No match - abcd: -No match - -/^[^bcd]*(c+)/ - aexycd - 0: aexyc - 1: c - -/(>a+)ab/ - -/(?>a+)b/ - aaab - 0: aaab - -/([[:]+)/ - a:[b]: - 0: :[ - 1: :[ - -/([[=]+)/ - a=[b]= - 0: =[ - 1: =[ - -/([[.]+)/ - a.[b]. - 0: .[ - 1: .[ - -/((?>a+)b)/ - aaab - 0: aaab - 1: aaab - -/(?>(a+))b/ - aaab - 0: aaab - 1: aaa - -/((?>[^()]+)|\([^()]*\))+/ - ((abc(ade)ufh()()x - 0: abc(ade)ufh()()x - 1: x - -/a\Z/ - *** Failers -No match - aaab -No match - a\nb\n -No match - -/b\Z/ - a\nb\n - 0: b - -/b\z/ - -/b\Z/ - a\nb - 0: b - -/b\z/ - a\nb - 0: b - *** Failers -No match - -/^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/ - a - 0: a - 1: - abc - 0: abc - 1: - a-b - 0: a-b - 1: - 0-9 - 0: 0-9 - 1: - a.b - 0: a.b - 1: - 5.6.7 - 0: 5.6.7 - 1: - the.quick.brown.fox - 0: the.quick.brown.fox - 1: - a100.b200.300c - 0: a100.b200.300c - 1: - 12-ab.1245 - 0: 12-ab.1245 - 1: - ***Failers -No match - \ -No match - .a -No match - -a -No match - a- -No match - a. -No match - a_b -No match - a.- -No match - a.. -No match - ab..bc -No match - the.quick.brown.fox- -No match - the.quick.brown.fox. -No match - the.quick.brown.fox_ -No match - the.quick.brown.fox+ -No match - -/(?>.*)(?<=(abcd|wxyz))/ - alphabetabcd - 0: alphabetabcd - 1: abcd - endingwxyz - 0: endingwxyz - 1: wxyz - *** Failers -No match - a rather long string that doesn't end with one of them -No match - -/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/ - word cat dog elephant mussel cow horse canary baboon snake shark otherword - 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword - word cat dog elephant mussel cow horse canary baboon snake shark -No match - -/word (?>[a-zA-Z0-9]+ ){0,30}otherword/ - word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope -No match - -/(?<=\d{3}(?!999))foo/ - 999foo - 0: foo - 123999foo - 0: foo - *** Failers -No match - 123abcfoo -No match - -/(?<=(?!...999)\d{3})foo/ - 999foo - 0: foo - 123999foo - 0: foo - *** Failers -No match - 123abcfoo -No match - -/(?<=\d{3}(?!999)...)foo/ - 123abcfoo - 0: foo - 123456foo - 0: foo - *** Failers -No match - 123999foo -No match - -/(?<=\d{3}...)(? - 2: - 3: abcd - - 2: - 3: abcd - \s*)=(?>\s*) # find - 2: - 3: abcd - Z)+|A)*/ - ZABCDEFG - 0: ZA - 1: A - -/((?>)+|A)*/ - ZABCDEFG - 0: - 1: - -/a*/g - abbab - 0: a - 0: - 0: - 0: a - 0: - 0: - -/ End of test input / - diff --git a/srclib/pcre/testdata/testoutput4 b/srclib/pcre/testdata/testoutput4 deleted file mode 100644 index d285224515..0000000000 --- a/srclib/pcre/testdata/testoutput4 +++ /dev/null @@ -1,115 +0,0 @@ -PCRE version 3.2 12-May-2000 - -/^[\w]+/ - *** Failers -No match - École -No match - -/^[\w]+/Lfr - École - 0: École - -/^[\w]+/ - *** Failers -No match - École -No match - -/^[\W]+/ - École - 0: \xc9 - -/^[\W]+/Lfr - *** Failers - 0: *** - École -No match - -/[\b]/ - \b - 0: \x08 - *** Failers -No match - a -No match - -/[\b]/Lfr - \b - 0: \x08 - *** Failers -No match - a -No match - -/^\w+/ - *** Failers -No match - École -No match - -/^\w+/Lfr - École - 0: École - -/(.+)\b(.+)/ - École - 0: \xc9cole - 1: \xc9 - 2: cole - -/(.+)\b(.+)/Lfr - *** Failers - 0: *** Failers - 1: *** - 2: Failers - École -No match - -/École/i - École - 0: \xc9cole - *** Failers -No match - école -No match - -/École/iLfr - École - 0: École - école - 0: école - -/\w/IS -Capturing subpattern count = 0 -No options -No first char -No need char -Starting character set: 0 1 2 3 4 5 6 7 8 9 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 - -/\w/ISLfr -Capturing subpattern count = 0 -No options -No first char -No need char -Starting character set: 0 1 2 3 4 5 6 7 8 9 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 - À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å - æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ - -/^[\xc8-\xc9]/iLfr - École - 0: É - école - 0: é - -/^[\xc8-\xc9]/Lfr - École - 0: É - *** Failers -No match - école -No match - - diff --git a/support/.cvsignore b/support/.cvsignore deleted file mode 100644 index fa1c006478..0000000000 --- a/support/.cvsignore +++ /dev/null @@ -1,27 +0,0 @@ -.libs -*.lo -.deps -Makefile -*.mak -rotatelogs -htpasswd -htdigest -unescape -inc2shtml -httpd_monitor -suexec -logresolve -ab -apxs -Debug -Release -vc*.idb -*.opt -*.plg -*.pdb -apachectl -dbmmanage -log_server_status -logresolve.pl -split-logfile -phf_abuse_log.cgi diff --git a/support/.indent.pro b/support/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- 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 ff5f6a4e26..0000000000 --- a/support/Makefile.in +++ /dev/null @@ -1,46 +0,0 @@ -DISTCLEAN_TARGETS = apxs apachectl dbmmanage log_server_status logresolve.pl \ - phf_abuse_log.cgi split-logfile - -PROGRAMS = htpasswd htdigest rotatelogs logresolve ab -targets = $(PROGRAMS) - -PROGRAM_LDADD = $(EXTRA_LDFLAGS) $(PROGRAM_DEPENDENCIES) $(EXTRA_LIBS) -PROGRAM_DEPENDENCIES = \ - ../srclib/apr-util/libaprutil.la ../srclib/apr/libapr.la - -include $(top_srcdir)/build/rules.mk - -install: - @test -d $(bindir) || $(MKINSTALLDIRS) $(bindir) - @cp -p httpd.exp $(bindir) - @cp -p apachectl $(bindir) - chmod 755 $(bindir)/apachectl - @if test -f $(builddir)/apxs; then \ - cp -p apxs $(bindir); \ - chmod 755 $(bindir)/apxs; \ - fi - -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) - -suexec_OBJECTS = suexec.lo -suexec: $(suexec_OBJECTS) - $(LINK) $(suexec_OBJECTS) $(PROGRAM_LDADD) - diff --git a/support/README b/support/README deleted file mode 100644 index 80e9cafde0..0000000000 --- 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 3998e1fdd9..0000000000 --- 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 35228022a0..0000000000 --- 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 ad624d1101..0000000000 --- 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 b8fe917eaf..0000000000 --- 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 55f382ac7c..0000000000 --- a/support/ab.c +++ /dev/null @@ -1,1670 +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. - */ - -/* - ** 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 1999 - ** Version 1.3d - ** - Increased version number - as some of the socket/error handling has - ** fundamentally changed - and will give fundamentally different results - ** in situations where a server is dropping requests. Therefore you can - ** no longer compare results of AB as easily. Hence the inc of the version. - ** They should be closer to the truth though. Sander & , End 2000. - ** - Fixed proxy functionality, added median/mean statistics, added gnuplot - ** output option, added _experimental/rudimentary_ SSL support. Added - ** confidence guestimators and warnings. Sander & , End 2000 - ** - Fixed serious int overflow issues which would cause realistic (longer - ** than a few minutes) run's to have wrong (but believable) results. Added - ** trapping of connection errors which influenced measurements. - ** Contributed by Sander Temme - , Early 2001 - ** Version 1.3e - ** - Changed timeout behavour during write to work whilst the sockets - ** are filling up and apr_write() does writes a few - but not all. - ** This will potentially change results. , April 2001 - ** - */ - -/* - * 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 AB_VERSION "1.3e" - -/* -------------------------------------------------------------------- */ - -#if 'A' != 0x41 -/* Hmmm... This source code isn't being compiled in ASCII. - * In order for data that flows over the network to make - * sense, we need to translate to/from ASCII. - */ -#define NOT_ASCII -#endif - -/* affects include files on Solaris */ -#define BSD_COMP - -#include "apr.h" -#include "apr_strings.h" -#include "apr_network_io.h" -#include "apr_file_io.h" -#include "apr_time.h" -#include "apr_getopt.h" -#include "apr_general.h" -#include -#include "apr_lib.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" -#if APR_HAVE_STDIO_H -#include /* for EOF */ -#endif -#if APR_HAVE_STDLIB_H -#include -#endif - -#include "apr_base64.h" -#ifdef NOT_ASCII -#include "apr_xlate.h" -#endif -#if APR_HAVE_STDIO_H -#include -#endif -#if APR_HAVE_STDLIB_H -#include - -#ifdef USE_SSL -#if ((!(RSAREF)) && (!(SYSSSL))) -/* Libraries on most systems.. */ -#include -#include -#include -#include -#include -#include -#else -/* Libraries for RSAref and SYSSSL */ -#include -#include -#include -#include -#include -#include -#endif -#endif - -#include -#endif -#if APR_HAVE_CTYPE_H -#include -#endif - -/* ------------------- DEFINITIONS -------------------------- */ - -#ifndef LLONG_MAX -#define AB_MAX APR_INT64_C(0x7fffffffffffffff) -#else -#define AB_MAX LLONG_MAX -#endif - -/* 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 (2048) - -struct connection { - apr_socket_t *aprsock; - int state; - int read; /* amount of bytes read */ - int bread; /* amount of body read */ - int rwrite, rwrote; /* keep pointers in what we write - across - * EAGAINs */ - 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 */ - apr_time_t start, /* Start of connection */ - connect, /* Connected, start writing */ - endwrite, /* Request written */ - beginread, /* First byte of input */ - done; /* Connection closed */ - - int socknum; -#ifdef USE_SSL - SSL *ssl; -#endif -}; - -struct data { -#ifdef USE_SSL - /* XXXX insert SSL timings */ -#endif - int read; /* number of bytes read */ - apr_time_t starttime; /* start time of connection in seconds since - * Jan. 1, 1970 */ - apr_interval_time_t waittime; /* Between writing request and reading - * response */ - apr_interval_time_t ctime; /* time in ms to connect */ - apr_interval_time_t 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 heartbeatres = 100; /* How often do we say we're alive */ -int concurrency = 1; /* Number of multiple requests to make */ -int percentile = 1; /* Show percentile served */ -int confidence = 1; /* Show confidence estimator and warnings */ -int tlimit = 0; /* time limit in cs */ -int keepalive = 0; /* try and do keepalive connections */ -char servername[1024]; /* name that server reports */ -char *hostname; /* host name from URL */ -char *host_field; /* value of "Host:" header field */ -char path[1024]; /* path name */ -char postfile[1024]; /* name of file containing post data */ -char *postdata; /* *buffer containing data from postfile */ -apr_size_t 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 */ -apr_port_t port; /* port number */ -char proxyhost[1024]; /* proxy host name */ -int proxyport = 0; /* proxy port */ -char connecthost[1024]; -int connectport; -char *gnuplot; /* GNUplot file */ -char *csvperc; /* CSV Percentile file */ -char url[1024]; -char fullurl[1024]; -int isproxy = 0; -apr_time_t aprtimeout = 30 * APR_USEC_PER_SEC; /* timeout value */ - /* - * XXX - this is now a per read/write transact type of value - */ - -int use_html = 0; /* use html in the report */ -const char *tablestring; -const char *trstring; -const char *tdstring; - -int doclen = 0; /* the length the document should be */ -long started = 0; /* number of requests started, so no excess */ -long totalread = 0; /* total number of bytes read */ -long totalbread = 0; /* totoal amount of entity body read */ -long totalposted = 0; /* total number of bytes posted, inc. headers */ -long done = 0; /* number of requests we have done */ -long doneka = 0; /* number of keep alive connections done */ -long good = 0, bad = 0; /* number of good and bad requests */ -long epipe = 0; /* number of broken pipe writes */ - -#ifdef USE_SSL -int ssl = 0; -SSL_CTX *ctx; -#endif - -/* store error cases */ -int err_length = 0, err_conn = 0, err_except = 0; -int err_response = 0; - -apr_time_t start, endtime; - -/* global request (and its length) */ -char _request[512]; -char *request = _request; -apr_size_t reqlen; - -/* one global throw-away buffer to read stuff into */ -char buffer[8192]; - -/* interesting percentiles */ -int percs[] = {50, 66, 75, 80, 90, 95, 98, 99, 100}; - -struct connection *con; /* connection array */ -struct data *stats; /* date for each request */ -apr_pool_t *cntxt; - -apr_pollfd_t *readbits; - -#ifdef NOT_ASCII -apr_xlate_t *from_ascii, *to_ascii; -#endif - -static void close_connection(struct connection * c); -/* --------------------------------------------------------- */ - -/* simple little function to write an error string and exit */ - -static void err(char *s) -{ - fprintf(stderr, "%s", s); - exit(1); -} - -/* simple little function to write an APR error string and exit */ - -static void apr_err(char *s, apr_status_t rv) -{ - char buf[120]; - - fprintf(stderr, - "%s: %s (%d)\n", - s, apr_strerror(rv, buf, sizeof buf), rv); - exit(rv); -} - -/* --------------------------------------------------------- */ -/* 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) -{ - do { - apr_time_t tnow = apr_time_now(); - apr_size_t l = c->rwrite; - apr_status_t e; - - /* - * First time round ? - */ - if (c->rwrite == 0) { - apr_setsocketopt(c->aprsock, APR_SO_TIMEOUT, 0); - c->connect = tnow; - c->rwrite = reqlen; - c->rwrote = 0; - if (posting) - c->rwrite += postlen; - } - else if (tnow > c->connect + aprtimeout) { - printf("Send request timed out!\n"); - close_connection(c); - return; - } - - e = apr_send(c->aprsock, request + c->rwrote, &l); - - /* - * Bail early on the most common case - */ - if (l == c->rwrite) - break; - - if (e != APR_SUCCESS) { - /* - * Let's hope this traps EWOULDBLOCK too ! - */ - if (!APR_STATUS_IS_EAGAIN(e)) { - epipe++; - printf("Send request failed!\n"); - close_connection(c); - } - return; - } - c->rwrote += l; - c->rwrite -= l; - } while (1); - - totalposted += c->rwrite; - c->state = STATE_READ; - c->endwrite = apr_time_now(); - apr_poll_socket_add(readbits, c->aprsock, APR_POLLIN); -} - -/* --------------------------------------------------------- */ - -/* calculate and output results */ - -static int compradre(struct data * a, struct data * b) -{ - if ((a->ctime) < (b->ctime)) - return -1; - if ((a->ctime) > (b->ctime)) - return +1; - return 0; -} - -static int comprando(struct data * a, struct data * b) -{ - if ((a->time) < (b->time)) - return -1; - if ((a->time) > (b->time)) - return +1; - return 0; -} - -static int compri(struct data * a, struct data * b) -{ - apr_interval_time_t p = a->time - a->ctime; - apr_interval_time_t q = b->time - b->ctime; - if (p < q) - return -1; - if (p > q) - return +1; - return 0; -} - -static int compwait(struct data * a, struct data * b) -{ - if ((a->waittime) < (b->waittime)) - return -1; - if ((a->waittime) > (b->waittime)) - return 1; - return 0; -} - -static void output_results(void) -{ - apr_interval_time_t timetakenusec; - float timetaken; - - endtime = apr_time_now(); - timetakenusec = endtime - start; - timetaken = (float) timetakenusec / APR_USEC_PER_SEC; - - printf("\r \r"); - printf("Server Software: %s\n", servername); - printf("Server Hostname: %s\n", hostname); - printf("Server Port: %hd\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: %" APR_TIME_T_FMT ".%03" APR_TIME_T_FMT " seconds\n", - (apr_interval_time_t) timetakenusec / APR_USEC_PER_SEC, - (apr_interval_time_t) timetakenusec % APR_USEC_PER_SEC); - printf("Complete requests: %ld\n", done); - printf("Failed requests: %ld\n", bad); - if (bad) - printf(" (Connect: %d, Length: %d, Exceptions: %d)\n", - err_conn, err_length, err_except); - printf("Write errors: %ld\n", epipe); - if (err_response) - printf("Non-2xx responses: %d\n", err_response); - if (keepalive) - printf("Keep-Alive requests: %ld\n", doneka); - printf("Total transferred: %ld bytes\n", totalread); - if (posting > 0) - printf("Total POSTed: %ld\n", totalposted); - printf("HTML transferred: %ld bytes\n", totalbread); - - /* avoid divide by zero */ - if (timetaken) { - printf("Requests per second: %.2f [#/sec] (mean)\n", done / timetaken); - printf("Time per request: %.3f [ms] (mean)\n", concurrency * timetaken / done); - printf("Time per request: %.3f [ms] (mean, across all concurent requests)\n", - timetaken / done); - printf("Transfer rate: %.2f [Kbytes/sec] received\n", - totalread / 1024 / timetaken); - if (posting > 0) { - printf(" %.2f kb/s sent\n", - (float) totalposted / timetaken / 1024); - printf(" %.2f kb/s total\n", - (float) (totalread + totalposted) / timetaken / 1024); - } - } - - if (requests) { - /* work out connection times */ - long i; - double totalcon = 0, total = 0, totald = 0, totalwait = 0; - apr_interval_time_t mincon = AB_MAX, mintot = AB_MAX, mind = AB_MAX, - minwait = AB_MAX; - apr_interval_time_t maxcon = 0, maxtot = 0, maxd = 0, maxwait = 0; - apr_interval_time_t meancon = 0, meantot = 0, meand = 0, meanwait = 0; - double sdtot = 0, sdcon = 0, sdd = 0, sdwait = 0; - - for (i = 0; i < requests; i++) { - struct data s = stats[i]; - mincon = ap_min(mincon, s.ctime); - mintot = ap_min(mintot, s.time); - mind = ap_min(mind, s.time - s.ctime); - minwait = ap_min(minwait, s.waittime); - - maxcon = ap_max(maxcon, s.ctime); - maxtot = ap_max(maxtot, s.time); - maxd = ap_max(maxd, s.time - s.ctime); - maxwait = ap_max(maxwait, s.waittime); - - totalcon += s.ctime; - total += s.time; - totald += s.time - s.ctime; - totalwait += s.waittime; - } - totalcon /= requests; - total /= requests; - totald /= requests; - totalwait /= requests; - - for (i = 0; i < requests; i++) { - struct data s = stats[i]; - apr_interval_time_t a; - a = (s.time - total); - sdtot += a * a; - a = (s.ctime - totalcon); - sdcon += a * a; - a = (s.time - s.ctime - totald); - sdd += a * a; - a = (s.waittime - totalwait); - sdwait += a * a; - }; - - sdtot = (requests > 1) ? sqrt(sdtot / (requests - 1)) : 0; - sdcon = (requests > 1) ? sqrt(sdcon / (requests - 1)) : 0; - sdd = (requests > 1) ? sqrt(sdd / (requests - 1)) : 0; - sdwait = (requests > 1) ? sqrt(sdwait / (requests - 1)) : 0; - - if (gnuplot) { - FILE *out = fopen(gnuplot, "w"); - long i; - apr_time_t sttime; - char tmstring[1024];/* XXXX */ - if (!out) { - perror("Cannot open gnuplot output file"); - exit(1); - }; - fprintf(out, "starttime\tseconds\tctime\tdtime\tttime\twait\n"); - for (i = 0; i < requests; i++) { - sttime = stats[i].starttime; - (void) apr_ctime(tmstring, sttime); - tmstring[strlen(tmstring) - 1] = '\0'; /* ctime returns a - * string with a - * trailing newline */ - fprintf(out, "%s\t%" APR_TIME_T_FMT "\t%" APR_TIME_T_FMT "\t%" APR_TIME_T_FMT "\t%" APR_TIME_T_FMT "\t%" APR_TIME_T_FMT "\n", - tmstring, - sttime, - stats[i].ctime, - stats[i].time - stats[i].ctime, - stats[i].time, - stats[i].waittime); - } - fclose(out); - }; - /* - * XXX: what is better; this hideous cast of the copare function; or - * the four warnings during compile ? dirkx just does not know and - * hates both/ - */ - qsort(stats, requests, sizeof(struct data), - (int (*) (const void *, const void *)) compradre); - if ((requests > 1) && (requests % 2)) - meancon = (stats[requests / 2].ctime + stats[requests / 2 + 1].ctime) / 2; - else - meancon = stats[requests / 2].ctime; - - qsort(stats, requests, sizeof(struct data), - (int (*) (const void *, const void *)) compri); - if ((requests > 1) && (requests % 2)) - meand = (stats[requests / 2].time + stats[requests / 2 + 1].time \ - -stats[requests / 2].ctime - stats[requests / 2 + 1].ctime) / 2; - else - meand = stats[requests / 2].time - stats[requests / 2].ctime; - - qsort(stats, requests, sizeof(struct data), - (int (*) (const void *, const void *)) compwait); - if ((requests > 1) && (requests % 2)) - meanwait = (stats[requests / 2].waittime + stats[requests / 2 + 1].waittime) / 2; - else - meanwait = stats[requests / 2].waittime; - - qsort(stats, requests, sizeof(struct data), - (int (*) (const void *, const void *)) comprando); - if ((requests > 1) && (requests % 2)) - meantot = (stats[requests / 2].time + stats[requests / 2 + 1].time) / 2; - else - meantot = stats[requests / 2].time; - - printf("\nConnection Times (ms)\n"); - - if (confidence) { -#define CONF_FMT_STRING "%" APR_TIME_T_FMT " %5d %6.1f %" APR_TIME_T_FMT " %" APR_TIME_T_FMT "\n" - printf(" min mean[+/-sd] median max\n"); - printf("Connect: " CONF_FMT_STRING, - mincon, (int) (totalcon + 0.5), sdcon, meancon, maxcon); - printf("Processing: " CONF_FMT_STRING, - mind, (int) (totald + 0.5), sdd, meand, maxd); - printf("Waiting: " CONF_FMT_STRING, - minwait, (int) (totalwait + 0.5), sdwait, meanwait, maxwait); - printf("Total: " CONF_FMT_STRING, - mintot, (int) (total + 0.5), sdtot, meantot, maxtot); -#undef CONF_FMT_STRING - -#define SANE(what,avg,mean,sd) \ - { \ - double d = avg - mean; \ - if (d < 0) d = -d; \ - if (d > 2 * sd ) \ - printf("ERROR: The median and mean for " what " are more than twice the standard\n" \ - " deviation apart. These results are NOT reliable.\n"); \ - else if (d > sd ) \ - printf("WARING: The median and mean for " what " are not within a normal deviation\n" \ - " These results are propably not that reliable.\n"); \ - } - SANE("the initial connection time", totalcon, meancon, sdcon); - SANE("the processing time", totald, meand, sdd); - SANE("the waiting time", totalwait, meanwait, sdwait); - SANE("the total time", total, meantot, sdtot); - } - else { - printf(" min avg max\n"); -#define CONF_FMT_STRING "%5" APR_TIME_T_FMT " %5e %5" APR_TIME_T_FMT "\n" - printf("Connect: " CONF_FMT_STRING, mincon, totalcon / requests, - maxcon); - printf("Processing: " CONF_FMT_STRING, mintot - mincon, - (total / requests) - (totalcon / requests), maxtot - maxcon); - printf("Total: " CONF_FMT_STRING, mintot, total / requests, - maxtot); -#undef CONF_FMT_STRING - } - - - /* Sorted on total connect times */ - if (percentile && (requests > 1)) { - printf("\nPercentage of the requests served within a certain time (ms)\n"); - for (i = 0; i < sizeof(percs) / sizeof(int); i++) - if (percs[i] <= 0) - printf(" 0%% <0> (never)\n"); - else if (percs[i] >= 100) - printf(" 100%% %5" APR_TIME_T_FMT " (longest request)\n", - stats[requests - 1].time); - else - printf(" %d%% %5" APR_TIME_T_FMT "\n", - percs[i], stats[(int) (requests * percs[i] / 100)].time); - }; - if (csvperc) { - FILE *out = fopen(csvperc, "w"); - int i; - if (!out) { - perror("Cannot open CSV output file"); - exit(1); - }; - fprintf(out, "" "Percentage served" "," "Time in ms" "\n"); - for (i = 0; i < 100; i++) { - double d; - if (i == 0) - d = stats[0].time; - else if (i == 100) - d = stats[requests - 1].time; - else - d = stats[(int) (0.5 + requests * i / 100.0)].time; - fprintf(out, "%d,%e\n", i, d); - } - fclose(out); - }; - - } -} - -/* --------------------------------------------------------- */ - -/* calculate and output results in HTML */ - -static void output_html_results(void) -{ - long timetaken; - - endtime = apr_time_now(); - timetaken = (endtime - start) / 1000; - - 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 / APR_USEC_PER_SEC, timetaken % APR_USEC_PER_SEC); - 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 > 0) - 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 > 0) { - printf("" - "\n", - trstring, tdstring, tdstring, - (float) (totalposted) / timetaken); - printf("" - "\n", - trstring, tdstring, tdstring, - (float) (totalread + totalposted) / timetaken); - } - } { - /* work out connection times */ - long i; - apr_interval_time_t totalcon = 0, total = 0; - apr_interval_time_t mincon = AB_MAX, mintot = AB_MAX; - apr_interval_time_t 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:%hd
    Document Path:%s
    Document Length:%d bytes
    Concurrency Level:%d
    Time taken for tests:%qd.%03qd seconds
    Complete requests:%ld
    Failed requests:%ld
    (Connect: %d, Length: %d, Exceptions: %d)
    Non-2xx responses:%d
    Keep-Alive requests:%ld
    Total transferred:%ld bytes
    Total POSTed:%ld
    HTML transferred:%ld 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:%5" APR_TIME_T_FMT "%5" APR_TIME_T_FMT "%5" APR_TIME_T_FMT "
    Processing:%5" APR_TIME_T_FMT "%5" APR_TIME_T_FMT "%5" APR_TIME_T_FMT "
    Total:%5" APR_TIME_T_FMT "%5" APR_TIME_T_FMT "%5" APR_TIME_T_FMT "
    \n"); - } -} - -/* --------------------------------------------------------- */ - -/* start asnchronous non-blocking connection */ - -static void start_connect(struct connection * c) -{ - apr_status_t rv; - apr_sockaddr_t *destsa; - - if (!(started < requests)) - return; - - c->read = 0; - c->bread = 0; - c->keepalive = 0; - c->cbx = 0; - c->gotheader = 0; - c->rwrite = 0; - - if ((rv = apr_sockaddr_info_get(&destsa, connecthost, APR_UNSPEC, connectport, 0, cntxt)) - != APR_SUCCESS) { - char buf[120]; - apr_snprintf(buf, sizeof(buf), - "apr_sockaddr_info_get() for %s", connecthost); - apr_err(buf, rv); - } - if ((rv = apr_socket_create(&c->aprsock, destsa->sa.sin.sin_family, - SOCK_STREAM, cntxt)) != APR_SUCCESS) { - apr_err("socket", rv); - } - c->start = apr_time_now(); - if ((rv = apr_connect(c->aprsock, destsa)) != APR_SUCCESS) { - if (APR_STATUS_IS_EINPROGRESS(rv)) { - c->state = STATE_CONNECTING; - c->rwrite = 0; - apr_poll_socket_add(readbits, c->aprsock, APR_POLLOUT); - return; - } - else { - apr_poll_socket_remove(readbits, c->aprsock); - apr_socket_close(c->aprsock); - err_conn++; - if (bad++ > 10) { - fprintf(stderr, - "\nTest aborted after 10 failures\n\n"); - apr_err("apr_connect()", rv); - } - c->state = STATE_UNCONNECTED; - start_connect(c); - return; - } - } - - /* connected first time */ - started++; - 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 - */ - if (good) - good--; /* connection never happened */ - } - 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; - if ((done) && heartbeatres && !(done % heartbeatres)) { - fprintf(stderr, "Completed %ld requests\n", done); - fflush(stderr); - } - c->done = apr_time_now(); - s.read = c->read; - s.starttime = c->start; - s.ctime = (c->connect - c->start) / 1000; - s.time = (c->done - c->start) / 1000; - s.waittime = (c->beginread - c->endwrite) / 1000; - stats[done++] = s; - } - } - - apr_poll_socket_remove(readbits, c->aprsock); - apr_socket_close(c->aprsock); - c->state = STATE_UNCONNECTED; - - /* connect again */ - start_connect(c); - return; -} - -/* --------------------------------------------------------- */ - -/* read data from connection */ - -static void read_connection(struct connection * c) -{ - apr_size_t r; - apr_status_t status; - char *part; - char respcode[4]; /* 3 digits and null */ - - r = sizeof(buffer); - apr_setsocketopt(c->aprsock, APR_SO_TIMEOUT, aprtimeout); - status = apr_recv(c->aprsock, buffer, &r); - if (r == 0 || (status != APR_SUCCESS && !APR_STATUS_IS_EAGAIN(status))) { - good++; - close_connection(c); - return; - } - - if (APR_STATUS_IS_EAGAIN(status)) - return; - - totalread += r; - if (c->read == 0) { - c->beginread = apr_time_now(); - }; - c->read += 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; -#ifdef NOT_ASCII - apr_size_t inbytes_left = space, outbytes_left = space; - - status = apr_xlate_conv_buffer(from_ascii, buffer, &inbytes_left, - c->cbuff + c->cbx, &outbytes_left); - if (status || inbytes_left || outbytes_left) { - fprintf(stderr, "only simple translation is supported (%d/%u/%u)\n", - status, inbytes_left, outbytes_left); - exit(1); - } -#else - memcpy(c->cbuff + c->cbx, buffer, space); -#endif /* NOT_ASCII */ - 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 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 */ - apr_poll_socket_remove(readbits, c->aprsock); - apr_socket_close(c->aprsock); - err_response++; - if (bad++ > 10) { - err("\nTest aborted after 10 failures\n\n"); - } - 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; - if ((done) && (!(done % heartbeatres))) { - fprintf(stderr, "Completed %ld requests\n", done); - fflush(stderr); - } - c->done = apr_time_now(); - s.read = c->read; - s.starttime = c->start; - s.ctime = (c->connect - c->start) / 1000; - s.waittime = (c->beginread - c->endwrite) / 1000; - s.time = (c->done - c->start) / 1000; - 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) -{ - apr_time_t now; - apr_int16_t rv; - long i; - apr_status_t status; -#ifdef NOT_ASCII - apr_size_t inbytes_left, outbytes_left; -#endif - - if (isproxy) { - strcpy(connecthost, proxyhost); - connectport = proxyport; - } - else { - strcpy(connecthost, hostname); - connectport = port; - } - - if (!use_html) { - printf("Benchmarking %s ", hostname); - if (isproxy) - printf("[through %s:%d] ", proxyhost, proxyport); - printf("(be patient)%s", - (heartbeatres ? "\n" : "...")); - fflush(stdout); - } - - now = apr_time_now(); - - con = malloc(concurrency * sizeof(struct connection)); - memset(con, 0, concurrency * sizeof(struct connection)); - - stats = malloc(requests * sizeof(struct data)); - apr_poll_setup(&readbits, concurrency, cntxt); - - /* setup request */ - if (!posting) { - sprintf(request, "%s %s HTTP/1.0\r\n" - "User-Agent: ApacheBench/%s\r\n" - "%s" "%s" "%s" - "Host: %s\r\n" - "Accept: */*\r\n" - "%s" "\r\n", - (posting == 0) ? "GET" : "HEAD", - (isproxy) ? fullurl : path, - AB_VERSION, - keepalive ? "Connection: Keep-Alive\r\n" : "", - cookie, auth, host_field, 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: %" APR_SIZE_T_FMT "\r\n" - "Content-type: %s\r\n" - "%s" - "\r\n", - (isproxy) ? fullurl : path, - AB_VERSION, - keepalive ? "Connection: Keep-Alive\r\n" : "", - cookie, auth, - host_field, 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); - - /* - * Combine headers and (optional) post file into one contineous buffer - */ - if (posting) { - char *buff = (char *) malloc(postlen + reqlen + 1); - strcpy(buff, request); - strcpy(buff + reqlen, postdata); - request = buff; - } - -#ifdef NOT_ASCII - inbytes_left = outbytes_left = reqlen; - status = apr_xlate_conv_buffer(to_ascii, request, &inbytes_left, - request, &outbytes_left); - if (status || inbytes_left || outbytes_left) { - fprintf(stderr, "only simple translation is supported (%d/%u/%u)\n", - status, inbytes_left, outbytes_left); - exit(1); - } -#endif /* NOT_ASCII */ - - /* ok - lets start */ - start = apr_time_now(); - - /* initialise lots of requests */ - for (i = 0; i < concurrency; i++) { - con[i].socknum = i; - start_connect(&con[i]); - } - - while (done < requests) { - apr_int32_t n; - apr_int32_t timed; - - /* check for time limit expiry */ - now = apr_time_now(); - timed = (now - start) / APR_USEC_PER_SEC; - if (tlimit && timed > (tlimit * 1000)) { - requests = done; /* so stats are correct */ - } - - n = concurrency; - status = apr_poll(readbits, &n, aprtimeout); - if (status != APR_SUCCESS) - apr_err("apr_poll", status); - - if (!n) { - err("\nServer timed out\n\n"); - } - - for (i = 0; i < concurrency; i++) { - /* - * If the connection isn't connected how can we check it? - */ - if (con[i].state == STATE_UNCONNECTED) - continue; - - apr_poll_revents_get(&rv, con[i].aprsock, readbits); - /* - * Notes: APR_POLLHUP is set after FIN is received on some - * systems, so treat that like APR_POLLIN so that we try to read - * again. - * - * Some systems return APR_POLLERR with APR_POLLHUP. We need to - * call read_connection() for APR_POLLHUP, so check for - * APR_POLLHUP first so that a closed connection isn't treated - * like an I/O error. If it is, we never figure out that the - * connection is done and we loop here endlessly calling - * apr_poll(). - */ - if ((rv & APR_POLLIN) || (rv & APR_POLLPRI) || (rv & APR_POLLHUP)) - read_connection(&con[i]); - if ((rv & APR_POLLERR) || (rv & APR_POLLNVAL)) { - bad++; - err_except++; - start_connect(&con[i]); - continue; - } - if (rv & APR_POLLOUT) - write_request(&con[i]); - - /* - * When using a select based poll every time we check the bits - * are reset. In 1.3's ab we copied the FD_SET's each time - * through, but here we're going to check the state and if the - * connection is in STATE_READ or STATE_CONNECTING we'll add the - * socket back in as APR_POLLIN. - */ - if (con[i].state == STATE_READ || con[i].state == STATE_CONNECTING) - apr_poll_socket_add(readbits, con[i].aprsock, APR_POLLIN); - - } - } - - if (heartbeatres) - fprintf(stderr, "Finished %ld requests\n", done); - else - printf("..done\n"); - - 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", AB_VERSION " <$Revision: 1.70 $> apache-2.0"); - printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n"); - printf("Copyright (c) 1998-2001 The Apache Software Foundation, http://www.apache.org/\n"); - printf("\n"); - } - else { - printf("

    \n"); - printf(" This is ApacheBench, Version %s <%s> apache-2.0
    \n", AB_VERSION, "$Revision: 1.70 $"); - printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    \n"); - printf(" Copyright (c) 1998-2001 The Apache Software Foundation, http://www.apache.org/
    \n"); - printf("

    \n

    \n"); - } -} - -/* display usage information */ -static void usage(const char *progname) -{ - fprintf(stderr, "Usage: %s [options] [http" -#if USE_SSL - "[s]" -#endif - "://]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 containing 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, " -i Use HEAD instead of GET\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, " -X proxy:port Proxyserver and port number to use\n"); - fprintf(stderr, " -V Print version number and exit\n"); - fprintf(stderr, " -k Use HTTP KeepAlive feature\n"); - fprintf(stderr, " -d Do not show percentiles served table.\n"); - fprintf(stderr, " -S Do not show confidence estimators and warnings.\n"); - fprintf(stderr, " -g filename Output collected data to gnuplot format file.\n"); - fprintf(stderr, " -e filename Output CSV file with percentages served\n"); -#if USE_SSL - fprintf(stderr, " -s Use httpS instead of HTTP (SSL)\n"); -#endif - 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 *scope_id; - apr_status_t rv; - - if (strlen(url) > 7 && strncmp(url, "http://", 7) == 0) - url += 7; - else -#if USE_SSL - if (strlen(url) > 8 && strncmp(url, "https://", 8) == 0) { - url += 8; - ssl = 1; - port = 443; - } -#else - if (strlen(url) > 8 && strncmp(url, "https://", 8) == 0) { - fprintf(stderr, "SSL not compiled in; no https support\n"); - exit(1); - } -#endif - - if ((cp = strchr(url, '/')) == NULL) - return 1; - h = apr_palloc(cntxt, cp - url + 1); - memcpy(h, url, cp - url); - h[cp - url] = '\0'; - rv = apr_parse_addr_port(&hostname, &scope_id, &port, h, cntxt); - if (rv != APR_SUCCESS || !hostname || scope_id) { - return 1; - } - strcpy(path, cp); - *cp = '\0'; - if (*url == '[') { /* IPv6 numeric address string */ - host_field = apr_psprintf(cntxt, "[%s]", hostname); - } - else { - host_field = hostname; - } - if (port == 0) { /* no port specified */ - port = 80; - } - return 0; -} - -/* ------------------------------------------------------- */ - -/* read data to POST from file, save contents and length */ - -static int open_postfile(const char *pfile) -{ - apr_file_t *postfd = NULL; - apr_finfo_t finfo; - apr_fileperms_t mode = APR_OS_DEFAULT; - apr_size_t length; - apr_status_t rv; - char errmsg[120]; - - rv = apr_file_open(&postfd, pfile, APR_READ, mode, cntxt); - if (rv != APR_SUCCESS) { - printf("Invalid postfile name (%s): %s\n", pfile, - apr_strerror(rv, errmsg, sizeof errmsg)); - return rv; - } - - apr_file_info_get(&finfo, APR_FINFO_NORM, postfd); - postlen = finfo.size; - postdata = (char *) malloc(postlen); - if (!postdata) { - printf("Can\'t alloc postfile buffer\n"); - return APR_ENOMEM; - } - length = postlen; - rv = apr_file_read(postfd, postdata, &length); - if (rv != APR_SUCCESS) { - printf("error reading postfile: %s\n", - apr_strerror(rv, errmsg, sizeof errmsg)); - return rv; - } - if (length != postlen) { - printf("error reading postfile: read only %" - APR_SIZE_T_FMT " bytes", - length); - return APR_EINVAL; - } - apr_file_close(postfd); - return 0; -} - -static void terminate(void) -{ - apr_terminate(); -} - -/* ------------------------------------------------------- */ - -/* sort out command-line args and call test */ -int main(int argc, const char *const argv[]) -{ - int r, l; - char tmp[1024]; - apr_status_t status; - apr_getopt_t *opt; - const char *optarg; - char c; - - /* table defaults */ - tablestring = ""; - trstring = ""; - tdstring = "bgcolor=white"; - cookie[0] = '\0'; - auth[0] = '\0'; - proxyhost[0] = '\0'; - hdrs[0] = '\0'; - - apr_initialize(); - atexit(terminate); - apr_pool_create(&cntxt, NULL); - -#ifdef NOT_ASCII - status = apr_xlate_open(&to_ascii, "ISO8859-1", APR_DEFAULT_CHARSET, cntxt); - if (status) { - fprintf(stderr, "apr_xlate_open(to ASCII)->%d\n", status); - exit(1); - } - status = apr_xlate_open(&from_ascii, APR_DEFAULT_CHARSET, "ISO8859-1", cntxt); - if (status) { - fprintf(stderr, "apr_xlate_open(from ASCII)->%d\n", status); - exit(1); - } - status = apr_base64init_ebcdic(to_ascii, from_ascii); - if (status) { - fprintf(stderr, "apr_base64init_ebcdic()->%d\n", status); - exit(1); - } -#endif - - apr_getopt_init(&opt, cntxt, argc, argv); - while ((status = apr_getopt(opt, "n:c:t:T:p:v:kVhwix:y:z:C:H:P:A:g:X:de:Sq" -#if USE_SSL - "s" -#endif - ,&c, &optarg)) == APR_SUCCESS) { - switch (c) { -#if USE_SSL - case 's': - ssl = 1; - break; -#endif - case 'n': - requests = atoi(optarg); - if (!requests) { - err("Invalid number of requests\n"); - } - break; - case 'k': - keepalive = 1; - break; - case 'q': - heartbeatres = 0; - break; - case 'c': - concurrency = atoi(optarg); - break; - case 'i': - if (posting == 1) - err("Cannot mix POST and HEAD\n"); - posting = -1; - break; - case 'g': - gnuplot = strdup(optarg); - break; - case 'd': - percentile = 0; - break; - case 'e': - csvperc = strdup(optarg); - break; - case 'S': - confidence = 0; - break; - case 'p': - if (posting != 0) - err("Cannot mix POST and HEAD\n"); - - 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 (apr_isspace(*optarg)) - optarg++; - l = apr_base64_encode(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 (apr_isspace(*optarg)) - optarg++; - l = apr_base64_encode(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 '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 'X': - { - char *p; - /* - * assume proxy-name[:port] - */ - if ((p = strchr(optarg, ':'))) { - *p = '\0'; - p++; - proxyport = atoi(p); - }; - strcpy(proxyhost, optarg); - isproxy = 1; - } - break; - case 'y': - use_html = 1; - trstring = optarg; - break; - case 'z': - use_html = 1; - tdstring = optarg; - break; - case 'h': - usage(argv[0]); - break; - case 'V': - copyright(); - return 0; - } - } - - if (opt->ind != argc - 1) { - fprintf(stderr, "%s: wrong number of arguments\n", argv[0]); - usage(argv[0]); - } - - if (parse_url(apr_pstrdup(cntxt, opt->argv[opt->ind++]))) { - fprintf(stderr, "%s: invalid URL\n", argv[0]); - usage(argv[0]); - } - - - if ((heartbeatres) && (requests > 150)) { - heartbeatres = requests / 10; /* Print line every 10% of requests */ - if (heartbeatres < 100) - heartbeatres = 100; /* but never more often than once every 100 - * connections. */ - } - else - heartbeatres = 0; - -#ifdef USE_SSL - SSL_library_init(); - if (!(ctx = SSL_CTX_new(SSLv2_client_method()))) { - fprintf(stderr, "Could not init SSL CTX"); - ERR_print_errors_fp(stderr); - exit(1); - } -#endif -#if SIGPIPE - signal(SIGPIPE, SIG_IGN); /* Ignore writes to connections that - * have been closed at the other end. */ -#endif - copyright(); - test(); - - return 0; -} diff --git a/support/ab.dsp b/support/ab.dsp deleted file mode 100644 index 616799b8e0..0000000000 --- a/support/ab.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ab" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.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 AllowPerConfigDependencies 0 -# 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 "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/ab" /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 /nologo /subsystem:console /incremental:no /map /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /machine:I386 - -!ELSEIF "$(CFG)" == "ab - 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/ab" /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 "ab - Win32 Release" -# Name "ab - Win32 Debug" -# Begin Source File - -SOURCE=.\ab.c -# End Source File -# End Target -# End Project diff --git a/support/ab.mak b/support/ab.mak deleted file mode 100644 index ce41db0b20..0000000000 --- a/support/ab.mak +++ /dev/null @@ -1,290 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on ab.dsp -!IF "$(CFG)" == "" -CFG=ab - Win32 Debug -!MESSAGE No configuration specified. Defaulting to ab - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "ab - Win32 Release" && "$(CFG)" != "ab - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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 -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "ab - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\ab.exe" - -!ELSE - -ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\ab.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\ab.idb" - -@erase "$(INTDIR)\ab.obj" - -@erase "$(OUTDIR)\ab.exe" - -@erase "$(OUTDIR)\ab.map" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\ab"\ - /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\ab.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\ab.pdb"\ - /map:"$(INTDIR)\ab.map" /machine:I386 /out:"$(OUTDIR)\ab.exe" -LINK32_OBJS= \ - "$(INTDIR)\ab.obj" \ - "..\srclib\apr-util\LibR\aprutil.lib" \ - "..\srclib\apr\LibR\apr.lib" - -"$(OUTDIR)\ab.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "ab - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\ab.exe" - -!ELSE - -ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\ab.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\ab.idb" - -@erase "$(INTDIR)\ab.obj" - -@erase "$(OUTDIR)\ab.exe" - -@erase "$(OUTDIR)\ab.map" - -@erase "$(OUTDIR)\ab.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\ab"\ - /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\ab.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\ab.pdb"\ - /map:"$(INTDIR)\ab.map" /debug /machine:I386 /out:"$(OUTDIR)\ab.exe" -LINK32_OBJS= \ - "$(INTDIR)\ab.obj" \ - "..\srclib\apr-util\LibD\aprutil.lib" \ - "..\srclib\apr\LibD\apr.lib" - -"$(OUTDIR)\ab.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "ab - Win32 Release" || "$(CFG)" == "ab - Win32 Debug" - -!IF "$(CFG)" == "ab - Win32 Release" - -"apr - Win32 Release" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\apr.mak CFG="apr - Win32 Release" - cd "..\..\support" - -"apr - Win32 ReleaseCLEAN" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\apr.mak CFG="apr - Win32 Release" RECURSE=1\ - - cd "..\..\support" - -!ELSEIF "$(CFG)" == "ab - Win32 Debug" - -"apr - Win32 Debug" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\apr.mak CFG="apr - Win32 Debug" - cd "..\..\support" - -"apr - Win32 DebugCLEAN" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\apr.mak CFG="apr - Win32 Debug" RECURSE=1 - cd "..\..\support" - -!ENDIF - -!IF "$(CFG)" == "ab - Win32 Release" - -"aprutil - Win32 Release" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" - cd "..\..\support" - -"aprutil - Win32 ReleaseCLEAN" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\aprutil.mak" CFG="aprutil - Win32 Release"\ - RECURSE=1 - cd "..\..\support" - -!ELSEIF "$(CFG)" == "ab - Win32 Debug" - -"aprutil - Win32 Debug" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" - cd "..\..\support" - -"aprutil - Win32 DebugCLEAN" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"\ - RECURSE=1 - cd "..\..\support" - -!ENDIF - -SOURCE=.\ab.c -DEP_CPP_AB_C0=\ - "..\srclib\apr-util\include\apr_base64.h"\ - "..\srclib\apr-util\include\apu.h"\ - "..\srclib\apr\include\apr.h"\ - "..\srclib\apr\include\apr_errno.h"\ - "..\srclib\apr\include\apr_file_info.h"\ - "..\srclib\apr\include\apr_file_io.h"\ - "..\srclib\apr\include\apr_general.h"\ - "..\srclib\apr\include\apr_getopt.h"\ - "..\srclib\apr\include\apr_lib.h"\ - "..\srclib\apr\include\apr_network_io.h"\ - "..\srclib\apr\include\apr_pools.h"\ - "..\srclib\apr\include\apr_strings.h"\ - "..\srclib\apr\include\apr_time.h"\ - "..\srclib\apr\include\apr_user.h"\ - "..\srclib\apr\include\apr_want.h"\ - "..\srclib\apr\include\apr_xlate.h"\ - - -"$(INTDIR)\ab.obj" : $(SOURCE) $(DEP_CPP_AB_C0) "$(INTDIR)" - - - -!ENDIF - diff --git a/support/apachectl.in b/support/apachectl.in deleted file mode 100644 index 136a81cacb..0000000000 --- a/support/apachectl.in +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2000-2001 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 c1c91ee07f..0000000000 --- a/support/apxs.in +++ /dev/null @@ -1,646 +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 -# . -# -## -## apxs -- APache eXtenSion tool -## Written by Ralf S. Engelschall -## - -require 5.003; -use strict; -package apxs; - -## -## Configuration -## - -my $CFG_TARGET = '@progname@'; -my $CFG_CC = '@CC@'; -my $CFG_DEFS = '@DEFS@'; -my $CFG_CFLAGS = '@CFLAGS@ @EXTRA_CFLAGS@'; -my $CFG_PREFIX = "@prefix@"; -my $prefix = "$CFG_PREFIX"; -my $CFG_EXEC_PREFIX = "@exec_prefix@"; -my $exec_prefix = "$CFG_EXEC_PREFIX"; -my $CFG_SBINDIR = "@bindir@"; -my $CFG_INCLUDEDIR = "@includedir@"; -my $CFG_LIBEXECDIR = "@libexecdir@"; -my $CFG_SYSCONFDIR = "@sysconfdir@"; - - -## -## Cleanup the above stuff -## -$CFG_CFLAGS =~ s|^\s+||; -$CFG_CFLAGS =~ s|\s+$||; -$CFG_CFLAGS =~ s|\s+`.+apaci`||; - -## -## 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; - } - } -} - -## -## Initial shared object support check -## -my $httpd = "$CFG_SBINDIR/$CFG_TARGET"; - -#allow apxs to be run from the source tree, before installation -if ($0 =~ m:support/apxs$:) { - ($httpd = $0) =~ s:support/apxs$::; - $httpd .= $CFG_TARGET; -} - -if (not -x $httpd) { - print STDERR "apxs:Error: $httpd not found or not executable\n"; - exit(1); -} -if (not grep(/mod_so/, `$httpd -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 `$httpd'.\n"; - exit(1); -} - -## -## 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|\.[^.]+$|.la|; - } - elsif ($#objs > -1) { - $dso_file = $objs[0]; - $dso_file =~ s|\.[^.]+$|.la|; - } - 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"; - my $s; - my $mod; - foreach $s (@srcs) { - my $slo = $s; - $slo =~ s|\.c$|.slo|; - my $lo = $s; - $lo =~ s|\.c$|.lo|; - my $la = $s; - $la =~ s|\.c$|.la|; - my $o = $s; - $o =~ s|\.c$|.o|; - push(@cmds, "libtool --silent --mode=compile $CFG_CC $cflags -I$CFG_INCLUDEDIR $opt -c -o $lo $s && touch $slo"); - unshift(@objs, $lo); - } - - # create link command - my $o; - my $lo; - foreach $o (@objs) { - $lo .= " $o"; - } - - push(@cmds, "libtool --silent --mode=link $CFG_CC $cflags -o $dso_file -rpath $CFG_LIBEXECDIR -module -avoid-version $lo"); - - # 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$|\.la$)#) { - 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, "libtool --mode=install 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+(?:AP_MODULE_DECLARE_DATA\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/|; - $t =~ s|\.la$|.so|; - 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) { - if (open(FP, ">$CFG_SYSCONFDIR/$CFG_TARGET.conf.new")) { - 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"); - } else { - print STDERR "unable to open configuration file\n"; - } - } - } -} - -##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%.la - -# compile the shared object file -mod_%NAME%.la: 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%.la - -# cleanup -clean: - -rm -f mod_%NAME%.o mod_%NAME%.lo mod_%NAME%.slo mod_%NAME%.la - -# 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 modules 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 modules/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) -{ - if (strcmp(r->handler, "%NAME%")) { - return DECLINED; - } - 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; -} - -static void %NAME%_register_hooks(apr_pool_t *p) -{ - ap_hook_handler(%NAME%_handler, NULL, NULL, APR_HOOK_MIDDLE); -} - -/* Dispatch list for API hooks */ -module AP_MODULE_DECLARE_DATA %NAME%_module = { - STANDARD20_MODULE_STUFF, - 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%_register_hooks /* register hooks */ -}; - diff --git a/support/dbmmanage b/support/dbmmanage deleted file mode 100644 index ad9a4aca76..0000000000 --- a/support/dbmmanage +++ /dev/null @@ -1,350 +0,0 @@ -#!/usr/bin/perl -# ==================================================================== -# 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/dbmmanage.in b/support/dbmmanage.in deleted file mode 100644 index 8c75637e1d..0000000000 --- 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/htdigest.c b/support/htdigest.c deleted file mode 100644 index 987bd629a6..0000000000 --- a/support/htdigest.c +++ /dev/null @@ -1,318 +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 - * . - */ - -/****************************************************************************** - ****************************************************************************** - * 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 "apr.h" -#include "apr_file_io.h" -#include "apr_md5.h" -#include "apr_lib.h" /* for apr_getpass() */ -#include "apr_general.h" -#include "apr_signal.h" - -#define APR_WANT_STDIO -#include "apr_want.h" - -#if APR_HAVE_SYS_TYPES_H -#include -#endif -#if APR_HAVE_STDLIB_H -#include -#endif - -#ifdef WIN32 -#include -#endif - - -#if APR_CHARSET_EBCDIC -#define LF '\n' -#define CR '\r' -#else -#define LF 10 -#define CR 13 -#endif /* APR_CHARSET_EBCDIC */ - -#define MAX_STRING_LEN 256 - -char *tn; -apr_pool_t *cntxt; -#if APR_CHARSET_EBCDIC -apr_xlate_t *to_ascii; -#endif - -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, apr_file_t *f) -{ - register int i = 0; - char ch; - - while (1) { - apr_file_getc(&ch, f); - s[i] = ch; - - if (s[i] == CR) - apr_file_getc(&ch, f); - s[i] = ch; - - if ((s[i] == 0x4) || (s[i] == LF) || (i == (n - 1))) { - s[i] = '\0'; - if (apr_file_eof(f) == APR_EOF) { - return 1; - } - return 0; - } - ++i; - } -} - -static void putline(apr_file_t *f, char *l) -{ - int x; - - for (x = 0; l[x]; x++) - apr_file_putc(l[x], f); - apr_file_putc('\n', f); -} - - -static void add_password(char *user, char *realm, apr_file_t *f) -{ - char *pw; - apr_md5_ctx_t context; - unsigned char digest[16]; - char string[MAX_STRING_LEN]; - char pwin[MAX_STRING_LEN]; - char pwv[MAX_STRING_LEN]; - unsigned int i; - size_t len = sizeof(pwin); - - if (apr_password_get("New password: ", pwin, &len) != APR_SUCCESS) { - fprintf(stderr, "password too long"); - exit(5); - } - len = sizeof(pwin); - apr_password_get("Re-type new password: ", pwv, &len); - if (strcmp(pwin, pwv) != 0) { - fprintf(stderr, "They don't match, sorry.\n"); - if (tn) { - apr_file_remove(tn, cntxt); - } - exit(1); - } - pw = pwin; - apr_file_printf(f, "%s:%s:", user, realm); - - /* Do MD5 stuff */ - sprintf(string, "%s:%s:%s", user, realm, pw); - - apr_md5_init(&context); -#if APR_CHARSET_EBCDIC - apr_md5_set_xlate(&context, to_ascii); -#endif - apr_md5_update(&context, (unsigned char *) string, strlen(string)); - apr_md5_final(digest, &context); - - for (i = 0; i < 16; i++) - apr_file_printf(f, "%02x", digest[i]); - - apr_file_printf(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) - apr_file_remove(tn, cntxt); - exit(1); -} - -static void terminate(void) -{ - apr_terminate(); -} - -int main(int argc, char *argv[]) -{ - apr_file_t *tfp = NULL, *f; - apr_status_t rv; - 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; - - rv = apr_initialize(); - if (rv) { - fprintf(stderr, "apr_initialize(): %s (%d)\n", - apr_strerror(rv, line, sizeof(line)), rv); - exit(1); - } - atexit(terminate); - apr_pool_create(&cntxt, NULL); - -#if APR_CHARSET_EBCDIC - rv = apr_xlate_open(&to_ascii, "ISO8859-1", APR_DEFAULT_CHARSET, cntxt); - if (rv) { - fprintf(stderr, "apr_xlate_open(): %s (%d)\n", - apr_strerror(rv, line, sizeof(line)), rv); - exit(1); - } -#endif - - tn = NULL; - apr_signal(SIGINT, (void (*)(int)) interrupted); - if (argc == 5) { - if (strcmp(argv[1], "-c")) - usage(); - rv = apr_file_open(&tfp, argv[2], APR_WRITE | APR_CREATE, -1, cntxt); - if (rv != APR_SUCCESS) { - char errmsg[120]; - - fprintf(stderr, "Could not open passwd file %s for writing: %s\n", - argv[2], - apr_strerror(rv, errmsg, sizeof errmsg)); - exit(1); - } - printf("Adding password for %s in realm %s.\n", argv[4], argv[3]); - add_password(argv[4], argv[3], tfp); - apr_file_close(tfp); - exit(0); - } - else if (argc != 4) - usage(); - - tn = tmpnam(NULL); - if (apr_file_open(&tfp, tn, APR_WRITE | APR_CREATE, -1, cntxt)!= APR_SUCCESS) { - fprintf(stderr, "Could not open temp file.\n"); - exit(1); - } - - if (apr_file_open(&f, argv[1], APR_READ, -1, cntxt) != APR_SUCCESS) { - 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); - } - apr_file_close(f); - apr_file_close(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); - apr_file_remove(tn, cntxt); - return 0; -} diff --git a/support/htdigest.dsp b/support/htdigest.dsp deleted file mode 100644 index 2096019b94..0000000000 --- a/support/htdigest.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="htdigest" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.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 AllowPerConfigDependencies 0 -# 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 "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/htdigest" /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 /incremental:no /map /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /machine:I386 - -!ELSEIF "$(CFG)" == "htdigest - 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/htdigest" /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 "htdigest - Win32 Release" -# Name "htdigest - Win32 Debug" -# Begin Source File - -SOURCE=.\htdigest.c -# End Source File -# End Target -# End Project diff --git a/support/htdigest.mak b/support/htdigest.mak deleted file mode 100644 index 838178174f..0000000000 --- a/support/htdigest.mak +++ /dev/null @@ -1,291 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on htdigest.dsp -!IF "$(CFG)" == "" -CFG=htdigest - Win32 Debug -!MESSAGE No configuration specified. Defaulting to htdigest - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "htdigest - Win32 Release" && "$(CFG)" !=\ - "htdigest - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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 -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "htdigest - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\htdigest.exe" - -!ELSE - -ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\htdigest.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\htdigest.idb" - -@erase "$(INTDIR)\htdigest.obj" - -@erase "$(OUTDIR)\htdigest.exe" - -@erase "$(OUTDIR)\htdigest.map" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\htdigest" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\htdigest.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\htdigest.pdb"\ - /map:"$(INTDIR)\htdigest.map" /machine:I386 /out:"$(OUTDIR)\htdigest.exe" -LINK32_OBJS= \ - "$(INTDIR)\htdigest.obj" \ - "..\srclib\apr-util\LibR\aprutil.lib" \ - "..\srclib\apr\LibR\apr.lib" - -"$(OUTDIR)\htdigest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "htdigest - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\htdigest.exe" - -!ELSE - -ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\htdigest.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\htdigest.idb" - -@erase "$(INTDIR)\htdigest.obj" - -@erase "$(OUTDIR)\htdigest.exe" - -@erase "$(OUTDIR)\htdigest.map" - -@erase "$(OUTDIR)\htdigest.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\htdigest" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\htdigest.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\htdigest.pdb"\ - /map:"$(INTDIR)\htdigest.map" /debug /machine:I386\ - /out:"$(OUTDIR)\htdigest.exe" -LINK32_OBJS= \ - "$(INTDIR)\htdigest.obj" \ - "..\srclib\apr-util\LibD\aprutil.lib" \ - "..\srclib\apr\LibD\apr.lib" - -"$(OUTDIR)\htdigest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "htdigest - Win32 Release" || "$(CFG)" ==\ - "htdigest - Win32 Debug" - -!IF "$(CFG)" == "htdigest - Win32 Release" - -"apr - Win32 Release" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\apr.mak CFG="apr - Win32 Release" - cd "..\..\support" - -"apr - Win32 ReleaseCLEAN" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\apr.mak CFG="apr - Win32 Release" RECURSE=1\ - - cd "..\..\support" - -!ELSEIF "$(CFG)" == "htdigest - Win32 Debug" - -"apr - Win32 Debug" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\apr.mak CFG="apr - Win32 Debug" - cd "..\..\support" - -"apr - Win32 DebugCLEAN" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\apr.mak CFG="apr - Win32 Debug" RECURSE=1 - cd "..\..\support" - -!ENDIF - -!IF "$(CFG)" == "htdigest - Win32 Release" - -"aprutil - Win32 Release" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" - cd "..\..\support" - -"aprutil - Win32 ReleaseCLEAN" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\aprutil.mak" CFG="aprutil - Win32 Release"\ - RECURSE=1 - cd "..\..\support" - -!ELSEIF "$(CFG)" == "htdigest - Win32 Debug" - -"aprutil - Win32 Debug" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" - cd "..\..\support" - -"aprutil - Win32 DebugCLEAN" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"\ - RECURSE=1 - cd "..\..\support" - -!ENDIF - -SOURCE=.\htdigest.c -DEP_CPP_HTDIG=\ - "..\srclib\apr\include\apr.h"\ - "..\srclib\apr\include\apr_errno.h"\ - "..\srclib\apr\include\apr_file_info.h"\ - "..\srclib\apr\include\apr_file_io.h"\ - "..\srclib\apr\include\apr_general.h"\ - "..\srclib\apr\include\apr_lib.h"\ - "..\srclib\apr\include\apr_md5.h"\ - "..\srclib\apr\include\apr_pools.h"\ - "..\srclib\apr\include\apr_signal.h"\ - "..\srclib\apr\include\apr_time.h"\ - "..\srclib\apr\include\apr_user.h"\ - "..\srclib\apr\include\apr_want.h"\ - "..\srclib\apr\include\apr_xlate.h"\ - - -"$(INTDIR)\htdigest.obj" : $(SOURCE) $(DEP_CPP_HTDIG) "$(INTDIR)" - - - -!ENDIF - diff --git a/support/htpasswd.c b/support/htpasswd.c deleted file mode 100644 index bfbbcabeb1..0000000000 --- a/support/htpasswd.c +++ /dev/null @@ -1,679 +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. - */ - -/****************************************************************************** - ****************************************************************************** - * 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 "apr.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_errno.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_signal.h" - -#if APR_HAVE_STDIO_H -#include -#endif - -#include "apr_md5.h" -#include "apr_sha1.h" -#include - -#if APR_HAVE_CRYPT_H -#include -#endif -#if APR_HAVE_STDLIB_H -#include -#endif -#if APR_HAVE_STRING_H -#include -#endif -#if APR_HAVE_UNISTD_H -#include -#endif - -#ifdef WIN32 -#include -#define unlink _unlink -#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_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; -/* - * If our platform knows about the tmpnam() external buffer size, create - * a buffer to pass in. This is needed in a threaded environment, or - * one that thinks it is (like HP-UX). - */ -#ifdef L_tmpnam -static char tname_buf[L_tmpnam]; -#else -static char *tname_buf = NULL; -#endif - -/* - * 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); -} - -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; - } -} - -/* - * 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]; - size_t bufsize; - - if (passwd != NULL) { - pw = passwd; - } - else { - bufsize = sizeof(pwin); - if (apr_password_get("New password: ", pwin, &bufsize) != 0) { - apr_snprintf(record, (rlen - 1), "password too long (>%" APR_SIZE_T_FMT - ")", sizeof(pwin) - 1); - return ERR_OVERFLOW; - } - bufsize = sizeof(pwv); - apr_password_get("Re-type new password: ", pwv, &bufsize); - if (strcmp(pwin, pwv) != 0) { - apr_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 */ - apr_sha1_base64(pw,strlen(pw),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 *)pw, (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,pw,sizeof(cpw)); - break; - -#ifndef WIN32 - case ALG_CRYPT: - default: - (void) srand((int) time((time_t *) NULL)); - to64(&salt[0], rand(), 8); - salt[8] = '\0'; - - apr_cpystrn(cpw, (char *)crypt(pw, salt), sizeof(cpw) - 1); - break; -#endif - } - 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)) { - apr_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, "\thtpasswd -n[mdps] username\n"); - fprintf(stderr, "\thtpasswd -nb[mdps] username password\n"); - fprintf(stderr, " -c Create a new file.\n"); - fprintf(stderr, " -n Don't update file; display results on stdout.\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) -{ - apr_finfo_t sbuf; - apr_status_t check; - - check = apr_stat(&sbuf, fname, APR_FINFO_NORM, NULL); - return (check ? 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 nofile = 0; - int noninteractive = 0; - int i; - int args_left = 2; -#if APR_CHARSET_EBCDIC - apr_pool_t *pool; - apr_status_t rv; - apr_xlate_t *to_ascii; - - apr_initialize(); - atexit(apr_terminate); - apr_pool_create(&pool, NULL); - - rv = apr_xlate_open(&to_ascii, "ISO8859-1", APR_DEFAULT_CHARSET, pool); - if (rv) { - fprintf(stderr, "apr_xlate_open(to ASCII)->%d\n", rv); - exit(1); - } - rv = apr_SHA1InitEBCDIC(to_ascii); - if (rv) { - fprintf(stderr, "apr_SHA1InitEBCDIC()->%d\n", rv); - exit(1); - } - rv = apr_MD5InitEBCDIC(to_ascii); - if (rv) { - fprintf(stderr, "apr_MD5InitEBCDIC()->%d\n", rv); - exit(1); - } -#endif /*APR_CHARSET_EBCDIC*/ - - tempfilename = NULL; - apr_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 == 'n') { - nofile++; - args_left--; - } - 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 (newfile && nofile) { - fprintf(stderr, "%s: -c and -n options conflict\n", argv[0]); - return ERR_SYNTAX; - } - if (nofile) { - i--; - } - else { - 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 (>%" APR_SIZE_T_FMT ")\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 (>%" APR_SIZE_T_FMT ")\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 - if (! nofile) { - /* - * Only do the file checks if we're supposed to frob it. - * - * 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 (if any) 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); - } - if (nofile) { - printf("%s\n", record); - exit(0); - } - - /* - * We can access the files the right way, and we have a record - * to add or update. Let's do it.. - */ - errno = 0; - tempfilename = tmpnam(tname_buf); - if ((tempfilename == NULL) || (*tempfilename == '\0')) { - fprintf(stderr, "%s: unable to generate temporary filename\n", - argv[0]); - if (errno == 0) { - errno = ENOENT; - } - perror("tmpnam"); - exit(ERR_FILEPERM); - } - ftemp = fopen(tempfilename, "w+"); - if (ftemp == NULL) { - fprintf(stderr, "%s: unable to create temporary file '%s'\n", argv[0], - tempfilename); - 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 7d10b60ab5..0000000000 --- a/support/htpasswd.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="htpasswd" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.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 AllowPerConfigDependencies 0 -# 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 /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/htpasswd" /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 /incremental:no /map /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /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 /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/htpasswd" /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 "htpasswd - Win32 Release" -# Name "htpasswd - Win32 Debug" -# Begin Source File - -SOURCE=.\htpasswd.c -# End Source File -# End Target -# End Project diff --git a/support/htpasswd.mak b/support/htpasswd.mak deleted file mode 100644 index efadbfa010..0000000000 --- a/support/htpasswd.mak +++ /dev/null @@ -1,294 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on htpasswd.dsp -!IF "$(CFG)" == "" -CFG=htpasswd - Win32 Debug -!MESSAGE No configuration specified. Defaulting to htpasswd - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "htpasswd - Win32 Release" && "$(CFG)" !=\ - "htpasswd - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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 -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "htpasswd - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\htpasswd.exe" - -!ELSE - -ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\htpasswd.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\htpasswd.idb" - -@erase "$(INTDIR)\htpasswd.obj" - -@erase "$(OUTDIR)\htpasswd.exe" - -@erase "$(OUTDIR)\htpasswd.map" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\htpasswd" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\htpasswd.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\htpasswd.pdb"\ - /map:"$(INTDIR)\htpasswd.map" /machine:I386 /out:"$(OUTDIR)\htpasswd.exe" -LINK32_OBJS= \ - "$(INTDIR)\htpasswd.obj" \ - "..\srclib\apr-util\LibR\aprutil.lib" \ - "..\srclib\apr\LibR\apr.lib" - -"$(OUTDIR)\htpasswd.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "htpasswd - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\htpasswd.exe" - -!ELSE - -ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\htpasswd.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\htpasswd.idb" - -@erase "$(INTDIR)\htpasswd.obj" - -@erase "$(OUTDIR)\htpasswd.exe" - -@erase "$(OUTDIR)\htpasswd.map" - -@erase "$(OUTDIR)\htpasswd.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\htpasswd" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\htpasswd.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\htpasswd.pdb"\ - /map:"$(INTDIR)\htpasswd.map" /debug /machine:I386\ - /out:"$(OUTDIR)\htpasswd.exe" -LINK32_OBJS= \ - "$(INTDIR)\htpasswd.obj" \ - "..\srclib\apr-util\LibD\aprutil.lib" \ - "..\srclib\apr\LibD\apr.lib" - -"$(OUTDIR)\htpasswd.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "htpasswd - Win32 Release" || "$(CFG)" ==\ - "htpasswd - Win32 Debug" - -!IF "$(CFG)" == "htpasswd - Win32 Release" - -"apr - Win32 Release" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\apr.mak CFG="apr - Win32 Release" - cd "..\..\support" - -"apr - Win32 ReleaseCLEAN" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\apr.mak CFG="apr - Win32 Release" RECURSE=1\ - - cd "..\..\support" - -!ELSEIF "$(CFG)" == "htpasswd - Win32 Debug" - -"apr - Win32 Debug" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\apr.mak CFG="apr - Win32 Debug" - cd "..\..\support" - -"apr - Win32 DebugCLEAN" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\apr.mak CFG="apr - Win32 Debug" RECURSE=1 - cd "..\..\support" - -!ENDIF - -!IF "$(CFG)" == "htpasswd - Win32 Release" - -"aprutil - Win32 Release" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" - cd "..\..\support" - -"aprutil - Win32 ReleaseCLEAN" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\aprutil.mak" CFG="aprutil - Win32 Release"\ - RECURSE=1 - cd "..\..\support" - -!ELSEIF "$(CFG)" == "htpasswd - Win32 Debug" - -"aprutil - Win32 Debug" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" - cd "..\..\support" - -"aprutil - Win32 DebugCLEAN" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"\ - RECURSE=1 - cd "..\..\support" - -!ENDIF - -SOURCE=.\htpasswd.c -DEP_CPP_HTPAS=\ - "..\srclib\apr-util\include\apr_sha1.h"\ - "..\srclib\apr-util\include\apu.h"\ - "..\srclib\apr\include\apr.h"\ - "..\srclib\apr\include\apr_errno.h"\ - "..\srclib\apr\include\apr_file_info.h"\ - "..\srclib\apr\include\apr_file_io.h"\ - "..\srclib\apr\include\apr_general.h"\ - "..\srclib\apr\include\apr_lib.h"\ - "..\srclib\apr\include\apr_md5.h"\ - "..\srclib\apr\include\apr_pools.h"\ - "..\srclib\apr\include\apr_signal.h"\ - "..\srclib\apr\include\apr_strings.h"\ - "..\srclib\apr\include\apr_time.h"\ - "..\srclib\apr\include\apr_user.h"\ - "..\srclib\apr\include\apr_want.h"\ - "..\srclib\apr\include\apr_xlate.h"\ - - -"$(INTDIR)\htpasswd.obj" : $(SOURCE) $(DEP_CPP_HTPAS) "$(INTDIR)" - - - -!ENDIF - diff --git a/support/httpd.exp b/support/httpd.exp deleted file mode 100644 index 04581acf52..0000000000 --- a/support/httpd.exp +++ /dev/null @@ -1,711 +0,0 @@ -#! . -XML_DefaultCurrent -XML_ErrorString -XML_ExternalEntityParserCreate -XML_GetBase -XML_GetBuffer -XML_GetCurrentByteCount -XML_GetCurrentByteIndex -XML_GetCurrentColumnNumber -XML_GetCurrentLineNumber -XML_GetErrorCode -XML_GetSpecifiedAttributeCount -XML_Parse -XML_ParseBuffer -XML_ParserCreate -XML_ParserCreateNS -XML_ParserFree -XML_SetBase -XML_SetCdataSectionHandler -XML_SetCharacterDataHandler -XML_SetCommentHandler -XML_SetDefaultHandler -XML_SetDefaultHandlerExpand -XML_SetElementHandler -XML_SetEncoding -XML_SetExternalEntityRefHandler -XML_SetExternalEntityRefHandlerArg -XML_SetNamespaceDeclHandler -XML_SetNotStandaloneHandler -XML_SetNotationDeclHandler -XML_SetProcessingInstructionHandler -XML_SetUnknownEncodingHandler -XML_SetUnparsedEntityDeclHandler -XML_SetUserData -XML_UseParserAsHandlerArg -XmlGetUtf16InternalEncoding -XmlGetUtf8InternalEncoding -XmlInitEncoding -XmlInitUnknownEncoding -XmlParseXmlDecl -XmlPrologStateInit -XmlSizeOfUnknownEncoding -XmlUtf16Encode -XmlUtf8Encode -ap_add_cgi_vars -ap_add_common_vars -ap_add_input_filter -ap_add_loaded_module -ap_add_module -ap_add_named_module -ap_add_node -ap_add_output_filter -ap_add_per_dir_conf -ap_add_per_url_conf -ap_add_version_component -ap_allow_methods -ap_allow_options -ap_allow_overrides -ap_auth_name -ap_auth_type -ap_basic_http_header -ap_bucket_error_create -ap_bucket_error_make -ap_build_config -ap_build_cont_config -ap_byterange_filter -ap_cfg_closefile -ap_cfg_getc -ap_cfg_getline -ap_check_cmd_context -ap_checkmask -ap_cleanup_scoreboard -ap_clear_method_list -ap_close_piped_log -ap_construct_server -ap_construct_url -ap_content_length_filter -ap_content_type_tolower -ap_copy_method_list -ap_core_reorder_directories -ap_core_translate -ap_coredump_dir -ap_count_dirs -ap_create_conn_config -ap_create_environment -ap_create_per_dir_config -ap_create_request_config -ap_create_scoreboard -ap_custom_response -ap_default_port_for_request -ap_default_port_for_scheme -ap_default_type -ap_destroy_sub_req -ap_die -ap_discard_request_body -ap_document_root -ap_error_log2stderr -ap_escape_html -ap_escape_path_segment -ap_escape_quotes -ap_escape_shell_cmd -ap_exists_config_define -ap_exists_scoreboard_image -ap_extended_status -ap_fflush -ap_field_noparam -ap_filter_flush -ap_finalize_request_protocol -ap_finalize_sub_req_protocol -ap_find_command -ap_find_command_in_modules -ap_find_last_token -ap_find_linked_module -ap_find_list_item -ap_find_module_name -ap_find_path_info -ap_find_token -ap_fini_vhost_config -ap_fixup_virtual_hosts -ap_fprintf -ap_fputstrs -ap_get_basic_auth_pw -ap_get_brigade -ap_get_client_block -ap_get_limit_req_body -ap_get_limit_xml_body -ap_get_list_item -ap_get_local_host -ap_get_remote_host -ap_get_remote_logname -ap_get_server_built -ap_get_server_name -ap_get_server_port -ap_get_server_version -ap_get_status_line -ap_get_token -ap_getparents -ap_getword -ap_getword_conf -ap_getword_conf_nc -ap_getword_nc -ap_getword_nulls -ap_getword_nulls_nc -ap_getword_white -ap_getword_white_nc -ap_gname2id -ap_graceful_stop_signalled -ap_hook_access_checker -ap_hook_auth_checker -ap_hook_check_user_id -ap_hook_child_init -ap_hook_create_request -ap_hook_default_port -ap_hook_fixups -ap_hook_handler -ap_hook_header_parser -ap_hook_http_method -ap_hook_insert_filter -ap_hook_log_transaction -ap_hook_open_logs -ap_hook_optional_fn_retrieve -ap_hook_post_config -ap_hook_post_read_request -ap_hook_pre_connection -ap_hook_process_connection -ap_hook_quick_handler -ap_hook_translate_name -ap_hook_type_checker -ap_ht_time -ap_http_header_filter -ap_increment_counts -ap_ind -ap_index_of_response -ap_init_vhost_config -ap_init_virtual_host -ap_internal_redirect -ap_internal_redirect_handler -ap_invoke_handler -ap_is_directory -ap_is_initial_req -ap_is_matchexp -ap_is_rdirectory -ap_is_url -ap_limit_section -ap_lingering_close -ap_listen_pre_config -ap_listeners -ap_loaded_modules -ap_log_assert -ap_log_error -ap_log_perror -ap_log_pid -ap_log_rerror -ap_make_content_type -ap_make_dirstr_parent -ap_make_dirstr_prefix -ap_make_etag -ap_make_full_path -ap_make_method_list -ap_matches_request_vhost -ap_max_requests_per_child -ap_md5 -ap_md5_binary -ap_md5contextTo64 -ap_md5digest -ap_meets_conditions -ap_merge_per_dir_configs -ap_method_in_list -ap_method_is_limited -ap_method_list_add -ap_method_list_do -ap_method_list_remove -ap_method_list_vdo -ap_method_name_of -ap_method_number_of -ap_mpm_query -ap_mpm_run -ap_my_generation -ap_new_connection -ap_no2slash -ap_note_auth_failure -ap_note_basic_auth_failure -ap_note_digest_auth_failure -ap_old_write_filter -ap_open_logs -ap_open_piped_log -ap_open_stderr_log -ap_os_create_privileged_process -ap_os_escape_path -ap_os_is_path_absolute -ap_parseHTTPdate -ap_parse_hostinfo_components -ap_parse_htaccess -ap_parse_uri -ap_parse_uri_components -ap_parse_vhost_addrs -ap_pass_brigade -ap_pbase64decode -ap_pbase64encode -ap_pcfg_open_custom -ap_pcfg_openfile -ap_pregcomp -ap_pregfree -ap_pregsub -ap_prelinked_modules -ap_preloaded_modules -ap_process_child_status -ap_process_config_tree -ap_process_request -ap_process_resource_config -ap_psignature -ap_rationalize_mtime -ap_read_config -ap_read_request -ap_reclaim_child_processes -ap_regerror -ap_regexec -ap_register_hooks -ap_register_input_filter -ap_register_output_filter -ap_remove_loaded_module -ap_remove_module -ap_remove_output_filter -ap_requires -ap_resolve_env -ap_response_code_string -ap_rfc1413 -ap_rfc1413_timeout -ap_rflush -ap_rind -ap_rprintf -ap_rputc -ap_rputs -ap_run_access_checker -ap_run_auth_checker -ap_run_check_user_id -ap_run_child_init -ap_run_create_request -ap_run_default_port -ap_run_fixups -ap_run_handler -ap_run_header_parser -ap_run_http_method -ap_run_insert_filter -ap_run_log_transaction -ap_run_open_logs -ap_run_optional_fn_retrieve -ap_run_post_read_request -ap_run_pre_config -ap_run_pre_connection -ap_run_process_connection -ap_run_quick_handler -ap_run_rewrite_args -ap_run_sub_req -ap_run_translate_name -ap_run_type_checker -ap_rvputs -ap_rwrite -ap_satisfies -ap_save_brigade -ap_scan_script_header_err -ap_scan_script_header_err_core -ap_scan_script_header_err_strs -ap_scoreboard_fname -ap_scoreboard_image -ap_send_error_response -ap_send_fd -ap_send_http_options -ap_send_http_trace -ap_send_mmap -ap_send_size -ap_server_argv0 -ap_server_config_defines -ap_server_post_read_config -ap_server_pre_read_config -ap_server_root -ap_server_root_relative -ap_set_content_length -ap_set_etag -ap_set_file_slot -ap_set_flag_slot -ap_set_int_slot -ap_set_keepalive -ap_set_last_modified -ap_set_listenbacklog -ap_set_listener -ap_set_name_virtual_host -ap_set_send_buffer_size -ap_set_string_slot -ap_set_string_slot_lower -ap_set_sub_req_protocol -ap_setup_client_block -ap_setup_listeners -ap_setup_prelinked_modules -ap_should_client_block -ap_show_directives -ap_show_modules -ap_single_module_configure -ap_size_list_item -ap_soak_end_container -ap_sock_disable_nagle -ap_some_auth_required -ap_str_tolower -ap_strcasecmp_match -ap_strcasestr -ap_strcmp_match -ap_stripprefix -ap_sub_req_lookup_file -ap_sub_req_lookup_uri -ap_sub_req_method_uri -ap_sync_scoreboard_image -ap_threads_per_child -ap_time_process_request -ap_top_module -ap_uname2id -ap_unescape_url -ap_unparse_uri_components -ap_update_child_status -ap_update_mtime -ap_update_vhost_from_headers -ap_update_vhost_given_ip -ap_vrprintf -ap_wait_or_timeout -ap_walk_config -ap_xml_parse_input -apr_accept -apr_ansi_time_to_apr_time -apr_array_append -apr_array_cat -apr_array_copy -apr_array_copy_hdr -apr_array_make -apr_array_pstrcat -apr_array_push -apr_base64_decode -apr_base64_decode_binary -apr_base64_decode_len -apr_base64_encode -apr_base64_encode_binary -apr_base64_encode_len -apr_bind -apr_brigade_create -apr_brigade_destroy -apr_brigade_length -apr_brigade_partition -apr_brigade_printf -apr_brigade_putc -apr_brigade_puts -apr_brigade_putstrs -apr_brigade_split -apr_brigade_to_iovec -apr_brigade_vprintf -apr_brigade_vputstrs -apr_brigade_write -apr_bucket_destroy_notimpl -apr_bucket_eos_create -apr_bucket_eos_make -apr_bucket_flush_create -apr_bucket_flush_make -apr_bucket_heap_create -apr_bucket_immortal_create -apr_bucket_pipe_create -apr_bucket_setaside_notimpl -apr_bucket_shared_copy -apr_bucket_shared_destroy -apr_bucket_shared_make -apr_bucket_shared_split -apr_bucket_simple_copy -apr_bucket_simple_split -apr_bucket_socket_create -apr_collapse_spaces -apr_connect -apr_cpystrn -apr_ctime -apr_day_snames -apr_dbm_close -apr_dbm_delete -apr_dbm_exists -apr_dbm_fetch -apr_dbm_firstkey -apr_dbm_freedatum -apr_dbm_get_usednames -apr_dbm_geterror -apr_dbm_nextkey -apr_dbm_open -apr_dbm_store -apr_dir_close -apr_dir_make -apr_dir_open -apr_dir_read -apr_dir_remove -apr_dir_rewind -apr_dso_error -apr_dso_load -apr_dso_sym -apr_dso_unload -apr_explode_gmt -apr_explode_localtime -apr_file_close -apr_file_data_get -apr_file_data_set -apr_file_dup -apr_file_eof -apr_file_flush -apr_file_getc -apr_file_gets -apr_file_info_get -apr_file_lock -apr_file_name_get -apr_file_namedpipe_create -apr_file_open -apr_file_open_stderr -apr_file_open_stdout -apr_file_perms_set -apr_file_pipe_create -apr_file_pipe_timeout_get -apr_file_pipe_timeout_set -apr_file_printf -apr_file_putc -apr_file_puts -apr_file_read -apr_file_read_full -apr_file_remove -apr_file_rename -apr_file_seek -apr_file_ungetc -apr_file_unlock -apr_file_write -apr_file_write_full -apr_file_writev -apr_filename_of_pathname -apr_fnmatch -apr_get_groupname -apr_get_home_directory -apr_get_user_passwd -apr_get_userid -apr_get_username -apr_gethostname -apr_getnameinfo -apr_getopt -apr_getopt_init -apr_getopt_long -apr_getservbyname -apr_getsocketopt -apr_global_hook_pool -apr_hash_count -apr_hash_first -apr_hash_get -apr_hash_make -apr_hash_next -apr_hash_set -apr_hash_this -apr_hook_deregister_all -apr_hook_generic_add -apr_hook_generic_get -apr_hook_sort_register -apr_implode_time -apr_initialize -apr_ipsubnet_create -apr_ipsubnet_test -apr_is_fnmatch -apr_listen -apr_lock_acquire -apr_lock_child_init -apr_lock_create -apr_lock_data_get -apr_lock_data_set -apr_lock_destroy -apr_lock_release -apr_lstat -apr_md5_encode -apr_md5_final -apr_md5_init -apr_md5_set_xlate -apr_md5_update -apr_mmap_create -apr_mmap_delete -apr_mmap_offset -apr_month_snames -apr_os_dir_get -apr_os_dir_put -apr_os_exp_time_get -apr_os_exp_time_put -apr_os_file_get -apr_os_file_put -apr_os_imp_time_get -apr_os_imp_time_put -apr_os_lock_get -apr_os_lock_put -apr_os_sock_get -apr_os_sock_make -apr_os_sock_put -apr_os_thread_get -apr_os_thread_put -apr_os_threadkey_get -apr_os_threadkey_put -apr_palloc -apr_parse_addr_port -apr_password_get -apr_password_validate -apr_pcalloc -apr_pmemdup -apr_poll -apr_poll_data_get -apr_poll_data_set -apr_poll_revents_get -apr_poll_setup -apr_poll_socket_add -apr_poll_socket_clear -apr_poll_socket_mask -apr_poll_socket_remove -apr_pool_alloc_init -apr_pool_alloc_term -apr_pool_cleanup_for_exec -apr_pool_cleanup_kill -apr_pool_cleanup_null -apr_pool_cleanup_register -apr_pool_cleanup_run -apr_pool_clear -apr_pool_create -apr_pool_destroy -apr_pool_free_blocks_num_bytes -apr_pool_get_abort -apr_pool_note_subprocess -apr_pool_num_bytes -apr_pool_set_abort -apr_pool_sub_make -apr_pool_userdata_get -apr_pool_userdata_set -apr_proc_create -apr_proc_detach -apr_proc_fork -apr_proc_kill -apr_proc_other_child_check -apr_proc_other_child_read -apr_proc_other_child_register -apr_proc_other_child_unregister -apr_proc_probe_writable_fds -apr_proc_wait -apr_proc_wait_all_procs -apr_procattr_child_err_set -apr_procattr_child_in_set -apr_procattr_child_out_set -apr_procattr_cmdtype_set -apr_procattr_create -apr_procattr_detach_set -apr_procattr_dir_set -apr_procattr_io_set -apr_procattr_limit_set -apr_psprintf -apr_pstrcat -apr_pstrdup -apr_pstrndup -apr_pvsprintf -apr_recv -apr_recvfrom -apr_register_optional_fn -apr_retrieve_optional_fn -apr_rfc822_date -apr_send -apr_sendfile -apr_sendto -apr_sendv -apr_setsocketopt -apr_setup_signal_thread -apr_sha1_base64 -apr_sha1_final -apr_sha1_init -apr_sha1_update -apr_sha1_update_binary -apr_shm_avail -apr_shm_calloc -apr_shm_destroy -apr_shm_free -apr_shm_init -apr_shm_malloc -apr_shm_name_get -apr_shm_name_set -apr_shm_open -apr_show_hook -apr_shutdown -apr_signal -apr_signal_get_description -apr_signal_init -apr_signal_thread -apr_sleep -apr_snprintf -apr_sockaddr_info_get -apr_sockaddr_ip_get -apr_sockaddr_ip_set -apr_sockaddr_port_get -apr_sockaddr_port_set -apr_socket_addr_get -apr_socket_close -apr_socket_create -apr_socket_data_get -apr_socket_data_set -apr_socket_from_file -apr_sort_hooks -apr_stat -apr_strerror -apr_strftime -apr_strnatcasecmp -apr_strnatcmp -apr_table_add -apr_table_addn -apr_table_clear -apr_table_copy -apr_table_do -apr_table_get -apr_table_make -apr_table_merge -apr_table_mergen -apr_table_overlap -apr_table_overlay -apr_table_set -apr_table_setn -apr_table_unset -apr_table_vdo -apr_terminate -apr_text_append -apr_thread_create -apr_thread_data_get -apr_thread_data_set -apr_thread_detach -apr_thread_exit -apr_thread_join -apr_threadattr_create -apr_threadattr_detach_get -apr_threadattr_detach_set -apr_threadkey_data_get -apr_threadkey_data_set -apr_threadkey_private_create -apr_threadkey_private_delete -apr_threadkey_private_get -apr_threadkey_private_set -apr_time_now -apr_tokenize_to_argv -apr_uuid_format -apr_uuid_get -apr_uuid_parse -apr_vformatter -apr_vsnprintf -apr_xlate_close -apr_xlate_conv_buffer -apr_xlate_get_sb -apr_xlate_open -apr_xml_empty_elem -apr_xml_insert_uri -apr_xml_parser_create -apr_xml_parser_done -apr_xml_parser_feed -apr_xml_parser_geterror -apr_xml_quote_elem -apr_xml_quote_string -apr_xml_to_text -pcre_compile -pcre_copy_substring -pcre_exec -pcre_free -pcre_get_substring -pcre_get_substring_list -pcre_info -pcre_maketables -pcre_malloc -pcre_study -pcre_version -regcomp -regerror -regexec -regfree diff --git a/support/log_server_status b/support/log_server_status deleted file mode 100644 index e32280c912..0000000000 --- a/support/log_server_status +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/perl -# ==================================================================== -# 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/log_server_status.in b/support/log_server_status.in deleted file mode 100644 index f301604b76..0000000000 --- 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 237e091b2c..0000000000 --- a/support/logresolve.c +++ /dev/null @@ -1,378 +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 "apr_lib.h" -#if APR_HAVE_STDIO_H -#include -#endif -#if APR_HAVE_STDLIB_H -#include -#endif -#if APR_HAVE_CTYPE_H -#include -#endif -#if APR_HAVE_NETDB_H -#include -#endif -#if APR_HAVE_NETINET_IN_H -#include -#endif -#if APR_HAVE_STRING_H -#include -#endif -#if APR_HAVE_SYS_SOCKET_H -#include -#endif -#if APR_HAVE_ARPA_INET_H -#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); - -#ifdef BEOS -#define NO_ADDRESS NO_DATA -#endif - - -/* maximum line length */ -#define MAXLINE 1024 - -/* maximum length of a domain name */ -#ifndef MAXDNAME -#define MAXDNAME 256 -#endif - -/* number of buckets in cache hash apr_table_t */ -#define BUCKETS 256 - -#if !APR_HAVE_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 - -/* largest 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; - -#ifdef WIN32 - /* If we apr'ify this code, apr_pool_create/apr_pool_destroy - * should perform the WSAStartup/WSACleanup for us. - */ - WSADATA wsaData; - WSAStartup(0x101, &wsaData); -#endif - - 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 (!apr_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); - } - -#ifdef WIN32 - WSACleanup(); -#endif - - 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 f8ccbb2121..0000000000 --- a/support/logresolve.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="logresolve" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.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 AllowPerConfigDependencies 0 -# 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 /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/logresolve" /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 /incremental:no /map /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /machine:I386 - -!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 /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/logresolve" /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 "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.mak b/support/logresolve.mak deleted file mode 100644 index 278daf8a32..0000000000 --- a/support/logresolve.mak +++ /dev/null @@ -1,214 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on logresolve.dsp -!IF "$(CFG)" == "" -CFG=logresolve - Win32 Debug -!MESSAGE No configuration specified. Defaulting to logresolve - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "logresolve - Win32 Release" && "$(CFG)" !=\ - "logresolve - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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 -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "logresolve - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\logresolve.exe" - -!ELSE - -ALL : "$(OUTDIR)\logresolve.exe" - -!ENDIF - -CLEAN : - -@erase "$(INTDIR)\logresolve.idb" - -@erase "$(INTDIR)\logresolve.obj" - -@erase "$(OUTDIR)\logresolve.exe" - -@erase "$(OUTDIR)\logresolve.map" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\logresolve" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\logresolve.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\logresolve.pdb"\ - /map:"$(INTDIR)\logresolve.map" /machine:I386 /out:"$(OUTDIR)\logresolve.exe" -LINK32_OBJS= \ - "$(INTDIR)\logresolve.obj" - -"$(OUTDIR)\logresolve.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "logresolve - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\logresolve.exe" - -!ELSE - -ALL : "$(OUTDIR)\logresolve.exe" - -!ENDIF - -CLEAN : - -@erase "$(INTDIR)\logresolve.idb" - -@erase "$(INTDIR)\logresolve.obj" - -@erase "$(OUTDIR)\logresolve.exe" - -@erase "$(OUTDIR)\logresolve.map" - -@erase "$(OUTDIR)\logresolve.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\logresolve" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\logresolve.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\logresolve.pdb"\ - /map:"$(INTDIR)\logresolve.map" /debug /machine:I386\ - /out:"$(OUTDIR)\logresolve.exe" -LINK32_OBJS= \ - "$(INTDIR)\logresolve.obj" - -"$(OUTDIR)\logresolve.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "logresolve - Win32 Release" || "$(CFG)" ==\ - "logresolve - Win32 Debug" -SOURCE=.\logresolve.c -DEP_CPP_LOGRE=\ - "..\srclib\apr\include\apr.h"\ - "..\srclib\apr\include\apr_errno.h"\ - "..\srclib\apr\include\apr_lib.h"\ - - -"$(INTDIR)\logresolve.obj" : $(SOURCE) $(DEP_CPP_LOGRE) "$(INTDIR)" - - - -!ENDIF - diff --git a/support/logresolve.pl b/support/logresolve.pl deleted file mode 100644 index ab5a7322ab..0000000000 --- a/support/logresolve.pl +++ /dev/null @@ -1,261 +0,0 @@ -#!/usr/bin/perl -# ==================================================================== -# 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/logresolve.pl.in b/support/logresolve.pl.in deleted file mode 100644 index c2142f161d..0000000000 --- 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 b/support/phf_abuse_log.cgi deleted file mode 100644 index 87543ce5f4..0000000000 --- a/support/phf_abuse_log.cgi +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/perl - -# 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/phf_abuse_log.cgi.in b/support/phf_abuse_log.cgi.in deleted file mode 100644 index 723f553bac..0000000000 --- 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 dab94408c5..0000000000 --- a/support/rotatelogs.c +++ /dev/null @@ -1,208 +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 - * . - */ - -/* - * Simple program to rotate Apache logs without having to kill the server. - * - * Contributed by Ben Laurie - * - * 12 Mar 1996 - */ - - -#include "apr.h" -#include -#include -#include -#include -#if APR_HAVE_STDIO_H -#include -#endif -#if APR_HAVE_UNISTD_H -#include -#endif -#if APR_HAVE_IO_H -#include -#endif -#if APR_HAVE_FCNTL_H -#include -#endif - -#define BUFSIZE 65536 -#define ERRMSGSZ 82 - -#ifndef MAX_PATH -#define MAX_PATH 1024 -#endif - -int main (int argc, char *argv[]) -{ - char buf[BUFSIZE], buf2[MAX_PATH], errbuf[ERRMSGSZ]; - time_t tLogEnd = 0, tRotation; - int nLogFD = -1, nLogFDprev = -1, nMessCount = 0, nRead, nWrite; - int utc_offset = 0; - int use_strftime = 0; - time_t now; - char *szLogRoot; - - if (argc < 3) { - fprintf(stderr, - "Usage: %s " - "[offset minutes from UTC]\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]; - if (argc >= 4) { - utc_offset = atoi(argv[3]) * 60; - } - tRotation = atoi(argv[2]); - if (tRotation <= 0) { - fprintf(stderr, "Rotation time must be > 0\n"); - exit(6); - } - - use_strftime = (strstr(szLogRoot, "%") != NULL); - for (;;) { - nRead = read(0, buf, sizeof buf); - now = time(NULL) + utc_offset; - if (nRead == 0) - exit(3); - if (nRead < 0) - if (errno != EINTR) - exit(4); - if (nLogFD >= 0 && (now >= tLogEnd || nRead < 0)) { - nLogFDprev = nLogFD; - nLogFD = -1; - } - if (nLogFD < 0) { - time_t tLogStart = (now / tRotation) * tRotation; - if (use_strftime) { - struct tm *tm_now; - tm_now = gmtime(&tLogStart); - strftime(buf2, sizeof(buf2), szLogRoot, tm_now); - } - else { - sprintf(buf2, "%s.%010d", szLogRoot, (int) tLogStart); - } - tLogEnd = tLogStart + tRotation; - nLogFD = open(buf2, O_WRONLY | O_CREAT | O_APPEND, 0666); - if (nLogFD < 0) { - /* Uh-oh. Failed to open the new log file. Try to clear - * the previous log file, note the lost log entries, - * and keep on truckin'. */ - if (nLogFDprev == -1) { - perror(buf2); - exit(2); - } - else { - nLogFD = nLogFDprev; - sprintf(errbuf, - "Resetting log file due to error opening " - "new log file. %10d messages lost.\n", - nMessCount); - nWrite = strlen(errbuf); -#ifdef WIN32 - chsize(nLogFD, 0); -#else - ftruncate(nLogFD, 0); -#endif - write(nLogFD, errbuf, nWrite); - } - } - else { - close(nLogFDprev); - } - nMessCount = 0; - } - do { - nWrite = write(nLogFD, buf, nRead); - } while (nWrite < 0 && errno == EINTR); - if (nWrite != nRead) { - nMessCount++; - sprintf(errbuf, - "Error writing to log file. " - "%10d messages lost.\n", - nMessCount); - nWrite = strlen(errbuf); -#ifdef WIN32 - chsize(nLogFD, 0); -#else - ftruncate(nLogFD, 0); -#endif - write (nLogFD, errbuf, nWrite); - } - else { - nMessCount++; - } - } - /* Of course we never, but prevent compiler warnings */ - return 0; -} diff --git a/support/rotatelogs.dsp b/support/rotatelogs.dsp deleted file mode 100644 index 876092d869..0000000000 --- a/support/rotatelogs.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="rotatelogs" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.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 AllowPerConfigDependencies 0 -# 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 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/rotatelogs" /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 /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /map /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 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/rotatelogs" /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 "rotatelogs - Win32 Release" -# Name "rotatelogs - Win32 Debug" -# Begin Source File - -SOURCE=.\rotatelogs.c -# End Source File -# End Target -# End Project diff --git a/support/rotatelogs.mak b/support/rotatelogs.mak deleted file mode 100644 index e96167867a..0000000000 --- a/support/rotatelogs.mak +++ /dev/null @@ -1,212 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on rotatelogs.dsp -!IF "$(CFG)" == "" -CFG=rotatelogs - Win32 Debug -!MESSAGE No configuration specified. Defaulting to rotatelogs - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "rotatelogs - Win32 Release" && "$(CFG)" !=\ - "rotatelogs - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!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 -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "rotatelogs - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\rotatelogs.exe" - -!ELSE - -ALL : "$(OUTDIR)\rotatelogs.exe" - -!ENDIF - -CLEAN : - -@erase "$(INTDIR)\rotatelogs.idb" - -@erase "$(INTDIR)\rotatelogs.obj" - -@erase "$(OUTDIR)\rotatelogs.exe" - -@erase "$(OUTDIR)\rotatelogs.map" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\rotatelogs" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\rotatelogs.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\rotatelogs.pdb"\ - /map:"$(INTDIR)\rotatelogs.map" /machine:I386 /out:"$(OUTDIR)\rotatelogs.exe" -LINK32_OBJS= \ - "$(INTDIR)\rotatelogs.obj" - -"$(OUTDIR)\rotatelogs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "rotatelogs - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\rotatelogs.exe" - -!ELSE - -ALL : "$(OUTDIR)\rotatelogs.exe" - -!ENDIF - -CLEAN : - -@erase "$(INTDIR)\rotatelogs.idb" - -@erase "$(INTDIR)\rotatelogs.obj" - -@erase "$(OUTDIR)\rotatelogs.exe" - -@erase "$(OUTDIR)\rotatelogs.map" - -@erase "$(OUTDIR)\rotatelogs.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/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" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\rotatelogs" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\rotatelogs.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\rotatelogs.pdb"\ - /map:"$(INTDIR)\rotatelogs.map" /debug /machine:I386\ - /out:"$(OUTDIR)\rotatelogs.exe" -LINK32_OBJS= \ - "$(INTDIR)\rotatelogs.obj" - -"$(OUTDIR)\rotatelogs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "rotatelogs - Win32 Release" || "$(CFG)" ==\ - "rotatelogs - Win32 Debug" -SOURCE=.\rotatelogs.c -DEP_CPP_ROTAT=\ - "..\srclib\apr\include\apr.h"\ - - -"$(INTDIR)\rotatelogs.obj" : $(SOURCE) $(DEP_CPP_ROTAT) "$(INTDIR)" - - - -!ENDIF - diff --git a/support/split-logfile b/support/split-logfile deleted file mode 100644 index c0f34861aa..0000000000 --- a/support/split-logfile +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/perl -# ==================================================================== -# 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/split-logfile.in b/support/split-logfile.in deleted file mode 100644 index 66de2ebfdd..0000000000 --- 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 8550ba9abe..0000000000 --- a/support/suexec.c +++ /dev/null @@ -1,634 +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 - * . - */ - -/* - * 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 -#include - -#include -#include -#include - -#include "suexec.h" - -#ifdef HAVE_PWD_H -#include -#endif - -#ifdef HAVE_GRP_H -#include -#endif - -/* - *********************************************************************** - * 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 AP_LOG_EXEC - time_t timevar; - struct tm *lt; - - if (!log) { - if ((log = fopen(AP_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 /* AP_LOG_EXEC */ - return; -} - -static void log_err(const char *fmt,...) -{ -#ifdef AP_LOG_EXEC - va_list ap; - - va_start(ap, fmt); - err_output(fmt, ap); - va_end(ap); -#endif /* AP_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", AP_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 */ - - prog = argv[0]; - /* - * 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("crit: invalid uid: (%ld)\n", uid); - exit(102); - } - /* - * See if this is a 'how were you compiled' request, and - * comply if so. - */ - if ((argc > 1) - && (! strcmp(argv[1], "-V")) - && ((uid == 0) -#ifdef _OSD_POSIX - /* User name comparisons are case insensitive on BS2000/OSD */ - || (! strcasecmp(AP_HTTPD_USER, pw->pw_name))) -#else /* _OSD_POSIX */ - || (! strcmp(AP_HTTPD_USER, pw->pw_name))) -#endif /* _OSD_POSIX */ - ) { -#ifdef AP_DOC_ROOT - fprintf(stderr, " -D AP_DOC_ROOT=\"%s\"\n", AP_DOC_ROOT); -#endif -#ifdef AP_GID_MIN - fprintf(stderr, " -D AP_GID_MID=%d\n", AP_GID_MIN); -#endif -#ifdef AP_HTTPD_USER - fprintf(stderr, " -D AP_HTTPD_USER=\"%s\"\n", AP_HTTPD_USER); -#endif -#ifdef AP_LOG_EXEC - fprintf(stderr, " -D AP_LOG_EXEC=\"%s\"\n", AP_LOG_EXEC); -#endif -#ifdef AP_SAFE_PATH - fprintf(stderr, " -D AP_SAFE_PATH=\"%s\"\n", AP_SAFE_PATH); -#endif -#ifdef AP_SUEXEC_UMASK - fprintf(stderr, " -D AP_SUEXEC_UMASK=%03o\n", AP_SUEXEC_UMASK); -#endif -#ifdef AP_UID_MIN - fprintf(stderr, " -D AP_UID_MID=%d\n", AP_UID_MIN); -#endif -#ifdef AP_USERDIR_SUFFIX - fprintf(stderr, " -D AP_USERDIR_SUFFIX=\"%s\"\n", AP_USERDIR_SUFFIX); -#endif - exit(0); - } - /* - * If there are a proper number of arguments, set - * all of them to variables. Otherwise, error out. - */ - if (argc < 4) { - log_err("too few arguments\n"); - exit(101); - } - target_uname = argv[1]; - target_gname = argv[2]; - cmd = argv[3]; - - /* - * 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(AP_HTTPD_USER, pw->pw_name)) { - log_err("user mismatch (%s instead of %s)\n", pw->pw_name, AP_HTTPD_USER); - exit(103); - } -#else /*_OSD_POSIX*/ - if (strcmp(AP_HTTPD_USER, pw->pw_name)) { - log_err("user mismatch (%s instead of %s)\n", pw->pw_name, AP_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 (strspn(target_uname, "1234567890") != strlen(target_uname)) { - if ((pw = getpwnam(target_uname)) == NULL) { - log_err("invalid target user name: (%s)\n", target_uname); - exit(105); - } - } - else { - if ((pw = getpwuid(atoi(target_uname))) == NULL) { - log_err("invalud target user id: (%s)\n", target_uname); - exit(121); - } - } - - /* - * 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 AP_UID_MIN. Tsk tsk. - */ - if ((uid == 0) || (uid < AP_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 AP_GID_MIN. Tsk tsk. - */ - if ((gid == 0) || (gid < AP_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(AP_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(AP_DOC_ROOT)) != 0) || - ((getcwd(dwd, AP_MAXPATH)) == NULL) || - ((chdir(cwd)) != 0)) { - log_err("cannot get docroot information (%s)\n", AP_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); - } - -#ifdef AP_SUEXEC_UMASK - /* - * umask() uses inverse logic; bits are CLEAR for allowed access. - */ - if ((~AP_SUEXEC_UMASK) & 0022) { - log_err("notice: AP_SUEXEC_UMASK of %03o allows " - "write permission to group and/or other\n", AP_SUEXEC_UMASK); - } - umask(AP_SUEXEC_UMASK); -#endif /* AP_SUEXEC_UMASK */ - 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 AP_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 AP_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 aa95425f57..0000000000 --- a/support/suexec.h +++ /dev/null @@ -1,140 +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 - * . - */ - -/* - * 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 AP_HTTPD_USER -#define AP_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 AP_UID_MIN -#define AP_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 AP_GID_MIN -#define AP_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 AP_USERDIR_SUFFIX -#define AP_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 AP_LOG_EXEC -#define AP_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 AP_DOC_ROOT -#define AP_DOC_ROOT "/usr/local/apache/htdocs" -#endif - -/* - * SAFE_PATH -- Define a safe PATH environment to pass to CGI executables. - * - */ -#ifndef AP_SAFE_PATH -#define AP_SAFE_PATH "/usr/local/bin:/usr/bin:/bin" -#endif - -#endif /* _SUEXEC_H */ diff --git a/test/.cvsignore b/test/.cvsignore deleted file mode 100644 index d961cf092b..0000000000 --- a/test/.cvsignore +++ /dev/null @@ -1,16 +0,0 @@ -a.out -time-FCNTL -time-FLOCK -time-SYSVSEM -time-SYSVSEM2 -time-PTHREAD -time-USLOCK -zb -test-writev -test_date -test_select -.libs -.deps -*.lo -Makefile -dbu diff --git a/test/.indent.pro b/test/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- 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 1426e44c95..0000000000 --- a/test/Makefile.in +++ /dev/null @@ -1,19 +0,0 @@ - -# no targets: we don't want to build anything by default. if you want the -# test programs, then "make test" -targets = - -PROGRAMS = - -PROGRAM_LDADD = $(EXTRA_LDFLAGS) $(PROGRAM_DEPENDENCIES) $(EXTRA_LIBS) -PROGRAM_DEPENDENCIES = ../srclib/apr-util/libaprutil.la \ - ../srclib/apr/libapr.la - -include $(top_srcdir)/build/rules.mk - -test: $(PROGRAMS) - -# example for building a test proggie -# 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 9f8be502b8..0000000000 --- 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 6a12167211..0000000000 --- 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 91114a784c..0000000000 --- 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 9c1060edab..0000000000 --- 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 852c701766..0000000000 --- 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_date.c b/test/test_date.c deleted file mode 100644 index 4e10ebf5dd..0000000000 --- a/test/test_date.c +++ /dev/null @@ -1,180 +0,0 @@ -/* This program tests the parseHTTPdate routine in ../main/util_date.c. - * - * It is only semiautomated in that I would run it, modify the code to - * use a different algorithm or seed, recompile and run again, etc. - * Obviously it should use an argument for that, but I never got around - * to changing the implementation. - * - * gcc -g -O2 -I../main -o test_date ../main/util_date.o test_date.c - * test_date | egrep '^No ' - * - * Roy Fielding, 1996 - */ -#define AP_DECLARE(x) x - -#include -#include -#include "util_date.h" - -static const long year2secs[] = { - 0L, /* 1970 */ - 31536000L, /* 1971 */ - 63072000L, /* 1972 */ - 94694400L, /* 1973 */ - 126230400L, /* 1974 */ - 157766400L, /* 1975 */ - 189302400L, /* 1976 */ - 220924800L, /* 1977 */ - 252460800L, /* 1978 */ - 283996800L, /* 1979 */ - 315532800L, /* 1980 */ - 347155200L, /* 1981 */ - 378691200L, /* 1982 */ - 410227200L, /* 1983 */ - 441763200L, /* 1984 */ - 473385600L, /* 1985 */ - 504921600L, /* 1986 */ - 536457600L, /* 1987 */ - 567993600L, /* 1988 */ - 599616000L, /* 1989 */ - 631152000L, /* 1990 */ - 662688000L, /* 1991 */ - 694224000L, /* 1992 */ - 725846400L, /* 1993 */ - 757382400L, /* 1994 */ - 788918400L, /* 1995 */ - 820454400L, /* 1996 */ - 852076800L, /* 1997 */ - 883612800L, /* 1998 */ - 915148800L, /* 1999 */ - 946684800L, /* 2000 */ - 978307200L, /* 2001 */ - 1009843200L, /* 2002 */ - 1041379200L, /* 2003 */ - 1072915200L, /* 2004 */ - 1104537600L, /* 2005 */ - 1136073600L, /* 2006 */ - 1167609600L, /* 2007 */ - 1199145600L, /* 2008 */ - 1230768000L, /* 2009 */ - 1262304000L, /* 2010 */ - 1293840000L, /* 2011 */ - 1325376000L, /* 2012 */ - 1356998400L, /* 2013 */ - 1388534400L, /* 2014 */ - 1420070400L, /* 2015 */ - 1451606400L, /* 2016 */ - 1483228800L, /* 2017 */ - 1514764800L, /* 2018 */ - 1546300800L, /* 2019 */ - 1577836800L, /* 2020 */ - 1609459200L, /* 2021 */ - 1640995200L, /* 2022 */ - 1672531200L, /* 2023 */ - 1704067200L, /* 2024 */ - 1735689600L, /* 2025 */ - 1767225600L, /* 2026 */ - 1798761600L, /* 2027 */ - 1830297600L, /* 2028 */ - 1861920000L, /* 2029 */ - 1893456000L, /* 2030 */ - 1924992000L, /* 2031 */ - 1956528000L, /* 2032 */ - 1988150400L, /* 2033 */ - 2019686400L, /* 2034 */ - 2051222400L, /* 2035 */ - 2082758400L, /* 2036 */ - 2114380800L, /* 2037 */ - 2145916800L /* 2038 */ -}; - -const char month_snames[12][4] = { - "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" -}; - -void gm_timestr_822(char *ts, time_t sec) -{ - static const char *const days[7]= - {"Sun","Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; - struct tm *tms; - - tms = gmtime(&sec); - - sprintf(ts, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", days[tms->tm_wday], - tms->tm_mday, month_snames[tms->tm_mon], tms->tm_year + 1900, - tms->tm_hour, tms->tm_min, tms->tm_sec); -} - -void gm_timestr_850(char *ts, time_t sec) -{ - static const char *const days[7]= - {"Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; - struct tm *tms; - int year; - - tms = gmtime(&sec); - - year = tms->tm_year; - if (year >= 100) year -= 100; - - sprintf(ts, "%s, %.2d-%s-%.2d %.2d:%.2d:%.2d GMT", days[tms->tm_wday], - tms->tm_mday, month_snames[tms->tm_mon], year, - tms->tm_hour, tms->tm_min, tms->tm_sec); -} - -void gm_timestr_ccc(char *ts, time_t sec) -{ - static const char *const days[7]= - {"Sun","Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; - struct tm *tms; - - tms = gmtime(&sec); - - sprintf(ts, "%s %s %2d %.2d:%.2d:%.2d %d", days[tms->tm_wday], - month_snames[tms->tm_mon], tms->tm_mday, - tms->tm_hour, tms->tm_min, tms->tm_sec, tms->tm_year + 1900); -} - -int main (void) -{ - int year, i; - time_t guess; - time_t offset = 0; - /* time_t offset = 0; */ - /* time_t offset = ((31 + 28) * 24 * 3600) - 1; */ - time_t secstodate, newsecs; - char datestr[50]; - - for (year = 1970; year < 2038; ++year) { - secstodate = (time_t)year2secs[year - 1970] + offset; - gm_timestr_822(datestr, secstodate); - newsecs = parseHTTPdate(datestr); - if (secstodate == newsecs) - printf("Yes %4d %11ld %s\n", year, (long)secstodate, datestr); - else if (newsecs == BAD_DATE) - printf("No %4d %11ld %11ld %s\n", year, (long)secstodate, - (long)newsecs, datestr); - else - printf("No* %4d %11ld %11ld %s\n", year, (long)secstodate, - (long)newsecs, datestr); - } - - srand48(978245L); - - for (i = 0; i < 10000; ++i) { - guess = (time_t)mrand48(); - if (guess < 0) guess *= -1; - secstodate = guess + offset; - gm_timestr_822(datestr, secstodate); - newsecs = parseHTTPdate(datestr); - if (secstodate == newsecs) - printf("Yes %11ld %s\n", (long)secstodate, datestr); - else if (newsecs == BAD_DATE) - printf("No %11ld %11ld %s\n", (long)secstodate, - (long)newsecs, datestr); - else - printf("No* %11ld %11ld %s\n", (long)secstodate, - (long)newsecs, datestr); - } - exit(0); -} diff --git a/test/test_find.c b/test/test_find.c deleted file mode 100644 index e71a531804..0000000000 --- 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 "apr_general.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; - -AP_DECLARE(void) ap_block_alarms(void) -{ - ; -} - -AP_DECLARE(void) ap_unblock_alarms(void) -{ - ; -} - -AP_DECLARE(void) ap_log_error(const char *file, int line, int level, - const request_rec *r, const char *fmt, ...) -{ - ; -} - -int main (void) -{ - apr_pool_t *p; - char line[512]; - char tok[512]; - - p = apr_pool_alloc_init(); - - 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 8d76ce2e08..0000000000 --- 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 eef1be45cd..0000000000 --- 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 "apr_general.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; - -AP_DECLARE(void) ap_block_alarms(void) -{ - ; -} - -AP_DECLARE(void) ap_unblock_alarms(void) -{ - ; -} - -AP_DECLARE(void) ap_log_error(const char *file, int line, int level, - const request_rec *r, const char *fmt, ...) -{ - ; -} - -int main (void) -{ - apr_pool_t *p; - const char *field; - char *newstr; - char instr[512]; - - p = apr_pool_alloc_init(); - - 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 8c0a6a4363..0000000000 --- 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 7800844ed2..0000000000 --- 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 0a6666eb25..0000000000 --- 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; -} - - - - - - -- GitLab