You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Chris HOlland <ch...@whitecapdirect.com> on 2001/02/22 19:57:19 UTC

mod_rewrite/7296: The text lookup feature for modrewrite is not correctly parsing the ${} commands

>Number:         7296
>Category:       mod_rewrite
>Synopsis:       The text lookup feature for modrewrite is not correctly parsing the ${} commands
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Thu Feb 22 11:00:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     cholland@whitecapdirect.com
>Release:        1.3.17
>Organization:
apache
>Environment:
I ran into the problem on a redhat 6.2 linux box.
>Description:
I have a configuration file with a rewrite map specified. Then I have a rewrite rule that tries to reference the keys in the map. The parsing doesn't work correctly.. I debuged it and here is the change I had to make.

mod_rewrite.c:
  function - static void do_expand(request_rec *r, char *input, char *buffer,
                                   int nbuf, backrefinfo *briRR,
                                   backrefinfo *briRC)


the first if block:

	if (inp[1] == '{') {
	    char *endp;
	    endp = find_closing_bracket(inp, '{', '}');

I changed to:

	if (inp[1] == '{') {
	    char *endp;
	    rewritelog( r, 9, "CALLING find closing with %s", inp+2 );
	    endp = find_closing_bracket(inp+2, '{', '}');

The find_closing_bracket function was getting too deep for the full parse of the line... so I made it pass the first starting bracket. It now works fine.
>How-To-Repeat:
Make any text or rnd rewrite map and try to use it.

ex: main configuration file
RewriteMap server rnd:/home/cholland/apache1317/apache-rproxy.conf-server

RewriteRule ^/(.*)$                   to://${server:static}/$1


Map file:

static cholland|cholland|cholland
dynamic cholland|cholland|cholland


>Fix:
yes:

mod_rewrite.c:
  function - static void do_expand(request_rec *r, char *input, char *buffer,
                                   int nbuf, backrefinfo *briRR,
                                   backrefinfo *briRC)


the first if block:

	if (inp[1] == '{') {
	    char *endp;
	    endp = find_closing_bracket(inp, '{', '}');

I changed to:

	if (inp[1] == '{') {
	    char *endp;
	    rewritelog( r, 9, "CALLING find closing with %s", inp+2 );
	    endp = find_closing_bracket(inp+2, '{', '}');

The find_closing_bracket function was getting too deep for the full parse of the line... so I made it pass the first starting bracket. It now works fine.
>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <ap...@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]