Commit Graph

182 Commits

Author SHA1 Message Date
7ecfc5b3a8 * Fix memory leak in case of failures to load the private key.
PR: 65620


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893969 13f79535-47bb-0310-9956-ffa450edef68
2021-10-07 11:55:51 +00:00
e150697086 core: AP_NORMALIZE_DECODE_UNRESERVED should normalize the second encoded dot.
Otherwise ap_normalize_path() can leave some "%2e" encoded.
 


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893724 13f79535-47bb-0310-9956-ffa450edef68
2021-09-29 12:35:25 +00:00
3d2842e915 mod_proxy: Add tunnel_forward hook.
* modules/proxy/mod_proxy.h, modules/proxy/mod_proxy.c:
  Declare/implement the hook.

* modules/proxy/proxy_util.c(proxy_transfer):
  Run tunnel_forward hooks when called by the tunneling loop.
  Simpler input/output brigade cleanup on exit.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893603 13f79535-47bb-0310-9956-ffa450edef68
2021-09-24 15:52:50 +00:00
df3a613555 * Update CHANGES [skip ci]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893590 13f79535-47bb-0310-9956-ffa450edef68
2021-09-24 06:45:09 +00:00
7f08c2bfa1 * Correctly handle errors returned by dav providers on REPORT requests.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893589 13f79535-47bb-0310-9956-ffa450edef68
2021-09-24 06:42:04 +00:00
8720881b06 * Correctly decrement active_daemons also in the case that the child
process decides on its own to die because of MaxRequestsPerChild.

PR: 65592


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893520 13f79535-47bb-0310-9956-ffa450edef68
2021-09-22 18:48:25 +00:00
6d476a6695 mod_proxy: Handle UDS URIs with empty hostname as if they had no hostname.
It was reported to me (privately) that r1893101 broke existing settings like:
  SetHandler "proxy:unix:///path/to/uds.sock|fcgi://localhost/"

RFC 3986 (section 3.2.2) says that:
   If the URI scheme defines a default for host, then that default
   applies when the host subcomponent is undefined or when the
   registered name is empty (zero length).  For example, the "file" URI
   scheme is defined so that no authority, an empty host, and
   "localhost" all mean the end-user's machine, whereas the "http"
   scheme considers a missing authority or empty host invalid.

Let's consider that the "unix" scheme is closer to the "file" scheme than
the "http" one, and accept "unix:///path/to/uds.sock" as a valid URI.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893519 13f79535-47bb-0310-9956-ffa450edef68
2021-09-22 18:47:09 +00:00
6d76cbb910 mod_rewrite: Fix UDS ("unix:") scheme for [P] rules. PR 57691 + 65590.
Handle the unix: scheme as an obsolute URI or a rule like:
  RewriteRule ^/(.*) unix:/path/to/uds.sock|fcgi://localhost/$1 [P]
sets r->filename for /index.html as:
  proxy:http://www.example.com/unix:/path/to/uds.sock|http://localhost/index.html
instead of the expected:
  proxy:unix:/path/to/uds.sock|http://localhost/index.html

Submitted by: Janne Peltonen <janne.peltonen sange.fi>
Reviewed by: ylavic



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893516 13f79535-47bb-0310-9956-ffa450edef68
2021-09-22 18:16:38 +00:00
994787e126 * Add change entry for r1893497 [skip ci]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893507 13f79535-47bb-0310-9956-ffa450edef68
2021-09-22 07:02:28 +00:00
00e2ca574f *) mod_md: when MDMessageCmd for a 'challenge-setup:<type>:<dnsname>'
fails (!= 0 exit), the renewal process is aborted and an error is
     reported for the MDomain. This provides scripts that distribute
     information in a cluster to abort early with bothering an ACME
     server to validate a dns name that will not work. The common
     retry logic will make another attempt in the future, as with
     other failures.
     Fixed a bug when adding private key specs to an already working
     MDomain, see <https://github.com/icing/mod_md/issues/260>.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893399 13f79535-47bb-0310-9956-ffa450edef68
2021-09-17 12:18:41 +00:00
44abd7180e *) mod_md: fixed a bug in handling multiple parallel OCSP requests. These could
run into an assertion which terminated (and restarted) the child process where
     the task was running. Eventually, all OCSP responses were collected, but not
     in the way that things are supposed to work.
     See also <https://bz.apache.org/bugzilla/show_bug.cgi?id=65567>.
     The bug was possibly triggered when more than one OCSP status needed updating
     at the same time. For example for several renewed certificates after a server
     reload.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893359 13f79535-47bb-0310-9956-ffa450edef68
2021-09-15 13:22:27 +00:00
2fd8dd4a5e formatting change entry [skip ci]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893215 13f79535-47bb-0310-9956-ffa450edef68
2021-09-10 08:18:32 +00:00
5057dc6a8e * mod_http2: when a server is restarted gracefully, any idle h2 worker
threads are shut down immediately. [Stefan Eissing]



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893214 13f79535-47bb-0310-9956-ffa450edef68
2021-09-10 08:14:48 +00:00
2b7f51ade7 core: Add ap_create_connection() to create a server or client/proxy connection.
c->outgoing shouldn't be set by mod_ssl, ap_create_connection() allows that
and this commit also replaces all the calls to ap_run_create_connection() in
mod_proxy modules (not in the MPMs which create incoming connections only).

* include/http_connection.h, server/connection.c:
  Declare and implement ap_create_connection().

* modules/proxy/proxy_util.c, modules/proxy/mod_proxy_connect.c,
  modules/proxy/mod_proxy_ftp.c:
  Use ap_create_connection() instead of ap_run_create_connection(), and don't
  provide a connection_id a scoreboard handle for outgoing connection.

* server/log.c(do_errorlog_default):
  Use c->outgoing instead of c->sbh to determine if it's a "client" or "remote"
  connection.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893184 13f79535-47bb-0310-9956-ffa450edef68
2021-09-09 16:55:24 +00:00
40df9da013 Sync CHANGES [skip ci].
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893049 13f79535-47bb-0310-9956-ffa450edef68
2021-09-07 15:29:23 +00:00
74c097f0e1 core: Initialize the request fields on read failure to avoid NULLs.
* server/protocol.c(read_request_line):
  Set r->method_number to M_INVALID and r->{method,uri,unparsed_uri} to "-"
  when read fails, ap_parse_request_line() will never be called.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893030 13f79535-47bb-0310-9956-ffa450edef68
2021-09-07 13:09:07 +00:00
e8dce10f62 Revert r1893026, will re-commit with minimal changes to ease backport.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893028 13f79535-47bb-0310-9956-ffa450edef68
2021-09-07 13:05:22 +00:00
d4f195853b core: Initialize the request fields on read failure to avoid NULLs.
* server/protocol.c(read_request_line):
  Set r->method_number to M_INVALID and r->{method,uri,unparsed_uri} to "-"
  when read fails, ap_parse_request_line() will never be called.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893026 13f79535-47bb-0310-9956-ffa450edef68
2021-09-07 13:00:06 +00:00
22895e737d mod_proxy: Don't canonicalize with both nocanon and ProxyPassInterpolateEnv On.
If nocanon is set, we should match the unparsed_uri against the interpolated
alias (not the ProxyPass'ed one) when verifying the resulting length. Otherwise
we falsely restore the canonicalized URL in case of mismatch.  PR 65549.

Submitted by: Joel Self <joelself gmail.com>



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893016 13f79535-47bb-0310-9956-ffa450edef68
2021-09-07 10:16:03 +00:00
03442ed466 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.

Proposed by: Joel Self <joelself gmail.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893014 13f79535-47bb-0310-9956-ffa450edef68
2021-09-07 09:34:09 +00:00
0df673fcce Reduce the time window where duplicates may be generated by mod_uniqueid
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892915 13f79535-47bb-0310-9956-ffa450edef68
2021-09-05 05:58:57 +00:00
8fc481e28a Revert r1887244 and r1887245 which causes issues on Windows
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892914 13f79535-47bb-0310-9956-ffa450edef68
2021-09-05 05:41:37 +00:00
2a8cdcefdf Sync CHANGES [skip ci].
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892879 13f79535-47bb-0310-9956-ffa450edef68
2021-09-03 17:07:37 +00:00
520dcd80a4 mod_proxy: Faster unix socket path parsing in the "proxy:" URL.
The actual r->filename format is "[proxy:]unix:path|url" for UDS, no need to
strstr(,"unix:") since it's at the start of the string.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892814 13f79535-47bb-0310-9956-ffa450edef68
2021-09-02 12:37:02 +00:00
b364cad72b mod_proxy_uwsgi: Fix PATH_INFO setting for generic worker.
When the generic "proxy:reverse" worker is selected for an uwsgi scheme, the
worker name is irrelevant so uwscgi_handler() should point to the PATH_INFO
directly from the given URL.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892805 13f79535-47bb-0310-9956-ffa450edef68
2021-09-02 09:53:43 +00:00
62e6e7081e mod_md:
* Certificate/keys pairs are verified as matching before a renewal is accepted
   as successful or a staged renewal is replacing the existing certificates.
   This avoid potential mess ups in the md store file system to render the active
   certificates non-working. [@mkauf]



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892782 13f79535-47bb-0310-9956-ffa450edef68
2021-09-01 13:16:03 +00:00
e8228ba4e6 mod_proxy: Fix potential tunneling infinite loop and spurious timeout.
PRs 65521 and 65519.

* modules/proxy/proxy_util.c(ap_proxy_tunnel_run):
  Avoid an infinite loop by shutting down the connection for write when poll()
  returns POLLHUP and read is already down.  PR 65521.

* modules/proxy/proxy_util.c(ap_proxy_tunnel_run):
  When write completion is finished don't check for ap_filter_input_pending()
  before proxy_tunnel_forward() to flush input data, this is a nonblocking read
  already which will do the same thing implicitely. ap_filter_input_pending()
  is broken in 2.4.x without the whole pending data mechanism (not backported
  yet), so let's align here.  PR 65519.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892740 13f79535-47bb-0310-9956-ffa450edef68
2021-08-30 18:04:20 +00:00
c1619c6843 Sync CHANGES entries [skip ci].
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892737 13f79535-47bb-0310-9956-ffa450edef68
2021-08-30 17:05:13 +00:00
19360d53df * core/mpm: add hook 'child_stopping` 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/trunk@1891919 13f79535-47bb-0310-9956-ffa450edef68
2021-07-31 13:36:19 +00:00
67c17882e1 Follow up to r1891716: CHANGES entry. [skip ci]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891728 13f79535-47bb-0310-9956-ffa450edef68
2021-07-22 17:18:00 +00:00
3fe911d3c9 *) mod_md:
- Domain names in `<MDomain ...>` can now appear in quoted form.
     - Fixed a failure in ACME challenge selection that aborted further searches
       when the tls-alpn-01 method did not seem to be suitable.
     - Changed the tls-alpn-01 setup to only become unsuitable when none of the
       dns names showed support for a configured 'Protocols ... acme-tls/1'. This
       allows use of tls-alpn-01 for dns names that are not mapped to a VirtualHost.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891683 13f79535-47bb-0310-9956-ffa450edef68
