From 0c1c05d572f947deab6236e7d9deda5f66aaa63d Mon Sep 17 00:00:00 2001 From: "Paul J. Reder" Date: Mon, 14 Jul 2003 16:40:13 +0000 Subject: [PATCH] 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 ] [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 --- CHANGES | 6 ++++++ modules/mappers/mod_rewrite.c | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/CHANGES b/CHANGES index 5ab527e42c..cfc5e624e9 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,12 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] + *) 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 ] + [Updated and reviewed by: Paul J. Reder] + *) mod_actions: Propagate the handler name to the action script via the REDIRECT_HANDLER environment variable. [André Malo] diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 7880255a0e..d714bc4cec 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -1104,6 +1104,7 @@ static void init_child(apr_pool_t *p, server_rec *s) static int hook_uri2file(request_rec *r) { rewrite_server_conf *conf; + const char *saved_rulestatus; const char *var; const char *thisserver; char *thisport; @@ -1182,6 +1183,7 @@ static int hook_uri2file(request_rec *r) thisurl, NULL); apr_table_setn(r->subprocess_env, ENVVAR_SCRIPT_URI, var); + if (!(saved_rulestatus = apr_table_get(r->notes,"already_rewritten"))) { /* if filename was not initially set, * we start with the requested URI */ @@ -1190,11 +1192,25 @@ static int hook_uri2file(request_rec *r) rewritelog(r, 2, "init rewrite engine with requested uri %s", r->filename); } + else { + rewritelog(r, 2, "init rewrite engine with passed filename %s." + " Original uri = %s", r->filename, r->uri); + } /* * now apply the rules ... */ rulestatus = apply_rewrite_list(r, conf->rewriterules, NULL); + apr_table_set(r->notes,"already_rewritten", + apr_psprintf(r->pool,"%d",rulestatus)); + } + else { + rewritelog(r, 2, + "uri already rewritten. Status %s, Uri %s, r->filename %s", + saved_rulestatus, r->uri, r->filename); + rulestatus = atoi(saved_rulestatus); + } + if (rulestatus) { unsigned skip; @@ -2818,6 +2834,13 @@ static unsigned is_absolute_uri(char *uri) return 7; } break; + + case 'p': + case 'P': + if (!strncasecmp(uri, "roxy:", 5)) { /* proxy: */ + return 6; + } + break; } return 0; -- 2.40.0