1
0
mirror of https://github.com/apache/httpd.git synced 2025-11-06 16:49:32 +03:00
Commit Graph

187 Commits

Author SHA1 Message Date
André Malo
d4b1817c38 Get a rid of the oversized cache.
The new map-cache consists of a simple two-tiered apr_hash structure.
cachep->maps contains entries for each map, which point to a hash with
the actual values (map->entries).

Each map->entries hash lives in a subpool of cachep->pool.
The mtime is stored per map and if the map expires, we just clear
map->pool and create a fresh map->entries hash structure.

This removes a big chunk of code from mod_rewrite, improves readability and
even the memory footprint of the cache.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100801 13f79535-47bb-0310-9956-ffa450edef68
2003-07-27 22:12:49 +00:00
André Malo
b863e3a2db cleanup the select_random_value_part function.
improve efficiency and readabilty.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100800 13f79535-47bb-0310-9956-ffa450edef68
2003-07-27 19:18:27 +00:00
André Malo
6077bd9bb2 cleanup lookup_map_dbmfile function.
improve efficiency and readablity.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100798 13f79535-47bb-0310-9956-ffa450edef68
2003-07-27 14:40:52 +00:00
André Malo
dfdc32155d cleanup lookup_map_txtfile function.
- improve efficiency
- make it better readable


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100797 13f79535-47bb-0310-9956-ffa450edef68
2003-07-27 13:49:15 +00:00
André Malo
13c0dfe406 avoid unnecessary memory operations
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100796 13f79535-47bb-0310-9956-ffa450edef68
2003-07-27 11:56:06 +00:00
André Malo
0d14f55e88 cleanup lookup_map function.
- use switch instead of if-else chain
- collapse txt/rnd code, which is essentially the same
- make it better readable at all.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100795 13f79535-47bb-0310-9956-ffa450edef68
2003-07-27 00:08:21 +00:00
André Malo
80bbbe3d5e rewritemaps are identified by name. Store 'em in a hash rather than
an array. This is more naturally, efficient (mostly) and better
readable.
Leave deep indentations for now (better diff).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100794 13f79535-47bb-0310-9956-ffa450edef68
2003-07-26 23:04:18 +00:00
André Malo
18ae486705 re-add missing headers
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100793 13f79535-47bb-0310-9956-ffa450edef68
2003-07-26 20:47:03 +00:00
André Malo
74bf9ef099 oof. Strip all non-public stuff from mod_rewrite.h and
reorder the code in mod_rewrite.c in order to get a rid of
the forward declaration. Cleaned up the comments as well.

No real code change, but a quite big diff ...


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100792 13f79535-47bb-0310-9956-ffa450edef68
2003-07-26 20:32:24 +00:00
André Malo
b982623b1d remove outdated and more confusing than helping comment.
no code change.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100789 13f79535-47bb-0310-9956-ffa450edef68
2003-07-25 20:07:29 +00:00
André Malo
d352d90db9 avoid unnecessary memory operation
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100784 13f79535-47bb-0310-9956-ffa450edef68
2003-07-24 23:25:31 +00:00
André Malo
d4bd00d88e remove more unnecessary strlen() operations
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100783 13f79535-47bb-0310-9956-ffa450edef68
2003-07-24 23:10:29 +00:00
André Malo
46fb97d0db remove another fixed buffer from the stack
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100782 13f79535-47bb-0310-9956-ffa450edef68
2003-07-24 22:48:17 +00:00
André Malo
8cc2889e83 indentation. no code change
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100780 13f79535-47bb-0310-9956-ffa450edef68
2003-07-24 22:24:40 +00:00
André Malo
3ca16bbc4c remove useless post increment.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100776 13f79535-47bb-0310-9956-ffa450edef68
2003-07-24 20:50:50 +00:00
André Malo
0b3c2f8372 remove more variables from the stack and
increase readability.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100775 13f79535-47bb-0310-9956-ffa450edef68
2003-07-24 20:29:19 +00:00
André Malo
70d30b01f0 minor optimization.
this avoids a variable on stack and some internal
pointer operations.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100774 13f79535-47bb-0310-9956-ffa450edef68
2003-07-24 19:50:45 +00:00
André Malo
ce50cb7bcc remove outdated comments about different regex libs
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100773 13f79535-47bb-0310-9956-ffa450edef68
2003-07-24 19:39:11 +00:00
André Malo
7f68f45af6 optimization/cleanup.
The generic flagparser (read: lexer) for RewriteRules and RewriteConds
does the same except for one function call.
Collapse these to functions to one and make the result more
readable.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100772 13f79535-47bb-0310-9956-ffa450edef68
2003-07-24 19:06:33 +00:00
André Malo
2f283a1dcd don't compute the strlen of dconf->directory three times
Submitted by: Justin


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100744 13f79535-47bb-0310-9956-ffa450edef68
2003-07-23 13:32:14 +00:00
André Malo
279a27db23 when prefixing document root, use the core translator instead
of baking our own. The core function is much better maintained
and probably more safe.
Additionally this removes just another fixed buffer :)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100681 13f79535-47bb-0310-9956-ffa450edef68
2003-07-18 00:38:44 +00:00
André Malo
8af17391ee step two: get a rid of the old do_expand function.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100676 13f79535-47bb-0310-9956-ffa450edef68
2003-07-17 21:22:50 +00:00
André Malo
b0572362e9 optimization; rewrite the do_expand function in order to:
+ give it a better interface
  + get a rid of most of the fixed stack buffers and then
  + no longer limit rewritten uris, expanded variables etc to
    2k
  + make it better readable and understandable at all.

