summaryrefslogtreecommitdiff
path: root/pygments/lexers/textfmts.py
diff options
context:
space:
mode:
authorJoshua Huber <joshua@mrhuber.com>2020-05-18 08:13:37 -0400
committerGitHub <noreply@github.com>2020-05-18 14:13:37 +0200
commitc40bbcca8fa5a99146d6677204e1837f6d2f4aea (patch)
treeb5ba4a9718c33c1fc48692afc4823764620e931a /pygments/lexers/textfmts.py
parent65562a9624863476722dcc8c319d4579583edf8a (diff)
downloadpygments-git-c40bbcca8fa5a99146d6677204e1837f6d2f4aea.tar.gz
Make HttpLexer compatible with RFC 7230 (section 3.1.2). Specifically this addresses for the case where only a numeric HTTP status code is returned (eg. 200) and no textual reason phrase (eg. OK). Strictly according to RFC 7230, the whitespace just after the status code number is NOT optional, and in fact Tomcat 8.5 behaves this way, emiting status lines like "HTTP/1.1 200 \n" (note the whitespace after the 200). (#1432)
Diffstat (limited to 'pygments/lexers/textfmts.py')
-rw-r--r--pygments/lexers/textfmts.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/pygments/lexers/textfmts.py b/pygments/lexers/textfmts.py
index bfd053d5..63d1da39 100644
--- a/pygments/lexers/textfmts.py
+++ b/pygments/lexers/textfmts.py
@@ -179,7 +179,7 @@ class HttpLexer(RegexLexer):
bygroups(Name.Function, Text, Name.Namespace, Text,
Keyword.Reserved, Operator, Number, Text),
'headers'),
- (r'(HTTP)(/)(1\.[01]|2|3)( +)(\d{3})(?:( +)([^\r\n]+))?(\r?\n|\Z)',
+ (r'(HTTP)(/)(1\.[01]|2|3)( +)(\d{3})(?:( +)([^\r\n]*))?(\r?\n|\Z)',
bygroups(Keyword.Reserved, Operator, Number, Text, Number, Text,
Name.Exception, Text),
'headers'),