Author: Alexandre Rossi Description: Fix download stalling on recent libevhtp A while ago[1], evhtp_request_pause() behavior changed: it now disables both read and write events. seafile-server would then stall. . [1] https://github.com/criticalstack/libevhtp/commit/6cd89466fd6bd76c5b8624be65af5893afe3e40c [2] https://github.com/haiwen/seafile/issues/1119 Forwarded: no --- a/server/access-file.c +++ b/server/access-file.c @@ -661,7 +661,7 @@ do_file(evhtp_request_t *req, SeafRepo * /* Block any new request from this connection before finish * handling this request. */ - evhtp_request_pause (req); + bufferevent_disable(bev, EV_READ); /* Kick start data transfer by sending out http headers. */ evhtp_send_reply_start(req, EVHTP_RES_OK); @@ -1021,7 +1021,7 @@ do_file_range (evhtp_request_t *req, Sea /* Block any new request from this connection before finish * handling this request. */ - evhtp_request_pause (req); + bufferevent_disable(bev, EV_READ); /* Kick start data transfer by sending out http headers. */ evhtp_send_reply_start(req, EVHTP_RES_PARTIAL); @@ -1091,7 +1091,7 @@ start_download_zip_file (evhtp_request_t /* Block any new request from this connection before finish * handling this request. */ - evhtp_request_pause (req); + bufferevent_disable(bev, EV_READ); /* Kick start data transfer by sending out http headers. */ evhtp_send_reply_start(req, EVHTP_RES_OK); @@ -1435,7 +1435,7 @@ do_block(evhtp_request_t *req, SeafRepo /* Block any new request from this connection before finish * handling this request. */ - evhtp_request_pause (req); + bufferevent_disable(bev, EV_READ); /* Kick start data transfer by sending out http headers. */ evhtp_send_reply_start(req, EVHTP_RES_OK); --- a/server/upload-file.c +++ b/server/upload-file.c @@ -2196,6 +2196,7 @@ out: if (res != EVHTP_RES_OK) { /* Don't receive any data before the connection is closed. */ //evhtp_request_pause (req); + // or for later evhtp bufferevent_disable(evhtp_request_get_bev(req), EV_READ); /* Set keepalive to 0. This will cause evhtp to close the * connection after sending the reply. @@ -2513,6 +2514,7 @@ upload_headers_cb (evhtp_request_t *req, err: /* Don't receive any data before the connection is closed. */ //evhtp_request_pause (req); + // or for later evhtp bufferevent_disable(evhtp_request_get_bev(req), EV_READ); /* Set keepalive to 0. This will cause evhtp to close the * connection after sending the reply.