perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug MacEachern <do...@pobox.com>
Subject Re: Bug in PerlSections with ErrorDocument
Date Wed, 01 Mar 2000 06:10:25 GMT
On Wed, 16 Feb 2000, Michael schout wrote:

> Hi.
> 
> I seem to have stumbled across a bug in PerlSections in mod_perl.
> 
> The problem is that instead of showing the actual error document to the user,
> mod_perl shows the contents of my error document config with a '"' appended to
> it.
> 
> For example, this is a section from my httpd.conf that demonstrates the
> problem:
> 
> <Perl>
>     $Location{'/foo'} = {
>         'ErrorDocument' => [ [404 => '/notfound.html'] ]
>     };
> </Perl>

i see the problem, mod_perl "quotes" all the strings is passes the to
config engine, which are normally stripped, but ErrorDocument is a special
case, where "'s are taken literally to be a string that should be
displayed as the ErrorDocument.  patch below fixes.

Index: perl_config.c
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/perl_config.c,v
retrieving revision 1.82
diff -u -u -r1.82 perl_config.c
--- perl_config.c	1999/12/30 19:16:39	1.82
+++ perl_config.c	2000/03/01 06:13:26
@@ -1494,17 +1494,29 @@
 				   key, cmd, config);
 	}
 	else {
+	    int do_quote = cmd->cmd->args_how != RAW_ARGS;
 	    SV *sv = newSV(0);
 	    sv_catpv(sv, key);
-	    sv_catpvn(sv, " \"", 2);
-
+	    if (do_quote) {
+		sv_catpvn(sv, " \"", 2);
+	    }
+	    else {
+		sv_catpvn(sv, " ", 1);
+	    }
 	    for(j=1; j<=n; j++) {
 		sv_catsv(sv, av_shift(av));
-		if(j != n)
-		    sv_catpvn(sv, "\" \"", 3);
+		if (j != n) {
+		    if (do_quote) {
+			sv_catpvn(sv, "\" \"", 3);
+		    }
+		    else {
+			sv_catpvn(sv, " ", 1);
+		    }
+		}
+	    }
+	    if (do_quote) {
+		sv_catpvn(sv,"\"", 1);
 	    }
-	    sv_catpvn(sv,"\"",1);
-
 	    perl_handle_command(cmd, config, SvPVX(sv));
 	    SvREFCNT_dec(sv);
 	}


Mime
View raw message