Bug 56528 - "bad flags delimiter" - improve helpfulness
Summary: "bad flags delimiter" - improve helpfulness
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_rewrite (show other bugs)
Version: 2.5-HEAD
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: FixedInTrunk, PatchAvailable
Depends on:
Blocks:
 
Reported: 2014-05-15 14:33 UTC by Edward Lu
Modified: 2015-01-16 19:44 UTC (History)
0 users



Attachments
Improve error reporting in mod_rewrite (3.35 KB, patch)
2014-05-15 14:33 UTC, Edward Lu
Details | Diff
Improve error reporting in mod_rewrite (3.37 KB, patch)
2014-06-03 13:53 UTC, Edward Lu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Edward Lu 2014-05-15 14:33:48 UTC
Created attachment 31627 [details]
Improve error reporting in mod_rewrite

The parser in mod_rewrite always interprets the third argument to RewriteRule/RewriteCond as optional flags. However, unescaped whitespace is fairly easy to accidentally insert into a RewriteRule/RewriteCond directive. When this happens, "bad flag delimiters" is displayed since the rogue whitespace causes the parser to interpret a chunk of one of the args as flags. This error is a spectacularly bad way to express this (even if it's strictly true).

The attached patch attempts to improve the error reporting of the relevant section in mod_rewrite.
Comment 1 Eric Covener 2014-06-03 13:23:23 UTC
This seems to trigger on:

RewriteRule .* - [G]

RewriteRule: bad flag delimiters: third argument must end with ']' but found [G] - unintended whitespace within the flags definition? (pattern='.*', substitution='-', flags='[G]')
Comment 2 Edward Lu 2014-06-03 13:53:07 UTC
Created attachment 31685 [details]
Improve error reporting in mod_rewrite

Silly of me - forgot my order of operations.
Comment 3 Eric Covener 2015-01-16 19:44:27 UTC
Thanks, committed to trunk in r1652507.

(reminded of this patch by my own whitespace typo in RewriteCond)