Skip to content

Commit

Permalink
bytes/str/bytes/str/bytes...
Browse files Browse the repository at this point in the history
  • Loading branch information
jay0lee committed Sep 9, 2019
1 parent 375e67f commit 7e12123
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fmbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self, msg_bytes):
def get_header(self, header, case_insensitive=False):
if case_insensitive:
header = header.lower()
header_value = ''
header_value = b''
check_folded_header = False
for line in self.msg_bytes.split(b'\n'):
if case_insensitive:
Expand All @@ -29,13 +29,13 @@ def get_header(self, header, case_insensitive=False):
if line.startswith(b' ') or line.startswith(b'\t'):
header_value += line.lstrip()
else:
return header_value
return header_value.decode()
elif line.startswith(b'%s: ' % header):
header_value = line[len(header)+2:].decode()
header_value = line[len(header)+2:]
check_folded_header = True
elif line == '':
return header_value
return header_value
return header_value.decode()
return header_value.decode()

def set_headers(self, headers):
new_msg = b''
Expand Down

0 comments on commit 7e12123

Please sign in to comment.