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

Commit e176959

Browse files
committed
Cleanup some aspects of the socket API
1 parent 97b088a commit e176959

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

hyper/http11/response.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,12 @@ def __init__(self, code, reason, headers, sock):
6868
#: once, and never assigned again.
6969
self.headers = headers
7070

71-
# The response trailers. These are always intially ``None``.
72-
self._trailers = None
71+
#: The response trailers. These are always intially ``None``.
72+
self.trailers = None
7373

7474
# The socket this response is being sent over.
7575
self._sock = sock
7676

77-
# We always read in one-data-frame increments from the stream, so we
78-
# may need to buffer some for incomplete reads.
79-
self._data_buffer = b''
80-
8177
# This object is used for decompressing gzipped request bodies. Right
8278
# now we only support gzip because that's all the RFC mandates of us.
8379
# Later we'll add support for more encodings.
@@ -130,19 +126,14 @@ def read(self, amt=None, decode_content=True):
130126

131127
return data
132128

133-
def fileno(self):
134-
"""
135-
Return the ``fileno`` of the underlying socket. This function is
136-
currently not implemented.
137-
"""
138-
raise NotImplementedError("Not currently implemented.")
139-
140129
def close(self):
141130
"""
142-
Close the response. In effect this closes the backing HTTP/2 stream.
131+
Close the response. In effect this closes the backing socket.
143132
144133
:returns: Nothing.
145134
"""
135+
# FIXME: This should notify the parent connection object if possible.
136+
self._sock.close()
146137
self._sock = None
147138

148139
# The following methods implement the context manager protocol.

0 commit comments

Comments
 (0)