diff options
author | rugk <rugk+git@posteo.de> | 2020-08-23 18:05:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-23 18:05:09 +0200 |
commit | 92e9bddfa5b992d5df7690428f7e119393e88e09 (patch) | |
tree | fef3df690535a60148a9d03e88369823df367b17 | |
parent | 2a762c5fe655a3b3ecc9c52422300b9430110758 (diff) | |
download | pygments-git-92e9bddfa5b992d5df7690428f7e119393e88e09.tar.gz |
Fix HttpLexer to allow 2.0
According to [RFC7540 (section 3.5)](https://tools.ietf.org/html/rfc7540#section-3.5), if I interpret it correctly, it actually even _has to_ start with `2.0` and not `2`.
As HTTP/3 is also defined there, I have not looked into how that has to be used/started.
-rw-r--r-- | pygments/lexers/textfmts.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pygments/lexers/textfmts.py b/pygments/lexers/textfmts.py index abfb39d7..1a7c1623 100644 --- a/pygments/lexers/textfmts.py +++ b/pygments/lexers/textfmts.py @@ -175,11 +175,11 @@ class HttpLexer(RegexLexer): tokens = { 'root': [ (r'(GET|POST|PUT|DELETE|HEAD|OPTIONS|TRACE|PATCH)( +)([^ ]+)( +)' - r'(HTTP)(/)(1\.[01]|2|3)(\r?\n|\Z)', + r'(HTTP)(/)(1\.[01]|2(?:\.0)|3)(\r?\n|\Z)', 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(?:\.0)|3)( +)(\d{3})(?:( +)([^\r\n]*))?(\r?\n|\Z)', bygroups(Keyword.Reserved, Operator, Number, Text, Number, Text, Name.Exception, Text), 'headers'), |