This is a two-tiered commit for better diffs.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100675 13f79535-47bb-0310-9956-ffa450edef68
2003-07-17 21:18:02 +00:00
André Malo
c80f883337 add some linebreaks and reorder case alphabetically for better
readability. No code changes.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100652 13f79535-47bb-0310-9956-ffa450edef68
2003-07-16 19:01:05 +00:00
André Malo
3aae3ae057 optimization: no need to use the pool here. This is
obviously a static value.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100651 13f79535-47bb-0310-9956-ffa450edef68
2003-07-16 18:23:37 +00:00
André Malo
1991286e67 optimization:
- add comment about what subst_prefix_path function does
- reduce the use of fixed buffers
- get a rid of unnecessary memory operations


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100650 13f79535-47bb-0310-9956-ffa450edef68
2003-07-16 17:27:26 +00:00
André Malo
9a685a36ed optimization: speed up ruleflag parsing.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100645 13f79535-47bb-0310-9956-ffa450edef68
2003-07-16 01:04:23 +00:00
André Malo
1af42640c5 optimization: no need to search linear for headers.
apr_table_get should be more efficient nearly always.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100644 13f79535-47bb-0310-9956-ffa450edef68
2003-07-15 23:30:40 +00:00
André Malo
4bf361a0e9 optimization: rewrite reduce_uri function:
get a rid of static buffers and unnecessary memory operations


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100643 13f79535-47bb-0310-9956-ffa450edef68
2003-07-15 22:29:38 +00:00
André Malo
606c7d4243 minor optimization. No need to use a function overhead here.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100637 13f79535-47bb-0310-9956-ffa450edef68
2003-07-15 20:38:04 +00:00
Paul J. Reder
4afe1d7747 Namespace protected the table label.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100634 13f79535-47bb-0310-9956-ffa450edef68
2003-07-15 18:43:41 +00:00
André Malo
742a08e311 Ignore RewriteRules in .htaccess files if the directory
containing the .htaccess file is requested without a trailing slash.

PR:	20195


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100632 13f79535-47bb-0310-9956-ffa450edef68
2003-07-15 17:49:03 +00:00
Paul J. Reder
cbf0523733 Remove some extraneous code committed as part of the fix for 13946 pointed
out by Andre Malo. [Paul J. Reder]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100615 13f79535-47bb-0310-9956-ffa450edef68
2003-07-14 19:30:14 +00:00
Paul J. Reder
0c1c05d572 mod_rewrite: fix a problem in the proxy support of mod_rewrite. The broken
code was inserting multiple "proxy:" fields in the rewritten URIs.
[Submitted by:  Eider Oliveira <eider@bol.com.br>]
[Updated and reviewed by: Paul J. Reder]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100600 13f79535-47bb-0310-9956-ffa450edef68
2003-07-14 16:40:13 +00:00
Jeff Trawick
8f0cd048e0 Unix: Handle permissions settings for flock-based mutexes in
unixd_set_global|proc_mutex_perms().  Allow the functions to be
called for any type of mutex.

This resolves a fatal problem with mod_rewrite on systems where
APR uses flock-based mutex.

It simplifies mod_ssl as well, which had special logic to perform
the chown().  It fixed an init error with mod_ssl on systems where
flock is used when the user had no SSLMutex directive.

The Unix MPMs continue to call unixd_set_global|proc_mutex_perms()
only for SysV sems.  There is no permission problem with flock-based
accept mutexes since the child init logic for the MPMs is done
prior to switching identity.

PR:              20312


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100189 13f79535-47bb-0310-9956-ffa450edef68
2003-06-07 19:50:01 +00:00
Jeff Trawick
d7d7c6a73e mod_rewrite: Perform child initialization on the rewrite log lock.
This fixes a log corruption issue when flock-based serialization
is used (e.g., FreeBSD).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100187 13f79535-47bb-0310-9956-ffa450edef68
2003-06-07 13:09:10 +00:00
André Malo
87bb42c589 fix LA-U lookaheads in directory context.
I'm wondering if this ever worked ...

