httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bertrand Jacquin <bjacq...@exosec.fr>
Subject [PATCH] Strip comments while parsing config
Date Wed, 27 Jan 2010 19:34:22 GMT
Hi,

Here a thin patch for vanilla 2.2.14 to strip comments when reading config files. Without
it, you can't comment inline your config nor disable a pattern for rapid
tests. In fact, this only have impact with command type AP_INIT_TAKE_ARGV like :

IndexOptions FancyIndexing VersionSort HTMLTable NameWidth=* DescriptionWidth=* Charset=UTF-8
      # Look nicer
IndexOptions FancyIndexing VersionSort HTMLTable NameWidth=* DescriptionWidth=* # Charset=UTF-8
    # Look nicer

Attached patch allow you to strip that as the regexp .*[^"].*(( |\t)+)#.*
to :
 - Avoid strip unblank pre-sharp character, only strip when preceding by
   space or tab

IndexIgnore .??* *~ *# Not stripped part

 - Also, handle multiline when using \

IndexOptions FancyIndexing	\	# That is stripped
			 			 VersionSort		\ # And that too
				     ...

So AP_INIT_TAKE_ARGV (and others now) only see real config and no more comments.

As I can't find any "No "get string" function", I didn't do it for that way.

I think for patch is simple but hey, it's my first attempt to hack a
bit apache. I'd appreciate comments, reviews, and if it need to be applied
to "No "get string" function" part.

Bertrand

-- 
Bertrand Jacquin, EXOSEC (http://www.exosec.fr/)
ZAC des Metz - 3 Rue du petit robinson - 78350 JOUY EN JOSAS
Tel: +33 1 30 67 60 65  -  Fax: +33 1 75 43 40 70
mailto:bjacquin@exosec.fr

Mime
View raw message