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
commite59c3bf66fb13a9efc25c3a8e2396804f32ca1e5 (patch)
tree7664ec8263066d1db73d069233e2af5516966181
parent923fbfedc8467761491d4adeba1f5f00a11239eb (diff)
downloadpygments-e59c3bf66fb13a9efc25c3a8e2396804f32ca1e5.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 698868ca..395515a2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -17,6 +17,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()