1
0
mirror of https://github.com/apache/httpd.git synced 2025-11-11 02:42:23 +03:00
Commit Graph

214 Commits

Author SHA1 Message Date
William A. Rowe Jr
e04108cee2 Revamped ap_directory_walk logic, without a path_info helper is now
activated.  It may be bumpy for a few days, and we have more optimizations
  to put in place, but it's time to get this in the developer's test code.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91359 13f79535-47bb-0310-9956-ffa450edef68
2001-10-08 17:38:52 +00:00
William A. Rowe Jr
006f49d98a This is nothing but const bogosity. We have our very own manipulation,
we are allowed to touch the char *'s, even if we have a const contract.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91358 13f79535-47bb-0310-9956-ffa450edef68
2001-10-08 17:35:41 +00:00
William A. Rowe Jr
526abd74c0 Hmmm... continue's not so good an idea here :)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91344 13f79535-47bb-0310-9956-ffa450edef68
2001-10-06 22:47:20 +00:00
William A. Rowe Jr
05cd8ac520 Aaargh! Unwinding part of my patch before I committed the prior version,
I ended up blasting these (intentional) changes as well :(

  This finishes up the changes for the new, replacement ap_directory_walk
  for testing.  This code isn't active yet.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91342 13f79535-47bb-0310-9956-ffa450edef68
2001-10-06 22:16:11 +00:00
William A. Rowe Jr
2b9d60f5f5 A major overhaul to the -replacement- ap_directory_walk logic. This still
doesn't activate that code, I will do so probably by Monday, after more
  thorough testing.

  Introduces the ap_directory_walk::cache so we can stop wasting tons of
  effort in mod_autoindex and other subreq/redirect requests.

  This isn't thoroughly tested, I've only stepped through a half dozen
  common cases.  If you want to play, define REPLACE_PATH_INFO_METHOD.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91340 13f79535-47bb-0310-9956-ffa450edef68
2001-10-06 21:52:29 +00:00
William A. Rowe Jr
e9efbadadb Correct file lookups when we are given a file within the same directory
as the parent request.  Also pulls a bunch of notes and code that was
  set aside, we don't need this with the other optimizations introduced.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91254 13f79535-47bb-0310-9956-ffa450edef68
2001-10-03 13:24:28 +00:00
Greg Ames
a119c52846 ap_sub_req_output_filter: don't pass along a brigade if it becomes empty
after deleting the EOS bucket.

This prevents a seg fault in mod_include when the connection dies.  There
doesn't seem to be much point in passing empty brigades in general.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91225 13f79535-47bb-0310-9956-ffa450edef68
2001-10-01 21:01:14 +00:00
Justin Erenkrantz
d7a730adcf Fix for httpd-test modules/include test #17.
If we are *already* a faux URI (i.e. relative file sub req) and we then
make a subrequest from that faux URI to a file in the same directory,
we'd try to build a URI out of the fake URI which leads to the wrong
thing happening somewhere down the line.  So, let's just give this
special case a fake URI as well.

OtherBill needs to verify this.  He can back it out if he wants.  I
don't much care.  It's one line and it seems okay...


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91187 13f79535-47bb-0310-9956-ffa450edef68
2001-09-29 06:54:08 +00:00
William A. Rowe Jr
e748927d17 Optimize file_walk with the same logic as location_walk. Fix both to
have a bit more legibility, and tighter locality of scope for a smaller
  number of variables.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91186 13f79535-47bb-0310-9956-ffa450edef68
2001-09-28 19:50:22 +00:00
William A. Rowe Jr
8e82ad3743 Split out (soon to be) common code for all _walk functions
(no net change to location_walk).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91185 13f79535-47bb-0310-9956-ffa450edef68
2001-09-28 18:56:21 +00:00
William A. Rowe Jr
6d273ef60f Overhaul the compatibility with 1.3's subrequest and redirect processing.
Eliminate URI-centric phases in ap_process_request_internal() for pure
  file subrequests (that don't correspond to URI space.)  translate_name
  hook and location_walks are skipped for these requests.

  Moves the reset of the per_dir_config out of directory_walk into the
  internal request processing code, so that resources with alternate
  map_to_storage requirements start with clean r->server->lookup_defaults.

  Optimizes out the authn/authz of effectively identical subreqests and
  redirects, as the sub_req_lookup calls once did.  Unlike 1.3, we copy
  r->user and r->ap_auth_type from main/prev for the request's reference.

  Stop copying the subrequest's r->chunked flag (Rbb assured me it looked
  bogus, chunking is on the parent request) and clean out other #if 0'ed
  cruft we don't need to refer back to anymore.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91169 13f79535-47bb-0310-9956-ffa450edef68
2001-09-28 04:46:37 +00:00
Jeff Trawick
42ac007cc6 fix a gcc warning -- "/* within a comment"
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91140 13f79535-47bb-0310-9956-ffa450edef68
2001-09-25 09:46:37 +00:00
William A. Rowe Jr
1eed4b273e Joy, joy. Relax the rules, just a wee bit, and prepare to move the fatal
ending to this filename-less request a bit later in the request cycle, to
  give older, ported modules more time to cope without implementing
  the map_to_storage hook.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91131 13f79535-47bb-0310-9956-ffa450edef68
2001-09-24 21:07:06 +00:00
Jeff Trawick
8b31569e09 Currently, when the map-to-storage handler for TRACE returns DONE, the
caller -- ap_process_request_internal() -- catches that and returns
OK to its caller -- ap_process_request().  But ap_process_request(),
seeing OK, tries to run a handler.  It needs to skip that if the
request was completed in ap_process_request_internal().

Reviewed by:	William A. Rowe, Jr.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91095 13f79535-47bb-0310-9956-ffa450edef68
2001-09-20 17:54:51 +00:00
Ryan Bloom
1e90a12ab2 Fix a seg fault in mod_include. When we are generating an
internal redirect, we must set r->uri to "", not a bogus
string, and not NULL.  [Ryan Bloom]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90929 13f79535-47bb-0310-9956-ffa450edef68
2001-09-06 17:58:28 +00:00
William A. Rowe Jr
3c1228bf9d Optimize location_walk. We build an array of incremental matches, and
on attempting a subreq/redirect or simply a second pass, and for each
  match in series, if the section is a match,  we reuse the merge result
  for that section.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90925 13f79535-47bb-0310-9956-ffa450edef68
2001-09-06 16:48:15 +00:00
William A. Rowe Jr
b5108c6797 After some consideration - Location walk is always required (before and
after any other map_to_storage operations.)  Therefore, initialize any
  NULL r->per_dir_config at this phase (the earliest necessary point.)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90868 13f79535-47bb-0310-9956-ffa450edef68
2001-09-01 05:21:16 +00:00
William A. Rowe Jr
bc01f18d5d I love it when a plan comes together.
We hadn't prepared for this possibility that someone didn't set up the
  r->per_dir_config (which the subreq's didn't).  Since we are first in
  line, we will handle it if need be.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90865 13f79535-47bb-0310-9956-ffa450edef68
2001-09-01 02:38:18 +00:00
William A. Rowe Jr
640e927610 Ahhh, a const headache. Here's a flag that is writeable.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90861 13f79535-47bb-0310-9956-ffa450edef68
2001-08-31 22:33:24 +00:00
William A. Rowe Jr
450f9a96dc Since we can preserve and further canonicalize the subreq_file name onto
a canonical r->filename, let's do so.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90860 13f79535-47bb-0310-9956-ffa450edef68
2001-08-31 22:29:28 +00:00
William A. Rowe Jr
a060632d51 Add some notes of things I noticed while proofing. We still need a
resolution to rnew->chunked = r->chunked in subrequests!


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90859 13f79535-47bb-0310-9956-ffa450edef68
2001-08-31 22:07:05 +00:00
Jeff Trawick
99fc2084a6 resolve_symlink() is only used if REPLACE_PATH_INFO_METHOD is
defined


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90846 13f79535-47bb-0310-9956-ffa450edef68
2001-08-31 10:58:47 +00:00
Cliff Woolley
7f6b8db678 As I understand it, this test is supposed to read like so:
----------------------------------------------------
if the base paths are the same
    if (strncmp(rnew->filename, fdir, fdirlen) == 0

and there's more stuff in the new filename than just the base path
        && rnew->filename[fdirlen]

and that stuff contains no slashes
        && ap_strchr_c(rnew->filename + fdirlen, '/') == NULL)
----------------------------------------------------

Assuming that's a correct translation, which I believe to be the case
(and which also seems to jive with the previous version of the test),
then that first part darned well better check == 0, as opposed to != 0.
strncmp returns 0 when they match.  =-)

