File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -102,9 +102,25 @@ def poll(self):
102
102
conn , _ = self ._sock .accept ()
103
103
with conn :
104
104
conn .settimeout (self ._timeout )
105
- length , _ = conn .recvfrom_into (self ._buffer )
106
-
107
- request = HTTPRequest (raw_request = self ._buffer [:length ])
105
+ received_data = bytearray ()
106
+
107
+ # Receiving data until timeout
108
+ while "Receiving data" :
109
+ try :
110
+ length = conn .recv_into (self ._buffer )
111
+ received_data += self ._buffer [:length ]
112
+ except OSError as ex :
113
+ if ex .errno == ETIMEDOUT :
114
+ break
115
+ except Exception as ex :
116
+ raise ex
117
+
118
+ # Return if no data received
119
+ if not received_data :
120
+ return
121
+
122
+ # Parsing received data
123
+ request = HTTPRequest (raw_request = received_data )
108
124
109
125
handler = self .route_handlers .get (
110
126
_HTTPRoute (request .path , request .method ), None
You can’t perform that action at this time.
0 commit comments