Commit Graph

265 Commits

Author SHA1 Message Date
ba808b06f3 * Fix copy and paste error
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910324 13f79535-47bb-0310-9956-ffa450edef68
2023-06-09 11:18:02 +00:00
3e638ff283 core: Add the token_checker hook, that allows authentication to take
place using mechanisms other than username/password, such as bearer
tokens.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1909409 13f79535-47bb-0310-9956-ffa450edef68
2023-04-25 17:35:08 +00:00
48b5dfd696 core: Add ap_unescape_url_ex() for better decoding control, and deprecate
unused AP_NORMALIZE_DROP_PARAMETERS flag.
 


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893971 13f79535-47bb-0310-9956-ffa450edef68
2021-10-07 12:00:20 +00:00
6141d5aa3f legacy default slash-matching behavior w/ 'MergeSlashes OFF'
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1889036 13f79535-47bb-0310-9956-ffa450edef68
2021-04-21 01:02:11 +00:00
eb24229d58 Follow up to r1879079: fail early if URI path resolves above root.
Don't let it through as "/".


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879147 13f79535-47bb-0310-9956-ffa450edef68
2020-06-24 12:11:08 +00:00
6defe5493d Follow up to r1879079, r1879080: change to DONE semantics for pre_trans hooks.
Don't decode r->uri when pre_trans returns DONE instead of OK, which allows to
preserve previous behaviour where decoding was avoided for "ProxyRequests on"
or post_read_request RewriteRule [P] only, but not ProxyPass'ed requests.

This also preserves decoded location walk in most/same cases.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879137 13f79535-47bb-0310-9956-ffa450edef68
2020-06-24 07:47:58 +00:00
aaf7e3eb4f Follow up to r1879079: merge slashes (if configured to) before pre_trans
There are few cases (if any) where multiple slashes have different semantics
than a single one, and it's always been like that for proxy_trans anyway.

This allows for better directory/location/if walk caching and is less confusing
for their users.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879117 13f79535-47bb-0310-9956-ffa450edef68
2020-06-23 12:25:56 +00:00
256108b9e5 Follow up to r1879079: merge/walk locations for pre_trans hooks.
So that their configurations work in directory context.

This requires potentially a third walk in ap_process_request_internal(),
though in most cases it should use ap_walk_location() cache.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879116 13f79535-47bb-0310-9956-ffa450edef68
2020-06-23 11:58:53 +00:00
8d073ced23 ap_location_walk/ap_directory_walk: copy the cached uri/filename.
Any in-place modification of r->uri of r->filename shouldn't affect the cache.

For instance, ap_process_request_internal() normalizes r->uri in place and yet
calls ap_location_walk() multiple times, which confuses caching.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879114 13f79535-47bb-0310-9956-ffa450edef68
2020-06-23 11:27:48 +00:00
6b3b91a616 Allow for URI-path pre_translate_name before (and/or instead of) decoding.
Apply minimal normalization (AP_NORMALIZE_DECODE_UNRESERVED) first in
ap_process_request_internal() before running pre_translate_name hooks,
such that the hooks can work with undecoded r->uri.

Only if no hook takes "ownership" of the URI (returning OK), apply
percent decoding for the rest of request handling. Otherwise r->uri remains
encoded meaning that further location/directory/file/if/.. sections (walks)
should that into account.

Since normalization now happens before decoding, we might have to
re-normalize after decoding if "AllowEncodedSlahes on" transformed any
"%2F" sequence to "/", potentially creating new "/./" or "/../" sequences.

Note that for (lookup) subrequests, the path may be relative so we have
to allow for that.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879079 13f79535-47bb-0310-9956-ffa450edef68
2020-06-22 10:36:55 +00:00
d2c7a48ff6 Add pre_translate_name hook running before URI-path decoding.
This allows any module to work with un-decoded URI-path (besides
unreserved characters) in r->uri, and eventually to avoid decoding by
returning OK.

The first candidate is mod_proxy (following commit) when
ProxyMappingDecoded is disabled, such that the forwarded URI is
equivalent to the original one.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879076 13f79535-47bb-0310-9956-ffa450edef68
2020-06-22 10:32:15 +00:00
f461bcf12c Add missing pool tags to help debugging.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876599 13f79535-47bb-0310-9956-ffa450edef68
2020-04-16 12:32:33 +00:00
b3110d36af core: handle morphing buckets setaside/reinstate and kill request core filter.
The purpose of ap_request_core_filter() is not clear, it seems to prevent
potential morphing buckets to go through AP_FTYPE_CONNECTION filters which
would fail to set them aside (ENOTIMPL), and read them (unbounded) in memory.

