[dgit import tarball webdis 0.1.4+dfsg-1+rpi1 webdis_0.1.4+dfsg-1+rpi1.debian.tar.xz]
--- /dev/null
+webdis (0.1.4+dfsg-1+rpi1) bullseye-staging; urgency=medium
+
+ * Disable testsuite.
+
+ -- Peter Michael Green <plugwash@raspbian.org> Tue, 19 Nov 2019 08:28:46 +0000
+
+webdis (0.1.4+dfsg-1) unstable; urgency=medium
+
+ * New upstream version 0.1.4+dfsg
+ * d/control, d/copyright: update maintainers email and proper name spelling.
+ * Raise compat level to 11.
+ * d/control: remove explicit *-dbg package definition.
+ * d/control: bump Standards-Version to 4.2.0.
+ * d/control: update Vcs-* fields to point to salsa.d.o.
+ * d/control: add Rules-Requires-Root header set to no.
+ * d/control: add direct build dependency on pkg-config.
+ * d/webdis.install: no need to explicitly install webdis binary.
+ * d/rules: remove DESTDIR and CONFDIR vars setup by hand.
+ * d/rules: avoid installing webdis.prod.json from upstream.
+ * d/control, d/rules: remove trailing whitespace.
+ * d/control: remote unnecessary Testsuite header.
+ * d/copyright: use https protocol.
+ * Add systemd service configuration.
+ * d/patches/fix-test-new-libevent.patch: fix pubsub test when compiled w/
+ libevent 2.1.x. (Closes: #869951, #901555)
+ * d/rules: use /usr/share/dpkg/buildflags.mk to populate build flags.
+ * Fix lintian typo check
+
+ -- Andrii Senkovych <andrii@senkovych.com> Sun, 26 Aug 2018 15:30:36 +0300
+
+webdis (0.1.2+dfsg-2) unstable; urgency=medium
+
+ * Update testsuite variable names. Fixup to sockstat
+ * Remove dependency on netstat or sockstat to run the tests
+
+ -- Andriy Senkovych <jolly_roger@itblog.org.ua> Thu, 17 Nov 2016 00:46:01 +0200
+
+webdis (0.1.2+dfsg-1) unstable; urgency=medium
+
+ * New upstream version 0.1.2+dfsg
+ * Move repository to collab-maint on alioth
+ * Repack upstream tarball to remove hiredis, jansson and b64 copies
+ * Drop copyright notices for removed libraries
+ * Update Standards-Version to 3.9.8. No changes required
+ * Raise compat level to 10
+ * Add explicit dependency on lsb-base
+ * Enable all hardening features during build
+
+ -- Andriy Senkovych <jolly_roger@itblog.org.ua> Thu, 10 Nov 2016 01:36:21 +0200
+
+webdis (0.1.1-2.2) unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * Fix FTBFS with recent msgpack-c versions. (Closes: #811343)
+ + Use pkg-config to determine CFLAGS/LDFLAGS
+ - Search for msgpackc library in both MA and non-MA directories to ease
+ backports
+ + Use different APIs for the RAW type, based on the version of msgpack-c
+
+ -- James McCoy <jamessan@debian.org> Thu, 21 Jul 2016 23:43:34 -0400
+
+webdis (0.1.1-2.1) unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * Remove embedded code copies (hiredis, jansson) in the clean target
+ to make sure not to use them; this notably fixes the FTBFS during
+ the libhiredis0.10 → libhiredis0.13 transition (Closes: #785476).
+
+ -- Cyril Brulebois <kibi@debian.org> Tue, 14 Jul 2015 18:32:13 +0200
+
+webdis (0.1.1-2) unstable; urgency=medium
+
+ * Use correct license names in debian/copyright
+ * Document hiredis and jansson libraries
+ * Add autopkgtest support
+ * Update Standards-Version to 3.9.6. No changes required
+
+ -- Andriy Senkovych <jolly_roger@itblog.org.ua> Fri, 24 Oct 2014 22:48:16 +0300
+
+webdis (0.1.1-1) unstable; urgency=low
+
+ * Initial release (Closes: #623528)
+
+ -- Andriy Senkovych <jolly_roger@itblog.org.ua> Mon, 04 Aug 2014 02:10:55 +0300
--- /dev/null
+Source: webdis
+Section: web
+Priority: optional
+Maintainer: Andrii Senkovych <andrii@senkovych.com>
+Build-Depends: debhelper (>= 11~),
+ libevent-dev (>= 1.4.13),
+ libhiredis-dev (>= 0.10),
+ libjansson-dev (>= 1.3),
+ libb64-dev (>= 1.2),
+ libmsgpack-dev,
+ redis-server,
+ python-unittest2,
+ python-msgpack (>= 0.3),
+ pkg-config
+Standards-Version: 4.2.0
+Vcs-Git: https://salsa.debian.org/debian/webdis.git
+Vcs-Browser: https://salsa.debian.org/debian/webdis
+Homepage: http://webd.is
+Rules-Requires-Root: no
+
+Package: webdis
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6)
+Suggests: redis-server
+Description: simple web server providing an HTTP interface to Redis
+ Webdis is a simple web server providing HTTP interface to Redis. Some features
+ include:
+ * Support for GET and POST requests.
+ * JSON output by default, optional JSONP parameter (?jsonp=myFunction).
+ * Raw Redis 2.0 protocol output with .raw suffix
+ * HTTP 1.1 pipelining (50,000 http requests per second on a desktop Linux
+ machine.)
+ * Restricted commands by IP range (CIDR subnet + mask) or HTTP Basic Auth,
+ returning 403 errors.
+ * Possible Redis authentication in the config file.
+ * Pub/Sub using Transfer-Encoding: chunked, works with JSONP as well. Webdis
+ can be used as a Comet server.
+ * Custom Content-Type using a pre-defined file extension, or with
+ ?type=some/thing.
+ * URL-encoded parameters for binary data or slashes.
+ * Logs, with a configurable verbosity.
+ * Cross-origin XHR, if compiled with libevent2 (for OPTIONS support).
+ * File upload with PUT.
+ * With the JSON output, the return value of INFO is parsed and transformed
+ into an object.
--- /dev/null
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: webdis
+Upstream-Contact: Nicolas Favre-Félix <n.favrefelix@gmail.com>
+Source: https://github.com/nicolasff/webdis/blob/master/COPYING
+Files-Excluded: jansson/* hiredis/* b64/*
+Comment: source tarball is repacked with +dfsg suffix to remove convenience
+ copies of the hiredis, jansson and b64 libraries that are already packaged in
+ Debian.
+
+Files: *
+Copyright: 2010-2011, Nicolas Favre-Felix <n.favrefelix@gmail.com>
+License: bsd-2-clause
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+ .
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Files: debian/*
+Copyright: 2011-2018, Andrii Senkovych <andrii@senkovych.com>
+License: GPL-2+
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
+
+Files: md5/*
+Copyright: 1999, 2000, 2002, Aladdin Enterprises
+ 1999, 2000, 2002, L. Peter Deutsch <ghost@aladdin.com>
+License: bsd-3-clause
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+ .
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+ .
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+Files: sha1/*
+Copyright: 1998, 2009, Paul E. Jones <paulej@packetizer.com>
+License: FPL
+ This software is licensed as "freeware." Permission to distribute
+ this software in source and binary forms, including incorporation
+ into other products, is hereby granted without a fee. THIS SOFTWARE
+ IS PROVIDED 'AS IS' AND WITHOUT ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHOR SHALL NOT BE HELD
+ LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE, EITHER
+ DIRECTLY OR INDIRECTLY, INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA
+ OR DATA BEING RENDERED INACCURATE.
+
+Files: http-parser/*
+Copyright: 2009, 2010, Ryan Dahl <ry@tinyclouds.org>
+License: MIT
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to
+ deal in the Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
--- /dev/null
+README.markdown
--- /dev/null
+Description: Fix pubsub test when compiled w/ libevent 2.1.x
+ The pubsub test hangs in the infinite loop due to changes in the libevent2.x
+ compared to the previous version. This patch makes test pass again.
+Author: Oleksandr Senkovych <bjsenya@gmail.com>
+Bug: https://github.com/nicolasff/webdis/issues/149
+Last-Update: 2018-08-25
+
+diff --git a/tests/pubsub.c b/tests/pubsub.c
+index f4a3451..2426ba9 100644
+--- a/tests/pubsub.c
++++ b/tests/pubsub.c
+@@ -82,6 +82,23 @@ reader_http_request(struct cx *c, const char* buffer, const char *limit) {
+ }
+ }
+
++/*
++ * prepare an event structure(s)
++ */
++void
++cx_init(struct cx* c)
++{
++ if(c->read_fun) { /* attach callback for read. */
++ event_set(&c->evr, c->fd, EV_READ, c->read_fun, c);
++ event_base_set(c->base, &c->evr);
++ }
++
++ if(c->write_fun) { /* attach callback for write. */
++ event_set(&c->evw, c->fd, EV_WRITE, c->write_fun, c);
++ event_base_set(c->base, &c->evw);
++ }
++}
++
+ /**
+ * (re)install connection in the event loop.
+ */
+@@ -89,16 +106,11 @@ void
+ cx_install(struct cx *c) {
+
+ if(c->read_fun) { /* attach callback for read. */
+- event_set(&c->evr, c->fd, EV_READ, c->read_fun, c);
+- event_base_set(c->base, &c->evr);
+ event_add(&c->evr, NULL);
+ }
+ if(c->write_fun) { /* attach callback for write. */
+- event_set(&c->evw, c->fd, EV_WRITE, c->write_fun, c);
+- event_base_set(c->base, &c->evw);
+ event_add(&c->evw, NULL);
+ }
+-
+ }
+
+ /**
+@@ -160,6 +172,7 @@ reader_new(struct event_base *base, const char *host, short port, int total, int
+ reader_http_request(c, c->http_request, "{\"SUBSCRIBE\":[\"subscribe\"");
+
+ /* add to the event loop. */
++ cx_init(c);
+ cx_install(c);
+ }
+
+@@ -209,6 +222,7 @@ writer_new(struct event_base *base, const char *host, short port, int chan) {
+ sprintf(c->http_request, "GET /PUBLISH/chan:%d/hi HTTP/1.1\r\n\r\n", chan);
+ reader_http_request(c, c->http_request, "{\"PUBLISH\":");
+
++ cx_init(c);
+ cx_install(c);
+ }
+
--- /dev/null
+From 2a8908bdcf89b1cc8a332033bc9f8971b82438a3 Mon Sep 17 00:00:00 2001
+From: James McCoy <jamessan@jamessan.com>
+Date: Thu, 21 Jul 2016 23:30:32 -0400
+Subject: [PATCH] Find libmsgpackc in Multi-Arch library paths
+
+The msgpack library may be present in /usr/lib or /usr/lib/$arch,
+but only the former is being searched. Check both places and fix the
+library name to use the C lib (libmsgpackc) rather than the C++ lib
+(libmsgpack).
+
+Signed-off-by: James McCoy <jamessan@jamessan.com>
+---
+ Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 40a7787..11bd9cd 100644
+--- a/Makefile
++++ b/Makefile
+@@ -14,11 +14,11 @@ ifneq ($(findstring yes,$(shell pkg-config --exists msgpack && echo yes)),)
+ CFLAGS += -DMSGPACK=1 $(shell pkg-config --cflags msgpack)
+ LDFLAGS += $(shell pkg-config --libs msgpack)
+ else
+- MSGPACK_LIB=$(shell ls /usr/lib/libmsgpack.so 2>/dev/null)
++ MSGPACK_LIB=$(shell ls /usr/lib/libmsgpackc.so /usr/lib/*/libmsgpackc.so 2>/dev/null)
+ ifneq ($(strip $(MSGPACK_LIB)),)
+ FORMAT_OBJS += formats/msgpack.o
+ CFLAGS += -DMSGPACK=1
+- LDFLAGS += -lmsgpack
++ LDFLAGS += -lmsgpackc
+ endif
+ endif
+
+--
+2.8.1
+
--- /dev/null
+From 7526080ac6f1c08584688ac568da9ce25024cf59 Mon Sep 17 00:00:00 2001
+From: James McCoy <jamessan@jamessan.com>
+Date: Wed, 15 Jun 2016 09:26:20 -0400
+Subject: [PATCH] Use msgpack_pack_v4raw(_body) with new msgpack-c versions
+
+In msgpack-c's 1.0.0 release, the code was changed to be compatible with
+the v5 msgpack spec, specifically separating out the STR and BIN types
+as replacements for the old RAW type.
+
+While the STR type is likely the right replacement type to use, it does
+introduce a str 8 variant that wasn't present for the old RAW type. For
+better compatibility, the msgpack_pack_v4raw functions were added to
+directly map to the old functionality.
+
+Signed-off-by: James McCoy <jamessan@jamessan.com>
+---
+ formats/msgpack.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/formats/msgpack.c b/formats/msgpack.c
+index dc1ab0c..a3abc8b 100644
+--- a/formats/msgpack.c
++++ b/formats/msgpack.c
+@@ -8,6 +8,18 @@
+ #include <hiredis/hiredis.h>
+ #include <hiredis/async.h>
+
++/* msgpack-c versions >= 1.0 changed to support the v5 msgpack spec.
++ * As part of doing this, the (un)pack_raw functions were replaced with
++ * more explicit (un)pack_str and (un)pack_bin. 1.2.0 introduced the
++ * (un)pack_v4raw functions to retain compatibility.
++ */
++#if defined(MSGPACK_VERSION_MAJOR) && defined(MSGPACK_VERSION_MINOR) \
++ && MSGPACK_VERSION_MAJOR > 1 \
++ || (MSGPACK_VERSION_MAJOR == 1 && MSGPACK_VERSION_MINOR >= 2)
++#define msgpack_pack_raw msgpack_pack_v4raw
++#define msgpack_pack_raw_body msgpack_pack_v4raw_body
++#endif
++
+ struct msg_out {
+ char *p;
+ size_t sz;
--- /dev/null
+From ca170bcced750629ef65e66c6a5b1642cb3ddde0 Mon Sep 17 00:00:00 2001
+From: James McCoy <jamessan@jamessan.com>
+Date: Wed, 15 Jun 2016 09:06:50 -0400
+Subject: [PATCH] Use pkg-config to find msgpack library when available
+
+Since 0.5.8, msgpack-c has provided a pkg-config file. If it's
+installed, use pkg-config to get the relevant CFLAGS/LDFLAGS.
+
+Signed-off-by: James McCoy <jamessan@jamessan.com>
+---
+ Makefile | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index e29ad4b..40a7787 100644
+--- a/Makefile
++++ b/Makefile
+@@ -9,11 +9,17 @@ CFLAGS ?= -O0 -ggdb -Wall -Wextra -I. -Ijansson/src -Ihttp-parser
+ LDFLAGS ?= -levent -pthread
+
+ # check for MessagePack
+-MSGPACK_LIB=$(shell ls /usr/lib/libmsgpack.so 2>/dev/null)
+-ifneq ($(strip $(MSGPACK_LIB)),)
++ifneq ($(findstring yes,$(shell pkg-config --exists msgpack && echo yes)),)
+ FORMAT_OBJS += formats/msgpack.o
+- CFLAGS += -DMSGPACK=1
+- LDFLAGS += -lmsgpack
++ CFLAGS += -DMSGPACK=1 $(shell pkg-config --cflags msgpack)
++ LDFLAGS += $(shell pkg-config --libs msgpack)
++else
++ MSGPACK_LIB=$(shell ls /usr/lib/libmsgpack.so 2>/dev/null)
++ ifneq ($(strip $(MSGPACK_LIB)),)
++ FORMAT_OBJS += formats/msgpack.o
++ CFLAGS += -DMSGPACK=1
++ LDFLAGS += -lmsgpack
++ endif
+ endif
+
+
--- /dev/null
+Description: Print HTTP port number in the logs during startup
+ Current test suite allows dynamic HTTP port allocation for test purpose.
+ Once webdis is started it is possible to discover webdis' HTTP port using
+ netstat. However resent builds have shown that netstat has different options
+ for hurd and kfreebsd and thus tests are failed and the overall package build
+ is marked as failed as well. In order to overcome this I have tried to use
+ sockstat instead of netstat but bug #679876 renders sockstat unusable.
+ .
+ This patch removes the need to use netstat or sockstat to discover the port
+ number webdis is listening to and instead allows one to simply grep the
+ necessary info out of webdis logs.
+Author: Andrii Senkovych <andrii@senkovych.com>
+Last-Update: 2016-11-17
+Index: webdis/server.c
+===================================================================
+--- webdis.orig/server.c
++++ webdis/server.c
+@@ -25,6 +25,7 @@ socket_setup(struct server *s, const cha
+
+ int reuse = 1;
+ struct sockaddr_in addr;
++ socklen_t len = sizeof(addr);
+ int fd, ret;
+
+ memset(&addr, 0, sizeof(addr));
+@@ -60,7 +61,7 @@ socket_setup(struct server *s, const cha
+ }
+
+ /* bind */
+- ret = bind(fd, (struct sockaddr*)&addr, sizeof(addr));
++ ret = bind(fd, (struct sockaddr*)&addr, len);
+ if (0 != ret) {
+ slog(s, WEBDIS_ERROR, strerror(errno), 0);
+ return -1;
+@@ -73,6 +74,18 @@ socket_setup(struct server *s, const cha
+ return -1;
+ }
+
++ if (getsockname(fd, (struct sockaddr *)&addr, &len) != -1) {
++ const char* comment = "Webdis listening on port %d";
++ int port_num = ntohs(addr.sin_port);
++
++ char* buffer = malloc(strlen(comment) -2 + strlen("65535") + 1);
++ sprintf(buffer, comment, port_num);
++
++ slog(s, WEBDIS_INFO, buffer , 0);
++
++ free(buffer);
++ }
++
+ /* there you go, ready to accept! */
+ return fd;
+ }
--- /dev/null
+fix-test-new-libevent.patch
+print-listen-port-number.patch
+tests.patch
+msgpack-pkgconfig.patch
+msgpack-compat.patch
+msgpack-clib.patch
--- /dev/null
+Description: Pass tests with python-msgpack >= 0.3
+ Current test suite pass with python-msgpack v0.2 but fails with python-msgpack
+ v0.3 and later due to changes in the library. Currently Debian ships v0.3
+ for jessie and wheezy-backports.
+Author: Andrii Senkovych <andrii@senkovych.com>
+Bug: https://github.com/nicolasff/webdis/issues/92
+Last-Update: 2014-08-03
+diff --git a/tests/basic.py b/tests/basic.py
+index 89d664e..c70babe 100755
+--- a/tests/basic.py
++++ b/tests/basic.py
+@@ -154,7 +154,7 @@ class TestMsgPack(TestWebdis):
+ f = self.query('SET/hello/world.msg')
+ self.assertTrue(f.headers.getheader('Content-Type') == 'application/x-msgpack')
+ obj = msgpack.loads(f.read())
+- self.assertTrue(obj == {'SET': (True, 'OK')})
++ self.assertTrue(obj == {'SET': [True, 'OK']})
+
+ @need_msgpack
+ def test_get(self):
+@@ -180,7 +180,7 @@ class TestMsgPack(TestWebdis):
+ self.query('RPUSH/hello/def')
+ f = self.query('LRANGE/hello/0/-1.msg')
+ obj = msgpack.loads(f.read())
+- self.assertTrue(obj == {'LRANGE': ('abc', 'def')})
++ self.assertTrue(obj == {'LRANGE': ['abc', 'def']})
+
+ @need_msgpack
+ def test_error(self):
+@@ -189,7 +189,7 @@ class TestMsgPack(TestWebdis):
+ obj = msgpack.loads(f.read())
+ self.assertTrue('UNKNOWN' in obj)
+ self.assertTrue(isinstance(obj, dict))
+- self.assertTrue(isinstance(obj['UNKNOWN'], tuple))
++ self.assertTrue(isinstance(obj['UNKNOWN'], list))
+ self.assertTrue(obj['UNKNOWN'][0] == False)
+ self.assertTrue(isinstance(obj['UNKNOWN'][1], str))
+
--- /dev/null
+daemonize yes
+pidfile REDIS_PIDFILE
+port 0
+unixsocket REDIS_SOCK
--- /dev/null
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+export DEB_BUILD_MAINT_OPTIONS=hardening=+bindnow
+include /usr/share/dpkg/buildflags.mk
+CFLAGS += $(CPPFLAGS)
+
+export PREFIX = /usr
+
+# Objects to be removed from build procedure
+export HIREDIS_OBJ=
+export JANSSON_OBJ=
+export B64_OBJS=
+
+export CFLAGS += -I. -Ihttp-parser
+export LDFLAGS += -levent -pthread -lhiredis -ljansson -lb64
+
+%:
+ dh $@
+
+override_dh_auto_build:
+ dh_auto_build
+ $(MAKE) -C tests pubsub websocket
+
+override_dh_auto_clean:
+ $(MAKE) clean
+ $(MAKE) -C tests clean
+ rm -f debian/files
+ dh_auto_clean
+
+override_dh_auto_install:
+ dh_auto_install
+ rm debian/webdis/etc/webdis.prod.json
+
+override_dh_auto_test:
+ifneq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
+ @echo "Skipping check (disabled in DEB_BUILD_OPTIONS)."
+else
+ #$(CURDIR)/debian/test.sh $(MAKE) test
+endif
--- /dev/null
+3.0 (quilt)
--- /dev/null
+#!/bin/sh
+# This script runs redis server and webdis server and launches the test
+# suite. It avoids race condition while obtaining a port to listen by
+# binding to random available port. The port is then found via netstat -nlp
+# using PID-file.
+
+TMPDIR=`mktemp -d`
+
+WEBDIS_PIDFILE=${TMPDIR}/webdis.pid
+WEBDIS_CONFFILE=${TMPDIR}/webdis.json
+WEBDIS_LOGFILE=${TMPDIR}/webdis.log
+
+REDIS_CONFFILE=${TMPDIR}/redis.conf
+REDIS_PIDFILE=${TMPDIR}/redis.pid
+REDIS_SOCK=${TMPDIR}/redis.sock
+
+if [ -n "$WEBDIS_BIN" ] ; then
+ if [ ! -x "$WEBDIS_BIN" ] ; then
+ echo "webdis binary $WEBDIS_BIN is not executable"
+ exit 1
+ fi
+else
+ WEBDIS_BIN="$PWD/webdis"
+fi
+
+set_up() {
+ echo "Generating config files.."
+ sed -e "s|REDIS_SOCK|${REDIS_SOCK}|" -e "s|WEBDIS_PIDFILE|${WEBDIS_PIDFILE}|" \
+ -e "s|WEBDIS_LOGFILE|${WEBDIS_LOGFILE}|" \
+ debian/webdis-test.json > ${WEBDIS_CONFFILE}
+ sed -e "s|REDIS_PIDFILE|${REDIS_PIDFILE}|" -e "s|REDIS_SOCK|${REDIS_SOCK}|" \
+ debian/redis-test.conf > ${REDIS_CONFFILE}
+
+ echo "Starting redis-server.."
+ /sbin/start-stop-daemon --start --verbose \
+ --pidfile ${REDIS_PIDFILE} \
+ --exec `which redis-server` -- ${REDIS_CONFFILE} || return 1
+
+ echo "Starting webdis.."
+ /sbin/start-stop-daemon --start --verbose \
+ --pidfile ${WEBDIS_PIDFILE} \
+ --exec $WEBDIS_BIN -- ${WEBDIS_CONFFILE} || return 2
+
+ WEBDIS_PID=`cat $WEBDIS_PIDFILE`
+ export WEBDIS_PORT=`grep -o 'listening on port.*$' ${WEBDIS_LOGFILE}| \
+ tail -1|cut -d " " -f 4`
+ [ "0$WEBDIS_PORT" -gt 0 ] || return 3
+ echo webdis is listening on port "$WEBDIS_PORT"
+}
+
+tear_down() {
+ echo "Shutting down webdis.."
+ /sbin/start-stop-daemon --stop --verbose \
+ --retry=TERM/1/KILL/1 \
+ --pidfile ${WEBDIS_PIDFILE} \
+ --name webdis
+ echo "Shutting down redis-server.."
+ /sbin/start-stop-daemon --stop --verbose \
+ --retry=TERM/1/KILL/1 \
+ --pidfile ${REDIS_PIDFILE} \
+ --name redis-server
+}
+
+if ! set_up ; then
+ echo "Setting up redis/webdis server FAILED."
+ tear_down
+ exit 1
+fi
+
+echo Running test commands: $*
+
+$*
+EXIT_CODE=$?
+
+tear_down
+rm -fR $TMPDIR
+
+exit $EXIT_CODE
--- /dev/null
+Tests: webdis
+Depends: @, redis-server, build-essential, libevent-dev,
+ python-unittest2, python-msgpack, net-tools
+Restrictions: isolation-container, allow-stderr
--- /dev/null
+#!/bin/sh
+set -e
+
+make -C tests
+WEBDIS_BIN=/usr/bin/webdis debian/test.sh make test
--- /dev/null
+version=3
+opts=dversionmangle=s/\+(dfsg|ds)$//,repacksuffix=+dfsg \
+ https://github.com/nicolasff/webdis/releases \
+ .*\/([0-9.]+)\.tar\.gz
--- /dev/null
+{
+ "redis_host": "REDIS_SOCK",
+
+ "http_host": "127.0.0.1",
+ "http_port": 0,
+
+ "threads": 2,
+ "pool_size": 5,
+
+ "daemonize": true,
+ "pidfile": "WEBDIS_PIDFILE",
+ "websockets": false,
+
+ "database": 0,
+
+ "acl": [
+ {
+ "disabled": ["DEBUG"]
+ },
+
+ {
+ "http_basic_auth": "user:password",
+ "enabled": ["DEBUG"]
+ }
+ ],
+
+ "verbosity": 3,
+ "logfile": "WEBDIS_LOGFILE"
+}
--- /dev/null
+.TH WEBDIS 1 "August 29, 2013"
+.SH NAME
+webdis \- fast HTTP interface for redis-server(1)
+.SH SYNOPSIS
+.B webdis
+.RI configfile
+.SH DESCRIPTION
+Webdis is a Webdis is a simple HTTP server which forwards commands to Redis and
+sends the reply back using a format of your choice. Accessing
+/COMMAND/arg0/arg1/.../argN[.ext] on Webdis executes the command on Redis and
+returns the response; the reply format can be changed with the optional
+extension (.json, .txt).
+.PP
+.SH OPTIONS
+.IP "configfile"
+Read options from specified configuration file.
+.SH NOTES
+On Debian GNU/Linux systems, \fBwebdis\fP is typically started via the
+\fB/etc/init.d/webdis\fP initscript, not manually. This defaults to using
+\fB/etc/webdis/webdis.json\fP as a configuration file.
+.SH AUTHOR
+\fBwebdis\fP was written by Nicolas Favre-Félix.
+.PP
+This manual page was written by Andrii Senkovych <andrii@senkovych.com> for the
+Debian project (but may be used by others).
--- /dev/null
+# Webdis configuration file used at startup.
+CONFFILE="/etc/webdis/webdis.json"
+
+# Additional options that are passed to the Daemon.
+DAEMON_OPTS=""
--- /dev/null
+/var/log/webdis
--- /dev/null
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: webdis
+# Required-Start: $local_fs $remote_fs
+# Required-Stop: $local_fs $remote_fs
+# Should-Start: redis-server
+# Should-Stop: redis-server
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Starts webdis daemon
+# Description: Starts webdis daemon
+### END INIT INFO
+
+# Do NOT "set -e"
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="webdis server"
+NAME=webdis
+DAEMON=/usr/bin/$NAME
+PIDDIR=/var/run/$NAME
+PIDFILE=$PIDDIR/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+USER=webdis
+CONFFILE="/etc/webdis/webdis.json"
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ if [ ! -e $PIDDIR ] ; then
+ mkdir $PIDDIR
+ chown webdis: $PIDDIR
+ elif [ ! -d $PIDDIR ] ; then
+ log_action_cont_msg \ $PIDDIR exists but is not a directory
+ return 2
+ fi
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+ start-stop-daemon --start --quiet --test \
+ --pidfile $PIDFILE \
+ --user $USER --chuid $USER \
+ --exec $DAEMON > /dev/null \
+ || return 1
+ /sbin/start-stop-daemon --start --quiet \
+ --pidfile $PIDFILE \
+ --user $USER --chuid $USER \
+ --exec $DAEMON -- $CONFFILE $DAEMON_OPTS\
+ || return 2
+ # Add code here, if necessary, that waits for the process to be ready
+ # to handle requests from services started subsequently which depend
+ # on this one. As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+ start-stop-daemon --stop --quiet \
+ --pidfile $PIDFILE \
+ --user $USER \
+ --retry=TERM/1/KILL/1 \
+ --name $NAME
+ RETVAL="$?"
+ [ "$RETVAL" = 2 ] && return 2
+ # Wait for children to finish too if this is a daemon that forks
+ # and if the daemon is only ever run from this initscript.
+ # If the above conditions are not satisfied then add some other code
+ # that waits for the process to drop all resources that could be
+ # needed by services started subsequently. A last resort is to
+ # sleep for some time.
+ start-stop-daemon --stop --quiet --oknodo \
+ --pidfile $PIDIFLE \
+ --user $USER \
+ --retry=0/1/KILL/1 \
+ --exec $DAEMON
+ [ "$?" = 2 ] && return 2
+ # Many daemons don't delete their pidfiles when they exit.
+ rm -f $PIDFILE
+ return "$RETVAL"
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+ #
+ # If the daemon can reload its configuration without
+ # restarting (for example, when it is sent a SIGHUP),
+ # then implement that here.
+ #
+ start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+ return 0
+}
+
+case "$1" in
+ start)
+ log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) log_end_msg 0 ;;
+ 2) log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) log_end_msg 0 ;;
+ 2) log_end_msg 1 ;;
+ esac
+ ;;
+ status)
+ status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+ ;;
+ #reload|force-reload)
+ #
+ # If do_reload() is not implemented then leave this commented out
+ # and leave 'force-reload' as an alias for 'restart'.
+ #
+ #log_daemon_msg "Reloading $DESC" "$NAME"
+ #do_reload
+ #log_end_msg $?
+ #;;
+ restart|force-reload)
+ #
+ # If the "reload" option is implemented then remove the
+ # 'force-reload' alias
+ #
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ *)
+ #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+ exit 3
+ ;;
+esac
+
+:
--- /dev/null
+debian/webdis.json /etc/webdis/
--- /dev/null
+{
+ "redis_host": "127.0.0.1",
+
+ "redis_port": 6379,
+ "redis_auth": null,
+
+ "http_host": "127.0.0.1",
+ "http_port": 7379,
+ "threads": 2,
+
+ "daemonize": true,
+ "pidfile": "/var/run/webdis/webdis.pid",
+
+ "database": 0,
+
+ "acl": [
+ {
+ "disabled":["DEBUG"]
+ },
+
+ {
+ "http_basic_auth": "user:password",
+ "enabled": ["DEBUG"]
+ }
+ ],
+
+ "verbosity": 3,
+ "logfile": "/var/log/webdis/webdis.log"
+}
--- /dev/null
+/var/log/webdis/webdis.log {
+ missingok
+ rotate 5
+ weekly
+ size 10M
+ compress
+ notifempty
+ postrotate
+ /usr/bin/killall -HUP webdis
+ endscript
+}
--- /dev/null
+debian/webdis.1
--- /dev/null
+#! /bin/sh
+
+set -e
+WEBDIS_LOG=/var/log/webdis
+
+case "$1" in
+ configure)
+ adduser --system --group \
+ --home /var/lib/webdis \
+ --no-create-home \
+ --gecos "webdis system user" \
+ --disabled-login \
+ --disabled-password webdis
+ if ! dpkg-statoverride --list $WEBDIS_LOG >/dev/null 2>&1 ; then
+ dpkg-statoverride --update --add webdis webdis 0750 $WEBDIS_LOG
+ fi
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
+
+
--- /dev/null
+#! /bin/sh
+
+set -e
+WEBDIS_LOG=/var/log/webdis
+
+case "$1" in
+ upgrade|failed-upgrade|abort-install|abort-upgrade|disappear|remove)
+ ;;
+
+ purge)
+ # Since no data is stored in the webdis home directory, the package is
+ # not affected by bug #621833 and thus homedir can be safely removed
+ if dpkg-statoverride --list $WEBDIS_LOG >/dev/null 2>&1 ; then
+ dpkg-statoverride --remove /var/log/webdis
+ fi
+ rm -rf $WEBDIS_LOG
+
+ deluser --system webdis
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+
+esac
+
+#DEBHELPER#
+
+exit 0
--- /dev/null
+[Unit]
+Description=Webdis service, an HTTP interface to Redis
+After=network.target redis-server.service
+Documentation=man:webdis(1)
+Documentation=https://webd.is
+
+[Service]
+Type=forking
+WorkingDirectory=/
+ExecStartPre=mkdir /var/run/webdis
+ExecStartPre=chown webdis: /var/run/webdis
+ExecStart=/usr/bin/webdis /etc/webdis/webdis.json
+User=webdis
+Group=webdis
+PermissionsStartOnly=true
+PIDFile=/var/run/webdis/webdis.pid
+KillMode=process
+StandardOutput=journal
+
+[Install]
+WantedBy=multi-user.target