From a9596cabe34b07ac45df644c00d57bf1116b8c3e Mon Sep 17 00:00:00 2001 From: Henrique Date: Tue, 12 Nov 2019 21:44:07 -0500 Subject: Small fix to handle line breaks and tabs \r\n\t --- mitmproxy/lexer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'mitmproxy') 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) -- cgit v1.2.3