This patch allows ap_filter_setaside_brigade() to set morphing buckets aside
by simply moving them, assuming they have the correct lifetime (either until
some further EOR, or the connection lifetime, or whatever). IOW, the module is
responsible for sending morphing buckets whose lifetime needs not be changed
by the connection filters.

Now since morphing buckets consume no memory until (apr_bucket_)read, like FILE
buckets, we don't account for them in flush_max_threshold either. This changes
ap_filter_reinstate_brigade() to only account for in-memory and EOR buckets to
flush_upto.

Also, since the EOR bucket is sent only to c->output_filters once the request
is processed, when all the filters < AP_FTYPE_CONNECTION have done their job
and stopped retaining data (after the EOS bucket, if ever), we prevent misuse
of ap_filter_{setaside,reinstate}_brigade() outside connection filters by
returning ENOTIMPL. This is not the right API for request filters as of now.

Finally, ap_request_core_filter() and co can be removed.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1875947 13f79535-47bb-0310-9956-ffa450edef68
2020-03-31 16:22:53 +00:00
8e7b3d4902 revert for now, surprising the scheme is present.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1875605 13f79535-47bb-0310-9956-ffa450edef68
2020-03-25 02:01:04 +00:00
1acda06095 PR63437: don't clobber the scheme in r->uri with MergeSlashes
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1875604 13f79535-47bb-0310-9956-ffa450edef68
2020-03-25 01:52:48 +00:00
2e00fa7241 * r->parsed_uri.path can be NULL in case of the CONNECT method.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1855744 13f79535-47bb-0310-9956-ffa450edef68
2019-03-18 09:21:26 +00:00
680bfc6596 * Revert r1855741 which committed other stuff as well.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1855742 13f79535-47bb-0310-9956-ffa450edef68
2019-03-18 09:17:50 +00:00
97752cb849 * Play safe in case we get no name
Reverted by r1855742.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1855741 13f79535-47bb-0310-9956-ffa450edef68
2019-03-18 09:16:06 +00:00
807a365d91 Merge consecutive slashes in the URL by default
opt-out w/ `MergeSlashes OFF`.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1855705 13f79535-47bb-0310-9956-ffa450edef68
2019-03-17 14:41:10 +00:00
cd5255cd29 request: forward as much buckets as possible in ap_request_core_filter().
This improves performances while still preventing morphing buckets bound to
r->pool from reaching connection filters.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1844780 13f79535-47bb-0310-9956-ffa450edef68
2018-10-24 15:06:04 +00:00
e70b8bfbcd util_filter: protect ap_filter_t private fields from external (ab)use.
Introduce opaque struct ap_filter_private to move ap_filter_t "pending", "bb"
and "deferred_pool" fields to the "priv" side of things.

This allows to trust values set internally (only!) in util_filter code, and
make useful assertions between the different functions calls, along with the
usual nice extensibility property.

Likewise, the private struct ap_filter_conn_ctx in conn_rec (from r1839997)
allows now to implement the new ap_acquire_brigade() and ap_release_brigade()
functions useful to get a brigade with c->pool's lifetime. They obsolete
ap_reuse_brigade_from_pool() which is replaced where previously used.

Some comments added in ap_request_core_filter() regarding the lifetime of the
data it plays with, up to EOR...

MAJOR bumped (once again).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1840149 13f79535-47bb-0310-9956-ffa450edef68
2018-09-05 17:27:43 +00:00
5262e7e73a core: follow up to r1839997: recycle request filters to a delayed ring first.
We want not only ap_filter_output_pending() to be able to access each pending
filter's *f after the EOR is destroyed, but also each request filter to do
the same until it returns.

So request filters are now always cleaned up into a dead_filters ring which is
merged into spare_filters only when ap_filter_recycle() is called explicitely,
that is in ap_process_request_after_handler() and ap_filter_output_pending().

