1
0
mirror of https://github.com/apache/httpd.git synced 2026-10-23 22:49:01 +03:00

4224 Commits

Author SHA1 Message Date
Eric Covener
8b6d55f6a0 Merge r1906539 from trunk:
fail on bad header

Submitted By: covener
Reviewed By: covener, rpluem, gbechis


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1906541 13f79535-47bb-0310-9956-ffa450edef68
2023-01-10 13:20:09 +00:00
Jim Jagielski
4d37880753 Merge r1822857, r1876815, r1893499, r1900024, r1900152, r1900306, r1900559, r1900564, r1900691, r1900694 from trunk:
* Makefile.in (build/config_vars.out): Rebuild if build/config_vars.sh
  has changed.


sort safe_env_lst 
bz 64371


mod_optional_hook_import: debug message at APLOG_DEBUG level.



  *) de-duplicate ALOGNO from code copy.



ab: apr_base64_encode already NUL-terminate the output.

And returns the length including the trailing \0, so setting it at that
length is off by +1.



* Avoid an overflow on large inputs

PR: 66033


dav_get_liveprop_info() returns a long not an int.

Update the type of global_ns accordingly and update the format specifier when this variable is used in printf like functions.

This also aligns code with dav_core_insert_prop() in modules/dav/main/std_liveprop.c

Length computed by count_string() are accumulated in an apr_size_t, so be more consistent and use this data type also in this function.

Fix some typo

[skip ci]

Fix some typos

[skip ci]
Submitted by: jorton, gbechis, ylavic, icing, ylavic, rpluem, jailletc36, jailletc36, jailletc36, jailletc36
Reviewed by: jailletc36, rpluem, jim


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1903618 13f79535-47bb-0310-9956-ffa450edef68
2022-08-21 20:26:51 +00:00
Eric Covener
adefe64c3e Merge r1901645 from trunk:
fixed in 1.7 SVN but not released

just in case we reroll.




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1901646 13f79535-47bb-0310-9956-ffa450edef68
2022-06-04 20:21:24 +00:00
Eric Covener
a46d582ea5 Merge r1901619 from trunk:
force to 0 on 1.6 on Windows



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1901620 13f79535-47bb-0310-9956-ffa450edef68
2022-06-04 12:07:17 +00:00
Eric Covener
8c14927162 Merge r1901500 from trunk:
handle large writes in ap_rputs


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1901501 13f79535-47bb-0310-9956-ffa450edef68
2022-06-01 12:34:16 +00:00
Eric Covener
ce259c4061 Merge r1901497 from trunk:
use a liberal default limit for LimitRequestBody of 1GB


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1901499 13f79535-47bb-0310-9956-ffa450edef68
2022-06-01 12:31:48 +00:00
Eric Covener
6503d09ab5 Merge r1901494 from trunk:
fix types



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1901495 13f79535-47bb-0310-9956-ffa450edef68
2022-06-01 12:21:45 +00:00
Stefan Eissing
5f3010a643 Merge /httpd/httpd/trunk:r1899858,1899865,1899884,1900991
*) mpm_event, mpm_worker: Handle children killed pathologically.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1901234 13f79535-47bb-0310-9956-ffa450edef68
2022-05-25 12:09:36 +00:00
Yann Ylavic
c2cbd5f50f core: Disable TCP_NOPUSH optimization on OSX. BZ 66019.
OSX supports TCP_NOPUSH but does not release the data retained (in TCP stack)
when the option is unset. It seems that unsetting it before the last write
does not help either so just disable the optimization for OSX in the core
output filter to avoid uncontrollable transmission delays.

* server/core_filters.c():
  Add the sock_nopush() helper that does nothing on OSX and platforms not
  supporting TCP_NOPUSH or TCP_CORK.

* server/core_filters.c(send_brigade_nonblocking):
  Use sock_nopush() instead of apr_socket_opt_set() for APR_TCP_NOPUSH option.


Merge r1900100 from trunk.

Submitted by: ylavic
Reviewed by: ylavic, rpluem, jorton


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1901201 13f79535-47bb-0310-9956-ffa450edef68
2022-05-24 09:03:30 +00:00
Yann Ylavic
138691a51c mpm_event: Fix accounting of active/total processes on ungraceful restart.
Children processes terminated by ap_{reclaim,relieve}_child_processes() were
were not un-accounted for total_daemons and active_daemons, which was done in
server_main_loop() only. This led to perform_idle_server_maintenance() thinking
it was over the limit of children processes and never create new ones.

Have this accounting right in event_note_child_{started,stopped}() which is
called both at runtime and reload time.

* server/mpm/event/event.c(struct event_retained_data):
  Rename field max_daemons_limit to max_daemon_used to better describe what
  it's about and to align with AP_MPMQ_MAX_DAEMON_USED.

* server/mpm/event/event.c(event_note_child_stopped):
  Renamed from event_note_child_killed() to clarify that it's not only called
  when a child is killed (i.e. on restart) but whenever a child has stopped.

