You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

85 lines
4.1 KiB

Author: Alexandre Rossi <alexandre.rossi@gmail.com>
Description: Take into account libevhtp API changes
Forwarded: no
Index: seafile-server/server/upload-file.c
===================================================================
--- seafile-server.orig/server/upload-file.c 2018-02-01 12:25:52.666911934 +0100
+++ seafile-server/server/upload-file.c 2018-02-01 12:27:37.812323399 +0100
@@ -2059,7 +2059,7 @@
/* 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;
}
@@ -2260,8 +2260,8 @@
}
/* 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;
@@ -2277,7 +2277,7 @@
/* 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);
@@ -2346,38 +2346,32 @@
cb = evhtp_set_regex_cb (htp, "^/upload/.*", upload_cb, NULL);
/* upload_headers_cb() will be called after evhtp parsed all http headers. */
- 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-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);
-
- /* 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); */
+ evhtp_callback_set_hook(cb, 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/.*", update_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);
-
- /* 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); */
+ evhtp_callback_set_hook(cb, 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);