Skip to content

Commit ab8daeb

Browse files
authored
Fix outdated regexp of apache2 parser (#647)
The regexp shown in parser/apache2.md was the one used before v1.14.2. Escape sequences were first allowed by df5ac352 "Allow escape sequences in Apache access log" (v0.14.14), which used `(?:[^\"]|\\.)`, and that is the form the document still shows. The source was later narrowed by db93f4b9 "parser_apache2: Fix too wide matching regexp" (v1.14.2): - REGEXP = ... (?<path>(?:[^\"]|\\.)*?) ... (?<referer>(?:[^\"]|\\.)*) ... (?<agent>(?:[^\"]|\\.)*) ... + REGEXP = ... (?<path>(?:[^\"]|\\")*?) ... (?<referer>(?:[^\"]|\\")*) ... (?<agent>(?:[^\"]|\\")*) ... The document was not updated at that time. So it still says that any backslash-escaped character is accepted in path, referer and agent, while the current implementation accepts only an escaped double quote. The new text is copied from Apache2Parser::REGEXP.source of the v1.19 branch and was compared with the document line to confirm they are identical. Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
1 parent 1e6fa26 commit ab8daeb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

parser/apache2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ See [Parse Section Configurations](../configuration/parse-section.md)
1111
Here is the regexp and time format patterns of this plugin:
1212

1313
```text
14-
expression /^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>(?:[^\"]|\\.)*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>(?:[^\"]|\\.)*)" "(?<agent>(?:[^\"]|\\.)*)")?$/
14+
expression /^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>(?:[^\"]|\\")*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>(?:[^\"]|\\")*)" "(?<agent>(?:[^\"]|\\")*)")?$/
1515
time_format %d/%b/%Y:%H:%M:%S %z
1616
```
1717

0 commit comments

Comments
 (0)