Commit Graph

157 Commits

Author SHA1 Message Date
4fc2fd7dd5 Make sources build with latest clang version
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1909450 13f79535-47bb-0310-9956-ffa450edef68
2023-04-27 07:14:36 +00:00
243c5fad0a mpm_{event,worker,prefork}: late stop of children processes on restart.
Change how the main process handles restarts, from:
    0. <restart signal>
    1. stop old generation of children processes (graceful or not)
    2. reload new configuration
    3. start new generation of children processes
to:
    0. <restart signal>
    1. reload new configuration
    2. stop old generation of children processes (graceful or not)
    3. start new generation of children processes

The delay between stop and start is now very short and does not depend on the
reload time (which can be quite long with many vhosts and/or complex setups
with regexps or whatever third party components to compile).

Also, while reloading, the old generation of children processes keeps accepting
and handling incoming connections until the new generation is up to take over.

* os/unix/unixd.c (sig_term, sig_restart):
  Set AP_MPMQ_STOPPING only once.

* server/listen.c (ap_duplicate_listeners):
  Use ap_log_error() the main server instead of ap_log_perror().

* server/mpm/{event,worker,prefork}/{event,worker,prefork}.c
    ({event,worker,prefork}_retained_data):
  Save the generation pool pointer (gen_pool) and all the buckets here, they
  won't be cleared before the reload like pconf so they need a persitent
  storage accross restarts (i.e. retained->gen_pool).

* server/mpm/{event,worker,prefork}/{event,worker,prefork}.c
    (perform_idle_server_maintenance, child_main, make_child):
  Change usage of all_buckets (previously with global/static scope) to the new
  retained->buckets array.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892587 13f79535-47bb-0310-9956-ffa450edef68
2021-08-24 22:22:40 +00:00
a42f3692b1 Add optional options= argument to Listen to add listener-specific
socket options.

Reimplement "use_specific_errors" listener flag under generic
ap_listen_rec flags field holding all listener-specific options.

* include/ap_listen.h: Add AP_LISTEN_* flags.
  (ap_listen_rec): Rename use_specific_errors to flags.

* server/listen.c (make_sock): Set APR_SO_FREEBIND if
  AP_LISTEN_FREEBIND flag is set on listener; set APR_SO_REUSEPORT
  unconditionally if AP_LISTEN_REUSEPORT is set.
  (alloc_listener): Take flags argument.
  (ap_setup_listeners): Set AP_LISTEN_SPECIFIC_ERRORS flag here.
  (ap_set_listener): Parse optional options=... argument, catch
  typos and fail if protocol name contains a "=".
  (ap_duplicate_listeners): Duplicate flags.

Submitted by: jkaluza, Lubos Uhliarik <luhliari redhat.com>, jorton
PR: 61865
Github: closes #114


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876865 13f79535-47bb-0310-9956-ffa450edef68
2020-04-23 08:26:26 +00:00
f5c6ef494e Follow up to r1822537: replace static variable with pool userdata.
Also adds a comment and a CHANGES entry.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1830744 13f79535-47bb-0310-9956-ffa450edef68
2018-05-02 11:16:00 +00:00
7fa2267d94 mpm_unix(es): cleanup properly on exit in one_process mode.
We can't destroy ap_pglobal in the MPMs because clean_child_exit() runs in
a DSO which would be unloaded under us.

So we defer an ap_terminate() with atexit() in ap_unixd_mpm_set_signals(),
all this is static/builtin code in "os/unix/unixd.c".



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1822537 13f79535-47bb-0310-9956-ffa450edef68
2018-01-29 17:00:23 +00:00
98e9503120 Add "AcceptErrorsNonFatal" directive
This tweaks accept() failure processing by having ap_unixd_accept
pass more errors up, and having the MPM's check against a macro
to see if they are in a whitelist of non ENETDOWN/EMFILE kind 
of potential process-wide errors.

Default behavior is still to exit.

edit: MMN bump in 1820099.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1820098 13f79535-47bb-0310-9956-ffa450edef68
2018-01-04 15:10:45 +00:00
eb0229b1a5 Fix compilation failure :
unixd.c: In function ‘ap_unixd_mpm_set_signals’:
unixd.c:579:5: error: implicit declaration of function ‘apr_signal’; did you mean ‘strsignal’? [-Werror=implicit-function-declaration]
     apr_signal(SIGPIPE, SIG_IGN);
     ^~~~~~~~~~
     strsignal

Not sure where it comes from, maybe related to r1812301.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1813116 13f79535-47bb-0310-9956-ffa450edef68
2017-10-24 03:20:56 +00:00
1ebc68400d MPMs unix: follow up to r1809881 and r1809973.
unset_signals() is called when ap_pglobal is destroyed too.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1809976 13f79535-47bb-0310-9956-ffa450edef68
2017-09-28 11:31:57 +00:00
a16360a61f core, MPMs unix: follow up to r1809881.
Deregister all hooks first (in pre_cleanup), by doing it last we could still
have had them run when DSOs were unloaded.

Likewise, avoid double faults when handling fatal signals by restoring the
default handler before pconf is cleared (we can't ap_log_error there).

Finally, we need to ignore sig_term/restart (do nothing) when the main
process is exiting (i.e. ap_pglobal is destroyed), since retained_data are
freed.

Aimed to fix all faults in PR 61558.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1809973 13f79535-47bb-0310-9956-ffa450edef68
2017-09-28 11:08:09 +00:00
f46d03312e MPMs unix: Place signals handlers and helpers out of DSOs to avoid
a possible crash if a signal is caught during (graceful) restart.
PR 60487.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1783849 13f79535-47bb-0310-9956-ffa450edef68
2017-02-21 09:07:42 +00:00
25a2e41ea7 Save a few bytes in conf pool when parsing some directives. Use temp_pool when applicable.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1657692 13f79535-47bb-0310-9956-ffa450edef68
2015-02-05 21:03:04 +00:00
56d0c25725 Add missing APLOGNO.
Refactor some lines to keep APLOGNO on the same line as ap_log_error, when applicable.
Split lines longer than 80.
Improve alignment.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1612068 13f79535-47bb-0310-9956-ffa450edef68
2014-07-20 09:32:58 +00:00
6625c31ba1 'ap_getword_conf' does not return NULL but an empty string if nothing could be got.
So the message 02173 can never trigger.

Actually, this is not a problem because all calls to 'ap_unixd_set_rlimit' are done in configuration parsing functions guarded with AP_INIT_TAKE12, so we are guaranteed to have something.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1551005 13f79535-47bb-0310-9956-ffa450edef68
2013-12-15 07:53:09 +00:00
d5a372ff78 Fix valgrind warning about uninitialized memory in argument to semctl
PR: 53690
Submitted by: Mikhail T. <mi+apache aldan algebra com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1442326 13f79535-47bb-0310-9956-ffa450edef68
2013-02-04 20:15:10 +00:00
76f782e188 Various code cleanup to avoid compiler, cppcheck, or clang warnings:
modules/debugging/mod_firehose.c: Make some internal functions static
                                  (to do: logs_cleanup() is unused)

modules/filters/mod_charset_lite.c: Remove dead assignments

modules/filters/mod_include.c: likewise

modules/metadata/mod_usertrack.c: likewise

modules/proxy/mod_proxy_ftp.c: likewise

modules/ssl/ssl_engine_pphrase.c: likewise

modules/proxy/mod_proxy_balancer.c: likewise;
                                    Remove NULL check that can never happen

modules/proxy/proxy_util.c: Axe NULL-check that can never happen and if it
                            would, it would just mask another bug

os/unix/unixd.c: likewise

modules/http/http_filters.c: Remove sub-condition that is always true

modules/lua/mod_lua.c: Add default cases to switch statements

modules/generators/mod_autoindex.c: Unsigned value can never be < 0

server/util_expr_eval.c: Fix compiler warnings with VC and on OS2



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1220493 13f79535-47bb-0310-9956-ffa450edef68
2011-12-18 17:52:59 +00:00
92e366007c Add lots of unique tags to error log messages
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1209766 13f79535-47bb-0310-9956-ffa450edef68
2011-12-02 23:02:04 +00:00
0ddfb3e6cc Add -D DUMP_RUN_CFG option to dump some configuration items
from the parsed (or default) config. This is useful for init scripts that
need to setup temporary directories and permissions, for example if those
temporary directories are located on a ram disk.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1180681 13f79535-47bb-0310-9956-ffa450edef68
2011-10-09 18:35:23 +00:00
1951a037bf More cleanup: Expand tabs and some more indentation fixes
No functional change


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1174929 13f79535-47bb-0310-9956-ffa450edef68
2011-09-23 18:08:42 +00:00
103f776c25 Cleanup effort in prep for GA push:
Trim trailing whitespace... no func change



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1174748 13f79535-47bb-0310-9956-ffa450edef68
2011-09-23 13:38:09 +00:00
255f723fef We already have ap_str_tolower(), so also add ap_str_toupper() function and use
it where possible.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1138617 13f79535-47bb-0310-9956-ffa450edef68
2011-06-22 20:24:27 +00:00
46bdc28bf4 fix some logging calls to include the server_rec
(and even the conn_rec in a couple of places)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1074871 13f79535-47bb-0310-9956-ffa450edef68
2011-02-26 15:32:01 +00:00
49bd9d3de1 Per the existing comment and setrlimit() behavior -- only prevent attempts to
raise the hard limit, not to lower it, by nonroot users.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1042198 13f79535-47bb-0310-9956-ffa450edef68
2010-12-04 15:06:29 +00:00
d4d90bdf0a suEXEC: Add Suexec directive to disable suEXEC without renaming the
binary (Suexec Off), or force startup failure if suEXEC is required
but not supported (Suexec On).  Change SuexecUserGroup to fail 
startup instead of just printing a warning if suEXEC is disabled.

Additionally, ap_unixd_config.suexec_disabled_reason has a message,
suitable for logging/messaging, explaining why the feature isn't
available.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1033519 13f79535-47bb-0310-9956-ffa450edef68
2010-11-10 15:34:43 +00:00
90a12694f8 The directives "User", "Group" and "ChrootDir" have
been moved into mod_unixd.

The old macro UNIX_DAEMON_COMMANDS is no longer in use.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@954783 13f79535-47bb-0310-9956-ffa450edef68
2010-06-15 09:33:20 +00:00
ebb62867fb Use the new APLOG_USE_MODULE/AP_DECLARE_MODULE macros everywhere to take
advantage of per-module loglevels


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951895 13f79535-47bb-0310-9956-ffa450edef68
2010-06-06 16:59:50 +00:00
79d196b3b2 generalize the existing (r589761) platform- and errno-specific
logic to suppress an error message if accept() fails after the
socket has been marked inactive

a message will still be logged, but at debug level instead of error

PR: 49058


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@933657 13f79535-47bb-0310-9956-ffa450edef68
2010-04-13 14:58:03 +00:00
0464e456f6 revert 759711 and 759713... don't require apr2
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@760026 13f79535-47bb-0310-9956-ffa450edef68
2009-03-30 16:10:26 +00:00
f1d5422ab9 0600 is UWRITE+UREAD
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@759713 13f79535-47bb-0310-9956-ffa450edef68
2009-03-29 16:10:02 +00:00
0e19eb7475 Use apr-2 object perms setter
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@759711 13f79535-47bb-0310-9956-ffa450edef68
2009-03-29 16:05:53 +00:00
a1908585a8 Core can specify a platform-specific rewrite args hook. Use that on Unix.
Windows continues to specify this in the MPM, at least until someone
can separate out the MPM-specific bits.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@759699 13f79535-47bb-0310-9956-ffa450edef68
2009-03-29 14:41:02 +00:00
cb8a82faed remove TPF support
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@758936 13f79535-47bb-0310-9956-ffa450edef68
2009-03-27 00:05:18 +00:00
736d659de0 use a local module header file to store the function prototype
for ap_unixd_setup_child() that is used outside this module.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@739487 13f79535-47bb-0310-9956-ffa450edef68
2009-01-31 01:46:56 +00:00
5b5045a2d5 revert r711228: the ap_unixd_setup_child prototype needs to go somewhere.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@739150 13f79535-47bb-0310-9956-ffa450edef68
2009-01-30 02:48:08 +00:00
a73acf02f6 API Cleanup in preperation for 2.4.x, make sure all exported functions or variables contain an ap_ prefix.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@722399 13f79535-47bb-0310-9956-ffa450edef68
2008-12-02 08:13:36 +00:00
9327dae3a9 * unixd_setup_child is no longer implemented by unixd.c.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@711228 13f79535-47bb-0310-9956-ffa450edef68
2008-11-04 11:36:31 +00:00
368d9bb335 Further unixd hacks to remove duplication between old-unixd and mod_unixd,
and get it working with old MPMS[1] + mod_unixd.  It's still an uneasy
split, as some modules (mod_cgid, suexec)[2] also use unixd.
More thinking+hacking due.

[1] Should be prefork/worker/event, but only worker is tested.
[2] cgid is OK, suexec is untested.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@711146 13f79535-47bb-0310-9956-ffa450edef68
2008-11-04 00:44:56 +00:00
c63898be91 Also adjust unixd.c with changes from r709406
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@709407 13f79535-47bb-0310-9956-ffa450edef68
2008-10-31 13:37:32 +00:00
a324a1d72f Remove all references to CORE_PRIVATE.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@645455 13f79535-47bb-0310-9956-ffa450edef68
2008-04-07 10:45:43 +00:00
bafd1071fb Support chroot on unix-family platforms
PR 43596 (Dimitar Pashev)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@611483 13f79535-47bb-0310-9956-ffa450edef68
2008-01-12 21:16:27 +00:00
ee4ec8009b After a stop or restart signal, the old listening sockets
are closed. "Some platforms" drop out of the accept() with
an EBADF after the sockets have been closed. Such an
error should not clutter the logs.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@589761 13f79535-47bb-0310-9956-ffa450edef68
2007-10-29 17:38:11 +00:00
cd3ed0c3ca APR_HAVE/AP_HAVE are ALWAYS defined, not always 1.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@486436 13f79535-47bb-0310-9956-ffa450edef68
2006-12-13 00:34:58 +00:00
de659cbed0 update license header text
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@420983 13f79535-47bb-0310-9956-ffa450edef68
2006-07-11 20:33:53 +00:00
dd95d7c37c Update the copyright year in all .c, .h and .xml files
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@395228 13f79535-47bb-0310-9956-ffa450edef68
2006-04-19 12:11:27 +00:00
913e69c609 * os/unix/unixd.h: Use extern "C" linkage.
PR: 37357


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@354389 13f79535-47bb-0310-9956-ffa450edef68
2005-12-06 09:48:19 +00:00
5061d9fa92 No functional Change: Removing trailing whitespace. This also
means that "blank" lines consisting of just spaces or
tabs are now really blank lines


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@332306 13f79535-47bb-0310-9956-ffa450edef68
2005-11-10 15:11:44 +00:00
5d2fae4818 No functional change: simple detabbing of indented code.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@332305 13f79535-47bb-0310-9956-ffa450edef68
2005-11-10 15:05:51 +00:00
105543fce6 I'd prefer, before 2.2-final, to have AP_NEED_SET_MUTEX_PERMS defined
across all architectures as 1|0.  Comments?

  This simply ensures we can use the value in #if tests.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@289592 13f79535-47bb-0310-9956-ffa450edef68
2005-09-16 16:04:37 +00:00
8c1e315d3f Doxygen fixup / cleanup
submited by: Neale Ranns neale ranns.org
reviewed by: Ian Holsman



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@263931 13f79535-47bb-0310-9956-ffa450edef68
2005-08-28 23:03:59 +00:00
905cdf9f0b Update copyright year to 2005 and standardize on current copyright owner line.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@151408 13f79535-47bb-0310-9956-ffa450edef68
2005-02-04 20:28:49 +00:00
c36ecfa64f Remove the .cvsignore files.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@105796 13f79535-47bb-0310-9956-ffa450edef68
2004-11-19 09:07:29 +00:00