* server/mpm/event/event.c(event_note_child_stopped):
  Move decrementing {active,total}_daemons and marking child's threads as
  SERVER_DEAD from server_main_loop() so that it's done both at runtime and
  reload time. Log the current number/state of daemons at APLOG_DEBUG level
  for each child stopped.

* server/mpm/event/event.c(event_note_child_started):
  Move incrementing {active,total}_daemons from make_child() for symmetry,
  given that make_child() calls event_note_child_started(). Log the current
  number/state of daemons at APLOG_DEBUG level for each child started.

* server/mpm/event/event.c(perform_idle_server_maintenance):
  Fix possible miscounting of retained->max_daemon_used accross the multiple
  calls to perform_idle_server_maintenance() if ListenCoresBucketsRatio > 0.
  Pass an int *max_daemon_used which starts at zero and is bumped consistently
  for all the buckets, while retained->max_daemon_used is updated only after
  all the buckets have been maintained.

* server/mpm/event/event.c(perform_idle_server_maintenance):
  Use event_note_child_stopped() to handle exited children processes.


Follow up to r1899777: CHANGES entry.


mpm_event: Follow up to r1899777: Fix max_daemon_used.


Merge r1899777, r1899786, r1899812 from trunk.
Fixes: BZ 66004
Submitted by: ylavic
Reviewed by: ylavic, rpluem, jorton


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1901199 13f79535-47bb-0310-9956-ffa450edef68
2022-05-24 09:00:19 +00:00
Yann Ylavic
229dc3ac47 *) core: make ap_escape_quotes() work correctly on strings
with more than MAX_INT/2 characters, counting quotes double.
   Credit to <generalbugs@zippenhop.com> for finding this.


*) core: improved checks in ap_escape_quotes() for
   extra long strings (or resulting strings) that
   exceed ptrdiff_t ranges.


Merge r1899609, r1899905 from trunk.
Reviewed by: icing, rpluem, ylavic
Submitted by: icing, ylavic


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1901196 13f79535-47bb-0310-9956-ffa450edef68
2022-05-24 08:55:16 +00:00
Yann Ylavic
5a72f0fe6f core: Make sure and check that LimitXMLRequestBody fits in system memory.
LimitXMLRequestBody can not exceed the size needed to ap_escape_html2() the
body without failing to allocate memory, so enforce this at load time based
on APR_SIZE_MAX, and make sure that ap_escape_html2() is within the bounds.

Document the limits for LimitXMLRequestBody in our docs.


Merge r1898686 from trunk.
Submitted by: ylavic, rpluem
Reviewed by: ylavic, covener, rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1898693 13f79535-47bb-0310-9956-ffa450edef68
2022-03-07 14:48:54 +00:00
Yann Ylavic
19aa2d83b3 core: Simpler connection close logic if discarding the request body fails.
If ap_discard_request_body() sets AP_CONN_CLOSE by itself it simplifies and
allows to consolidate end_output_stream() and error_output_stream().


Merge r1898683 from trunk.
Submitted by: ylavic, rpluem
Reviewed by: ylavic, rpluem, covener


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1898692 13f79535-47bb-0310-9956-ffa450edef68
2022-03-07 14:46:08 +00:00
Yann Ylavic
285b6285e7 ap_regex: Use Thread Local Storage (if efficient) to avoid allocations.
PCRE2 wants an opaque context by providing the API to allocate and free it, so
to minimize these calls we maintain one opaque context per thread (in Thread
Local Storage, TLS) grown as needed, and while at it we do the same for PCRE1
ints vectors. Note that this requires a fast TLS mechanism to be worth it,
which is the case of apr_thread_data_get/set() from/to apr_thread_current()
when APR_HAS_THREAD_LOCAL; otherwise we'll do the allocation and freeing for
each ap_regexec().

The small stack vector is used for PCRE1 && !APR_HAS_THREAD_LOCAL only now.


Follow up to r1897240: APR_HAS_THREAD_LOCAL wants #ifdef instead of #if.


Follow up to r1897240: CHANGES entry.


ap_regex: PCRE needs buffers sized against the number of captures only.

No more (useless), no less (or PCRE will allocate a new buffer by itself to
satisfy the needs), so we should base our buffer size solely on the number
of captures in the regex (determined at compile time from the pattern).

The nmatch provided by the user is used to fill in pmatch only (up to that),
but "our" buffers are sized exactly as needed to avoid oversized allocations
or PCRE allocating by itself.


ap_regex: Follow up to r1897244: Fix pmatch overflow and returned value at limits.

Don't write to pmatch[nlimit:] when ncaps > nmatch, rc should not exceed nmatch
either as before r1897244.


ap_regex: Follow up to r1897240: Fix issues spotted by Rüdiger (thanks!).

#include "apr_thread_proc.h" is enough/needed by util_pcre.c and main.c.
Fix compilation (vector => ovector) for !HAVE_PCRE2 && APR_HAS_THREAD_LOCAL.
Check pcre2_match_data_create() return value for HAVE_PCRE2 && !APR_HAS_THREAD_LOCAL.


