Bug #2059

Lighttpd PCRE-Result differs from PCREtest

Added by M3m0r3x about 5 years ago. Updated about 5 years ago.

Status:FixedStart date:2009-08-28
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:core
Target version:1.4.24
Missing in 1.5.x:

Description

Lighttpd is not able to match, but pcretest did:

$HTTP["host"] =~ "(^(www\.|)funkhaus\.com$|^(www\.|)gong\.info|^(www\.|)funkhausonline\.de|^(www\.|)funkhaus-online\.de|^(www\.|)festungsweinfest\.de|^(www\.|)festungs-weinfest\.de|^(www\.|)gongchat\.de|^(www\.|)gong-chat\.de|^(www\.|)funkhauswuerzburg\.de|^(www\.|)funkhaus-wuerzburg\.de|^(www2\.|)mainfranken\.com|^(www\.|)wuerzburg24\.de|^(www\.|)radiocharivari\.net|^(www\.|)radio-charivari\.net|^(www\.|)radiocharivari\.com|^(www\.|)radio-charivari\.com|^(www\.|)stellenmarktmainfranken\.de|^(www\.|)stellenmarkt-mainfranken\.de|^(www\.|)immomarktmainfranken\.de|^(www\.|)immomarkt-mainfranken\.de|^(www\.|)immobilienmarkt-mainfranken\.de$)" {

here the result of pcretest-tool: http://pastebin.com/m6c8f82f

and here the lighttpd-output: http://pastebin.com/m6af9f737

as you can see, lighttpd didn't match but pcretest-tool did.

I tried, Debian (Etch/Lenny/SID) and a self compiled 1.4.22, I also updated pcre but didn't change anything.

Associated revisions

Revision 2614
Added by stbuehler about 5 years ago

Print an error if you use too many captures in a regex pattern (fixes #2059)

History

#1 Updated by M3m0r3x about 5 years ago

  • Target version changed from 1.5.0 to 1.4.x

#2 Updated by icy about 5 years ago

Do you have "!~" in your config instead of "=~"? The regex should match and I can't find any obvious bug in the code right now.

#3 Updated by M3m0r3x about 5 years ago

No, I copy&pasted the above line directly out of my config-file.

Maybe it helps, but if I remove f.e. "^(www\.|)gong-chat\.de" lighttpds-regex-system is working, too (at least with the above domain). It's very strange.

I also checked for "hidden" chars and typed everything again, nothing changed.

#4 Updated by jan about 5 years ago

M3m0r3x wrote:

No, I copy&pasted the above line directly out of my config-file.

Maybe it helps, but if I remove f.e. "^(www.|)gong-chat.de" lighttpds-regex-system is working, too (at least with the above domain). It's very strange.

Can you try if using (?:...) instead of (...) solves the problem ?

#5 Updated by icy about 5 years ago

There's an internal limit on how many matches lighty can work with. You are hitting it.
Unfortunately the current code does not output any error in this case. As a quick workaround, use what jan suggested or rewrite the regex like this:
^(www\.)?(funkhaus\.com|gong\.de|....)$

#6 Updated by M3m0r3x about 5 years ago

icy wrote:

There's an internal limit on how many matches lighty can work with. You are hitting it.
Unfortunately the current code does not output any error in this case. As a quick workaround, use what jan suggested or rewrite the regex like this:
^(www.)?(funkhaus.com|gong.de|....)$

I tried:

$HTTP["host"] =~ "(?:^(www\.|)funkhaus\.com$|^(www\.|)gong\.info|^(www\.|)funkhausonline\.de|^(www\.|)funkhaus-online\.de|^(www\.|)festungsweinfest\.de|^(www\.|)festungs-weinfest\.de|^(www\.|)gongchat\.de|^(www\.|)gong-chat\.de|^(www\.|)funkhauswuerzburg\.de|^(www\.|)funkhaus-wuerzburg\.de|^(www2\.|)mainfranken\.com|^(www\.|)wuerzburg24\.de|^(www\.|)radiocharivari\.net|^(www\.|)radio-charivari\.net|^(www\.|)radiocharivari\.com|^(www\.|)radio-charivari\.com|^(www\.|)stellenmarktmainfranken\.de|^(www\.|)stellenmarkt-mainfranken\.de|^(www\.|)immomarktmainfranken\.de|^(www\.|)immomarkt-mainfranken\.de|^(www\.|)immobilienmarkt-mainfranken\.de$)" {

but didn't help.

$HTTP["host"] =~ "(?:^(?:www\.|)funkhaus\.com$|^(?:www\.|)gong\.info|^(?:www\.|)funkhausonline\.de|^(?:www\.|)funkhaus-online\.de|^(?:www\.|)festungsweinfest\.de|^(?:www\.|)festungs-weinfest\.de|^(?:www\.|)gongchat\.de|^(?:www\.|)gong-chat\.de|^(?:www\.|)funkhauswuerzburg\.de|^(?:www\.|)funkhaus-wuerzburg\.de|^(?:www2\.|)mainfranken\.com|^(?:www\.|)wuerzburg24\.de|^(?:www\.|)radiocharivari\.net|^(?:www\.|)radio-charivari\.net|^(?:www\.|)radiocharivari\.com|^(?:www\.|)radio-charivari\.com|^(?:www\.|)stellenmarktmainfranken\.de|^(?:www\.|)stellenmarkt-mainfranken\.de|^(?:www\.|)immomarktmainfranken\.de|^(?:www\.|)immomarkt-mainfranken\.de|^(?:www\.|)immobilienmarkt-mainfranken\.de$)" 

is working. I will create a patch for syscp to get this "fixed" for everybody using syscp, maybe increasing the limit would be a good idea, too.

Thanks a lot!

#7 Updated by stbuehler about 5 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Applied in changeset r2614.

#8 Updated by stbuehler about 5 years ago

  • Target version changed from 1.4.x to 1.4.24

Also available in: Atom