2021-07-20 12:44:31 +00:00
2aa1c1415a * mod_http2:
- Added a timeout to h2 worker cleanup to exit latest after 5 seconds of
     waiting on idle workers to terminate. This happens after all connections
     have been processed. a WARNING is logged in case workers lagged behind.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891566 13f79535-47bb-0310-9956-ffa450edef68
2021-07-15 08:29:19 +00:00
ff0f512db1 mod_proxy: Fix icomplete initialization of BalancerMember(s) from the manager.
Clear the workers created in ap_proxy_sync_balancer(), notably ->local_status
for below ap_proxy_initialize_worker() to initialize all the child structures
like ->cp and ->cp->reslist, avoiding a possible crash when the workers are
used at runtime.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891477 13f79535-47bb-0310-9956-ffa450edef68
2021-07-12 10:32:21 +00:00
c07608101f *) mod_md: fixed a potential null pointer dereference if ACME/OCSP
server returned 2xx responses without content type. Reported by chuangwen.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891470 13f79535-47bb-0310-9956-ffa450edef68
2021-07-12 07:52:28 +00:00
2d34278612 *) mod_http2:
- Aborting requests via RST_STREAM no longer affect the available
     resources of a connection when the first chunk of the response
     body has been sent.
   - H2Min/MaxWorkers behave as intended again. The module will initially
     create H2MinWorkers threads and add up to H2MaxWorkers when needed. These
     additional workers time out when idle after H2MaxWorkerIdleSeconds and
     disappear again.
   - When the shutdown of a child is detected (e.g. graceful shutdown), the
     module will terminate all idle workers above H2MinWorkers right away.
     This detection currently only happens when a HTTP/2 connection is active.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891312 13f79535-47bb-0310-9956-ffa450edef68
2021-07-06 13:06:00 +00:00
71736a1f42 Sync CHANGES entries.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891217 13f79535-47bb-0310-9956-ffa450edef68
2021-07-02 22:39:11 +00:00
542efc0f00 mpm_proxy: Fix possible reuse/merging of Proxy(Pass)Match workers. PR 65419.
We can't truncate ProxyMatch's worker name/url to the first '$' substitution
without possibly colliding with other workers. This also makes the matching
done at runtime by ap_proxy_strcmp_ematch() completely pointless.

To fix this and still address r1878467 (i.e. make http://host:port$1 a "valid"
URL), we need to remove '$' substitutions from the :port part of the URL only
since it's allowed anywhere else by apr_uri_parse().