ap_regex: Follow up to r1897240: runtime fallback to alloc/free.

Even though APR_HAS_THREAD_LOCAL is compiled in, ap_regexec() might still be
called by non a apr_thread_t thread, let's fall back to alloc/free in this
case too.


ap_regex: Follow up to r1897240: no ap_thread_current() yet.


ap_regex: Follow up to r1897240: cleanups.


ap_regex: Follow up to r1897240: cleanup PCRE2 match data on exit.


ap_regex: Follow up to r1897240: #if APR_HAS_THREAD_LOCAL, not #ifdef.


core: Efficient ap_thread_current() with APR < 1.8.

#define ap_thread_create, ap_thread_current_create and ap_thread_current to
their apr-1.8+ equivalent if available, or implement them using the compiler's
thread_local mechanism if available, or finally provide stubs otherwise.

#define AP_HAS_THREAD_LOCAL to 1 in the two former case or 0 otherwise, while
AP_THREAD_LOCAL is defined to the compiler's keyword iff AP_HAS_THREAD_LOCAL.

Replace all apr_thread_create() calls with ap_thread_create() so that httpd
threads can use ap_thread_current()'s pool data as Thread Local Storage.

Bump MMN minor.

* include/httpd.h():
  Define AP_HAS_THREAD_LOCAL, AP_THREAD_LOCAL (eventually), ap_thread_create(),
  ap_thread_current_create() and ap_thread_current().
  
* server/util.c:
  Implement ap_thread_create(), ap_thread_current_create() and
  ap_thread_current() when APR < 1.8.

* modules/core/mod_watchdog.c, modules/http2/h2_workers.c,
    modules/ssl/mod_ssl_ct.c:
  Use ap_thread_create() instead of apr_thread_create.

* server/main.c:
  Use AP_HAS_THREAD_LOCAL and ap_thread_current_create instead of APR's.

* server/util_pcre.c:
  Use AP_HAS_THREAD_LOCAL and ap_thread_current instead of APR's.

* server/mpm/event/event.c, server/mpm/worker/worker.c,
    server/mpm/prefork/prefork.c:
  Use ap_thread_create() instead of apr_thread_create.
  Create an apr_thread_t/ap_thread_current() for the main chaild thread usable
  at child_init().
  
* server/mpm/winnt/child.c:
  Use ap_thread_create() instead of CreateThread().
  Create an apr_thread_t/ap_thread_current() for the main chaild thread usable


Follow up to r1897460: APLOGNOs.


Follow up to r1897460: !APR_HAS_THREAD implies no ap_thread_* either.


core: Follow up to r1897460: Implement and use ap_thread_current_after_fork().

thread_local variables are not (always?) reset on fork(), so we need a way
to set the current_thread to NULL in the child process.

Implement and use ap_thread_current_after_fork() for that.

* include/httpd.h:
  Define ap_thread_current_after_fork().

* server/util.c:
  Implement ap_thread_current_after_fork().

* server/mpm/event/event.c, server/mpm/prefork/prefork.c,
    server/mpm/worker/worker.c:
  Use ap_thread_current_after_fork().

* server/mpm/winnt/child.c:
  Windows processes are not fork()ed and each child runs the main(), so
  ap_thread_current_create() was already called there.


core: Follow up to r1897460: Provide ap_thread_main_create().

Replace ap_thread_current_create() by ap_thread_main_create() which is how
it's used by httpd. The former is now a local helper only to implement the
latter.

This allows to consolidate/factorize common code in the main() of httpd and
the unix MPMs.


ap_regex: Follow up to r1897240: Fetch the ovector _after_ the match.

Possibly(?) pcre2_match() can modifiy the given pcre2_match_data and invalidate
the old ovector, be safe and fetch it after.


main: Follow up to r1897240: Fix bad log copypasta.

Don't stderr printf the "stat" and "failed" results from the previous
apr_app_initialize() call for an error in ap_thread_main_create().


core: Follow up to r1897240: Opt-out for AP_HAS_THREAD_LOCAL and/or pcre's usage.

If the compiler's thread_local is not efficient enough on some platforms, or
not desired, have a way to disable its usage in httpd (at compile time).

Handle -DAP_NO_THREAD_LOCAL and/or -DAPREG_NO_THREAD_LOCAL as build opt-out for
thread_local usage in httpd gobally and/or in ap_regex only (respectively).


core: Follow up to r1897240: Provide/export ap_thread_current_create()

For completness, and possibly to ease backport to 2.4.x for MPM winnt.


core: Follow up to r1897240 & r1897691: Syntax.


Add compiled and loaded PCRE version numbers
to "httpd -V" output and to mod_info page.


Forgotten file needed for r1612934.


Minor mmn bump due to r1612940.


Backports: r1897240, r1897241, r1897242, r1897244, r1897248, r1897250,
           r1897260, r1897261, r1897263, r1897386, r1897459, r1897460,
           r1897461, r1897462, r1897472, r1897543, r1897651, r1897680,
           r1897689, r1897691, r1897692, r1612934, r1612940, r1613189
