Timeout clients sending http body data too slow
This commit is contained in:
+9
-1
@@ -175,7 +175,9 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If we have not responded and we have a data handler, we need to timeout to enfore client sending the data */
|
/* If we have not responded and we have a data handler, we need to timeout to enfore client sending the data */
|
||||||
|
if (!((HttpResponse<SSL> *) s)->hasResponded() && httpResponseData->inStream) {
|
||||||
|
us_new_socket_timeout(SSL, (us_new_socket_t *) s, HTTP_IDLE_TIMEOUT_S);
|
||||||
|
}
|
||||||
|
|
||||||
/* Continue parsing */
|
/* Continue parsing */
|
||||||
return s;
|
return s;
|
||||||
@@ -183,6 +185,12 @@ private:
|
|||||||
}, [httpResponseData](void *user, std::string_view data, bool fin) -> void * {
|
}, [httpResponseData](void *user, std::string_view data, bool fin) -> void * {
|
||||||
/* We always get an empty chunk even if there is no data */
|
/* We always get an empty chunk even if there is no data */
|
||||||
if (httpResponseData->inStream) {
|
if (httpResponseData->inStream) {
|
||||||
|
|
||||||
|
/* Getting a chunk of data while having a data handler should reset timeout (todo: if last, short timeout, if not last, bigger timeout) */
|
||||||
|
/* Really, we only need to reset timeout to the larger delay if we are not fin */
|
||||||
|
us_new_socket_timeout(SSL, (us_new_socket_t *) s, HTTP_IDLE_TIMEOUT_S);
|
||||||
|
|
||||||
|
/* We might respond in the handler, so do not change timeout after this */
|
||||||
httpResponseData->inStream(data, fin);
|
httpResponseData->inStream(data, fin);
|
||||||
|
|
||||||
/* Was the socket closed? */
|
/* Was the socket closed? */
|
||||||
|
|||||||
Reference in New Issue
Block a user