Add debug flags

main
Bob Mottram 2022-07-10 22:57:26 +01:00
parent 5d0192732c
commit 17d7432fc6
1 changed files with 11 additions and 6 deletions

View File

@ -1480,6 +1480,8 @@ def extract_text_fields_in_post(post_bytes, boundary: str, debug: bool,
The boundary argument comes from the http header The boundary argument comes from the http header
""" """
if boundary == 'LYNX': if boundary == 'LYNX':
if debug:
print('POST from lynx browser')
boundary = '--LYNX' boundary = '--LYNX'
if not unit_test_data: 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: if '"' not in post_str:
continue continue
post_key = post_str.split('"', 1)[0] post_key = post_str.split('"', 1)[0]
if debug:
print('post_key: ' + post_key) print('post_key: ' + post_key)
post_value_str = post_str.split('"', 1)[1] post_value_str = post_str.split('"', 1)[1]
if boundary == '--LYNX': if boundary == '--LYNX':
post_value_str = \ post_value_str = \
post_value_str.replace(lynx_content_type, '') 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('boundary: ' + boundary)
print('post_value_str1: ' + post_value_str) print('post_value_str1: ' + post_value_str)
if ';' in post_value_str: if ';' in post_value_str:
if post_key not in fields_with_semicolon_allowed and \ if post_key not in fields_with_semicolon_allowed and \
not post_key.startswith('edited'): not post_key.startswith('edited'):
print('exit 1') if debug:
print('extract_text_fields_in_post exit 1')
continue continue
if 'password' not in post_key: if debug and 'password' not in post_key:
print('post_value_str2: ' + post_value_str) print('post_value_str2: ' + post_value_str)
if '\r\n' not in 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 continue
post_lines = post_value_str.split('\r\n') 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)) print('post_lines: ' + str(post_lines))
post_value = '' post_value = ''
if len(post_lines) > 2: if len(post_lines) > 2: