1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00

Call libwebsocket_set_timeout() before callback LWS_CALLBACK_HTTP.

This allows the LWS_CALLBACK_HTTP callback to override the timeout
with libwebsocket_set_timeout() if it wants.
This commit is contained in:
Craig McQueen 2014-02-20 10:27:11 +11:00
parent 03bb8f9045
commit e63a482e13

View file

@ -256,10 +256,20 @@ http_postbody:
LWS_CALLBACK_FILTER_HTTP_CONNECTION,
wsi->user_space, uri_ptr, uri_len);
if (!n && wsi->protocol->callback)
n = wsi->protocol->callback(context, wsi,
LWS_CALLBACK_HTTP,
wsi->user_space, uri_ptr, uri_len);
if (!n) {
/*
* if there is content supposed to be coming,
* put a timeout on it having arrived
*/
libwebsocket_set_timeout(wsi,
PENDING_TIMEOUT_HTTP_CONTENT,
AWAITING_TIMEOUT);
if (wsi->protocol->callback)
n = wsi->protocol->callback(context, wsi,
LWS_CALLBACK_HTTP,
wsi->user_space, uri_ptr, uri_len);
}
leave:
/* now drop the header info we kept a pointer to */
@ -269,18 +279,11 @@ leave:
wsi->u.http.ah = NULL;
if (n) {
libwebsocket_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
lwsl_info("LWS_CALLBACK_HTTP closing\n");
goto bail; /* struct ah ptr already nuked */
}
/*
* if there is content supposed to be coming,
* put a timeout on it having arrived
*/
libwebsocket_set_timeout(wsi,
PENDING_TIMEOUT_HTTP_CONTENT,
AWAITING_TIMEOUT);
/*
* (if callback didn't start sending a file)
* deal with anything else as body, whether