benluteijn / cherokee

Automatically exported from code.google.com/p/cherokee
0 stars 1 forks source link

PCRE userfriendlyness #214

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. make a terribly wrong pcre
2. save the config (gracefull restart)
3. cherokee will complain at startup, and basically not startup

What is the expected output? What do you see instead?
I think it could be so convenient to have something like a PCRE validator
in the admin.

Original issue reported on code.google.com by ste...@konink.de on 10 Nov 2008 at 11:02

GoogleCodeExporter commented 9 years ago
You mean.. something like this?  http://www.regextester.com/

Original comment by alobbs on 10 Nov 2008 at 3:04

GoogleCodeExporter commented 9 years ago
Actually I just would like to see that the admin compiles the regexp, and 
return an
error if something is wrong. (Otherwise it will allow Cherokee to commit 
suicide upon
restart.)

I think in some cases it would be really good to have a layer 8 firewall ;)
Especially when someone is using the admin.

Original comment by ste...@konink.de on 10 Nov 2008 at 3:41

GoogleCodeExporter commented 9 years ago
Well, the thing here is that Python regular expressions aren't pcre compatible. 
That's an issue, actually. 
Otherwise it'd be easy to implement.

Ideas?

Original comment by alobbs on 10 Nov 2008 at 3:55

GoogleCodeExporter commented 9 years ago
Nifty small cgi program that implements pcre and returns an error code?

Original comment by ste...@konink.de on 10 Nov 2008 at 4:07

GoogleCodeExporter commented 9 years ago
Geez!

oh, well... yeah, that would be an option.

More ideas?

Original comment by alobbs on 10 Nov 2008 at 4:12

GoogleCodeExporter commented 9 years ago
Implement the admin in [a language that supports pcre]... let me try C! ;)

Anyway it seems Javascript supports PCRE?

Original comment by ste...@konink.de on 10 Nov 2008 at 4:16

GoogleCodeExporter commented 9 years ago
That sounds much better... a small JS function would definitely be a much 
better option IMO.

Original comment by alobbs on 10 Nov 2008 at 4:24

GoogleCodeExporter commented 9 years ago
JS would be the best option, but I think JS Reg. Exp. are not PCRE 100% 
compatible.

Original comment by skar...@gmail.com on 10 Nov 2008 at 4:31

GoogleCodeExporter commented 9 years ago
I would prefer 'some check' above no check...

Original comment by ste...@konink.de on 10 Nov 2008 at 4:33

GoogleCodeExporter commented 9 years ago
According with http://www.pcre.org/pcre.txt:

-------
         PCRE_JAVASCRIPT_COMPAT

       If this option is set, PCRE's behaviour is changed in some ways so that
       it is compatible with JavaScript rather than Perl. The changes  are  as
       follows:

       (1)  A  lone  closing square bracket in a pattern causes a compile-time
       error, because this is illegal in JavaScript (by default it is  treated
       as a data character). Thus, the pattern AB]CD becomes illegal when this
       option is set.

       (2) At run time, a back reference to an unset subpattern group  matches
       an  empty  string (by default this causes the current matching alterna-
       tive to fail). A pattern such as (\1)(a) succeeds when this  option  is
       set  (assuming  it can find an "a" in the subject), whereas it fails by
       default, for Perl compatibility.
-------

Cherokee isn't using PCRE_JAVASCRIPT_COMPAT, although there are only a couple 
of little differences. I don't think it'd be such a big 
deal.

Original comment by alobbs on 10 Nov 2008 at 4:54

GoogleCodeExporter commented 9 years ago
Perfect! :-)

I could try to implement it, but I don't have time at the moment... :(

Original comment by skar...@gmail.com on 10 Nov 2008 at 5:02

GoogleCodeExporter commented 9 years ago
:) Then we wait a bit longer :)

Original comment by ste...@konink.de on 10 Nov 2008 at 5:07

GoogleCodeExporter commented 9 years ago
Ha, ha!... Ok!, I'll do it! :D

Original comment by skar...@gmail.com on 10 Nov 2008 at 5:40

GoogleCodeExporter commented 9 years ago
What about making the server verify its config is valid before reloading?

Original comment by ericd...@gmail.com on 1 Feb 2009 at 3:13

GoogleCodeExporter commented 9 years ago
ericdrex, I like the idea... +1 ;)

Original comment by skar...@gmail.com on 1 Feb 2009 at 11:30

GoogleCodeExporter commented 9 years ago
Could the patch attached to issue 732 be valid to close this bug?

Original comment by skar...@gmail.com on 11 Feb 2010 at 11:49

GoogleCodeExporter commented 9 years ago
Stuff seams closely related to input validation.

Original comment by ste...@konink.de on 9 May 2010 at 7:15