From 17d7432fc61425df3069a631914ec3633689664b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 10 Jul 2022 22:57:26 +0100 Subject: [PATCH] Add debug flags --- content.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/content.py b/content.py index b1a0eb20d..113c359fc 100644 --- a/content.py +++ b/content.py @@ -1480,6 +1480,8 @@ def extract_text_fields_in_post(post_bytes, boundary: str, debug: bool, The boundary argument comes from the http header """ if boundary == 'LYNX': + if debug: + print('POST from lynx browser') boundary = '--LYNX' if not unit_test_data: @@ -1513,26 +1515,29 @@ def extract_text_fields_in_post(post_bytes, boundary: str, debug: bool, if '"' not in post_str: continue post_key = post_str.split('"', 1)[0] - print('post_key: ' + post_key) + if debug: + print('post_key: ' + post_key) post_value_str = post_str.split('"', 1)[1] if boundary == '--LYNX': post_value_str = \ post_value_str.replace(lynx_content_type, '') - if 'password' not in post_key: + if debug and 'password' not in post_key: print('boundary: ' + boundary) print('post_value_str1: ' + post_value_str) if ';' in post_value_str: if post_key not in fields_with_semicolon_allowed and \ not post_key.startswith('edited'): - print('exit 1') + if debug: + print('extract_text_fields_in_post exit 1') continue - if 'password' not in post_key: + if debug and 'password' not in post_key: print('post_value_str2: ' + post_value_str) if '\r\n' not in post_value_str: - print('exit 2') + if debug: + print('extract_text_fields_in_post exit 2') continue post_lines = post_value_str.split('\r\n') - if 'password' not in post_key: + if debug and 'password' not in post_key: print('post_lines: ' + str(post_lines)) post_value = '' if len(post_lines) > 2: