Author: Alexandre Rossi <alexandre.rossi@gmail.com>
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

Index: seafile-server/server/access-file.c
===================================================================
--- seafile-server.orig/server/access-file.c	2018-02-01 12:23:53.209308343 +0100
+++ seafile-server/server/access-file.c	2018-02-01 12:23:53.205308288 +0100
@@ -618,7 +618,7 @@
     /* 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);
@@ -967,7 +967,7 @@
     /* 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);
@@ -1032,7 +1032,7 @@
     /* 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);
@@ -1365,7 +1365,7 @@
     /* 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);
Index: seafile-server/server/upload-file.c
===================================================================
--- seafile-server.orig/server/upload-file.c	2018-02-01 12:23:53.209308343 +0100
+++ seafile-server/server/upload-file.c	2018-02-01 12:25:14.542400155 +0100
@@ -2054,6 +2054,7 @@
     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.
@@ -2271,6 +2272,7 @@
 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.