The former takes care of recycling at the end of the request, with any MPM,
while the latter keeps recycling during MPM event's write completion.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1840002 13f79535-47bb-0310-9956-ffa450edef68
2018-09-04 02:40:49 +00:00
e1b6c18b50 ap_request_core_filter() can check whether the next filter should yield.
Itself won't yield at this point (its f->bb is empty).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1837823 13f79535-47bb-0310-9956-ffa450edef68
2018-08-10 16:24:15 +00:00
eb5e821bea core: Add ap_reuse_brigade_from_pool().
Current RETRIEVE_BRIGADE_FROM_POOL macro from "http_request.c" is turned into
a helper and used in ap_request_core_filter().

We will need it in a subsequent commit in "util_filter.c" too.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1836018 13f79535-47bb-0310-9956-ffa450edef68
2018-07-16 11:06:57 +00:00
08765e5c94 core: follow up to r1822596.
We can't dereference 'f' after EOR is destroyed either.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1822666 13f79535-47bb-0310-9956-ffa450edef68
2018-01-30 17:20:21 +00:00
106d0761c0 core: fix ap_request_core_filter()'s brigade lifetime.
The filter should pass everything up to and including EOR, then bail out.
For EOR it can't use a brigade created on r->pool, so retain one created
on c->pool in c->notes (this avoids leaking a brigades for each request
on the same connection).



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1822596 13f79535-47bb-0310-9956-ffa450edef68
2018-01-30 00:58:54 +00:00
f3fe438dbb Revert misguided commit r1799731.
Discussion on-list, but any occurance of a platform-specific behavior in this
code path will alter the behavior of the core code and introduce the very
fingerprintable behavior this patch pretended to obscuficate.

Returning 404 for /CON for example may lead to a module such as mod_speling
revealing the existance of a real file named similar to /.conf, which makes
this an unwise behavior.

Further discussion of returning 404 for all CHR files encountered in the
filepath (not URI path), which currently return 403 on all platforms,
belongs on the dev list.





git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1799965 13f79535-47bb-0310-9956-ffa450edef68
2017-06-26 17:45:23 +00:00
6d6232479d style: where did the tabs come from?
no code changes


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1799732 13f79535-47bb-0310-9956-ffa450edef68
2017-06-24 05:55:22 +00:00
de0ff1a55f Send a 404 response like other OSs do instead of 403 on Windows when
a path segment or file requested uses a reserved word so Windows
cannot be fingerprinted. PR55887


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1799731 13f79535-47bb-0310-9956-ffa450edef68
2017-06-24 05:49:45 +00:00
92ab67cbad core: deprecate and replace ap_get_basic_auth_pw
*) core: Deprecate ap_get_basic_auth_pw() and add 
    ap_get_basic_auth_components(). 

Submitted By: Emmanuel Dreyfus <manu netbsd.org>, Jacob Champion, Eric Covener
CVEID: CVE-2017-3167


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1796348 13f79535-47bb-0310-9956-ffa450edef68
2017-05-26 21:29:59 +00:00
fafe95b905 Evaluate nested If/ElseIf/Else config sections
It has been reported multiple times that nested
If/ElseIf/Else sections are not evaluated but
silently ignored.

This patch adds a simple recursion to the ap_if_walk
logic in order to allow arbitrary nested configs.
The overhead seems negligible compared to the actual
version of the ap_if_walk, but more expert feedback
is surely needed since this code gets called for every
HTTP request.

Tests are going to be added to t/apache/if_sections.t



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1792589 13f79535-47bb-0310-9956-ffa450edef68
2017-04-25 09:06:26 +00:00
6699f4e509 Revert r1783759: really more things than intended :p
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1783760 13f79535-47bb-0310-9956-ffa450edef68
2017-02-20 13:53:16 +00:00
37ebaff84d Follow up to r1783755: update APLOGNO.
[Reverted by r1783760]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1783759 13f79535-47bb-0310-9956-ffa450edef68
2017-02-20 13:50:49 +00:00
c28ac1fea6 Fix bug 58528 - Do not read .htaccess if override and overridelist are "None"
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1737114 13f79535-47bb-0310-9956-ffa450edef68
2016-03-30 13:31:07 +00:00
985d9885d7 Avoid a call to 'prep_walk_cache' if possible, just as in 'ap_if_walk' and 'ap_location_walk'
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1735906 13f79535-47bb-0310-9956-ffa450edef68
2016-03-20 21:22:14 +00:00
0eddea67ac Added some more log numbers to log statements that
had none.