Submitted by: ylavic, rjung, rjung, rjung
Reviewed by: ylavic, rpluem, covener, steffenal, wrowe
GH: closes #289 (https://github.com/apache/httpd/pull/289)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1898467 13f79535-47bb-0310-9956-ffa450edef68
2022-02-28 11:56:43 +00:00
William A. Rowe Jr
c602ba1481 Replace PCRE with PCRE2 where it is available
PCRE 8.45 from May '21 is at end-of-life and will not receive security
vulnerability attention. pcre2-10.x replaces this and has been updated 
(as of this time) as recently as Oct '21.

This patch removes the needless assignment of re_erroffset in the conf pool
by the worker threads; such mistakes break the shared copy-on-write pages of
memory that should have remained common between all httpd worker processes.

Two de-optimizations are inherent in this patch, the former ovector-on-stack
opportunity is lost. This is by design of pcre2, more serious exploits were
available with stack array underrun/overrun manipulation. Heap for all pcre
array processing is the recommendation of the implementor, enforced by API.

Safer that we either create a new general context using pool allocation
in heap (requires thread-pool args we don't have in our api), or recycle
a per-req, per-pool, TLS match_data buffer on heap of some arbitrary 10 elts
or so, for these most common cases. Since this can't be done portably in C89
we may revisit this optimization in post-2.4 releases.

This logic refuses to consider --without-pcre, which is nonsequitor.

Submitted by: [wrowe, Petr Pisar <ppisar redhat.com>, rjung]
Backports: 1773454 1773741 1773742 1773839 1773870 1773882 1814662 1881478



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1898399 13f79535-47bb-0310-9956-ffa450edef68
2022-02-24 22:18:42 +00:00
Christophe Jaillet
4a0e77df1e Merge r1881379, r1892422, r1893011, r1897270, r1897271 from trunk
Easy patches: synch 2.4.x and trunk
   - mod_ssl: Fix a few warnings on 64 bits windows compilation
   - ap_escape_quotes(): Remove unneeded checks to improve performance
   - test/time-sem.c: unlock the accept mutex before exiting (error conditions)
   - mod_ext_filter: Fix a spurious -1 used as a APR_SIZE_T_FMT in an error message
   - mod_sed: fix some format string (s/lld/APR_INT64_T_FMT/)

Submitted by: jailletc36, rpluem, ylavic, jailletc36, jailletc36
Reviewed by: jailletc36, icing, rpluem
Backported by: jailletc36

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1898391 13f79535-47bb-0310-9956-ffa450edef68
2022-02-24 20:37:08 +00:00
Christophe Jaillet
73ce13be5a Merge r1589986, r1589995, r1633528 from trunk
*) Add the ldap function to the expression API, allowing LDAP filters and
     distinguished names based on expressions to be escaped correctly to
     guard against LDAP injection.

Submitted by: minfrin, minfrin, jailletc36
Reviewed by: minfrin, icing, covener
Backported by: jailletc36

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1898217 13f79535-47bb-0310-9956-ffa450edef68
2022-02-19 13:47:02 +00:00
Ruediger Pluem
93291d20b0 Merge r1896505 from trunk:
mpm_event: Fix a possible listener deadlock.  PR 65769.

When the listener starts accepting more connections than the number of workers
already started (due to scheduling), the listening sockets gets disabled (per
AH03269) but nothing was re-enabling them before the end of the connections,
despite the creation of more idle/available workers in the meantime.
In the wost case there is no idle worker when the listener accepts the first
connection thus nothing to wake up the listener blocked in poll() with no
socket, hence a deadlock.

Fix this by waking up the listener when a worker becomes idle and this unblocks
connections_above_limit(). This is also worthwhile when all the workers are
started (fully initialized runtime) since the number of idle workers is a
condition for connections_above_limit() anyway so the sooner the listeners are
re-enabled the better (the other condition is the number of connections which
is unblocked appropriately by decrement_connection_count() already).

Also when a child exists with ps->quiescing == 1 and it's caught by
server_main_loop() before perform_idle_server_maintenance(), active_daemons was
not decrement as needed (including accross restarts), leading to an invalid
active_daemons accounting.

* server/mpm/event/event.c(should_enable_listensocks):
  New helper that returns whether listenning sockets can be poll()ed again.

* server/mpm/event/event.c(decrement_connection_count, listener_thread):
  Use should_enable_listensocks() where previously open-coded.

* server/mpm/event/event.c(worker_thread):
  Wake up the listener when is_idle => 1 and should_enable_listensocks().
  Have a single point of exit when workers_may_exit to make sure that the
  wake always occurs (even when exiting).

* server/mpm/event/event.c(server_main_loop):
  Decrement active_daemons not only when !ps->quiescing but also when
  ps->quiescing == 1, i.e. all the cases not handled by
  perform_idle_server_maintenance() already.


