summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2016-02-02 22:17:15 +0100
committerGeorg Brandl <georg@python.org>2016-02-02 22:17:15 +0100
commitfb564416e672bfa554638293f93d86283da97d26 (patch)
tree3e01539a263358b7ba3f9068309ac29e2027ee96
parent754f32c6ded2d4b4e84674aa012d6ba78ffd5d50 (diff)
downloadpygments-fb564416e672bfa554638293f93d86283da97d26.tar.gz
Fixed statefulness of HttpLexer between get_tokens calls
-rw-r--r--CHANGES1
-rw-r--r--pygments/lexers/textfmts.py5
2 files changed, 6 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index 1e852eec..9cd6c4fb 100644
--- a/CHANGES
+++ b/CHANGES
@@ -29,6 +29,7 @@ Version 2.1.1
- Fixed image formatter font searching on Macs (#1188)
- Fixed deepcopy-ing of Token instances (#1168)
- Fixed Julia string interpolation (#1170)
+- Fixed statefulness of HttpLexer between get_tokens calls
- Many smaller fixes to various lexers
diff --git a/pygments/lexers/textfmts.py b/pygments/lexers/textfmts.py
index 43b16f8c..cab9add5 100644
--- a/pygments/lexers/textfmts.py
+++ b/pygments/lexers/textfmts.py
@@ -122,6 +122,11 @@ class HttpLexer(RegexLexer):
flags = re.DOTALL
+ def get_tokens_unprocessed(self, text, stack=('root',)):
+ """Reset the content-type state."""
+ self.content_type = None
+ return RegexLexer.get_tokens_unprocessed(self, text, stack)
+
def header_callback(self, match):
if match.group(1).lower() == 'content-type':
content_type = match.group(5).strip()