Those were not detected by the coccinelle script.
Only a few hard cases are remaining now.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725548 13f79535-47bb-0310-9956-ffa450edef68
2016-01-19 15:43:17 +00:00
60964353d5 There is no need to duplicate some memory here, the 'path' given to ap_parse_htaccess is never modified.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1719016 13f79535-47bb-0310-9956-ffa450edef68
2015-12-10 06:39:46 +00:00
d5c6229953 core: follow up to r1708084.
We don't want to process the subrequest either in ap_sub_req_method_uri()
if the quick-handler returned an error (or any final status).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1708095 13f79535-47bb-0310-9956-ffa450edef68
2015-10-12 11:57:42 +00:00
9319152f39 core: follow up to r1708084,1708088: remove tabs.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1708090 13f79535-47bb-0310-9956-ffa450edef68
2015-10-12 11:05:18 +00:00
85717fad83 core: follow up to r1708084: we still need to take care of DONE in any case.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1708088 13f79535-47bb-0310-9956-ffa450edef68
2015-10-12 11:04:02 +00:00
42742592f0 core: we don't want to run the subrequest's handler if the
quick-handler returned an error (or any final status).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1708084 13f79535-47bb-0310-9956-ffa450edef68
2015-10-12 10:56:12 +00:00
2da6c9a57a Add the AsyncFilter directive that allows the asynchronous filter
functionality to be switched off for certain classes of filters.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1707161 13f79535-47bb-0310-9956-ffa450edef68
2015-10-06 22:33:03 +00:00
615f97f933 core: Extend support for asynchronous write completion from the
network filter to any connection or request filter.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1706669 13f79535-47bb-0310-9956-ffa450edef68
2015-10-04 10:10:51 +00:00
c449c94f28 Silence a sparse warning about inconsistent indenting
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1700319 13f79535-47bb-0310-9956-ffa450edef68
2015-08-31 19:49:32 +00:00
240d6e09d1 Avoid adding duplicate subequest filters, as they would not be stripped
properly during an ap_internal_fast_redirect.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1698334 13f79535-47bb-0310-9956-ffa450edef68
2015-08-28 13:13:14 +00:00
9d99941373 reversal of 1698239 due to nedless loop in t/apache/pr17629.t
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1698328 13f79535-47bb-0310-9956-ffa450edef68
2015-08-28 12:55:55 +00:00
f7a34707da avoid adding multiple subrequest filters when there are nested subrequests.
Multiple copies of the filter were not stripped properly 
during ap_fast_internal_redirect() which left the EOS buckets
stripped out of the brigade. This results in the end-chunk never
going out on the wire for a chunked response.

observed with mainreq -> directoryindex -> FallbackResource

PR58292



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1698239 13f79535-47bb-0310-9956-ffa450edef68
2015-08-27 22:55:52 +00:00
db81019ab8 SECURITY: CVE-2015-3185 (cve.mitre.org)
Replacement of ap_some_auth_required (unusable in Apache httpd 2.4)
with new ap_some_authn_required and ap_force_authn hook.

Submitted by: breser


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1684524 13f79535-47bb-0310-9956-ffa450edef68
2015-06-09 20:41:28 +00:00
0271656a56 Revert r4635428 corresponding to PR41867.
The code reverted attempted to restrict comparisons of the r->filename
to given DirectoryMatch blocks.

r->filename was already a non-directory entity at this point, because we
have already fallen out of the } while (thisinfo.filetype == APR_DIR);
block above.

The addition of r->d_is_directory was redundant.  That is what is always
returned by ap_get_core_module_config(r->per_dir_config).

Note modifying dir_config required an MMN major bump as this commit could
have realigned the offset of refs (had it been added to the end, this
would correspond to an mmn minor bump) and other fields packed into the
same bytes (this is undefined). Bump on revert to prevent unexpected crashes.




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1653666 13f79535-47bb-0310-9956-ffa450edef68
2015-01-21 21:39:55 +00:00
7dd5dc8bf6 core: Do not match files when using DirectoryMatch. PR41867.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1635428 13f79535-47bb-0310-9956-ffa450edef68
2014-10-30 08:34:12 +00:00