Submitted by: ylavic
Reviewed by: rpluem, ylavic, gbechis


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1897149 13f79535-47bb-0310-9956-ffa450edef68
2022-01-17 08:43:50 +00:00
Yann Ylavic
a962ba7304 Merge r1895914, r1895921 from trunk:
*) http: Enforce that fully qualified uri-paths not to be forward-proxied
     have an http(s) scheme, and that the ones to be forward proxied have a
     hostname, per HTTP specifications.
     trunk patch: http://svn.apache.org/r1895914
                  http://svn.apache.org/r1895921
     2.4.x patch: https://patch-diff.githubusercontent.com/raw/apache/httpd/pull/286.patch
     backport PR: https://github.com/apache/httpd/pull/286
     +1: ylavic, minfrin, gbechis


mod_proxy: Detect unix: scheme syntax errors at load time.

* modules/proxy/mod_proxy.c(add_pass, add_member, set_proxy_param,
                            proxysection):
  Check return value of ap_proxy_de_socketfy().

* modules/proxy/proxy_util.c(ap_proxy_get_worker_ex):
  Check return value of ap_proxy_de_socketfy().



http: Enforce that fully qualified uri-paths not to be forward-proxied
      have an http(s) scheme, and that the ones to be forward proxied have a
      hostname, per HTTP specifications.

The early checks avoid failing the request later on and thus save cycles
for those invalid cases.


Submitted by: ylavic
Reviewed by: ylavic, minfrin, gbechis
Closes #286


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1895955 13f79535-47bb-0310-9956-ffa450edef68
2021-12-14 15:35:56 +00:00
Graham Leggett
4819c58566 Backport:
*) mpm_event: Restart stopping of idle children after a load peak. PR 65626.
     trunk patch: http://svn.apache.org/r1894285
                  http://svn.apache.org/r1894286
                  http://svn.apache.org/r1894291
                  http://svn.apache.org/r1895550
                  http://svn.apache.org/r1895553
                  http://svn.apache.org/r1895630
     backport PR: https://github.com/apache/httpd/pull/276
     2.4.x patch: https://patch-diff.githubusercontent.com/raw/apache/httpd/pull/276.patch
     +1: ylavic, rpluem, minfrin
     ylavic: updated with r1894291 for correctness of perform_idle_server_maintenance()
             w.r.t. num_buckets > 1 and ease merging of r1895553, with r1895550 for
             correctness of active_daemons used in r1895553 and r1895630.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1895871 13f79535-47bb-0310-9956-ffa450edef68
2021-12-13 10:43:53 +00:00
Yann Ylavic
41f5c02eaf Merge r1894171 from trunk:
*) core: Be safe with ap_lingering_close() called with a socket NULL-ed.

PR 65627. 

mod_itk seems to:
  ap_set_core_module_config(c->conn_config, NULL)
before calling ap_lingering_close(), causing a crash after r1891721.
Until we have an API to no-op ap_lingering_close(), let's be safe.

* server/connection.c(ap_start_lingering_close):
  The socket should not be NULL here, add an assertion.

* server/connection.c(ap_lingering_close):
  Set c->aborted if the socket is NULL, and give up.


Submitted by: acmondor <bz.apache.org acmondor.ca>, ylavic
Reviewed by: ylavic, icing, rpluem
Github: closes #277


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1895555 13f79535-47bb-0310-9956-ffa450edef68
2021-12-03 15:34:16 +00:00
Joe Orton
857df905d2 Merge r1782986 from trunk:
util_filter: better ap_pass_brigade() vs empty brigades.

Submitted by: ylavic
Reviewed by: jorton, rpluem, ylavic


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1894150 13f79535-47bb-0310-9956-ffa450edef68
2021-10-12 08:13:29 +00:00
Yann Ylavic
c3a95d75da Merge r1893971 from trunk:
core: Add ap_unescape_url_ex() for better decoding control, and deprecate
      unused AP_NORMALIZE_DROP_PARAMETERS flag.
 
Submitted by: ylavic
Reviewed by: ylavic, icing, gbechis


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1893977 13f79535-47bb-0310-9956-ffa450edef68
2021-10-07 12:27:43 +00:00
Stefan Eissing
98246aa960 Merge of /httpd/httpd/trunk:r1893724
*) core: AP_NORMALIZE_DECODE_UNRESERVED should normalize the second dot in
     the uri-path when it's preceded by a dot.  [Yann Ylavic]



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1893775 13f79535-47bb-0310-9956-ffa450edef68
2021-10-01 11:21:11 +00:00
Graham Leggett
661a4dfb6d Backport:
*) mpm event: Correctly count active child processes in parent process if
   child process dies due to MaxConnectionsPerChild. PR 65592.
   Trunk version of patch:
      https://svn.apache.org/r1893520
   Backport version for 2.4.x of patch:
    Trunk version of patch works
    svn merge -c 1893520 ^/httpd/httpd/trunk .
   +1: rpluem, ylavic, minfrin



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1893660 13f79535-47bb-0310-9956-ffa450edef68
2021-09-26 14:35:55 +00:00
Graham Leggett
e6aaf9139e Backport:
*) core: do not install core input/output filters on secondary
   connections.
   Trunk version of patch:
     http://svn.apache.org/viewvc?view=revision&revision=1787606
   Backport version for 2.4.x of patch:
     svn merge -c 1787606 ^/httpd/httpd/trunk .
   +1: icing, rpluem, ylavic



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1893655 13f79535-47bb-0310-9956-ffa450edef68
2021-09-26 14:14:37 +00:00
Graham Leggett
324c4a2791 Backport:
*) core: Add ap_pre_connection() as a wrapper to ap_run_pre_connection()
   and use it to prevent that failures in running the pre_connection
   hook cause crashes afterwards.
   Trunk version of patch:
      https://svn.apache.org/r1893497
      https://svn.apache.org/r1893507
   Backport version for 2.4.x of patch:
     https://patch-diff.githubusercontent.com/raw/apache/httpd/pull/269.diff
   Can be applied via apply_backport_pr.sh 269.
   +1: rpluem, icing, ylavic



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1893654 13f79535-47bb-0310-9956-ffa450edef68
2021-09-26 14:11:22 +00:00
Stefan Eissing
f9c54948e4 Merge r1890605, r1893164, r1893179 from trunk:
*) core/mod_proxy/mod_ssl:
     Adding `outgoing` flag to conn_rec, indicating a connection is
     initiated by the server to somewhere, in contrast to incoming
     connections from clients.
     Adding 'ap_ssl_bind_outgoing()` function that marks a connection
     as outgoing and is used by mod_proxy instead of the previous
     optional function `ssl_engine_set`. This enables other SSL
     module to secure proxy connections.
     The optional functions `ssl_engine_set`, `ssl_engine_disable` and
     `ssl_proxy_enable` are now provided by the core to have backward
     compatibility with non-httpd modules that might use them. mod_ssl
     itself no longer registers these functions, but keeps them in its
     header for backward compatibility.
     The core provided optional function wrap any registered function
     like it was done for `ssl_is_ssl`.


  *core: clarify comments and use hook API better to check for presence of callbacks.



 * optimizing hook check as suggested by Yann.



Submitted by: icing
Reviewed by: 

Github: closes #203


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1893182 13f79535-47bb-0310-9956-ffa450edef68
2021-09-09 15:22:23 +00:00
Yann Ylavic
17a14e5bdb Merge r1893001, r1893002, r1893004 from trunk:
core: Set r->request_time before any logging, mod_unique_id needs it.

* server/protocol.c(read_request_line):
  Move r->request_time initialization before first APLOG_TRACE5,
  ap_log_rerror() may run the generate_log_id hooks and call mod_unique_id
  with no timestamp initialized (zero).
  


mod_unique_id: Follow up to r1892915: Shorter counter race condition yet.

* modules/metadata/mod_unique_id.c(gen_unique_id):
  Set the counter in network byte order for uuencoding only, allowing for
  simple cur_unique_id.counter++



mod_unique_id: Follow up to r1892915 and r1893002: Atomic counter.

* modules/metadata/mod_unique_id.c(gen_unique_id):
  Use an atomic 32bit counter to close the race condition with threaded MPMs,
  using the lower 16 bits for uuencoding still.


Submitted by: ylavic
Reviewed by: ylavic, rpluem, gbechis


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1893116 13f79535-47bb-0310-9956-ffa450edef68
2021-09-08 08:31:38 +00:00
Yann Ylavic
f91beac1e1 Merge r1893014, r1893073 from trunk:
mpm_event: Fix children processes possibly not stopped on graceful restart.

The number of children spawned can go above active_daemons_limit due to
exponential idle_spawn_rate growth (x 2), enforce the upper limit in
perform_idle_server_maintenance().  PR 63169.

Submitted by: Joel Self <joelself gmail.com>


mpm_event: Follow up to r1893014: log when children are not spawned.

Log at trace1 level when active_daemons >= active_daemons_limit and we won't
spawn children. Reset free_length to avoid negative value in this case too.


Submitted by: ylavic
Reviewed by: ylavic, covener, rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1893109 13f79535-47bb-0310-9956-ffa450edef68
2021-09-08 08:25:29 +00:00
Yann Ylavic
fa7b2a5250 Merge r1878092 from trunk:
Fix a NULL pointer dereference

* server/scoreboard.c (ap_increment_counts): In certain cases like certain
  invalid requests r->method might be NULL here. r->method_number defaults
  to M_GET and hence is M_GET in these cases.

Submitted by: rpluem
Reviewed by: covener, ylavic, jfclere


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1893051 13f79535-47bb-0310-9956-ffa450edef68
2021-09-07 16:05:31 +00:00
Yann Ylavic
619f6031f1 Merge r1890465 from trunk:
mpm_prefork: mask signals during ap_run_child_init().

