Skip to content

Commit

Permalink
Fix #949 (#950)
Browse files Browse the repository at this point in the history
Add missing UTF8 encoding when computing the content length.
  • Loading branch information
marina-p authored Feb 11, 2025
1 parent 3243900 commit fd2ff80
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion restler/engine/transport_layer/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ def _append_to_header(message, content):

if "Content-Length: " not in message:
try:
contentlen = len(message[_get_start_of_body(message):])
body = message[_get_start_of_body(message):]
contentlen = len(body.encode(UTF8))
message = _append_to_header(message, f"Content-Length: {contentlen}")
except Exception as error:
RAW_LOGGING(f'Failed to append Content-Length header to message: {message!r}\n')
Expand Down

0 comments on commit fd2ff80

Please sign in to comment.