Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade seafile-server to Libevhtp version 1.2.16 #119

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ ZDB_REQUIRED=2.10
CURL_REQUIRED=7.17
FUSE_REQUIRED=2.7.3
ZLIB_REQUIRED=1.2.0
LIBEVHTP_REQUIRED=1.2.16
ONIGURUMA_REQUIRED=5.9.2

PKG_CHECK_MODULES(SSL, [openssl])
AC_SUBST(SSL_CFLAGS)
Expand Down Expand Up @@ -222,6 +224,14 @@ PKG_CHECK_MODULES(ZLIB, [zlib >= $ZLIB_REQUIRED])
AC_SUBST(ZLIB_CFLAGS)
AC_SUBST(ZLIB_LIBS)

PKG_CHECK_MODULES(LIBEVHTP, [evhtp >= $LIBEVHTP_REQUIRED])
AC_SUBST(LIBEVHTP_CFLAGS)
AC_SUBST(LIBEVHTP_LIBS)

PKG_CHECK_MODULES(ONIGURUMA, [oniguruma >= $ONIGURUMA_REQUIRED])
AC_SUBST(ONIGURUMA_CFLAGS)
AC_SUBST(ONIGURUMA_LIBS)

if test x${compile_python} = xyes; then
AM_PATH_PYTHON([2.6])
if test "$bwin32" = true; then
Expand Down
2 changes: 1 addition & 1 deletion server/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ seaf_server_SOURCES = \

seaf_server_LDADD = @CCNET_LIBS@ \
$(top_builddir)/lib/libseafile_common.la \
@GLIB2_LIBS@ @GOBJECT_LIBS@ @SSL_LIBS@ @LIB_RT@ @LIB_UUID@ -lsqlite3 @LIBEVENT_LIBS@ -levhtp \
@ONIGURUMA_LIBS@ @GLIB2_LIBS@ @GOBJECT_LIBS@ @SSL_LIBS@ @LIB_RT@ @LIB_UUID@ -lsqlite3 @LIBEVENT_LIBS@ @LIBEVHTP_LIBS@ \
$(top_builddir)/common/cdc/libcdc.la \
$(top_builddir)/common/db-wrapper/libdbwrapper.la \
@SEARPC_LIBS@ @JANSSON_LIBS@ ${LIB_WS32} @ZLIB_LIBS@ \
Expand Down
2 changes: 1 addition & 1 deletion server/http-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -2122,7 +2122,7 @@ http_server_run (void *arg)

http_request_init (server);

evhtp_use_threads (priv->evhtp, NULL, server->worker_threads, NULL);
evhtp_use_threads_wexit (priv->evhtp, NULL, NULL, server->worker_threads, NULL);

struct timeval tv;
tv.tv_sec = CLEANING_INTERVAL_SEC;
Expand Down
30 changes: 15 additions & 15 deletions server/upload-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -2053,7 +2053,7 @@ upload_read_cb (evhtp_request_t *req, evbuf_t *buf, void *arg)
/* Set keepalive to 0. This will cause evhtp to close the
* connection after sending the reply.
*/
req->keepalive = 0;
evhtp_request_set_keepalive(req, 0);

fsm->state = RECV_ERROR;
}
Expand Down Expand Up @@ -2254,8 +2254,8 @@ upload_headers_cb (evhtp_request_t *req, evhtp_headers_t *hdr, void *arg)
}

/* 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;

Expand All @@ -2270,7 +2270,7 @@ upload_headers_cb (evhtp_request_t *req, evhtp_headers_t *hdr, void *arg)
/* Set keepalive to 0. This will cause evhtp to close the
* connection after sending the reply.
*/
req->keepalive = 0;
evhtp_request_set_keepalive(req, 0);
send_error_reply (req, EVHTP_RES_BADREQ, err_msg);

g_free (repo_id);
Expand Down Expand Up @@ -2339,38 +2339,38 @@ upload_file_init (evhtp_t *htp, const char *http_temp_dir)

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);
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);
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);
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);
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);

Expand Down