This prevents threads potentially created from the child_init hooks (e.g.
mod_watchdog workers) to catch signals needed by the MPM, like here:
https://travis-ci.com/github/apache/httpd/jobs/510821148#L5356.

Submitted by: ylavic
Reviewed by: jorton, icing, rpluem, ylavic


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1892978 13f79535-47bb-0310-9956-ffa450edef68
2021-09-06 10:03:06 +00:00
Graham Leggett
ac62c7e743 Backport:
*) core: fix ap_escape_quotes substitution logic
      trunk patch: https://svn.apache.org/r1892418
      2.4.x patch: svn merge -c 1892418 ^/httpd/httpd/trunk .
      +1: covener, rpluem, ylavic


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1892511 13f79535-47bb-0310-9956-ffa450edef68
2021-08-21 21:35:04 +00:00
Stefan Eissing
180ef6455b Merge 1892185,1892207 from trunk:
*) core: ap_timeout_parameter_parse UBI fuzz fix followup



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1892380 13f79535-47bb-0310-9956-ffa450edef68
2021-08-16 14:30:06 +00:00
Stefan Eissing
79a84dcf65 Merge of 1892038,1892063 from trunk:
*) core: avoid signed integer overflow under fuzzing in
     ap_timeout_parameter_parse



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1892173 13f79535-47bb-0310-9956-ffa450edef68
2021-08-10 08:59:48 +00:00
Stefan Eissing
c69d4cc90c Merged r1892012 from trunk:
*) core: fix ap_escape_quotes for pre-escaped quotes



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1892171 13f79535-47bb-0310-9956-ffa450edef68
2021-08-10 08:55:54 +00:00
Stefan Eissing
cb5c366792 Merged r1891919 from trunk:
*) core: add hook child_stopping hook that gets called when the MPM is stopping a
     child process. The additional graceful parameter allows registered hooks
     to free resources early during a graceful shutdown.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1892167 13f79535-47bb-0310-9956-ffa450edef68
2021-08-10 08:43:11 +00:00
Stefan Eissing
6a5d3e006b Merged /httpd/httpd/trunk:r1879074-1879080,1879094-1879095,1879110-1879112,1879114,1879116-1879117,1879137,1879144-1879145,1879147,1879149,1879235,1879360
back port the mapping=servlet proxy logic.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1892161 13f79535-47bb-0310-9956-ffa450edef68
2021-08-10 08:27:18 +00:00
Stefan Eissing
424360b5dc Merge of 1891716-1891719,1891721,1891724,1891726-1891728 from trunk:
*) mpm_event: Fix graceful stop/restart of children processes if connections
     are in lingering close for too long.  [Yann Ylavic]



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1892159 13f79535-47bb-0310-9956-ffa450edef68
2021-08-10 08:08:12 +00:00
Joe Orton
2cfafb4a36 Merge r1889957 from trunk: [excluding server/mpm/simple changes]
* server/mpm/event/event.c, 
  server/mpm/simple/simple_run.c,
  support/htcacheclean.c: Adjust use of APR_RING macros to
  ensure the APR_RING_HEAD is always embedded in a containing
  structure, to avoid warnings with GCC 11.  (apr_ring.h also
  suggests this is best practice)

See also: https://bugzilla.redhat.com/show_bug.cgi?id=1957353
          https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98503
          msgid <814cca2a-1992-3fae-bb0e-c84b3d09b73b@gmail.com>
Github: closes #186
Reviewed by: jorton, minfrin, jfclere


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1891377 13f79535-47bb-0310-9956-ffa450edef68
2021-07-08 07:04:49 +00:00
Stefan Eissing
ecebcc035c Merged r1734009,r1734231,r1734281,r1838055,r1838079,r1840229,r1876664,r1876674,r1876784,r1879078,r1881620,r1887311,r1888871 from trunk:
*) core: Split ap_create_request() from ap_read_request(). [Graham Leggett]

  *) core, h2: common ap_parse_request_line() and ap_check_request_header()
     code. [Yann Ylavic]

  *) core: Add StrictHostCheck to allow unconfigured hostnames to be
     rejected. [Eric Covener]



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1890245 13f79535-47bb-0310-9956-ffa450edef68
2021-05-27 13:08:21 +00:00
Stefan Eissing
c0cff48bcc Merge of [r1886840, r1887085, r1887087, r1887134, r1887151, r1887152,
r1887337, r1887340, r1887342, r1887343, r1887360, r1887364, 
       r1887923, r1887965, r1887993, r1888006, r1888083, r1888084,
       r1888723, r1888724, r1888726, r1888729, r1889788] from trunk:

   *) core/mod_ssl/mod_md:
     - adding new ap_ssl_*() functions for a backward
       compatible replacement of the major optional mod_ssl functions. This
       allows other ssl modules to work without impersonating mod_ssl and
       also allows different ssl modules being active on separate ports.
     - latest mod_md with support for multiple certificates per domain
       and ECDSA certificates. Removed ACMEv1 support.
     - Interworking mod_md and ssl modules changed to exchange PEM strings
       instead of file paths for ACME challenges.
     - core/mod_ssl/mod_md: adding OCSP response provisioning as core feature.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1889793 13f79535-47bb-0310-9956-ffa450edef68
