LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-16-2016, 08:32 AM   #1
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
WTF? Apache <if> directive ... doesn't work?!


Look at this, please, and tell me why the Error directive is reached:
Code:
<if "'prod' !~ /prod|dev|test/" >
  Error "This message should not appear"
</if>
A Perl "one-liner" confirms that the syntax of the regex is correct, and that it should (of course) match the string. Therefore, the result of the "does not match" operator should be false.

Actually, this set of directives produces this message whether the relational operator is "match" or "not-match!"

I am also encountering syntax-errors when evaluating a directive of this form:
Code:
<if ${DEFINED_SYMBOL} =~ ... >
... if it is indeed a symbol created by [font=courier]Define DEFINED_SYMBOL foobar[/code]. (And, yes, "${}" is correct in this case, not %{} ...)

The syntax-error complains about the !~ (or =~ symbol, saying that it expected a left-parentheis, unless the symbol-reference is enclosed in single quotes:
Code:
<if '${DEFINED_SYMBOL}' =~ ... >
This is Apache 2.4 current release (Ubuntu). It is simply inconceivable to me that Apache could have a directive that literally doesn't work, but I seem to be being pushed toward that conclusion.

Last edited by sundialsvcs; 03-16-2016 at 10:50 AM.
 
Old 03-16-2016, 10:27 AM   #2
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 509

Rep: Reputation: 203Reputation: 203Reputation: 203
Hi,

Quote:
Originally Posted by sundialsvcs View Post
Look at this, please, and tell me why the Error directive is reached:
Code:
<if "'prod' !~ /prod|dev|test" >
  Error "This message should not appear"
</if>
It looks like you might be missing a closing "/" for the regex here?
 
Old 03-16-2016, 10:51 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659

Original Poster
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
Bah, that was just a tpyo on my part, while creating this post, which I have since corrected.
 
Old 03-16-2016, 11:50 AM   #4
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 509

Rep: Reputation: 203Reputation: 203Reputation: 203
Hi,

Regarding the regex syntax, this seems to work for me:

Code:
<If "'prod' =~ m#(prod|dev|test)#" >
  #Error "This message should not appear"
  Header set APPLICATION_ENV prod
</If>
<Else>
  Header set APPLICATION_ENV unknown
</Else>
 
Old 03-17-2016, 07:34 AM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659

Original Poster
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
The regex syntax seems to be accepted in either case, but the outcome appears to be wrong.

Like I've said, this seems to be "such a 'bad [tangle of] Apache bug[s]" that I do not believe it. My "BOZO bit" is flipped. I presume that this parser has been thoroughly tested, for many years, and why should it change? But ...
 
Old 03-17-2016, 09:57 AM   #6
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 509

Rep: Reputation: 203Reputation: 203Reputation: 203
The outcome was correct for me. Running apache2-2.4.18.
 
Old 03-17-2016, 12:54 PM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659

Original Poster
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
Interesting. This Linux (Ubuntu server ...) is running 2/2.4.14. I'll look through the Apache closed-bugs list to see if this is something that appeared and has been corrected.

(But, again ... "BOZO! BOZO! BOZO!" ... how could such a thing ever have been broken?") I'm reaching the conclusion that it must be seriously-incorrect behavior on Apache's part, but I can't believe that such an error could ever make it to public release.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache doesn't work aocferreira Linux - Networking 2 04-14-2011 01:43 PM
Apache 'Listen' directive doesn't work robbiemorgan Linux - Software 0 11-22-2004 11:49 AM
Apache DirectorySlash directive doesn't seem to be working SeniorSE Linux - Newbie 2 11-16-2004 10:52 PM
Apache Directive sopiaz57 Linux - Security 2 12-09-2003 01:32 PM
Apache on 80 doesn't work mandeltuete Linux - Networking 6 03-23-2003 07:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration