patch seafile-server to work with recent libevhtp
based on patchset from https://github.com/haiwen/seafile-server/pull/119 and adapted to recent seafile-server version
This commit is contained in:
parent
518d4fd1c2
commit
990d57ca20
|
@ -6,22 +6,25 @@
|
||||||
}:
|
}:
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "libevhtp";
|
name = "libevhtp";
|
||||||
version = "1.2.15";
|
version = "1.2.18";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "ellzey";
|
owner = "criticalstack";
|
||||||
repo = "libevhtp";
|
repo = "libevhtp";
|
||||||
rev = version;
|
rev = version;
|
||||||
sha256 = "01c4l77arph8qyrhak4ik6kf60wb5msymqmfl4w7gzmgns2n0p89";
|
sha256 = "sha256:085yzrawn0gkfgiz02vwmlhawyaba4yqx98q3y4p95fhzs5wqwcb";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
buildInputs = [ libevent openssl pth oniguruma ];
|
buildInputs = [ libevent pth openssl ];
|
||||||
|
propagatedBuildInputs = [ oniguruma ];
|
||||||
|
cmakeFlags = [ "-DEVHTP_DISABLE_SSL=OFF" "-DEVHTP_BUILD_SHARED=ON" ];
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Create extremely-fast and secure embedded HTTP servers with ease.";
|
description = "Create extremely-fast and secure embedded HTTP servers with ease.";
|
||||||
homepage = "https://github.com/ellzey/libevhtp";
|
homepage = "https://github.com/ellzey/libevhtp";
|
||||||
license = lib.licenses.bsd3;
|
license = lib.licenses.bsd3;
|
||||||
|
platforms = lib.platforms.unix;
|
||||||
maintainers = with lib.maintainers; [ schmittlauch ];
|
maintainers = with lib.maintainers; [ schmittlauch ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{ stdenv, lib, fetchFromGitHub,
|
{ stdenv, lib, fetchFromGitHub,
|
||||||
autoconf, automake, autoreconfHook, pkgconfig, curl, libevent, glib, libuuid, intltool, sqlite, withMysql ? true, libmysql, libarchive, libtool, jansson, vala, fuse, openssl, libevhtp, ccnet, libsearpc,
|
autoconf, automake, autoreconfHook, pkgconfig, curl, libevent, glib, libuuid, intltool, sqlite, withMysql ? true, libmysql, libarchive, libtool, jansson, vala, fuse, openssl, libevhtp, ccnet, libsearpc, which,
|
||||||
# for SeaHub
|
# for SeaHub
|
||||||
python27, python27Packages }:
|
python27, python27Packages }:
|
||||||
|
|
||||||
|
@ -14,8 +14,13 @@
|
||||||
rev = "v${version}-server";
|
rev = "v${version}-server";
|
||||||
sha256 = "sha256:0r3vw145vzhbipwk4cyj1h7sb3szy5hcp36n3pf2jxpwy365ir92";
|
sha256 = "sha256:0r3vw145vzhbipwk4cyj1h7sb3szy5hcp36n3pf2jxpwy365ir92";
|
||||||
};
|
};
|
||||||
nativeBuildInputs = [ autoconf automake libtool pkgconfig autoreconfHook ];
|
# patch to work with latest, non-vulnerable libevhtp
|
||||||
buildInputs = [ sqlite glib python27 libuuid openssl ccnet fuse libarchive ];
|
patches = [
|
||||||
|
./recent_libevhtp.patch
|
||||||
|
];
|
||||||
|
# `which` is called directly from python during buildPhase, so we need the binary
|
||||||
|
nativeBuildInputs = [ autoconf automake libtool pkgconfig vala autoreconfHook which ];
|
||||||
|
buildInputs = [ sqlite glib python27 libuuid openssl fuse libarchive ccnet-server libevent libsearpc libevhtp ];
|
||||||
checkPhase = "bash ./run_tests.sh";
|
checkPhase = "bash ./run_tests.sh";
|
||||||
};
|
};
|
||||||
seahub = python27Packages.buildPythonApplication rec {
|
seahub = python27Packages.buildPythonApplication rec {
|
||||||
|
@ -25,7 +30,7 @@
|
||||||
owner = "haiwen";
|
owner = "haiwen";
|
||||||
repo = "seahub";
|
repo = "seahub";
|
||||||
rev = "v${version}-server";
|
rev = "v${version}-server";
|
||||||
sha256 = "1l4rmkdh0mcxjmm5fiz3frqm4wyq4pbdg9pwmb82f1q64ph9pjy2";
|
sha256 = "sha256:1aypbqrv30x9mmhiwcmkmzmac0mw0gx7cb1n4x90h46iqlbanhnq";
|
||||||
};
|
};
|
||||||
phases = [ "installPhase" "fixupPhase" "distPhase" ];
|
phases = [ "installPhase" "fixupPhase" "distPhase" ];
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
@ -57,20 +62,14 @@
|
||||||
owner = "haiwen";
|
owner = "haiwen";
|
||||||
repo = "ccnet-server";
|
repo = "ccnet-server";
|
||||||
rev = "v${version}-server";
|
rev = "v${version}-server";
|
||||||
sha256 = "sha256:0yfq8fvz17l0295kkpj95f33gwm31ikyhymxq4fy088q608vd8g5";
|
sha256 = "sha256:1iazjy013gjz4kg5xxzs9gsyyva9pyjlmslmrkcbkcj1a94g3pwc";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ vala libsearpc libuuid sqlite openssl libevent glib python27 ]
|
buildInputs = [ vala libsearpc libuuid sqlite openssl libevent glib python27 ]
|
||||||
++ lib.optional (!withMysql) "--without-mysql";
|
++ lib.optional (!withMysql) "--without-mysql";
|
||||||
nativeBuildInputs = [ autoconf automake libtool pkgconfig autoreconfHook ];
|
# `which` is called directly from python during buildPhase, so we need the binary
|
||||||
|
nativeBuildInputs = [ autoconf automake libtool pkgconfig autoreconfHook which ];
|
||||||
configureFlags = [ "--disable-static" ];
|
configureFlags = [ "--disable-static" ];
|
||||||
# generate required searpc header files
|
|
||||||
preBuildPhases = [ "searpcHeadergenPhase" ];
|
|
||||||
searpcHeadergenPhase = ''
|
|
||||||
cd ./lib/
|
|
||||||
python2 ${libsearpc}/bin/searpc-codegen.py rpc_table.py
|
|
||||||
cd ..
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Internal communication framework and user/group management for Seafile server";
|
description = "Internal communication framework and user/group management for Seafile server";
|
||||||
|
@ -86,5 +85,5 @@
|
||||||
++ lib.optional withMysql libmysql;
|
++ lib.optional withMysql libmysql;
|
||||||
phases = [ "installPhase" "fixupPhase" "distPhase" ];
|
phases = [ "installPhase" "fixupPhase" "distPhase" ];
|
||||||
# todo: create data directory in /srv in activation script
|
# todo: create data directory in /srv in activation script
|
||||||
inherit ccnet-server;
|
inherit seafile-server-core;
|
||||||
}
|
}
|
||||||
|
|
166
seafile-server/recent_libevhtp.patch
Normal file
166
seafile-server/recent_libevhtp.patch
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
From 8c3ee18d3eaf3e8a00dce677386dfae649ea309e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ultima1252 <ultima1252@gmail.com>
|
||||||
|
Date: Mon, 15 Jan 2018 17:05:52 -0800
|
||||||
|
Subject: [PATCH] Update http-server.c
|
||||||
|
|
||||||
|
diff --git a/server/http-server.c b/server/http-server.c
|
||||||
|
index b0319b9..fdfe8fe 100644
|
||||||
|
--- a/server/http-server.c
|
||||||
|
+++ b/server/http-server.c
|
||||||
|
@@ -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;
|
||||||
|
|
||||||
|
From 84038d1665423b5d72ee840318a337a1907c693b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ultima1252 <ultima1252@gmail.com>
|
||||||
|
Date: Mon, 15 Jan 2018 17:13:02 -0800
|
||||||
|
Subject: [PATCH] Update upload-file.c
|
||||||
|
|
||||||
|
---
|
||||||
|
server/upload-file.c | 30 +++++++++++++++---------------
|
||||||
|
1 file changed, 15 insertions(+), 15 deletions(-)
|
||||||
|
adjusted by schmittlauch
|
||||||
|
|
||||||
|
diff --git a/server/upload-file.c b/server/upload-file.c
|
||||||
|
index 21f955a..0606b28 100755
|
||||||
|
--- a/server/upload-file.c
|
||||||
|
+++ b/server/upload-file.c
|
||||||
|
@@ -2266,7 +2266,7 @@ out:
|
||||||
|
/* 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;
|
||||||
|
}
|
||||||
|
@@ -2550,8 +2550,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;
|
||||||
|
|
||||||
|
@@ -2566,7 +2566,7 @@ err:
|
||||||
|
/* 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);
|
||||||
|
@@ -2667,32 +2667,32 @@ upload_file_init (evhtp_t *htp, const char *http_temp_dir)
|
||||||
|
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); */
|
||||||
|
+ /* 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-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);
|
||||||
|
|
||||||
|
From b6c41aae74f1eb285a033125f4a5af578c8efbb6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ultima1252 <ultima1252@gmail.com>
|
||||||
|
Date: Mon, 15 Jan 2018 17:13:57 -0800
|
||||||
|
Subject: [PATCH] Update Makefile.am
|
||||||
|
|
||||||
|
---
|
||||||
|
server/Makefile.am | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/server/Makefile.am b/server/Makefile.am
|
||||||
|
index 2491f5e..dd695bd 100644
|
||||||
|
--- a/server/Makefile.am
|
||||||
|
+++ b/server/Makefile.am
|
||||||
|
@@ -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@ \
|
||||||
|
|
||||||
|
From bb2cd57f39450db39c1b6b222b06ac7987f3cd32 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ultima1252 <ultima1252@gmail.com>
|
||||||
|
Date: Mon, 15 Jan 2018 17:17:27 -0800
|
||||||
|
Subject: [PATCH] Update configure.ac
|
||||||
|
|
||||||
|
---
|
||||||
|
configure.ac | 10 ++++++++++
|
||||||
|
1 file changed, 10 insertions(+)
|
||||||
|
rebased by schmittlauch
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index c6fef89..78dece3 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -194,6 +194,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)
|
||||||
|
@@ -227,6 +229,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${MYSQL_CONFIG}" = "xdefault_mysql_config"; then
|
||||||
|
PKG_CHECK_MODULES(MYSQL, [mysqlclient], [have_mysql="yes"], [have_mysql="no"])
|
||||||
|
if test "x${have_mysql}" = "xyes"; then
|
||||||
|
if test "x${have_mysql}" = "xyes"; then
|
Loading…
Reference in a new issue