And voila,
"All tests successful, 1 test skipped."
is the result from httpd-test


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90842 13f79535-47bb-0310-9956-ffa450edef68
2001-08-31 05:05:58 +00:00
William A. Rowe Jr
679e890efc Invoking the handler must occur at the caller's discression, in order
for the sub_req mechanism to share this code.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90836 13f79535-47bb-0310-9956-ffa450edef68
2001-08-31 02:31:08 +00:00
William A. Rowe Jr
0dc1d9811c Move the ap_run_insert_filters to consistently occur in
ap_process_request_internal.  This allows the sub_req handler
  to alter the filters before the subreq is actually run.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90834 13f79535-47bb-0310-9956-ffa450edef68
2001-08-31 02:23:25 +00:00
William A. Rowe Jr
48a818a36f Normalize all paths to run the same, common code for pre-request setup
from the primary request, redirects and sub-requests.

    This will significantly reduce opporunities for inconsistancy (such
    as Ian observed, and as I repaired only a month ago.)

    This promotes process_request_internal to an ap_ namespace protected
    entity in server/request.c (from it's old home in http/http_request.c)
    since this fn has no http specifics.

Reviewed (in concept): Cliff Woolley, Ian Holsman


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90833 13f79535-47bb-0310-9956-ffa450edef68
2001-08-31 01:50:15 +00:00
William A. Rowe Jr
7cec5457d7 The add-in/strip-off temporary trailing slash logic was really hosed
in the new (not yet enabled) code path.  Now it's slightly hosed.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90829 13f79535-47bb-0310-9956-ffa450edef68
2001-08-30 23:58:23 +00:00
William A. Rowe Jr
515b1522d7 Fix the new code (not currently enabled) for directory_walk
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90823 13f79535-47bb-0310-9956-ffa450edef68
2001-08-30 20:48:06 +00:00
Jeff Trawick
066c3b0623 fix some calls to apr_pool_userdata_get()
(foo** just doesn't work the way we sometimes might want :( )


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90725 13f79535-47bb-0310-9956-ffa450edef68
2001-08-27 10:23:11 +00:00
William A. Rowe Jr
544cea832e Final additional comments (for the moment) about the new optimization.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90716 13f79535-47bb-0310-9956-ffa450edef68
2001-08-27 04:51:58 +00:00
William A. Rowe Jr
9c42239d68 Further optimization to location_walk() and clean up unused variables.
We will note the end result of the merge, and if remains the same through
  the second pass, we have nothing whatsoever to do :)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90714 13f79535-47bb-0310-9956-ffa450edef68
2001-08-27 04:37:40 +00:00
William A. Rowe Jr
7d55e44913 Clean up location_walk, so that this step performs a minimum
amount of redundant effort (it must be run twice, but it will no
  longer reparse all <Location > blocks when the request uri
  hadn't changed.)

  The location walk block is refactored, with some significant changes
  in variable names for legibility.  Cooler still, it uses pool data
  instead of 'notes' for the important cache info :)

  Note the patch builds the <Location > per dir config from _nothing_,
  and then merges it into the per_dir_config.  When the underlying
  per_dir_config changes between passes, the location_walk can simply
  tack back on this preconstruct onto the new per_dir_config.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90713 13f79535-47bb-0310-9956-ffa450edef68
2001-08-27 04:29:09 +00:00
William A. Rowe Jr
7552c9cb16 Eliminate proxy: (and all other 'special') processing from the
ap_directory_walk() phase.  Modules that want to use special
  walk logic should refer to the mod_proxy map_to_location example,
  with it's proxy_walk and proxysection implementation.  This makes
  either directory_walk flavor much more legible, since that phase
  only runs against real <Directory > blocks.

  On a technical note, this patch also forces the Directory to be
  canonical (unless it is "/" or a regex.)  It also allows us to
  be more explicit when declaring <Directory > block errors.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90684 13f79535-47bb-0310-9956-ffa450edef68
2001-08-26 05:10:17 +00:00
William A. Rowe Jr
307ab55886 Introduce the map_to_storage hook, which allows modules to bypass
the directory_walk and file_walk for non-file requests.  TRACE
  shortcut moved to http_protocol.c as APR_HOOK_MIDDLE, and the
  directory_walk/file_walk happen as APR_HOOK_VERY_LAST in core.c.

  A seperate patch to mod_proxy is required to short circuit both the
  TRACE and directory_walk/file_walk stuff.  That patch is next.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90665 13f79535-47bb-0310-9956-ffa450edef68
2001-08-25 23:43:19 +00:00
William A. Rowe Jr
bb757df043 sec, sec, who's got a sec? This gave me a headache, but I had to clear
out the last patch before I rearranged this to be _readable_.

  Next step for everyone's sanity, provide <Proxy > directives ;)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90646 13f79535-47bb-0310-9956-ffa450edef68
2001-08-24 18:12:02 +00:00
William A. Rowe Jr
6be8943643 Commit this code before another patch becomes to difficult to follow.
This patch does one thing, it changes the root path "/" to reflect an
  element count of Zero (0).  directory_walk will always accept the zero
  element (which sorts first, thankfully) on it's first go around.

  So, Unix will accept "/" when it's parsing it's first element "/".

  Dos/Win32 will accept "/" and "C:/" when they parse their first element,
  "C:/".  The root sorted first, so it behaves as users expect.

  The syntax "//" or "//machine" will be depreciated for now, the user
  needs to set up the extact "//machine/share/" that they want served
  on Win32.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90644 13f79535-47bb-0310-9956-ffa450edef68
2001-08-24 18:01:25 +00:00
William A. Rowe Jr
aa07a7d9e7 Whoops. To explain, we won't dup filename unless it really didn't match
in the first place.  We are about to abuse test_filename, so don't try
  using that copy.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90592 13f79535-47bb-0310-9956-ffa450edef68
2001-08-23 21:58:07 +00:00
William A. Rowe Jr
1a1e251ca8 Start with the presumption that canonical_filename is not likely to be set.
Therefore we will canonicalize it when it doesn't match filename.

  The next optimization should take the path common to canonical_filename
  and filename, and start merging filename from there for canonicalization.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90591 13f79535-47bb-0310-9956-ffa450edef68
2001-08-23 21:56:36 +00:00
William A. Rowe Jr
8944117f48 Another spot we are certain of the canonical_filename
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90590 13f79535-47bb-0310-9956-ffa450edef68
2001-08-23 21:21:17 +00:00
William A. Rowe Jr
1ffa5e572f Rather than continuing to canonicalize within directory_walk (very time
consuming on all but *nix systems) we temporarily canonicalize to compare
  the results of the many merges, and fail on a mismatch.

  The apr_filepath_merge and ap_server_root_relative calls now merge the
  file _by canonicalizing it_.  That includes resolving all /../, /./,
  and // misnomers.

  A minor effort is required to figure out who all munges the r->filename
  in an inappropriate manner.

  The final (return to optimized state) probably involves setting an
  r->goodname argument to r->filename, every time we properly merge
  through ap_server_root_relative or apr_filepath_merge().


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90573 13f79535-47bb-0310-9956-ffa450edef68
2001-08-23 19:19:52 +00:00
Jeff Trawick
c216c2184a fix some homophonic issues in comments, as well as some
mispelings found near "its" or "it's"

(helping our 4th grader with homework, couldn't help but
grep)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90173 13f79535-47bb-0310-9956-ffa450edef68
2001-08-15 21:11:59 +00:00
Ryan Bloom
6e932b2870 Fix the new method code. We need to cast 1 to an apr_int64_t or it will
be treated as a 32-bit integer, and it will wrap after being shifted
32 times.
Submitted by:	Cody Sherr <csherr@covalent.net> and
		Ryan Morgan <rmorgan@covalent.net>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90090 13f79535-47bb-0310-9956-ffa450edef68
2001-08-11 04:04:13 +00:00
Cliff Woolley
00b50aade9 Fix a segfault (was getting triggered by mod_include at least) caused
by calling ap_allow_options() before setting rnew->per_dir_config.

This is the "easy looking" fix but might have side effects of which I'm
unaware... please double-check this change for correctness.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89978 13f79535-47bb-0310-9956-ffa450edef68
2001-08-07 02:34:42 +00:00
William A. Rowe Jr
c2c43f7a9f This was entirely broken. We cannot skip the location walk just because
we are in a file subrequest (think of a file server-status sitting in
  the document root, this shouldn't be blindly served as a 'file'.)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89934 13f79535-47bb-0310-9956-ffa450edef68
2001-08-06 05:26:37 +00:00
William A. Rowe Jr
4e62141810 Just a little cleaner.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89933 13f79535-47bb-0310-9956-ffa450edef68
2001-08-06 05:07:34 +00:00
William A. Rowe Jr
f7e1f07bb3 More explanation
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89931 13f79535-47bb-0310-9956-ffa450edef68
2001-08-06 02:27:26 +00:00
Jeff Trawick
78b3feb4ce fix some warnings in resolve_symlink(), one of which seems to be for
a genuine bug...

The old logic

  if (!(opts & OPT_SYM_OWNER | OPT_SYM_LINKS))

wouldn't seem to work properly.  I think it would act like

  if (!((opts & OPT_SYM_OWNER) | OPT_SYM_LINKS))

This clearly isn't intended since OPT_SYM_LINKS is a constant non-zero, such
that we never really fail invalid parameters.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89860 13f79535-47bb-0310-9956-ffa450edef68
2001-08-01 11:59:55 +00:00
William A. Rowe Jr
bfa5e8539f Replace check_symlinks in the ap_sub_req_lookup_* calls with
the new resolve_symlink (also used by the new directory_walk)
  especially for performance and readability.  Left check_symlinks
  in the soon-to-be-gone get_path_info flavor of directory_walk.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89856 13f79535-47bb-0310-9956-ffa450edef68
2001-08-01 06:12:37 +00:00
William A. Rowe Jr
9d72a63ff7 Add the new directory_walk logic, eliminating get_path_info and
check_symlinks, in a protected define REPLACE_PATH_INFO_METHOD.

  This allows others to work on vetting, caching, etc, while keeping
  the existing logic stable till it's sufficiently optimal for beta.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89847 13f79535-47bb-0310-9956-ffa450edef68
2001-08-01 01:58:24 +00:00
William A. Rowe Jr
d35d3ecfab Use d_is_absolute within directory_walk.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89792 13f79535-47bb-0310-9956-ffa450edef68
2001-07-30 19:19:35 +00:00