Skip to content

build_http_response must always update Content-Length header #1041

Open
@abhinavsingh

Description

@abhinavsingh

Reference

for k, _ in headers.items():
if k.lower() == b'content-length':
has_content_length = True
if k.lower() == b'transfer-encoding':
has_transfer_encoding = True
if body is not None and \
not has_transfer_encoding and \
not has_content_length:
headers[b'Content-Length'] = bytes_(len(body))

If a plugin modifies the response without updating Content-Length header, client may see errors or at worst hang. build_http_response must ensure that Content-Length header matches size of response to be dispatched.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TaskTasks & chores related to proxy.py

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions