File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -149,18 +149,18 @@ async def _read_frame(self):
149149 raise WebSocketError ('Websocket connection closed' )
150150 fin , opcode , has_mask , length = self ._parse_frame_header (header )
151151 if length == - 2 :
152- length = await self .request .sock [0 ].read (2 )
152+ length = await self .request .sock [0 ].readexactly (2 )
153153 length = int .from_bytes (length , 'big' )
154154 elif length == - 8 :
155- length = await self .request .sock [0 ].read (8 )
155+ length = await self .request .sock [0 ].readexactly (8 )
156156 length = int .from_bytes (length , 'big' )
157157 max_allowed_length = Request .max_body_length \
158158 if self .max_message_length == - 1 else self .max_message_length
159159 if length > max_allowed_length :
160160 raise WebSocketError ('Message too large' )
161161 if has_mask : # pragma: no cover
162- mask = await self .request .sock [0 ].read (4 )
163- payload = await self .request .sock [0 ].read (length )
162+ mask = await self .request .sock [0 ].readexactly (4 )
163+ payload = await self .request .sock [0 ].readexactly (length )
164164 if has_mask : # pragma: no cover
165165 payload = bytes (x ^ mask [i % 4 ] for i , x in enumerate (payload ))
166166 return opcode , payload
You can’t perform that action at this time.
0 commit comments