Fix memory leak of Stream objects in HTTP20Connection

This commit is contained in:
Lazarev Ivan
2016-12-25 01:34:45 +03:00
committed by Sergey Petrov
parent 15ca6f6b62
commit 92a04546f9
+1
View File
@@ -37,6 +37,7 @@ class APNsClient(object):
url = '/3/device/{}'.format(token_hex) url = '/3/device/{}'.format(token_hex)
stream_id = self.__connection.request('POST', url, json_payload, headers) stream_id = self.__connection.request('POST', url, json_payload, headers)
resp = self.__connection.get_response(stream_id) resp = self.__connection.get_response(stream_id)
with resp:
if resp.status != 200: if resp.status != 200:
raw_data = resp.read().decode('utf-8') raw_data = resp.read().decode('utf-8')
data = json.loads(raw_data) data = json.loads(raw_data)