diff options
author | Henrique <typoon@gmail.com> | 2019-11-12 21:44:07 -0500 |
---|---|---|
committer | Henrique <typoon@gmail.com> | 2019-11-12 21:44:07 -0500 |
commit | a9596cabe34b07ac45df644c00d57bf1116b8c3e (patch) | |
tree | c99ef1ad9b58f437e9c2c0ff0a2fd811b671a260 | |
parent | 561415cea99c46dd5df892bcac148931f70ff3b0 (diff) | |
download | mitmproxy-a9596cabe34b07ac45df644c00d57bf1116b8c3e.tar.gz mitmproxy-a9596cabe34b07ac45df644c00d57bf1116b8c3e.tar.bz2 mitmproxy-a9596cabe34b07ac45df644c00d57bf1116b8c3e.zip |
Small fix to handle line breaks and tabs \r\n\t
-rw-r--r-- | mitmproxy/lexer.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mitmproxy/lexer.py b/mitmproxy/lexer.py index 5187a718..31ae382c 100644 --- a/mitmproxy/lexer.py +++ b/mitmproxy/lexer.py @@ -69,6 +69,8 @@ class Lexer: text = self.text i = 0 + whitespace = "\r\n\t " + #self.text.seek(self._text_pos) while True: @@ -98,7 +100,7 @@ class Lexer: self._state = self._states.pop() elif self._state == State.TEXT: - if ch == ' ': + if ch in whitespace: if acc != '': break elif ch == '"' or ch == "'": @@ -141,6 +143,7 @@ if __name__ == '__main__': cases.append(r' ') cases.append(r' ') cases.append(r'Hello World ') + cases.append('\n\n\rHello\n World With Spaces\n\n') for s in cases: lex = Lexer(s) |