2021-05-12 10:14:42 +00:00
Eric Covener
c2116baf9b Merge r1889037 from trunk:
Pass NULL instead of a "null ACL"

Submitted By: Ivan Zhakov
Reviewed By: covener, ylavic (by inspection), ivan



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1889039 13f79535-47bb-0310-9956-ffa450edef68
2021-04-21 01:10:58 +00:00
Eric Covener
eb986059aa Merge r1889036 from trunk:
legacy default slash-matching behavior w/ 'MergeSlashes OFF'

Submitted By: Ruediger Pluem
Reviewed By: covener, rpluem, ylavic




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1889038 13f79535-47bb-0310-9956-ffa450edef68
2021-04-21 01:10:12 +00:00
Christophe Jaillet
8433a9b8c9 Merge r1730128, r1878140, r1878265, r1881736, r1882775, r1883872, r1884509, r1887720 from trunk
*) Easy patches: synch 2.4.x and trunk
         - doxygen: Correct doxygen groupname
         - .gdbinit: align columns
         - .gdbinit: fix indentation
         - mod_dav: Add specific logs for different modes
         - core: ap_pbase64encode(): save double NUL byte allocation and assignment
         - core: ap_pbase64decode(): save double NUL byte allocation and assignment
         - support: Fix a typo in a comment
         - proxy_util.c: Fix leak in error path in the do_malloc case

Submitted by: wrowe, ylavic, ylavic, jorton, rpluem, ylavic, jorton, jorton
Reviewed by: jailletc36, gbechis, ylavic
Backported by: jailletc36

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1888929 13f79535-47bb-0310-9956-ffa450edef68
2021-04-18 19:40:13 +00:00
Christophe Jaillet
c0882d0209 Merge (most of) r1876599 from trunk
* Add missing pool tags to help debugging

Submitted by: ylavic
Reviewed by: jailletc36, gbechis, ylavic
Backported by: jailletc36

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1888928 13f79535-47bb-0310-9956-ffa450edef68
2021-04-18 19:11:48 +00:00
Christophe Jaillet
9a7bbd69f2 Merge r1887999 from trunk
* modules/http/http_core.c server/protocol.c:
     Make sure that conn->keepalive is NOT reset after being set in ap_read_request()

Submitted by: jfclere
Reviewed by: jfclere, covener, ylavic
Backported by: jailletc36

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1888926 13f79535-47bb-0310-9956-ffa450edef68
2021-04-18 19:09:03 +00:00
Yann Ylavic
10eddf2f65 Merge r1882370 from trunk:
Adjust signal handler before unblocking

* server/mpm/event/event.c: Set the new signal handler before unblocking the
  signal as otherwise queued signals get delivered to the old handler
  immediately when the signal is unblocked.

* server/mpm/worker/worker.c: Same thing as with event.

Submitted by: rpluem
Reviewed by: ylavic, jorton, icing


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1888917 13f79535-47bb-0310-9956-ffa450edef68
2021-04-18 17:04:34 +00:00
Yann Ylavic
1d65a704e0 Merge r1879285, r1879322, r1879345, r1879346, r1879465, r1879469, r1879470, r1879488, r1879541, r1879548 from trunk:
"[mod_dav_fs etag handling] should really honor the FileETag setting".
- It now does.
- Add "Digest" to FileETag directive, allowing a strong ETag to be
  generated using a file digest.
- Add ap_make_etag_ex() and ap_set_etag_fd() to allow full control over
  ETag generation.
- Add concept of "binary notes" to request_rec, allowing packed bit flags
  to be added to a request.
- First binary note - AP_REQUEST_STRONG_ETAG - allows modules to force
  the ETag to a strong ETag to comply with RFC requirements, such as those
  mandated by various WebDAV extensions.


Be defensive when the request is missing.


Remove tabs.


Use a dedicated constant for the base64 sha1 length.


Be defensive when calculating the digest. Make sure the offset is initialised
to zero before reading the current offset.


Seek to the start of the file when calculating the ETag.


Add log numbers to util_etag.c.


Add MMAP support to ETag generation.


Use a brigade instead of direct reads, allow APR to handle MMAP.


Bump the logno.


Submitted by: minfrin
Reviewed by: minfrin, jim, ylavic


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1887384 13f79535-47bb-0310-9956-ffa450edef68
2021-03-09 16:28:23 +00:00
Yann Ylavic
77b2843d14 Merge r1883184 from trunk:
Optimize 'ap_list_provider_names'.

Save some memory and potentialy avoid some useless copy .

Using 'goto' is not realy in line with httpd coding style, but the function is small and still readable IMHO.


Submitted by: jailletc36
Reviewed by: jailletc36, jorton, ylavic


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1887380 13f79535-47bb-0310-9956-ffa450edef68
2021-03-09 16:12:52 +00:00