Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit 08a74e4

Browse files
committed
Docstrings and comment updates for #80.
1 parent 82a2f33 commit 08a74e4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

hyper/http20/connection.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,16 @@ def _consume_single_frame(self):
487487
self._consume_frame_payload(frame, data)
488488

489489
def _recv_payload(self, length):
490+
"""
491+
This receive function handles the situation where the underlying socket
492+
has not received the full set of data. It spins on calling `recv`
493+
until the full quantity of data is available before returning.
494+
495+
Note that this function makes us vulnerable to a DoS attack, where a
496+
server can send part of a frame and then swallow the rest. We should
497+
add support for socket timeouts here at some stage.
498+
"""
499+
# TODO: Fix DoS risk.
490500
if not length:
491501
return memoryview(b'')
492502

@@ -507,6 +517,9 @@ def _recv_payload(self, length):
507517
return buffer_view[:end]
508518

509519
def _consume_frame_payload(self, frame, data):
520+
"""
521+
This builds and handles a frame.
522+
"""
510523
frame.parse_body(data)
511524

512525
log.info(

0 commit comments

Comments
 (0)