File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -483,7 +483,7 @@ async def _prepare_headers(self) -> None:
483
483
headers [hdrs .TRANSFER_ENCODING ] = "chunked"
484
484
if hdrs .CONTENT_LENGTH in headers :
485
485
del headers [hdrs .CONTENT_LENGTH ]
486
- elif self ._length_check :
486
+ elif self ._length_check : # Disabled for WebSockets
487
487
writer .length = self .content_length
488
488
if writer .length is None :
489
489
if version >= HttpVersion11 :
@@ -504,7 +504,7 @@ async def _prepare_headers(self) -> None:
504
504
# https://datatracker.ietf.org/doc/html/rfc9112#section-6.1-13
505
505
if hdrs .TRANSFER_ENCODING in headers :
506
506
del headers [hdrs .TRANSFER_ENCODING ]
507
- elif self .content_length != 0 :
507
+ elif ( writer . length if self ._length_check else self . content_length ) != 0 :
508
508
# https://www.rfc-editor.org/rfc/rfc9110#section-8.3-5
509
509
headers .setdefault (hdrs .CONTENT_TYPE , "application/octet-stream" )
510
510
headers .setdefault (hdrs .DATE , rfc822_formatted_time ())
You can’t perform that action at this time.
0 commit comments