Author: Alexandre Rossi <alexandre.rossi@gmail.com>
Description: Take into account libevhtp API changes
Forwarded: no

--- a/server/upload-file.c
+++ b/server/upload-file.c
@@ -2201,7 +2201,7 @@ out:
         /* Set keepalive to 0. This will cause evhtp to close the
          * connection after sending the reply.
          */
-        req->keepalive = 0;
+        req->flags &= ~EVHTP_REQ_FLAG_KEEPALIVE;
 
         fsm->state = RECV_ERROR;
     }
@@ -2502,8 +2502,8 @@ upload_headers_cb (evhtp_request_t *req,
     }
 
     /* Set up per-request hooks, so that we can read file data piece by piece. */
-    evhtp_set_hook (&req->hooks, evhtp_hook_on_read, upload_read_cb, fsm);
-    evhtp_set_hook (&req->hooks, evhtp_hook_on_request_fini, upload_finish_cb, fsm);
+    evhtp_request_set_hook (req, evhtp_hook_on_read, upload_read_cb, fsm);
+    evhtp_request_set_hook (req, evhtp_hook_on_request_fini, upload_finish_cb, fsm);
     /* Set arg for upload_cb or update_cb. */
     req->cbarg = fsm;
 
@@ -2519,7 +2519,7 @@ err:
     /* Set keepalive to 0. This will cause evhtp to close the
      * connection after sending the reply.
      */
-    req->keepalive = 0;
+    req->flags &= ~EVHTP_REQ_FLAG_KEEPALIVE;
     send_error_reply (req, EVHTP_RES_BADREQ, err_msg);
 
     g_free (repo_id);
@@ -2620,32 +2620,32 @@ upload_file_init (evhtp_t *htp, const ch
     g_free (cluster_shared_dir);
 
     cb = evhtp_set_regex_cb (htp, "^/upload-api/.*", upload_api_cb, NULL);
-    evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+    evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
 
     cb = evhtp_set_regex_cb (htp, "^/upload-raw-blks-api/.*",
                              upload_raw_blks_api_cb, NULL);
-    evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+    evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
 
     cb = evhtp_set_regex_cb (htp, "^/upload-blks-api/.*", upload_blks_api_cb, NULL);
-    evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+    evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
 
     /* cb = evhtp_set_regex_cb (htp, "^/upload-blks-aj/.*", upload_blks_ajax_cb, NULL); */
     /* evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL); */
 
     cb = evhtp_set_regex_cb (htp, "^/upload-aj/.*", upload_ajax_cb, NULL);
-    evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+    evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
 
     cb = evhtp_set_regex_cb (htp, "^/update-api/.*", update_api_cb, NULL);
-    evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+    evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
 
     cb = evhtp_set_regex_cb (htp, "^/update-blks-api/.*", update_blks_api_cb, NULL);
-    evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+    evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
 
     /* cb = evhtp_set_regex_cb (htp, "^/update-blks-aj/.*", update_blks_ajax_cb, NULL); */
     /* evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL); */
 
     cb = evhtp_set_regex_cb (htp, "^/update-aj/.*", update_ajax_cb, NULL);
-    evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+    evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
 
     evhtp_set_regex_cb (htp, "^/upload_progress.*", upload_progress_cb, NULL);
 