So let's strip them before apr_uri_parse() and prepend them back in the path
before apr_uri_unparse() to restore the original URL. Non-matchable workers are
not concerned so ap_proxy_define_worker() is made a local helper (w/o the ap_
prefix) which takes "matchable" as argument and can then be called by both
ap_proxy_define_[match_]worker() functions.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891206 13f79535-47bb-0310-9956-ffa450edef68
2021-07-02 14:58:46 +00:00
06a3e22e28 *) mod_ssl: tighten the handling of ALPN for outgoing (proxy)
connections. If ALPN protocols are provided and sent to the
     remote server, the received protocol selected is inspected
     and checked for a match. Without match, the peer handshake
     fails.
     An exception is the proposal of "http/1.1" where it is
     accepted if the remote server did not answer ALPN with
     a selected protocol. This accomodates for hosts that do
     not observe/support ALPN and speak http/1.x be default.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1890693 13f79535-47bb-0310-9956-ffa450edef68
2021-06-11 10:45:25 +00:00
a4f45f275b *) 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`.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1890605 13f79535-47bb-0310-9956-ffa450edef68
2021-06-08 14:37:44 +00:00
acd6d01267 mod_h2: Don't strip headers from 304 responses.
h2 equivalent of r1889341 for h1.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1890563 13f79535-47bb-0310-9956-ffa450edef68
2021-06-07 15:06:06 +00:00
6b05a451b8 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.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1890465 13f79535-47bb-0310-9956-ffa450edef68
2021-06-04 13:21:28 +00:00
0dbc5ca076 * mod_log_config/mod_ssl: moved the log_handlers registered by mod_ssl
into mod_log_config itself. These now use the global `ap_ssl_var_lookup()`
    functions and work for all running SSL modules.
    The dependency from mod_ssl to mod_log_config and its header is removed.
    mod_ssl now provides the content of "{errstr}c" as variable "SSL_CLIENT_VERIFY_ERRSTR".
    This change should be fully compatible to all deployed configurations.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1890003 13f79535-47bb-0310-9956-ffa450edef68
2021-05-18 14:42:52 +00:00
c3685c7a96 Sync CHANGES entries. [skip ci]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1889961 13f79535-47bb-0310-9956-ffa450edef68
2021-05-17 13:54:02 +00:00
ab2b9dbfb7 mod_proxy_hcheck: Honor worker timeout settings.
Daniel reported on user@ that hc connections do not timeout according to
the worker's tumeout= configuration, this fixes it.

While at it, copy the other timeout settings too.

Reported by: dferradal


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1889936 13f79535-47bb-0310-9956-ffa450edef68
2021-05-16 17:04:55 +00:00
fcf3ee2676 Follow up to r1889792: CHANGES entry.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1889795 13f79535-47bb-0310-9956-ffa450edef68
2021-05-12 10:16:07 +00:00
958c12bd6a * Spelling fixes after review by @bigio.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1889788 13f79535-47bb-0310-9956-ffa450edef68
2021-05-12 07:25:52 +00:00
886cb0d6aa * Do not strip any headers from 304 responses.
PR: 61820


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1889341 13f79535-47bb-0310-9956-ffa450edef68
2021-04-30 20:08:46 +00:00
db5aa786d8 *) core/mod_ssl/mod_md: adding OCSP response provisioning as core feature. This
allows modules to access and provide OCSP response data without being tied
     of each other. The data is exchanged in standard, portable formats (PEM encoded
     certificates and DER encoded responses), so that the actual SSL/crypto
     implementations used by the modules are independant of each other.
     Registration and retrieval happen in the context of a server (server_rec)
     which modules may use to decide if they are configured for this or not.
     The area of changes:
     1. core: defines 2 functions in include/http_ssl.h, so that modules may
        register a certificate, together with its issuer certificate for OCSP
        response provisioning and ask for current response data (DER bytes) later.
        Also, 2 hooks are defined that allow modules to implement this OCSP
        provisioning.
     2. mod_ssl uses the new functions, in addition to what it did already, to
        register its certificates this way. If no one is interested in providing
        OCSP, it falls back to its own (if configured) stapling implementation.
     3. mod_md registers itself at the core hooks for OCSP provisioning. Depending
        on configuration, it will accept registrations of its own certificates only,
        all certficates or none.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1888723 13f79535-47bb-0310-9956-ffa450edef68
2021-04-13 11:12:00 +00:00
ac502d58fb Apply CHANGES. [skip ci]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1888270 13f79535-47bb-0310-9956-ffa450edef68
2021-04-01 10:28:51 +00:00
6c15ac6353 Follow up to r1888266, r1888268: fix PR in CHANGES entry.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1888269 13f79535-47bb-0310-9956-ffa450edef68
2021-04-01 10:25:13 +00:00