PR: 8493 (related to)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@99902 13f79535-47bb-0310-9956-ffa450edef68
2003-05-17 22:28:23 +00:00
André Malo
5c7b03d75b Make sure that mod_rewrite's type checker is evaluated before mod_mime.
PR: 19626


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@99704 13f79535-47bb-0310-9956-ffa450edef68
2003-05-04 18:31:18 +00:00
William A. Rowe Jr
1e7b7d79bb SECURITY: Eliminated leaks of several file descriptors to child
processes, such as CGI scripts.

PR: 17206
Submitted by:	Christian Kratzer <ck@cksoft.de>, Bjoern A. Zeeb <bz@zabbadoz.net>
Reviewed by:	Joe Orton, Will Rowe


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@99032 13f79535-47bb-0310-9956-ffa450edef68
2003-03-20 21:50:40 +00:00
André Malo
811bb3ecab Prevent endless loops of internal redirects in mod_rewrite by
aborting after exceeding a limit of internal redirects. The
limit defaults to 10 and can be changed using the RewriteOptions
directive with the new MaxRedirects=n argument.
(The latter required some restructuring of the RewriteOptions
 evaluation code).

(Documentation patch follows asap)

PR: 17462


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98863 13f79535-47bb-0310-9956-ffa450edef68
2003-03-01 18:35:50 +00:00
Jeff Trawick
5261b44556 mod_rewrite: Fix some problems reporting errors with mapping
programs (RewriteMap prg:/something).

the wrong field was specified when trying to log the name of
the program that couldn't be started

recent APR features used to provide better error reporting
on systems where apr_proc_create() uses fork()


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98840 13f79535-47bb-0310-9956-ffa450edef68
2003-02-28 13:13:39 +00:00
André Malo
5cede9cd45 Fix mod_rewrite's abs_URI handling.
- uris were partially not correctly escaped (in particular:
  ldap, news, mailto)
- not all uri schemes contain an authority component (//)
- add nntp:// scheme
- don't add a query string (and drop r->args) if it's not
  http or mailto scheme
- be more efficient (think so)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98808 13f79535-47bb-0310-9956-ffa450edef68
2003-02-27 02:50:04 +00:00
Jeff Trawick
5c6fce7f56 fix some const-ness problems which break the compile with the native
compiler for AIX (and probably HP-UX and Tru64 as well, since they
tend to be picky too)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98792 13f79535-47bb-0310-9956-ffa450edef68
2003-02-25 14:44:42 +00:00
André Malo
7addaa4a89 This is part three.
It fixes the misunderstandings between local URL paths and local
system paths. Note that mod_rewrite handles _both_.
Fixed also some comments to make the explanations more clear.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98783 13f79535-47bb-0310-9956-ffa450edef68
2003-02-24 21:55:07 +00:00
André Malo
5c89fed043 This is part two.
It fixes the prefix_stat function. (which does a stat call on the first
path segment). This function was still tailored for unix systems only.
It should work on other systems as well now.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98782 13f79535-47bb-0310-9956-ffa450edef68
2003-02-24 21:44:15 +00:00
André Malo
6c0e1bf982 Well, here comes a major fix. I've splitted the patch into 3 parts
for better understanding, what I'm doing there. This is part one.

mod_rewrite appears to be very broken in several cases, especially on
non-unix systems. However, let's start with fixing the path handling, since
it's _the_ major PITA, e.g. on win32.

This part removes _unused_ code. The condition is never true, because
"A local rewrite in per-directory context" was caught much earlier.
I'd guess this piece of code was c&p accidentally...


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98781 13f79535-47bb-0310-9956-ffa450edef68
2003-02-24 21:34:51 +00:00
André Malo
73bb5423fc guess, what happens, when l == 0
theoretical case, maybe ...


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98773 13f79535-47bb-0310-9956-ffa450edef68
2003-02-23 22:04:23 +00:00
André Malo
ee1225a25e uh, oh. Fix possible 1-byte buffer overflow.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98769 13f79535-47bb-0310-9956-ffa450edef68
2003-02-23 00:05:32 +00:00
André Malo
6f1e0d8307 Hook mod_proxy's fixup before mod_rewrite's fixup, so that by
mod_rewrite proxied URLs will not be escaped accidentally by
mod_proxy's fixup.

PR: 16368


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98707 13f79535-47bb-0310-9956-ffa450edef68
2003-02-18 20:35:28 +00:00
André Malo
732d090388 catch some style issues. No code changes.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98669 13f79535-47bb-0310-9956-ffa450edef68
2003-02-15 02:17:21 +00:00