def __read(self):
while 1:
try:
rdata = self.__socket.recv(4096)
except BlockingIOError:
break
except ssl.SSLWantReadError:
break
if self.__ssl_on and not self.__ssl_ok:
if self.__alpn_on:
protocol = self.__socket.selected_alpn_protocol()
if protocol == "h2": self.__is_http2 = True
self.__ssl_ok = True
if rdata:
# if not self.__fd: self.__fd = open("test.txt", "wb")
# self.__fd.write(rdata)
self.__reader._putvalue(rdata)
else:
raise HttpErr("the connection has been closed")
return
评论列表
文章目录