diff options
author | André Malo <nd@apache.org> | 2003-03-01 19:35:50 +0100 |
---|---|---|
committer | André Malo <nd@apache.org> | 2003-03-01 19:35:50 +0100 |
commit | 811bb3ecabc78bc0b3d81f0b602eac01beb42cd4 (patch) | |
tree | d3eb5c3de7041730dd8d97aa79438430b4ac68b8 /modules/mappers/mod_rewrite.h | |
parent | Mention that ProxyPassReverse takes the hostname in respect (diff) | |
download | apache2-811bb3ecabc78bc0b3d81f0b602eac01beb42cd4.tar.xz apache2-811bb3ecabc78bc0b3d81f0b602eac01beb42cd4.zip |
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
Diffstat (limited to 'modules/mappers/mod_rewrite.h')
-rw-r--r-- | modules/mappers/mod_rewrite.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/modules/mappers/mod_rewrite.h b/modules/mappers/mod_rewrite.h index 5a4b904354..2a46b6199b 100644 --- a/modules/mappers/mod_rewrite.h +++ b/modules/mappers/mod_rewrite.h @@ -212,6 +212,8 @@ #define MAX_NMATCH 10 +/* default maximum number of internal redirects */ +#define REWRITE_REDIRECT_LIMIT 10 /* @@ -271,6 +273,7 @@ typedef struct { apr_array_header_t *rewriteconds; /* the RewriteCond entries (temporary) */ apr_array_header_t *rewriterules; /* the RewriteRule entries */ server_rec *server; /* the corresponding server indicator */ + int redirect_limit; /* maximum number of internal redirects */ } rewrite_server_conf; @@ -284,9 +287,18 @@ typedef struct { apr_array_header_t *rewriterules; /* the RewriteRule entries */ char *directory; /* the directory where it applies */ const char *baseurl; /* the base-URL where it applies */ + int redirect_limit; /* maximum number of internal redirects */ } rewrite_perdir_conf; + /* the per-request configuration + */ +typedef struct { + int redirects; /* current number of redirects */ + int redirect_limit; /* maximum number of redirects */ +} rewrite_request_conf; + + /* the cache structures, * a 4-way hash apr_table_t with LRU functionality */ @@ -343,8 +355,6 @@ static const char *cmd_rewriteengine(cmd_parms *cmd, static const char *cmd_rewriteoptions(cmd_parms *cmd, void *dconf, const char *option); -static const char *cmd_rewriteoptions_setoption(apr_pool_t *p, int *options, - const char *name); static const char *cmd_rewritelog (cmd_parms *cmd, void *dconf, const char *a1); static const char *cmd_rewriteloglevel(cmd_parms *cmd, void *dconf, const char *a1); static const char *cmd_rewritemap (cmd_parms *cmd, void *dconf, @@ -467,6 +477,7 @@ static int prefix_stat(const char *path, apr_pool_t *pool); static void add_env_variable(request_rec *r, char *s); static void add_cookie(request_rec *r, char *s); static int subreq_ok(request_rec *r); +static int is_redirect_limit_exceeded(request_rec *r); /* Lexicographic Comparison */ static int compare_lexicography(char *cpNum1, char *cpNum2); |