Skip to content

Commit

Permalink
chore: one extra response condition to conn close
Browse files Browse the repository at this point in the history
Makes verification of connection close semantics stricter.
  • Loading branch information
joamag committed May 30, 2024
1 parent 2734645 commit 0a1f285
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/netius/common/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,16 +461,17 @@ def get_encodings(self):

def parse_closed(self):
"""
"Parses" the closed event, which may trigger a changed in state
"Parses" the closed event, which may trigger a changed in parse state
for very specific conditions, which is the case of a plain encoded
connection with no explicit content length defined in HTTP/1.1 or older.
response with no explicit content length defined in HTTP/1.1 or older.
In these situations the closing of a connection should be seen as
the sending of a EOF character (with semantic value).
the sending of an EOF character (with semantic value).
"""

if (
not self.chunked
self.type == RESPONSE
and not self.chunked
and self.content_l == -1
and self.state == MESSAGE_STATE
and self.version
Expand Down

0 comments on commit 0a1f285

Please sign in to comment.