[vdr-plugin-live] 01/05: Imported Upstream version 0.3.0+git20150213
Tobias Grimm
tiber-guest at moszumanska.debian.org
Fri Feb 13 18:42:25 UTC 2015
This is an automated email from the git hooks/post-receive script.
tiber-guest pushed a commit to branch master
in repository vdr-plugin-live.
commit 7853a601e19efed116df331fd1ad0208fa8c1191
Author: etobi <git at e-tobi.net>
Date: Fri Feb 13 18:57:29 2015 +0100
Imported Upstream version 0.3.0+git20150213
---
Makefile | 162 ++++------
README | 58 ++--
css/Makefile | 34 +-
debian/links | 8 +-
debian/rules | 7 +-
httpd/Makefile | 46 ---
httpd/dispatcher.cpp | 109 -------
httpd/job.cpp | 240 --------------
httpd/listener.cpp | 167 ----------
httpd/poller.cpp | 190 -----------
httpd/regex.cpp | 175 -----------
httpd/tnt/dispatcher.h | 121 -------
httpd/tnt/gcryptinit.h | 37 ---
httpd/tnt/gnutls.h | 146 ---------
httpd/tnt/job.h | 201 ------------
httpd/tnt/listener.h | 78 -----
httpd/tnt/openssl.h | 121 -------
httpd/tnt/poller.h | 61 ----
httpd/tnt/regex.h | 79 -----
httpd/tnt/ssl.h | 52 ----
httpd/tnt/tntnet.h | 99 ------
httpd/tnt/worker.h | 91 ------
httpd/tntnet.cpp | 832 -------------------------------------------------
httpd/worker.cpp | 364 ----------------------
javascript/Makefile | 34 +-
pages/Makefile | 37 +--
pages/page_exit.eh | 4 -
pages/recordings.ecpp | 8 +-
pages/vlc.ecpp | 4 -
po/ca_ES.po | 2 +-
po/cs_CZ.po | 2 +-
po/da_DK.po | 2 +-
po/de_DE.po | 2 +-
po/el_GR.po | 2 +-
po/es_ES.po | 2 +-
po/et_EE.po | 2 +-
po/fi_FI.po | 2 +-
po/fr_FR.po | 2 +-
po/hr_HR.po | 2 +-
po/hu_HU.po | 2 +-
po/it_IT.po | 2 +-
po/lt_LT.po | 2 +-
po/nl_NL.po | 2 +-
po/nn_NO.po | 2 +-
po/pl_PL.po | 2 +-
po/pt_PT.po | 2 +-
po/ro_RO.po | 2 +-
po/ru_RU.po | 611 ++++++++++++++++++------------------
po/sk_SK.po | 2 +-
po/sl_SI.po | 2 +-
po/sv_SE.po | 2 +-
po/tr_TR.po | 2 +-
recman.cpp | 4 +
setup.cpp | 14 +-
setup.h | 6 -
thread.cpp | 22 --
tntconfig.cpp | 162 ----------
tntconfig.h | 26 --
tntfeatures.h | 13 -
tools.cpp | 12 +
tools.h | 32 +-
61 files changed, 465 insertions(+), 4046 deletions(-)
diff --git a/Makefile b/Makefile
index ab2f2b5..d50d41f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,54 +1,42 @@
#
-# Makefile for a Video Disk Recorder plugin
+# Makefile for the 'LIVE' Video Disk Recorder plugin
#
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
# By default the main source file also carries this name.
-# IPORTANT: the presence of this macro is important for the Make.config
-# file. So it must be defined, even if it is not used here!
-#
PLUGIN = live
### The version number of this plugin (taken from the main source file):
-
VERSION = $(shell grep '\#define LIVEVERSION ' setup.h | awk '{ print $$3 }' | sed -e 's/[";]//g')
-### The C++ compiler and options:
-
-CXX ?= g++
-ECPPC ?= ecppc
-
-### This variable is overriden in pages/Makefile because we don't want the
-### extra warnings in the tntnet generated files. So if you change here
-### something be sure to check pages/Makefile too.
-CXXFLAGS ?= -fPIC -O2 -Wall
-LDFLAGS ?= -fPIC -g
-
### Check for libpcre c++ wrapper
HAVE_LIBPCRECPP = $(shell pcre-config --libs-cpp)
### The directory environment:
+# Use package data if installed...otherwise assume we're under the VDR source directory:
+PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell pkg-config --variable=$(1) vdr || pkg-config --variable=$(1) ../../../vdr.pc))
+LIBDIR = $(call PKGCFG,libdir)
+LOCDIR = $(call PKGCFG,locdir)
+PLGCFG = $(call PKGCFG,plgcfg)
+#
+TMPDIR ?= /tmp
-VDRDIR ?= ../../..
-LIBDIR ?= ../../lib
-TMPDIR ?= /tmp
+### The compiler options:
+export CFLAGS = $(call PKGCFG,cflags)
+export CXXFLAGS = $(call PKGCFG,cxxflags)
-### Make sure that necessary options are included:
+ECPPC ?= ecppc
--include $(VDRDIR)/Make.global
+### The version number of VDR's plugin API:
+APIVERSION = $(call PKGCFG,apiversion)
### Allow user defined options to overwrite defaults:
+-include $(PLGCFG)
--include $(VDRDIR)/Make.config
-
-### The version number of VDR's plugin API (taken from VDR's "config.h"):
-
-APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
-I18NTARG = $(shell if [ `echo $(APIVERSION) | tr [.] [0]` -ge "10507" ]; then echo "i18n"; fi)
+### Determine tntnet and cxxtools versions:
TNTVERSION = $(shell tntnet-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }')
CXXTOOLVER = $(shell cxxtools-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }')
-TNTVERS7 = $(shell ver=$(TNTVERSION); if [ $$ver -ge "1606" ]; then echo "yes"; fi)
CXXFLAGS += $(shell tntnet-config --cxxflags)
LIBS += $(shell tntnet-config --libs)
@@ -61,30 +49,25 @@ ifneq ($(HAVE_LIBPCRECPP),)
LIBS += $(HAVE_LIBPCRECPP)
endif
-### The name of the distribution archive:
+### export all vars for sub-makes, using absolute paths
+LIBDIR := $(shell cd $(LIBDIR) >/dev/null 2>&1 && pwd)
+LOCDIR := $(shell cd $(LOCDIR) >/dev/null 2>&1 && pwd)
+export
+unexport PLUGIN
+### The name of the distribution archive:
ARCHIVE = $(PLUGIN)-$(VERSION)
PACKAGE = vdr-$(ARCHIVE)
-### Includes and Defines (add further entries here):
-
-INCLUDES += -I$(VDRDIR)/include
-ifneq ($(TNTVERS7),yes)
- INCLUDES += -Ihttpd
- LIBS += httpd/libhttpd.a
-endif
+### The name of the shared object file:
+SOFILE = libvdr-$(PLUGIN).so
+### Includes and Defines (add further entries here):
DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DTNTVERSION=$(TNTVERSION) -DCXXTOOLVER=$(CXXTOOLVER)
-
SUBDIRS = pages css javascript
-ifneq ($(TNTVERS7),yes)
- SUBDIRS += httpd
-endif
-
VERSIONSUFFIX = gen_version_suffix.h
### The object files (add further files here):
-
PLUGINOBJS = $(PLUGIN).o thread.o tntconfig.o setup.o i18n.o timers.o \
tools.o recman.o tasks.o status.o epg_events.o epgsearch.o \
grab.o md5.o filecache.o livefeatures.o preload.o timerconflict.o \
@@ -92,40 +75,29 @@ PLUGINOBJS = $(PLUGIN).o thread.o tntconfig.o setup.o i18n.o timers.o \
WEBLIBS = pages/libpages.a css/libcss.a javascript/libjavascript.a
-### Default rules:
-
-all: libvdr-$(PLUGIN).so $(I18NTARG)
-
-.PHONY: all dist clean subdirs $(SUBDIRS) PAGES
+### The main target:
+all: $(SOFILE) i18n
### Implicit rules:
-
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $(DEFINES) $(PLUGINFEATURES) $(INCLUDES) $<
-# Dependencies:
-
+### Dependencies:
MAKEDEP = $(CXX) -MM -MG
DEPFILE = .dependencies
$(DEPFILE): Makefile
- @$(MAKEDEP) $(DEFINES) $(PLUGINFEATURES) $(INCLUDES) $(PLUGINOBJS:%.o=%.cpp) > $@
+ @$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(PLUGINFEATURES) $(INCLUDES) $(PLUGINOBJS:%.o=%.cpp) > $@
ifneq ($(MAKECMDGOALS),clean)
-include $(DEPFILE)
endif
### Internationalization (I18N):
-
-PODIR = po
-LOCALEDIR = $(VDRDIR)/locale
-I18Npo = $(wildcard $(PODIR)/*.po)
-I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file))))
-I18Ndirs = $(notdir $(foreach file, $(I18Npo), $(basename $(file))))
-I18Npot = $(PODIR)/$(PLUGIN).pot
-I18Nvdrmo = vdr-$(PLUGIN).mo
-ifeq ($(strip $(APIVERSION)),1.5.7)
- I18Nvdrmo = $(PLUGIN).mo
-endif
+PODIR = po
+I18Npo = $(wildcard $(PODIR)/*.po)
+I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file))))
+I18Nmsgs = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
+I18Npot = $(PODIR)/$(PLUGIN).pot
%.mo: %.po
msgfmt -c -o $@ $<
@@ -133,60 +105,40 @@ endif
$(I18Npot): PAGES $(PLUGINOBJS:%.o=%.cpp)
xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --omit-header -o $@ $(PLUGINOBJS:%.o=%.cpp) pages/*.cpp setup.h epg_events.h
-$(I18Npo): $(I18Npot)
- msgmerge -U --no-wrap --no-location --backup=none -q $@ $<
-
-i18n: $(I18Nmo)
- @mkdir -p $(LOCALEDIR)
- for i in $(I18Ndirs); do\
- mkdir -p $(LOCALEDIR)/$$i/LC_MESSAGES;\
- cp $(PODIR)/$$i.mo $(LOCALEDIR)/$$i/LC_MESSAGES/$(I18Nvdrmo);\
- done
+%.po: $(I18Npot)
+ msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $<
+ @touch $@
-generate-i18n: i18n-template.h $(I18Npot) $(I18Npo) buildutil/pot2i18n.pl
- buildutil/pot2i18n.pl $(I18Npot) i18n-template.h > i18n-generated.h
+$(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
+ install -D -m644 $< $@
-### Targets:
+.PHONY: i18n
+i18n: $(I18Nmo) $(I18Npot)
-subdirs: $(SUBDIRS)
+install-i18n: $(I18Nmsgs)
-$(SUBDIRS):
- @$(MAKE) -C $@ $(MAKECMDGOALS) PLUGINFEATURES="$(PLUGINFEATURES)"
+#generate-i18n: i18n-template.h $(I18Npot) $(I18Npo) buildutil/pot2i18n.pl
+# buildutil/pot2i18n.pl $(I18Npot) i18n-template.h > i18n-generated.h
+### Targets:
PAGES:
- @$(MAKE) -C pages PLUGINFEATURES="$(PLUGINFEATURES)" .dependencies
+ $(MAKE) -C pages PLUGINFEATURES="$(PLUGINFEATURES)" .dependencies
$(VERSIONSUFFIX): FORCE
./buildutil/version-util $(VERSIONSUFFIX) || ./buildutil/version-util -F $(VERSIONSUFFIX)
-libvdr-$(PLUGIN).so: $(VERSIONSUFFIX) $(SUBDIRS) $(PLUGINOBJS)
- $(CXX) $(LDFLAGS) -shared -o $@ $(PLUGINOBJS) -Wl,--whole-archive $(WEBLIBS) -Wl,--no-whole-archive $(LIBS)
- @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
-
-ifneq ($(TNTVERS7),yes)
- @echo ""
- @echo "LIVE was built successfully and you can try to use it!"
- @echo ""
- @echo ""
- @echo ""
- @echo ""
- @echo "IMPORTANT INFORMATION:"
- @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
- @echo "+ This is one of the *last* CVS versions of LIVE which will +"
- @echo "+ work with versions of tntnet *less* than 1.6.0.6! +"
- @echo "+ +"
- @echo "+ This version of LIVE already supports tntnet >= 1.6.0.6. +"
- @echo "+ +"
- @echo "+ Please upgrade tntnet to at least version 1.6.0.6 soon, if +"
- @echo "+ you want to keep track of bleeding edge LIVE development. +"
- @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
- @echo ""
- @echo ""
- @echo ""
- @echo ""
-endif
+$(SOFILE): $(VERSIONSUFFIX) $(SUBDIRS) $(PLUGINOBJS)
+ for SUBDIR in $(SUBDIRS); \
+ do $(MAKE) -C $${SUBDIR} PLUGINFEATURES="$(PLUGINFEATURES)" all; \
+ done
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(PLUGINOBJS) -Wl,--whole-archive $(WEBLIBS) -Wl,--no-whole-archive $(LIBS) -o $@
+
+install-lib: $(SOFILE)
+ install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
+
+install: install-lib install-i18n
-dist: clean
+dist: $(I18Npo) clean
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@mkdir $(TMPDIR)/$(ARCHIVE)
@cp -a * $(TMPDIR)/$(ARCHIVE)
diff --git a/README b/README
index a4c9c9e..ac07d94 100644
--- a/README
+++ b/README
@@ -16,21 +16,14 @@ See the file COPYING for license information.
IMPORTANT:
==========
-This is the last version of LIVE which will work with Tntnet <
-1.6.0.6.
+This version of LIVE does not support VDR versions older than 2.0.0
+any more (maybe still some older VDR devel versions leading to VDR
+2.0.0 but that is not tested).
-Since Nov 17 2007 version 1.6.0.6 of Tntnet has been released with new
-features and binary incompatible changes. This version of LIVE works
-with that version and still maintains backwards compatibilty to older
-versions of Tntnet.
-
-Future versions of LIVE will start to use the new Tntnet
-features. This means that backwards compatibility can not be
-maintained from that point in time onwards.
-
-We therefore strongly suggest you upgrade to Tntnet with at least
-version 1.6.0.6. This new Tntnet version is supported by the current
-version of LIVE. Just update Tntnet and recompile LIVE from scratch.
+If you can not update your VDR the Version 0.3.x of LIVE is still 'up
+to date' enough and works with very old VDR versions and with old
+versions of Tntnet. The LIVE version 0.4.x adds only compatibility
+changes for newer VDR versions.
Description:
@@ -48,7 +41,7 @@ fast.
Requirements:
=============
-VDR >= 1.4.0-2
+VDR >= 2.0.0
gcc >= 3.1
if gcc < 4.0:
@@ -98,11 +91,11 @@ are expected.
In order to work correctly you must copy the subdirectory 'live' from
the source distribution to the directory where the vdr plugins look
-for their configuration files. The pure VDR default for this config
+for their resource files. The pure VDR default for this config
directory is: /video/plugins, but this depends also from the
parameters -c or -v (see 'vdr --help' for details).
-cp -a <live-src-dir>/live <plugin-config-dir>/plugins
+cp -a <live-src-dir>/live <vdr-resource-dir>/plugins
Setup
@@ -121,7 +114,7 @@ You can also specifiy this parameter via commandline:
(default: 8008)
-i IP, --ip=IP bind server only to specified IP, may appear
multiple times
- (default: 0.0.0.0)
+ (default: 0.0.0.0, ::0)
Additional SSL options are available now. See "How to make LIVE listen
for ssl connections" section below on hints how to setup SSL.
@@ -158,7 +151,7 @@ HTTP Listener (default: 8008)
Note: Since the gnutls SslListener was broken in Tntnet versions prior
to SVN revision 1035 you will have to recompile Tntnet with
"./configure --with-ssl=openssl" to make it work. Alternatively
-install version 1.6.2 of tntnet on your system.
+install version 1.6.2 or higher of tntnet on your system.
SSL Commandline options
@@ -217,27 +210,12 @@ and doc/TODO.txt.
Internationalization (i18n)
===========================
-Since the release of VDR 1.5.7 the way how VDR (and its plugins) are
-localized changed dramatically. The system now uses GNU gettext. This
-has the advantage that more languages can be supported. Also the
-translations are now local to a language specific message file. So
-simultaneous translations of different languages are much better
-supported. Message files are located in the po subdirectory.
-
-The downside to this is that, in order to provide new live-plugin
-versions for VDR versions less than 1.5.7, it means one has to
-maintain old i18n.c file and the new message files. Since this would
-be an ongoing source of complications we decided to actively support
-only the new internationalization scheme from VDR 1.5.7 and above.
-
-To be able to support versions of VDR prior to 1.5.7 we generate a
-backward compatible i18n-generated.h file from the new message
-files. This generation step is *not* done automatically on every
-build. It is only neccessary if the localized strings have changed or
-if translations have been added. So if one of above is true you can
-regenerate i18n-generated.h with the make target 'generate-i18n' prior
-to creating the live plugin. In this case you need the CPAN perl
-module Locale::PO installed on your system.
+LIVE uses the same i18n support like VDR does since version 1.5.7.
+This version of LIVE can not support i18n compatible with VDR versions
+older than 1.5.7.
+
+All localization files are found in the po subdirectory of the LIVE
+plugin source.
Security consideratios
diff --git a/css/Makefile b/css/Makefile
index 0ce391c..4373ffb 100644
--- a/css/Makefile
+++ b/css/Makefile
@@ -1,48 +1,19 @@
-# The official name of this plugin.
-
+### The official name of this plugin.
PLUGIN = live
### Additional options to silence TNTNET warnings
TNTFLAGS ?= -Wno-overloaded-virtual -Wno-unused-function
-TNTVERSION ?= $(shell tntnet-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }')
-
-### The C++ compiler and options:
-
-CXX ?= g++
-AR ?= ar
-ECPPC ?= ecppc
-
-CXXFLAGS ?= -O2 -Woverloaded-virtual -Wall -fPIC
-DEFINES ?= -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DTNTVERSION=$(TNTVERSION)
-
-### The directory environment:
-
-VDRDIR ?= ../../../..
-
-### Make sure that necessary options are included:
-
--include $(VDRDIR)/Make.global
-
-### Allow user defined options to overwrite defaults:
-
--include $(VDRDIR)/Make.config
### Includes and Defines (add further entries here):
-
INCLUDES += -I$(VDRDIR)/include -I..
### The object files (add further files here):
-
OBJS = styles.o
-### Default rules:
-
-.PHONY: all clean
-
+### The main target:
all: libcss.a
### Implicit rules:
-
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(TNTFLAGS) -c $(DEFINES) $(PLUGINFEATURES) $(INCLUDES) $<
@@ -50,7 +21,6 @@ all: libcss.a
$(ECPPC) $(ECPPFLAGS) $(ECPPFLAGS_CSS) -b -m "text/css" $<
### Targets:
-
libcss.a: $(OBJS)
$(AR) r $@ $^
diff --git a/debian/links b/debian/links
index a09ac13..a01823d 100644
--- a/debian/links
+++ b/debian/links
@@ -1,4 +1,4 @@
-usr/share/vdr-plugin-live/css var/lib/vdr/plugins/live/css
-usr/share/vdr-plugin-live/img var/lib/vdr/plugins/live/img
-usr/share/vdr-plugin-live/js var/lib/vdr/plugins/live/js
-usr/share/vdr-plugin-live/themes var/lib/vdr/plugins/live/themes
+usr/share/vdr-plugin-live/css usr/share/vdr/plugins/live/css
+usr/share/vdr-plugin-live/img usr/share/vdr/plugins/live/img
+usr/share/vdr-plugin-live/js usr/share/vdr/plugins/live/js
+usr/share/vdr-plugin-live/themes usr/share/vdr/plugins/live/themes
diff --git a/debian/rules b/debian/rules
index fc7104f..8cac789 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,4 +1,4 @@
-#! /bin/sh /usr/share/vdr-dev/make-special-vdr.sh
+#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
@@ -23,7 +23,7 @@ patch-stamp:
unpatch:
endif
-MAKE_OPTIONS = DVBDIR=/usr VDRDIR=/usr/include/vdr LIBDIR=.
+MAKE_OPTIONS = DVBDIR=/usr LIBDIR=. LOCDIR=locale
configure: configure-stamp
configure-stamp: patch-stamp
@@ -51,6 +51,7 @@ install: build
dh_testroot
dh_clean -k
dh_installdirs
+ $(MAKE) install $(MAKE_OPTIONS)
dh_install
# Build architecture-independent files here.
@@ -83,7 +84,7 @@ binary-arch: build install
dh_installdeb
# dh_perl
dh_shlibdeps
- sh /usr/share/vdr-dev/patchlevel.sh subst
+# sh /usr/share/vdr-dev/patchlevel.sh subst
sh /usr/share/vdr-dev/dependencies.sh
dh_gencontrol
dh_md5sums
diff --git a/httpd/Makefile b/httpd/Makefile
deleted file mode 100644
index a11d57c..0000000
--- a/httpd/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-CXX ?= g++
-AR ?= ar
-
-CXXFLAGS ?= -O2 -Woverloaded-virtual -Wall -fPIC
-
-CXXFLAGS += `tntnet-config --cxxflags`
-
-### Includes and Defines (add further entries here):
-
-INCLUDES += -I.
-
-### The object files (add further files here):
-
-OBJS = dispatcher.o job.o regex.o worker.o \
- listener.o poller.o tntnet.o
-
-### Default rules:
-
-.PHONY: all clean
-
-all: libhttpd.a
-
-### Implicit rules:
-
-%.o: %.cpp
- $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
-
-# Dependencies:
-
-MAKEDEP = $(CXX) -MM -MG
-DEPFILE = .dependencies
-$(DEPFILE): Makefile
- @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.cpp) > $@
-
--include $(DEPFILE)
-
-### Targets:
-
-libhttpd.a: $(OBJS)
- $(AR) r $@ $^
-
-clean:
- @rm -f *~ *.o core* libhttpd.a proctest $(DEPFILE)
-
-dist: clean
- @echo "Nothing to do for distribution here ..."
diff --git a/httpd/dispatcher.cpp b/httpd/dispatcher.cpp
deleted file mode 100644
index 8620e76..0000000
--- a/httpd/dispatcher.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/* dispatcher.cpp
- * Copyright (C) 2003-2005 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include "tnt/dispatcher.h"
-#include <tnt/httperror.h>
-#include <functional>
-#include <iterator>
-#include <algorithm>
-#include <cxxtools/log.h>
-
-log_define("tntnet.dispatcher")
-
-namespace tnt
-{
-
-void Dispatcher::addUrlMapEntry(const std::string& url, const CompidentType& ci)
-{
- cxxtools::WrLock lock(rwlock);
-
- urlmap.push_back(urlmap_type::value_type(regex(url), ci));
-}
-
-Compident Dispatcher::mapComp(const std::string& compUrl) const
-{
- urlmap_type::const_iterator pos = urlmap.begin();
- return mapCompNext(compUrl, pos);
-}
-
-namespace {
- class regmatch_formatter : public std::unary_function<const std::string&, std::string>
- {
- public:
- regex_smatch what;
- std::string operator() (const std::string& s) const
- { return what.format(s); }
- };
-}
-
-Dispatcher::urlMapCacheType::size_type Dispatcher::maxUrlMapCache = 8192;
-
-Dispatcher::CompidentType Dispatcher::mapCompNext(const std::string& compUrl,
- Dispatcher::urlmap_type::const_iterator& pos) const
-{
- // check cache
- urlMapCacheType::key_type cacheKey = urlMapCacheType::key_type(compUrl, pos);
- urlMapCacheType::const_iterator um = urlMapCache.find(cacheKey);
- if (um != urlMapCache.end())
- return um->second;
-
- // no cache hit
- regmatch_formatter formatter;
-
- for (; pos != urlmap.end(); ++pos)
- {
- if (pos->first.match(compUrl, formatter.what))
- {
- const CompidentType& src = pos->second;
-
- CompidentType ci;
- ci.libname = formatter(src.libname);
- ci.compname = formatter(src.compname);
- if (src.hasPathInfo())
- ci.setPathInfo(formatter(src.getPathInfo()));
- std::transform(src.getArgs().begin(), src.getArgs().end(),
- std::back_inserter(ci.getArgsRef()), formatter);
-
- // clear cache after maxUrlMapCache distict requests
- if (urlMapCache.size() >= maxUrlMapCache)
- {
- log_warn("clear url-map-cache");
- urlMapCache.clear();
- }
-
- urlMapCache.insert(urlMapCacheType::value_type(cacheKey, ci));
-
- return ci;
- }
- }
-
- throw NotFoundException(compUrl);
-}
-
-Dispatcher::CompidentType Dispatcher::PosType::getNext()
-{
- if (first)
- first = false;
- else
- ++pos;
-
- return dis.mapCompNext(url, pos);
-}
-
-}
diff --git a/httpd/job.cpp b/httpd/job.cpp
deleted file mode 100644
index 49ecba6..0000000
--- a/httpd/job.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-/* job.cpp
- * Copyright (C) 2003-2005 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include "tnt/job.h"
-#include <tnt/httpreply.h>
-#include <cxxtools/log.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-
-log_define("tntnet.job")
-
-namespace tnt
-{
- unsigned Job::socket_read_timeout = 200;
- unsigned Job::socket_write_timeout = 10000;
- unsigned Job::keepalive_max = 1000;
- unsigned Job::socket_buffer_size = 16384;
-
- Job::~Job()
- { }
-
- void Job::clear()
- {
- parser.reset();
- request.clear();
- touch();
- }
-
- int Job::msecToTimeout(time_t currentTime) const
- {
- return (lastAccessTime - currentTime + 1) * 1000
- + getKeepAliveTimeout()
- - getSocketReadTimeout();
- }
-
- unsigned Job::getKeepAliveTimeout()
- {
- return HttpReply::getKeepAliveTimeout();
- }
-
- ////////////////////////////////////////////////////////////////////////
- // Tcpjob
- //
- void Tcpjob::accept(const cxxtools::net::Server& listener)
- {
- log_debug("accept");
- socket.accept(listener);
-
- struct sockaddr_storage s = socket.getSockAddr();
- struct sockaddr_storage sockaddr;
- memcpy(&sockaddr, &s, sizeof(sockaddr));
-
- char buffer[INET6_ADDRSTRLEN];
- log_debug("connection accepted from "
- << inet_ntop(AF_INET6, &(socket.getPeeraddr()), buffer, sizeof(buffer)));
-
- getRequest().setPeerAddr(socket.getPeeraddr());
- getRequest().setServerAddr(sockaddr);
- getRequest().setSsl(false);
- }
-
- std::iostream& Tcpjob::getStream()
- {
- return socket;
- }
-
- int Tcpjob::getFd() const
- {
- return socket.getFd();
- }
-
- void Tcpjob::setRead()
- {
- socket.setTimeout(getSocketReadTimeout());
- }
-
- void Tcpjob::setWrite()
- {
- socket.setTimeout(getSocketWriteTimeout());
- }
-
-#ifdef USE_SSL
- ////////////////////////////////////////////////////////////////////////
- // SslTcpjob
- //
- void SslTcpjob::accept(const SslServer& listener)
- {
- log_debug("accept (ssl)");
- socket.accept(listener);
- log_debug("connection accepted (ssl)");
-
- struct sockaddr_storage s = socket.getSockAddr();
- struct sockaddr_storage sockaddr;
- memcpy(&sockaddr, &s, sizeof(sockaddr));
-
- getRequest().setPeerAddr(socket.getPeeraddr());
- getRequest().setServerAddr(sockaddr);
- getRequest().setSsl(true);
-
- setRead();
- }
-
- std::iostream& SslTcpjob::getStream()
- {
- return socket;
- }
-
- int SslTcpjob::getFd() const
- {
- return socket.getFd();
- }
-
- void SslTcpjob::setRead()
- {
- socket.setTimeout(getSocketReadTimeout());
- }
-
- void SslTcpjob::setWrite()
- {
- socket.setTimeout(getSocketWriteTimeout());
- }
-
-#endif // USE_SSL
-
-#ifdef USE_GNUTLS
- ////////////////////////////////////////////////////////////////////////
- // GnuTlsTcpjob
- //
- void GnuTlsTcpjob::accept(const GnuTlsServer& listener)
- {
- log_debug("accept (ssl)");
- socket.accept(listener);
- log_debug("connection accepted (ssl)");
-
- struct sockaddr_storage s = socket.getSockAddr();
- struct sockaddr_storage sockaddr;
- memcpy(&sockaddr, &s, sizeof(sockaddr));
-
- getRequest().setPeerAddr(socket.getPeeraddr());
- getRequest().setServerAddr(sockaddr);
- getRequest().setSsl(true);
-
- setRead();
- }
-
- std::iostream& GnuTlsTcpjob::getStream()
- {
- return socket;
- }
-
- int GnuTlsTcpjob::getFd() const
- {
- return socket.getFd();
- }
-
- void GnuTlsTcpjob::setRead()
- {
- socket.setTimeout(getSocketReadTimeout());
- }
-
- void GnuTlsTcpjob::setWrite()
- {
- socket.setTimeout(getSocketWriteTimeout());
- }
-
-#endif // USE_GNUTLS
-
- //////////////////////////////////////////////////////////////////////
- // Jobqueue
- //
- void Jobqueue::put(JobPtr j)
- {
- log_debug("Jobqueue::put");
- j->touch();
-
- cxxtools::MutexLock lock(mutex);
-
- if (capacity > 0)
- {
- while (jobs.size() >= capacity)
- {
- log_warn("Jobqueue full");
- notFull.wait(lock);
- }
- }
-
- jobs.push_back(j);
-
- if (waitThreads == 0)
- {
- log_info("no waiting threads left");
- noWaitThreads.signal();
- }
-
- notEmpty.signal();
- }
-
- Jobqueue::JobPtr Jobqueue::get()
- {
- // wait, until a job is available
- ++waitThreads;
-
- cxxtools::MutexLock lock(mutex);
- while (jobs.empty())
- notEmpty.wait(lock);
-
- --waitThreads;
-
- log_debug("Jobqueue: fetch job " << waitThreads << " waiting threads left");
-
- // take next job (queue is locked)
- JobPtr j = jobs.front();
- jobs.pop_front();
-
- // if there are more jobs, wake onther thread
- if (!jobs.empty())
- notEmpty.signal();
- notFull.signal();
-
- return j;
- }
-
-}
diff --git a/httpd/listener.cpp b/httpd/listener.cpp
deleted file mode 100644
index 57c334d..0000000
--- a/httpd/listener.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-/* listener.cpp
- * Copyright (C) 2003 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include "tnt/listener.h"
-#include "tnt/tntnet.h"
-#include <cxxtools/log.h>
-#include <errno.h>
-#include <unistd.h>
-
-#ifdef WITH_GNUTLS
-# include "tnt/gnutls.h"
-#endif
-
-#ifdef WITH_OPENSSL
-# include "tnt/openssl.h"
-#endif
-
-log_define("tntnet.listener")
-
-static void doListenRetry(cxxtools::net::Server& server,
- const char* ipaddr, unsigned short int port)
-{
- for (unsigned n = 1; true; ++n)
- {
- try
- {
- log_debug("listen " << ipaddr << ':' << port);
- server.listen(ipaddr, port, tnt::Listener::getBacklog());
- return;
- }
- catch (const cxxtools::net::Exception& e)
- {
- log_debug("cxxtools::net::Exception caught: errno=" << e.getErrno() << " msg=" << e.what());
- if (e.getErrno() != EADDRINUSE || n > tnt::Listener::getListenRetry())
- {
- log_debug("rethrow exception");
- throw;
- }
- log_warn("address " << ipaddr << ':' << port << " in use - retry; n = " << n);
- ::sleep(1);
- }
- }
-}
-
-namespace tnt
-{
- void ListenerBase::doStop()
- {
- log_warn("stop listener " << ipaddr << ':' << port);
- try
- {
- // connect once to wake up listener, so it will check stop-flag
- cxxtools::net::Stream(ipaddr, port);
- }
- catch (const std::exception& e)
- {
- log_warn("error waking up listener: " << e.what() << " try 127.0.0.1");
- cxxtools::net::Stream("127.0.0.1", port);
- }
- }
-
- int Listener::backlog = 16;
- unsigned Listener::listenRetry = 5;
-
- Listener::Listener(const std::string& ipaddr, unsigned short int port, Jobqueue& q)
- : ListenerBase(ipaddr, port),
- queue(q)
- {
- log_info("listen ip=" << ipaddr << " port=" << port);
- doListenRetry(server, ipaddr.c_str(), port);
- }
-
- void Listener::run()
- {
- // accept-loop
- log_debug("enter accept-loop");
- while (!Tntnet::shouldStop())
- {
- try
- {
- Tcpjob* j = new Tcpjob;
- Jobqueue::JobPtr p(j);
- j->accept(server);
- log_debug("connection accepted");
-
- if (Tntnet::shouldStop())
- break;
-
- queue.put(p);
- }
- catch (const std::exception& e)
- {
- log_error("error in accept-loop: " << e.what());
- }
- }
-
- log_debug("stop listener");
- }
-
-#ifdef WITH_GNUTLS
-#define USE_SSL
-
-#endif
-
-#ifdef WITH_OPENSSL
-#define USE_SSL
-
-#endif
-
-#ifdef USE_SSL
- Ssllistener::Ssllistener(const char* certificateFile,
- const char* keyFile,
- const std::string& ipaddr, unsigned short int port,
- Jobqueue& q)
- : ListenerBase(ipaddr, port),
- server(certificateFile, keyFile),
- queue(q)
- {
- log_info("listen ip=" << ipaddr << " port=" << port << " (ssl)");
- doListenRetry(server, ipaddr.c_str(), port);
- }
-
- void Ssllistener::run()
- {
- // accept-loop
- log_debug("enter accept-loop (ssl)");
- while (!Tntnet::shouldStop())
- {
- try
- {
- SslTcpjob* j = new SslTcpjob;
- Jobqueue::JobPtr p(j);
- j->accept(server);
-
- if (Tntnet::shouldStop())
- break;
-
- queue.put(p);
- }
- catch (const std::exception& e)
- {
- log_error("error in ssl-accept-loop: " << e.what());
- }
- }
-
- log_debug("stop ssl-listener");
- }
-
-#endif // USE_SSL
-
-}
diff --git a/httpd/poller.cpp b/httpd/poller.cpp
deleted file mode 100644
index c604f55..0000000
--- a/httpd/poller.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/* poller.cpp
- * Copyright (C) 2005 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include "tnt/poller.h"
-#include "tnt/tntnet.h"
-#include <cxxtools/log.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-log_define("tntnet.poller")
-
-namespace tnt
-{
- Poller::Poller(Jobqueue& q)
- : queue(q),
- poll_timeout(-1)
- {
- pipe(notify_pipe);
- fcntl(notify_pipe[0], F_SETFL, O_NONBLOCK);
-
- pollfds.reserve(16);
- pollfds[0].fd = notify_pipe[0];
- pollfds[0].events = POLLIN;
- pollfds[0].revents = 0;
- }
-
- void Poller::append_new_jobs()
- {
- cxxtools::MutexLock lock(mutex);
- if (!new_jobs.empty())
- {
- // append new jobs to current
- log_debug("add " << new_jobs.size() << " new jobs to poll-list");
-
- pollfds.reserve(current_jobs.size() + new_jobs.size() + 1);
-
- time_t currentTime;
- time(¤tTime);
- for (jobs_type::iterator it = new_jobs.begin();
- it != new_jobs.end(); ++it)
- {
- append(*it);
- int msec;
- if (poll_timeout < 0)
- poll_timeout = (*it)->msecToTimeout(currentTime);
- else if ((msec = (*it)->msecToTimeout(currentTime)) < poll_timeout)
- poll_timeout = msec;
- }
-
- new_jobs.clear();
- }
- }
-
- void Poller::append(Jobqueue::JobPtr& job)
- {
- current_jobs.push_back(job);
-
- pollfd& p = *(pollfds.data() + current_jobs.size());
- p.fd = job->getFd();
- p.events = POLLIN;
- }
-
- void Poller::run()
- {
- while (!Tntnet::shouldStop())
- {
- append_new_jobs();
-
- try
- {
- log_debug("poll timeout=" << poll_timeout);
- ::poll(pollfds.data(), current_jobs.size() + 1, poll_timeout);
- if (Tntnet::shouldStop())
- {
- log_warn("stop poller");
- break;
- }
-
- poll_timeout = -1;
-
- if (pollfds[0].revents != 0)
- {
- log_debug("read notify-pipe");
- char ch;
- ::read(notify_pipe[0], &ch, 1);
- pollfds[0].revents = 0;
- }
-
- dispatch();
- }
- catch (const std::exception& e)
- {
- log_error("error in poll-loop: " << e.what());
- }
- }
- }
-
- void Poller::doStop()
- {
- log_debug("notify stop");
- char ch = 'A';
- ::write(notify_pipe[1], &ch, 1);
- }
-
- void Poller::dispatch()
- {
- log_debug("dispatch " << current_jobs.size() << " jobs");
-
- time_t currentTime;
- time(¤tTime);
- for (unsigned i = 0; i < current_jobs.size(); )
- {
- if (pollfds[i + 1].revents & POLLIN)
- {
- log_debug("job found " << pollfds[i + 1].fd);
-
- // put job into work-queue
- queue.put(current_jobs[i]);
- remove(i);
- }
- else if (pollfds[i + 1].revents != 0)
- {
- log_debug("pollevent " << std::hex << pollfds[i + 1].revents << " on fd " << pollfds[i + 1].fd);
- remove(i);
- }
- else
- {
- // check timeout
- int msec = current_jobs[i]->msecToTimeout(currentTime);
- if (msec <= 0)
- {
- log_debug("keep-alive-timeout reached");
- remove(i);
- }
- else if (poll_timeout < 0 || msec < poll_timeout)
- poll_timeout = msec;
-
- ++i;
- }
- }
- }
-
- void Poller::remove(jobs_type::size_type n)
- {
- // replace job with last job in poller-list
- jobs_type::size_type last = current_jobs.size() - 1;
-
- if (n != last)
- {
- pollfds[n + 1] = pollfds[last + 1];
- current_jobs[n] = current_jobs[last];
- }
-
- current_jobs.pop_back();
- }
-
- void Poller::addIdleJob(Jobqueue::JobPtr job)
- {
- log_debug("addIdleJob " << job->getFd());
-
- {
- cxxtools::MutexLock lock(mutex);
- new_jobs.push_back(job);
- }
-
- log_debug("notify " << job->getFd());
-
- char ch = 'A';
- ::write(notify_pipe[1], &ch, 1);
-
- log_debug("addIdleJob ready");
- }
-
-}
diff --git a/httpd/regex.cpp b/httpd/regex.cpp
deleted file mode 100644
index a9f52fc..0000000
--- a/httpd/regex.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/* regex.cpp
- * Copyright (C) 2005 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include "tnt/regex.h"
-#include <stdexcept>
-#include <locale>
-
-namespace tnt
-{
- static inline bool isdigit(char ch)
- {
- return ch >= '0' && ch <= '9';
- }
-
- unsigned regex_smatch::size() const
- {
- unsigned n;
- for (n = 0; n < 10 && matchbuf[n].rm_so >= 0; ++n)
- ;
-
- return n;
- }
-
- std::string regex_smatch::get(unsigned n) const
- {
- return str.substr(matchbuf[n].rm_so, matchbuf[n].rm_eo - matchbuf[n].rm_so);
- }
-
- std::string regex_smatch::format(const std::string& s) const
- {
- enum state_type
- {
- state_0,
- state_esc,
- state_var0,
- state_var1,
- state_1
- } state;
-
- state = state_0;
- std::string ret;
-
- for (std::string::const_iterator it = s.begin(); it != s.end(); ++it)
- {
- char ch = *it;
-
- switch (state)
- {
- case state_0:
- if (ch == '$')
- state = state_var0;
- else if (ch == '\\')
- {
- ret = std::string(s.begin(), it);
- state = state_esc;
- }
- break;
-
- case state_esc:
- ret += ch;
- state = state_1;
- break;
-
- case state_var0:
- if (isdigit(ch))
- {
- ret = std::string(s.begin(), it - 1);
- regoff_t s = matchbuf[ch - '0'].rm_so;
- regoff_t e = matchbuf[ch - '0'].rm_eo;
- if (s >= 0 && e >= 0)
- ret.append(str, s, e-s);
- state = state_1;
- }
- else
- state = state_0;
- break;
-
- case state_1:
- if (ch == '$')
- state = state_var1;
- else if (state == '\\')
- state = state_esc;
- else
- ret += ch;
- break;
-
- case state_var1:
- if (isdigit(ch))
- {
- unsigned s = matchbuf[ch - '0'].rm_so;
- unsigned e = matchbuf[ch - '0'].rm_eo;
- if (s >= 0 && e >= 0)
- ret.append(str, s, e-s);
- state = state_1;
- }
- else if (ch == '$')
- ret += '$';
- else
- {
- ret += '$';
- ret += ch;
- }
- break;
- }
- }
-
- switch (state)
- {
- case state_0:
- case state_var0:
- return s;
-
- case state_esc:
- return ret + '\\';
-
- case state_var1:
- return ret + '$';
-
- case state_1:
- return ret;
- }
-
- return ret;
- }
-
- void regex::checkerr(int ret) const
- {
- if (ret != 0)
- {
- char errbuf[256];
- regerror(ret, &expr, errbuf, sizeof(errbuf));
- throw std::runtime_error(errbuf);
- }
- }
-
- bool regex::match(const std::string& str_, int eflags) const
- {
- regex_smatch smatch;
- return match(str_, smatch, eflags);
- }
-
- bool regex::match(const std::string& str_, regex_smatch& smatch, int eflags) const
- {
- smatch.str = str_;
- int ret = regexec(&expr, str_.c_str(),
- sizeof(smatch.matchbuf) / sizeof(regmatch_t), smatch.matchbuf, eflags);
-
- if (ret ==REG_NOMATCH)
- return false;
-
- checkerr(ret);
- return true;
- }
-
- void regex::free()
- {
- regfree(&expr);
- }
-}
diff --git a/httpd/tnt/dispatcher.h b/httpd/tnt/dispatcher.h
deleted file mode 100644
index 218efcb..0000000
--- a/httpd/tnt/dispatcher.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* tnt/dispatcher.h
- * Copyright (C) 2003-2005 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef TNT_DISPATCHER_H
-#define TNT_DISPATCHER_H
-
-#include <cxxtools/thread.h>
-#include <tnt/urlmapper.h>
-#include <vector>
-#include <map>
-#include "tnt/regex.h"
-
-namespace tnt
-{
- // Dispatcher - one per host
- class Dispatcher : public Urlmapper
- {
- public:
- class CompidentType : public Compident
- {
- public:
- typedef std::vector<std::string> args_type;
-
- private:
- std::string pathinfo;
- args_type args;
- bool pathinfo_set;
-
- public:
- CompidentType()
- : pathinfo_set(false)
- { }
-
- explicit CompidentType(const std::string& ident)
- : Compident(ident),
- pathinfo_set(false)
- { }
-
- bool hasPathInfo() const
- { return pathinfo_set; }
- void setPathInfo(const std::string& p)
- { pathinfo = p; pathinfo_set = true; }
- void setArgs(const args_type& a)
- { args = a; }
- const std::string& getPathInfo() const
- { return pathinfo; }
- const args_type& getArgs() const
- { return args; }
- args_type& getArgsRef()
- { return args; }
- };
-
- private:
- typedef std::vector<std::pair<regex, CompidentType> > urlmap_type;
- urlmap_type urlmap; // map url to soname/compname
- mutable cxxtools::RWLock rwlock;
-
- typedef std::map<std::pair<std::string, urlmap_type::const_iterator>,
- CompidentType> urlMapCacheType;
- mutable urlMapCacheType urlMapCache;
- static urlMapCacheType::size_type maxUrlMapCache;
-
- // don't make this public - it's not threadsafe:
- CompidentType mapCompNext(const std::string& compUrl,
- urlmap_type::const_iterator& pos) const;
-
- public:
- virtual ~Dispatcher() { }
-
- void addUrlMapEntry(const std::string& url, const CompidentType& ci);
-
- Compident mapComp(const std::string& compUrl) const;
-
- static urlMapCacheType::size_type getMaxUrlMapCache()
- { return maxUrlMapCache; }
- static void setMaxUrlMapCache(urlMapCacheType::size_type s)
- { maxUrlMapCache = s; }
-
- friend class PosType;
-
- class PosType
- {
- const Dispatcher& dis;
- cxxtools::RdLock lock;
- urlmap_type::const_iterator pos;
- std::string url;
- bool first;
-
- public:
- PosType(const Dispatcher& d, const std::string& u)
- : dis(d),
- lock(dis.rwlock),
- pos(dis.urlmap.begin()),
- url(u),
- first(true)
- { }
-
- CompidentType getNext();
- };
- };
-
-}
-
-#endif // TNT_DISPATCHER_H
-
diff --git a/httpd/tnt/gcryptinit.h b/httpd/tnt/gcryptinit.h
deleted file mode 100644
index 3b6ee33..0000000
--- a/httpd/tnt/gcryptinit.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* tnt/gcryptinit.h
- * Copyright (C) 2003-2005 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef TNT_GCRYPTINIT_H
-#define TNT_GCRYPTINIT_H
-
-#include <gcrypt.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-gcry_error_t gcrypt_init();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // TNT_GCRYPTINIT_H
-
diff --git a/httpd/tnt/gnutls.h b/httpd/tnt/gnutls.h
deleted file mode 100644
index 8d8811c..0000000
--- a/httpd/tnt/gnutls.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/* tnt/gnutls.h
- * Copyright (C) 2006 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef TNT_GNUTLS_H
-#define TNT_GNUTLS_H
-
-#include <cxxtools/tcpstream.h>
-#include <gnutls/gnutls.h>
-
-namespace tnt
-{
- class GnuTlsException : public std::runtime_error
- {
- unsigned long code;
- static std::string formatMessage(const std::string& function, int code_);
-
- public:
- GnuTlsException(const std::string& function, int code_)
- : std::runtime_error(formatMessage(function, code_)),
- code(code_)
- { }
-
- unsigned long getCode() const
- { return code; }
- };
-
- class GnuTlsInit
- {
- static unsigned initCount;
- static gnutls_dh_params dhParams;
-
- public:
- GnuTlsInit();
- ~GnuTlsInit();
-
- gnutls_dh_params getDhParams() const { return dhParams; }
- };
-
- class GnuTlsX509Cred
- {
- gnutls_certificate_credentials x509_cred;
- GnuTlsInit init;
-
- public:
- GnuTlsX509Cred(const char* certificateFile, const char* privateKeyFile);
- ~GnuTlsX509Cred();
-
- operator gnutls_certificate_credentials() const { return x509_cred; }
- };
-
- class GnuTlsServer : public cxxtools::net::Server
- {
- GnuTlsX509Cred cred;
-
- public:
- GnuTlsServer(const char* certificateFile, const char* privateKeyFile);
-
- gnutls_certificate_credentials getCred() const { return cred; }
- };
-
- class GnuTlsStream : public cxxtools::net::Stream
- {
- gnutls_session session;
-
- public:
- GnuTlsStream()
- : session(0)
- { }
-
- explicit GnuTlsStream(int fd)
- : cxxtools::net::Stream(fd)
- { }
-
- explicit GnuTlsStream(const GnuTlsServer& server)
- { accept(server); }
-
- ~GnuTlsStream();
-
- void accept(const GnuTlsServer& server);
- int sslRead(char* buffer, int bufsize) const;
- int sslWrite(const char* buffer, int bufsize) const;
- void shutdown() const;
- };
-
- class GnuTls_streambuf : public std::streambuf
- {
- GnuTlsStream& m_stream;
- char_type* m_buffer;
- unsigned m_bufsize;
-
- public:
- explicit GnuTls_streambuf(GnuTlsStream& stream, unsigned bufsize = 256, int timeout = -1);
- ~GnuTls_streambuf()
- { delete[] m_buffer; }
-
- void setTimeout(int t) { m_stream.setTimeout(t); }
- int getTimeout() const { return m_stream.getTimeout(); }
-
- /// overload std::streambuf
- int_type overflow(int_type c);
- /// overload std::streambuf
- int_type underflow();
- /// overload std::streambuf
- int sync();
- };
-
- class GnuTls_iostream : public GnuTlsStream, public std::iostream
- {
- GnuTls_streambuf m_buffer;
-
- public:
- explicit GnuTls_iostream(unsigned bufsize = 256, int timeout = -1)
- : GnuTlsStream(-1),
- std::iostream(&m_buffer),
- m_buffer(*this, bufsize, timeout)
- { }
-
- explicit GnuTls_iostream(const GnuTlsServer& server, unsigned bufsize = 256, int timeout = -1)
- : GnuTlsStream(server),
- std::iostream(&m_buffer),
- m_buffer(*this, bufsize, timeout)
- { }
-
- void setTimeout(int timeout) { m_buffer.setTimeout(timeout); }
- int getTimeout() const { return m_buffer.getTimeout(); }
- };
-}
-
-#endif // TNT_GNUTLS_H
-
diff --git a/httpd/tnt/job.h b/httpd/tnt/job.h
deleted file mode 100644
index 5e839fd..0000000
--- a/httpd/tnt/job.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/* tnt/job.h
- * Copyright (C) 2003-2005 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef TNT_JOB_H
-#define TNT_JOB_H
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include <deque>
-#include <cxxtools/thread.h>
-#include <cxxtools/tcpstream.h>
-#include <tnt/httprequest.h>
-#include <tnt/httpparser.h>
-#include <tnt/pointer.h>
-#include <time.h>
-#include "tnt/ssl.h"
-
-/**
-// in tntnet (mainthread):
-Jobqueue queue;
-void mainloop()
-{
- while (1)
- {
- Jobqueue::JobPtr j = new Tcpjob();
- j->accept(poller.get());
- queue.put(j);
- }
-}
-
-// in server (workerthread):
-void Server::run()
-{
- while (1)
- {
- Jobqueue::JobPtr j = queue.get();
- std::iostream& socket = j->getStream();
- processRequest(socket);
- }
-}
-*/
-
-namespace tnt
-{
- /** Job - one per request */
- class Job
- {
- unsigned keepAliveCounter;
-
- HttpRequest request;
- HttpMessage::Parser parser;
- time_t lastAccessTime;
-
- unsigned refs;
-
- static unsigned socket_read_timeout;
- static unsigned socket_write_timeout;
- static unsigned keepalive_max;
- static unsigned socket_buffer_size;
-
- public:
- Job()
- : keepAliveCounter(keepalive_max),
- parser(request),
- lastAccessTime(0),
- refs(0)
- { }
-
- protected:
- virtual ~Job();
-
- public:
- unsigned addRef() { return ++refs; }
- unsigned release()
- {
- if (--refs == 0)
- {
- delete this;
- return 0;
- }
- else
- return refs;
- }
-
- virtual std::iostream& getStream() = 0;
- virtual int getFd() const = 0;
- virtual void setRead() = 0;
- virtual void setWrite() = 0;
-
- HttpRequest& getRequest() { return request; }
- HttpMessage::Parser& getParser() { return parser; }
-
- unsigned decrementKeepAliveCounter()
- { return keepAliveCounter > 0 ? --keepAliveCounter : 0; }
- void clear();
- void touch() { time(&lastAccessTime); }
- int msecToTimeout(time_t currentTime) const;
-
- static void setSocketReadTimeout(unsigned ms) { socket_read_timeout = ms; }
- static void setSocketWriteTimeout(unsigned ms) { socket_write_timeout = ms; }
- static void setKeepAliveMax(unsigned n) { keepalive_max = n; }
- static void setSocketBufferSize(unsigned b) { socket_buffer_size = b; }
-
- static unsigned getSocketReadTimeout() { return socket_read_timeout; }
- static unsigned getSocketWriteTimeout() { return socket_write_timeout; }
- static unsigned getKeepAliveTimeout();
- static unsigned getKeepAliveMax() { return keepalive_max; }
- static unsigned getSocketBufferSize() { return socket_buffer_size; }
- };
-
- class Tcpjob : public Job
- {
- cxxtools::net::iostream socket;
-
- public:
- Tcpjob()
- : socket(getSocketBufferSize(), getSocketReadTimeout())
- { }
-
- void accept(const cxxtools::net::Server& listener);
-
- std::iostream& getStream();
- int getFd() const;
- void setRead();
- void setWrite();
- };
-
-#ifdef USE_SSL
- class SslTcpjob : public Job
- {
- ssl_iostream socket;
-
- public:
- SslTcpjob()
- : socket(getSocketBufferSize(), getSocketReadTimeout())
- { }
-
- void accept(const SslServer& listener);
-
- std::iostream& getStream();
- int getFd() const;
- void setRead();
- void setWrite();
- };
-#endif // USE_SSL
-
- /** Jobqueue - one per process */
- class Jobqueue
- {
- public:
- typedef Pointer<Job> JobPtr;
-
- cxxtools::Condition noWaitThreads;
-
- private:
- std::deque<JobPtr> jobs;
- cxxtools::Mutex mutex;
- cxxtools::Condition notEmpty;
- cxxtools::Condition notFull;
- unsigned waitThreads;
- unsigned capacity;
-
- public:
- explicit Jobqueue(unsigned capacity_)
- : waitThreads(0),
- capacity(capacity_)
- { }
-
- void put(JobPtr j);
- JobPtr get();
-
- void setCapacity(unsigned c)
- { capacity = c; }
- unsigned getCapacity() const
- { return capacity; }
- unsigned getWaitThreadCount() const
- { return waitThreads; }
- bool empty() const
- { return jobs.empty(); }
- };
-}
-
-#endif // TNT_JOB_H
-
diff --git a/httpd/tnt/listener.h b/httpd/tnt/listener.h
deleted file mode 100644
index 4991763..0000000
--- a/httpd/tnt/listener.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* tnt/listener.h
- * Copyright (C) 2003 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef TNT_LISTENER_H
-#define TNT_LISTENER_H
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include <cxxtools/thread.h>
-#include "tnt/job.h"
-
-namespace tnt
-{
- class ListenerBase : public cxxtools::AttachedThread
- {
- std::string ipaddr;
- unsigned short int port;
-
- public:
- ListenerBase(const std::string& ipaddr_, unsigned short int port_)
- : ipaddr(ipaddr_),
- port(port_)
- { }
-
- void doStop();
- };
-
- class Listener : public ListenerBase
- {
- cxxtools::net::Server server;
- Jobqueue& queue;
- static int backlog;
- static unsigned listenRetry;
-
- public:
- Listener(const std::string& ipaddr, unsigned short int port, Jobqueue& q);
- virtual void run();
-
- static void setBacklog(int backlog_) { backlog = backlog_; }
- static int getBacklog() { return backlog; }
- static void setListenRetry(unsigned listenRetry_) { listenRetry = listenRetry_; }
- static unsigned getListenRetry() { return listenRetry; }
- };
-
-#ifdef USE_SSL
- class Ssllistener : public ListenerBase
- {
- SslServer server;
- Jobqueue& queue;
-
- public:
- Ssllistener(const char* certificateFile, const char* keyFile,
- const std::string& ipaddr, unsigned short int port, Jobqueue& q);
- virtual void run();
- };
-#endif // USE_SSL
-
-}
-
-#endif // TNT_LISTENER_H
-
diff --git a/httpd/tnt/openssl.h b/httpd/tnt/openssl.h
deleted file mode 100644
index 863782f..0000000
--- a/httpd/tnt/openssl.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* tnt/openssl.h
- * Copyright (C) 2003 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef TNT_OPENSSL_H
-#define TNT_OPENSSL_H
-
-#include <cxxtools/tcpstream.h>
-#include <openssl/ssl.h>
-
-namespace tnt
-{
- class OpensslException : public std::runtime_error
- {
- unsigned long code;
-
- public:
- OpensslException(const std::string& what, unsigned long code_)
- : std::runtime_error(what),
- code(code_)
- { }
-
- unsigned long getCode() const
- { return code; }
- };
-
- class OpensslServer : public cxxtools::net::Server
- {
- SSL_CTX* ctx;
- void installCertificates(const char* certificateFile, const char* privateKeyFile);
-
- public:
- OpensslServer(const char* certificateFile);
- OpensslServer(const char* certificateFile, const char* privateKeyFile);
- ~OpensslServer();
-
- SSL_CTX* getSslContext() const { return ctx; }
- };
-
- class OpensslStream : public cxxtools::net::Stream
- {
- SSL* ssl;
-
- public:
- OpensslStream();
-
- explicit OpensslStream(int fd)
- : cxxtools::net::Stream(fd)
- { }
-
- explicit OpensslStream(const OpensslServer& server);
- ~OpensslStream();
-
- void accept(const OpensslServer& server);
-
- int sslRead(char* buffer, int bufsize) const;
- int sslWrite(const char* buffer, int bufsize) const;
- void shutdown() const;
- };
-
- class openssl_streambuf : public std::streambuf
- {
- OpensslStream& m_stream;
- char_type* m_buffer;
- unsigned m_bufsize;
-
- public:
- explicit openssl_streambuf(OpensslStream& stream, unsigned bufsize = 256, int timeout = -1);
- ~openssl_streambuf()
- { delete[] m_buffer; }
-
- void setTimeout(int t) { m_stream.setTimeout(t); }
- int getTimeout() const { return m_stream.getTimeout(); }
-
- /// overload std::streambuf
- int_type overflow(int_type c);
- /// overload std::streambuf
- int_type underflow();
- /// overload std::streambuf
- int sync();
- };
-
- class openssl_iostream : public OpensslStream, public std::iostream
- {
- openssl_streambuf m_buffer;
-
- public:
- explicit openssl_iostream(unsigned bufsize = 256, int timeout = -1)
- : OpensslStream(-1),
- std::iostream(&m_buffer),
- m_buffer(*this, bufsize, timeout)
- { }
-
- explicit openssl_iostream(const OpensslServer& server, unsigned bufsize = 256, int timeout = -1)
- : OpensslStream(server),
- std::iostream(&m_buffer),
- m_buffer(*this, bufsize, timeout)
- { }
-
- void setTimeout(int timeout) { m_buffer.setTimeout(timeout); }
- int getTimeout() const { return m_buffer.getTimeout(); }
- };
-}
-
-#endif // TNT_OPENSSL_H
-
diff --git a/httpd/tnt/poller.h b/httpd/tnt/poller.h
deleted file mode 100644
index d9b12e9..0000000
--- a/httpd/tnt/poller.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* tnt/poller.h
- * Copyright (C) 2005 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef TNT_POLLER_H
-#define TNT_POLLER_H
-
-#include "tnt/job.h"
-#include <cxxtools/dynbuffer.h>
-#include <cxxtools/thread.h>
-#include <sys/poll.h>
-
-namespace tnt
-{
- class Poller : public cxxtools::AttachedThread
- {
- Jobqueue& queue;
- int notify_pipe[2];
-
- typedef std::deque<Jobqueue::JobPtr> jobs_type;
-
- jobs_type current_jobs;
- cxxtools::Dynbuffer<pollfd> pollfds;
-
- jobs_type new_jobs;
-
- cxxtools::Mutex mutex;
- int poll_timeout;
-
- void append_new_jobs();
- void append(Jobqueue::JobPtr& job);
- void dispatch();
- void remove(jobs_type::size_type n);
-
- public:
- Poller(Jobqueue& q);
-
- virtual void run();
- void doStop();
- void addIdleJob(Jobqueue::JobPtr job);
- };
-
-}
-
-#endif // TNT_POLLER_H
-
diff --git a/httpd/tnt/regex.h b/httpd/tnt/regex.h
deleted file mode 100644
index b2a30e8..0000000
--- a/httpd/tnt/regex.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* tnt/regex.h
- * Copyright (C) 2005 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef TNT_REGEX_H
-#define TNT_REGEX_H
-
-#include <string>
-#include <sys/types.h>
-#include <regex.h>
-
-namespace tnt
-{
- /// collects matches in a regex
- class regex_smatch
- {
- friend class regex;
-
- std::string str;
- regmatch_t matchbuf[10];
-
- public:
- unsigned size() const;
- std::string get(unsigned n) const;
- std::string format(const std::string& s) const;
- };
-
- /// regex(3)-wrapper.
- /// Warning: incomplete, but sufficient for tntnet.
- /// Regular expression is not automatically freed. Tntnet needs to
- /// put regex into a stl-container, so it needs to be copyable.
- /// For this class to be complete, the regex_t needs to be
- /// reference-counted. This is unneeded for tntnet, because the regex is
- /// never freed anyway.
- class regex
- {
- regex_t expr;
-
- void checkerr(int ret) const;
-
- public:
- explicit regex(const char* ex, int cflags = REG_EXTENDED)
- {
- checkerr(::regcomp(&expr, ex, cflags));
- }
-
- explicit regex(const std::string& ex, int cflags = REG_EXTENDED)
- {
- checkerr(::regcomp(&expr, ex.c_str(), cflags));
- }
-
- bool match(const std::string& str_, regex_smatch& smatch, int eflags = 0) const;
- bool match(const std::string& str_, int eflags = 0) const;
-
- void free();
-
- private:
- friend class value_type;
- };
-
-}
-
-#endif // TNT_REGEX_H
-
diff --git a/httpd/tnt/ssl.h b/httpd/tnt/ssl.h
deleted file mode 100644
index 6660d2f..0000000
--- a/httpd/tnt/ssl.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* tnt/ssl.h
- * Copyright (C) 2006 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef TNT_SSL_H
-#define TNT_SSL_H
-
-#ifdef WITH_GNUTLS
-# include "tnt/gnutls.h"
-# define USE_SSL
-#endif
-
-#ifdef WITH_OPENSSL
-# include "tnt/openssl.h"
-# define USE_SSL
-#endif
-
-namespace tnt
-{
-#ifdef WITH_GNUTLS
-
- typedef GnuTlsServer SslServer;
- typedef GnuTls_iostream ssl_iostream;
-
-#endif
-
-#ifdef WITH_OPENSSL
-
- typedef OpensslServer SslServer;
- typedef openssl_iostream ssl_iostream;
-
-#endif
-
-}
-
-#endif // TNT_SSL_H
-
diff --git a/httpd/tnt/tntnet.h b/httpd/tnt/tntnet.h
deleted file mode 100644
index a83784e..0000000
--- a/httpd/tnt/tntnet.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* tnt/tntnet.h
- * Copyright (C) 2003-2005 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef TNT_TNTNET_H
-#define TNT_TNTNET_H
-
-#include <cxxtools/arg.h>
-#include "tnt/tntconfig.h"
-#include "tnt/job.h"
-#include "tnt/poller.h"
-#include "tnt/dispatcher.h"
-#include <tnt/scopemanager.h>
-#include <set>
-
-namespace tnt
-{
- class ListenerBase;
-
- class Tntnet
- {
- std::string configFile;
- Tntconfig config;
- cxxtools::Arg<const char*> propertyfilename;
- cxxtools::Arg<bool> debug;
- bool isDaemon;
-
- unsigned minthreads;
- unsigned maxthreads;
- unsigned long threadstartdelay;
-
- Jobqueue queue;
-
- static bool stop;
- static int ret;
- typedef std::set<ListenerBase*> listeners_type;
- listeners_type listeners;
-
- Poller pollerthread;
- Dispatcher d_dispatcher;
-
- static std::string pidFileName;
-
- ScopeManager scopemanager;
-
- // helper methods
- void setUser() const;
- void setGroup() const;
- void setDir(const char* def) const;
- int mkDaemon() const; // returns pipe
- void closeStdHandles() const;
-
- // noncopyable
- Tntnet(const Tntnet&);
- Tntnet& operator= (const Tntnet&);
-
- void initLogging();
- void writePidfile(int pid);
- void monitorProcess(int workerPid);
- void initWorkerProcess();
- void workerProcess(int filedes = -1);
-
- void timerTask();
- void loadConfiguration();
-
- public:
- Tntnet(int& argc, char* argv[]);
- int run();
-
- static void shutdown();
- static void restart();
- static bool shouldStop() { return stop; }
-
- Jobqueue& getQueue() { return queue; }
- Poller& getPoller() { return pollerthread; }
- const Dispatcher& getDispatcher() const { return d_dispatcher; }
- const Tntconfig& getConfig() const { return config; }
- ScopeManager& getScopemanager() { return scopemanager; }
- };
-
-}
-
-#endif // TNT_TNTNET_H
-
diff --git a/httpd/tnt/worker.h b/httpd/tnt/worker.h
deleted file mode 100644
index be42841..0000000
--- a/httpd/tnt/worker.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* tnt/worker.h
- * Copyright (C) 2003-2005 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef TNT_WORKER_H
-#define TNT_WORKER_H
-
-#include <string>
-#include <cxxtools/tcpstream.h>
-#include <cxxtools/thread.h>
-#include <cxxtools/pool.h>
-#include <tnt/comploader.h>
-#include <tnt/tntnet.h>
-#include <tnt/scope.h>
-
-namespace tnt
-{
- class HttpRequest;
- class HttpReply;
-
- class Worker : public cxxtools::DetachedThread
- {
- static cxxtools::Mutex mutex;
- static unsigned nextThreadNumber;
-
- Tntnet& application;
-
- typedef cxxtools::Pool<Comploader> ComploaderPoolType;
- static ComploaderPoolType comploaderPool;
-
- ComploaderPoolType::objectptr_type comploaderObject;
- Comploader& comploader;
-
- Scope threadScope;
-
- pthread_t threadId;
- const char* state;
- time_t lastWaitTime;
-
- typedef std::set<Worker*> workers_type;
- static workers_type workers;
-
- static unsigned maxRequestTime;
- static unsigned minThreads;
- static bool enableCompression;
-
- bool processRequest(HttpRequest& request, std::iostream& socket,
- unsigned keepAliveCount);
- void healthCheck(time_t currentTime);
-
- ~Worker();
-
- public:
- Worker(Tntnet& app);
-
- virtual void run();
-
- void dispatch(HttpRequest& request, HttpReply& reply);
-
- static void timer();
-
- /// Sets a hard limit for request-time.
- /// When the time is exceeded, this process exits.
- static void setMaxRequestTime(unsigned sec) { maxRequestTime = sec; }
- static unsigned getMaxRequestTime() { return maxRequestTime; }
-
- static workers_type::size_type getCountThreads();
- static void setMinThreads(unsigned n) { minThreads = n; }
-
- static void setEnableCompression(bool sw = true) { enableCompression = sw; }
- static unsigned getEnableCompression() { return enableCompression; }
- };
-}
-
-#endif // TNT_WORKER_H
-
diff --git a/httpd/tntnet.cpp b/httpd/tntnet.cpp
deleted file mode 100644
index 98f2ac9..0000000
--- a/httpd/tntnet.cpp
+++ /dev/null
@@ -1,832 +0,0 @@
-/* tntnet.cpp
- * Copyright (C) 2003-2005 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include "tnt/worker.h"
-#include "tnt/tntnet.h"
-#include "tnt/listener.h"
-#include "tnt/http.h"
-#include "tnt/httpreply.h"
-#include "tnt/sessionscope.h"
-
-#include <cxxtools/tcpstream.h>
-#include <cxxtools/log.h>
-#include <cxxtools/loginit.h>
-
-#include <iostream>
-#include <fstream>
-#include <vector>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <grp.h>
-#include <pwd.h>
-#include <signal.h>
-#include <sys/wait.h>
-#include <errno.h>
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifndef TNTNET_CONF
-# define TNTNET_CONF "/etc/tntnet.conf"
-#endif
-
-#ifndef TNTNET_PID
-# define TNTNET_PID "/var/run/tntnet.pid"
-#endif
-
-log_define("tntnet.tntnet")
-
-#define log_error_master(expr) \
- do { \
- std::cout << "ERROR: " << expr << std::endl; \
- } while(false)
-
-#define log_warn_master(expr) \
- do { \
- std::cout << "WARN: " << expr << std::endl; \
- } while(false)
-
-#define log_info_master(expr) \
- do { \
- std::cout << "INFO: " << expr << std::endl; \
- } while(false)
-
-#define log_debug_master(expr) \
- do { \
- std::cout << "DEBUG: " << expr << std::endl; \
- } while(false)
-
-namespace
-{
- void sigEnd(int)
- {
- tnt::Tntnet::shutdown();
- }
-
- void sigReload(int)
- {
- // stopping child with 111 signals monitor-process to restart child
- tnt::Tntnet::restart();
- }
-
- void configureDispatcher(tnt::Dispatcher& dis, const tnt::Tntconfig& config)
- {
- typedef tnt::Dispatcher::CompidentType CompidentType;
-
- const tnt::Tntconfig::config_entries_type& params = config.getConfigValues();
-
- tnt::Tntconfig::config_entries_type::const_iterator vi;
- for (vi = params.begin(); vi != params.end(); ++vi)
- {
- const tnt::Tntconfig::config_entry_type& v = *vi;
- const tnt::Tntconfig::params_type& args = v.params;
- if (v.key == "MapUrl")
- {
- if (args.size() < 2)
- {
- std::ostringstream msg;
- msg << "invalid number of parameters (" << args.size() << ") in MapUrl";
- throw std::runtime_error(msg.str());
- }
-
- std::string url = args[0];
-
- CompidentType ci = CompidentType(args[1]);
- if (args.size() > 2)
- {
- ci.setPathInfo(args[2]);
- if (args.size() > 3)
- ci.setArgs(CompidentType::args_type(args.begin() + 3, args.end()));
- }
-
- dis.addUrlMapEntry(url, ci);
- }
- }
- }
-
- bool checkChildSuccess(int fd)
- {
- log_debug("checkChildSuccess");
-
- char buffer;
- int ret = ::read(fd, &buffer, 1);
- if (ret < 0)
- throw std::runtime_error(
- std::string("error in read: ") + strerror(errno));
- close(fd);
- return ret > 0;
- }
-
- void signalParentSuccess(int fd)
- {
- log_debug("signalParentSuccess");
-
- ssize_t s = write(fd, "1", 1);
- if (s < 0)
- throw std::runtime_error(
- std::string("error in write(): ") + strerror(errno));
- close(fd);
- }
-
-}
-
-namespace tnt
-{
- ////////////////////////////////////////////////////////////////////////
- // Tntnet
- //
- bool Tntnet::stop = false;
- int Tntnet::ret = 0;
- std::string Tntnet::pidFileName;
-
- Tntnet::Tntnet(int& argc, char* argv[])
- : propertyfilename(argc, argv, 'P'),
- debug(argc, argv, 'd'),
- queue(1000),
- pollerthread(queue)
- {
- // check for argument -c
- cxxtools::Arg<const char*> conf(argc, argv, 'c');
- if (conf.isSet())
- configFile = conf;
- else
- {
- // read 1st parameter from argument-list
- cxxtools::Arg<const char*> conf(argc, argv);
- if (conf.isSet())
- configFile = conf;
- else
- {
- // check environment-variable TNTNET_CONF
- const char* tntnetConf = ::getenv("TNTNET_CONF");
- if (tntnetConf)
- configFile = tntnetConf;
- else
- configFile = TNTNET_CONF; // take default
- }
- }
- }
-
- void Tntnet::setGroup() const
- {
- Tntconfig::params_type group = config.getConfigValue("Group");
- if (group.size() >= 1)
- {
- struct group * gr = getgrnam(group.begin()->c_str());
- if (gr == 0)
- throw std::runtime_error("unknown group " + *group.begin());
-
- log_debug("change group to " << *group.begin() << '(' << gr->gr_gid << ')');
-
- int ret = setgid(gr->gr_gid);
- if (ret != 0)
- {
- std::ostringstream msg;
- msg << "cannot change group to " << *group.begin()
- << '(' << gr->gr_gid << "): " << strerror(errno);
- throw std::runtime_error(msg.str());
- }
- }
- }
-
- void Tntnet::setDir(const char* def) const
- {
- std::string dir = config.getValue("Dir", def);
-
- if (!dir.empty())
- {
- log_debug("chdir(" << dir << ')');
- if (chdir(dir.c_str()) == -1)
- {
- throw std::runtime_error(
- std::string("error in chdir(): ")
- + strerror(errno));
- }
- }
-
- std::string chrootdir = config.getValue("Chroot");
- if (!chrootdir.empty() && chroot(chrootdir.c_str()) == -1)
- throw std::runtime_error(
- std::string("error in chroot(): ")
- + strerror(errno));
- }
-
- void Tntnet::setUser() const
- {
- Tntconfig::params_type user = config.getConfigValue("User");
- if (user.size() >= 1)
- {
- struct passwd * pw = getpwnam(user.begin()->c_str());
- if (pw == 0)
- throw std::runtime_error("unknown user " + *user.begin());
-
- log_debug("change user to " << *user.begin() << '(' << pw->pw_uid << ')');
-
- int ret = setuid(pw->pw_uid);
- if (ret != 0)
- {
- std::ostringstream msg;
- msg << "cannot change user to " << *user.begin()
- << '(' << pw->pw_uid << "): " << strerror(errno);
- throw std::runtime_error(msg.str());
- }
- }
- }
-
- int Tntnet::mkDaemon() const
- {
- log_info("start daemon-mode");
-
- int filedes[2];
-
- if (pipe(filedes) != 0)
- throw std::runtime_error(
- std::string("error in pipe(int[2]): ") + strerror(errno));
-
- int pid = fork();
- if (pid > 0)
- {
- // parent
-
- close(filedes[1]); // close write-fd
-
- // exit with error, when nothing read
- ::exit (checkChildSuccess(filedes[0]) ? 0 : 1);
- }
- else if (pid < 0)
- throw std::runtime_error(
- std::string("error in fork(): ") + strerror(errno));
-
- // child
-
- close(filedes[0]); // close read-fd
-
- // setsid
- if (setsid() == -1)
- throw std::runtime_error(
- std::string("error in setsid(): ")
- + strerror(errno));
-
- // return write-fd
- return filedes[1];
- }
-
- void Tntnet::closeStdHandles() const
- {
- // close stdin, stdout and stderr
- bool noclosestd = config.getBoolValue("NoCloseStdout", false);
- if (noclosestd)
- {
- log_debug("not closing stdout");
- return;
- }
-
- if (freopen("/dev/null", "r", stdin) == 0)
- throw std::runtime_error(
- std::string("unable to replace stdin with /dev/null: ")
- + strerror(errno));
-
- if (freopen("/dev/null", "w", stdout) == 0)
- throw std::runtime_error(
- std::string("unable to replace stdout with /dev/null: ")
- + strerror(errno));
-
- if (freopen("/dev/null", "w", stderr) == 0)
- throw std::runtime_error(
- std::string("unable to replace stderr with /dev/null: ")
- + strerror(errno));
- }
-
- int Tntnet::run()
- {
- loadConfiguration();
-
- if (debug)
- {
- log_init_debug();
- log_warn("Debugmode");
- isDaemon = false;
- }
- else
- {
- isDaemon = config.getBoolValue("Daemon", false);
- }
-
- if (isDaemon)
- {
- int filedes = mkDaemon();
-
- setDir("");
-
- bool nomonitor = config.getBoolValue("NoMonitor", false);
- if (nomonitor)
- {
- log_debug("start worker-process without monitor");
- writePidfile(getpid());
- initWorkerProcess();
-
- // change group and user
- setGroup();
- setUser();
-
- initLogging();
- workerProcess(filedes);
- }
- else
- {
- initWorkerProcess();
- do
- {
- int filedes_monitor[2];
-
- if (pipe(filedes_monitor) != 0)
- throw std::runtime_error(
- std::string("error in pipe(int[2]): ") + strerror(errno));
-
- // fork workerprocess
- int pid = fork();
- if (pid < 0)
- throw std::runtime_error(
- std::string("error in forking workerprocess: ")
- + strerror(errno));
-
- if (pid == 0)
- {
- // workerprocess
-
- close(filedes_monitor[0]); // close read-fd
-
- // change group and user
- setGroup();
- setUser();
-
- initLogging();
- workerProcess(filedes_monitor[1]);
- return ret;
- }
- else
- {
- close(filedes_monitor[1]); // close write-fd
-
- // write child-pid
- writePidfile(pid);
-
- // wait for worker to signal success
- if (!checkChildSuccess(filedes_monitor[0]))
- ::exit(1);
- if (filedes >= 0)
- {
- signalParentSuccess(filedes);
- filedes = -1;
- }
-
- monitorProcess(pid);
- if (!stop)
- sleep(1);
- }
-
- } while (!stop);
- }
- }
- else
- {
- log_info("no daemon-mode");
- initLogging();
- initWorkerProcess();
- workerProcess();
- }
-
- return 0;
- }
-
- void Tntnet::initLogging()
- {
- if (debug)
- return; // logging already initialized
-
- std::string pf;
- if (propertyfilename.isSet())
- pf = propertyfilename.getValue();
- else
- pf = config.getValue("PropertyFile");
-
- if (pf.empty())
- log_init();
- else
- {
- struct stat properties_stat;
- if (stat(pf.c_str(), &properties_stat) != 0)
- throw std::runtime_error("propertyfile " + pf + " not found");
-
- log_init(pf.c_str());
- }
- }
-
- void Tntnet::writePidfile(int pid)
- {
- pidFileName = config.getValue("PidFile", TNTNET_PID);
-
- log_debug("pidfile=" << pidFileName);
-
- if (!pidFileName.empty())
- {
- if (pidFileName[0] != '/')
- {
- // prepend current working-directory to pidfilename if not absolute
- std::vector<char> buf(256);
- const char* cwd;
- while (true)
- {
- cwd = ::getcwd(&buf[0], buf.size());
- if (cwd)
- break;
- else if (errno == ERANGE)
- buf.resize(buf.size() * 2);
- else
- throw std::runtime_error(
- std::string("error in getcwd: ") + strerror(errno));
- }
- pidFileName = std::string(cwd) + '/' + pidFileName;
- log_debug("pidfile=" << pidFileName);
- }
-
- std::ofstream pidfile(pidFileName.c_str());
- if (!pidfile)
- throw std::runtime_error("unable to open pid-file " + pidFileName);
- pidfile << pid;
- }
- }
-
- void Tntnet::monitorProcess(int workerPid)
- {
- setDir("");
-
- // close stdin, stdout and stderr
- closeStdHandles();
-
- int status;
- waitpid(workerPid, &status, 0);
-
- if (WIFSIGNALED(status))
- {
- // SIGTERM means normal exit
- if (WTERMSIG(status) == SIGTERM)
- {
- log_info_master("child terminated normally");
- stop = true;
- }
- else
- {
- log_warn_master("child terminated with signal "
- << WTERMSIG(status) << " - restart child");
- }
- }
- else if (WEXITSTATUS(status) == 111)
- {
- log_info_master("child requested restart");
- }
- else
- {
- log_info_master("child exited with exitcode " << WEXITSTATUS(status));
- stop = true;
- }
-
- if (unlink(pidFileName.c_str()) != 0)
- log_error_master("failed to remove pidfile \"" << pidFileName << "\" error " << errno);
- }
-
- void Tntnet::initWorkerProcess()
- {
- log_debug("init workerprocess");
-
- //signal(SIGPIPE, SIG_IGN);
- //signal(SIGABRT, SIG_IGN);
- //signal(SIGTERM, sigEnd);
- //signal(SIGHUP, sigReload);
-
- configureDispatcher(d_dispatcher, config);
-
- // create listener-threads
- Tntconfig::config_entries_type configListen;
- config.getConfigValues("Listen", configListen);
-
- if (configListen.empty())
- {
- log_warn("no listeners defined - using 0.0.0.0:80");
- ListenerBase* s = new tnt::Listener("0.0.0.0", 80, queue);
- listeners.insert(s);
- }
- else
- {
- for (Tntconfig::config_entries_type::const_iterator it = configListen.begin();
- it != configListen.end(); ++it)
- {
- if (it->params.empty())
- throw std::runtime_error("empty Listen-entry");
-
- unsigned short int port = 80;
- if (it->params.size() >= 2)
- {
- std::istringstream p(it->params[1]);
- p >> port;
- if (!p)
- {
- std::ostringstream msg;
- msg << "invalid port " << it->params[1];
- throw std::runtime_error(msg.str());
- }
- }
-
- std::string ip(it->params[0]);
- log_debug("create listener ip=" << ip << " port=" << port);
- ListenerBase* s = new tnt::Listener(ip, port, queue);
- listeners.insert(s);
- }
- }
-
-#ifdef USE_SSL
- // create ssl-listener-threads
- std::string defaultCertificateFile = config.getValue("SslCertificate");
- std::string defaultCertificateKey = config.getValue("SslKey");
- configListen.clear();
- config.getConfigValues("SslListen", configListen);
-
- for (Tntconfig::config_entries_type::const_iterator it = configListen.begin();
- it != configListen.end(); ++it)
- {
- if (it->params.empty())
- throw std::runtime_error("empty SslListen-entry");
-
- unsigned short int port = 443;
- if (it->params.size() >= 2)
- {
- std::istringstream p(it->params[1]);
- p >> port;
- if (!p)
- {
- std::ostringstream msg;
- msg << "invalid port " << it->params[1];
- throw std::runtime_error(msg.str());
- }
- }
-
- std::string certificateFile =
- it->params.size() >= 3 ? it->params[2]
- : defaultCertificateFile;
- std::string certificateKey =
- it->params.size() >= 4 ? it->params[3] :
- it->params.size() >= 3 ? it->params[2] : defaultCertificateKey;
-
- if (certificateFile.empty())
- throw std::runtime_error("Ssl-certificate not configured");
-
- std::string ip(it->params[0]);
- log_debug("create ssl-listener ip=" << ip << " port=" << port);
- ListenerBase* s = new Ssllistener(certificateFile.c_str(),
- certificateKey.c_str(), ip, port, queue);
- listeners.insert(s);
- }
-#endif // USE_SSL
-
- // configure worker (static)
- Comploader::configure(config);
-
- // configure http
- HttpMessage::setMaxRequestSize(
- config.getValue("MaxRequestSize", HttpMessage::getMaxRequestSize()));
- Job::setSocketReadTimeout(
- config.getValue("SocketReadTimeout", Job::getSocketReadTimeout()));
- Job::setSocketWriteTimeout(
- config.getValue("SocketWriteTimeout", Job::getSocketWriteTimeout()));
- Job::setKeepAliveMax(
- config.getValue("KeepAliveMax", Job::getKeepAliveMax()));
- Job::setSocketBufferSize(
- config.getValue("BufferSize", Job::getSocketBufferSize()));
- HttpReply::setMinCompressSize(
- config.getValue("MinCompressSize", HttpReply::getMinCompressSize()));
- HttpReply::setKeepAliveTimeout(
- config.getValue("KeepAliveTimeout", HttpReply::getKeepAliveTimeout()));
- HttpReply::setDefaultContentType(
- config.getValue("DefaultContentType", HttpReply::getDefaultContentType()));
-
- log_debug("listeners.size()=" << listeners.size());
- }
-
- void Tntnet::workerProcess(int filedes)
- {
- log_debug("worker-process");
-
- // reload configuration
- config = Tntconfig();
- loadConfiguration();
-
- // initialize worker-process
- minthreads = config.getValue<unsigned>("MinThreads", 5);
- maxthreads = config.getValue<unsigned>("MaxThreads", 100);
- threadstartdelay = config.getValue<unsigned>("ThreadStartDelay", 10);
- Worker::setMinThreads(minthreads);
- Worker::setMaxRequestTime(config.getValue<unsigned>("MaxRequestTime", Worker::getMaxRequestTime()));
- Worker::setEnableCompression(config.getBoolValue("EnableCompression", Worker::getEnableCompression()));
- queue.setCapacity(config.getValue<unsigned>("QueueSize", queue.getCapacity()));
- Sessionscope::setDefaultTimeout(config.getValue<unsigned>("SessionTimeout", Sessionscope::getDefaultTimeout()));
- Listener::setBacklog(config.getValue<int>("ListenBacklog", Listener::getBacklog()));
- Listener::setListenRetry(config.getValue<int>("ListenRetry", Listener::getListenRetry()));
- Dispatcher::setMaxUrlMapCache(config.getValue<unsigned>("MaxUrlMapCache", Dispatcher::getMaxUrlMapCache()));
-
- Tntconfig::config_entries_type configSetEnv;
- config.getConfigValues("SetEnv", configSetEnv);
- for (Tntconfig::config_entries_type::const_iterator it = configSetEnv.begin();
- it != configSetEnv.end(); ++it)
- {
- if (it->params.size() >= 2)
- {
-#ifdef HAVE_SETENV
- log_debug("setenv " << it->params[0] << "=\"" << it->params[1] << '"');
- ::setenv(it->params[0].c_str(), it->params[1].c_str(), 1);
-#else
- std::string name = it->params[0];
- std::string value = it->params[1];
-
- char* env = new char[name.size() + value.size() + 2];
- name.copy(env, name.size());
- env[name.size()] = '=';
- value.copy(env + name.size() + 1, value.size());
- env[name.size() + value.size() + 1] = '\0';
-
- log_debug("putenv(" << env);
- ::putenv(env);
-#endif
- }
- }
-
- // create worker-threads
- log_info("create " << minthreads << " worker threads");
- for (unsigned i = 0; i < minthreads; ++i)
- {
- log_debug("create worker " << i);
- Worker* s = new Worker(*this);
- s->create();
- }
-
- // create poller-thread
- log_debug("start poller thread");
- pollerthread.create();
-
- // launch listener-threads
- log_info("create " << listeners.size() << " listener threads");
- for (listeners_type::iterator it = listeners.begin();
- it != listeners.end(); ++it)
- (*it)->create();
-
- log_debug("start timer thread");
- cxxtools::MethodThread<Tntnet, cxxtools::AttachedThread> timerThread(*this, &Tntnet::timerTask);
- timerThread.create();
-
- if (filedes >= 0)
- {
- signalParentSuccess(filedes);
- closeStdHandles();
- }
-
- // mainloop
- cxxtools::Mutex mutex;
- while (!stop)
- {
- {
- cxxtools::MutexLock lock(mutex);
- queue.noWaitThreads.wait(lock);
- }
-
- if (stop)
- break;
-
- if (Worker::getCountThreads() < maxthreads)
- {
- log_info("create workerthread");
- Worker* s = new Worker(*this);
- s->create();
- }
- else
- log_warn("max worker-threadcount " << maxthreads << " reached");
-
- if (threadstartdelay > 0)
- usleep(threadstartdelay);
- }
-
- log_warn("stopping Tntnet");
-
- // join-loop
- while (!listeners.empty())
- {
- listeners_type::value_type s = *listeners.begin();
- log_debug("remove listener from listener-list");
- listeners.erase(s);
-
- log_debug("request listener to stop");
- s->doStop();
-
- log_debug("join listener-thread");
- s->join();
- delete s;
-
- log_debug("listener stopped");
- }
-
- log_info("listeners stopped");
- }
-
- void Tntnet::timerTask()
- {
- log_debug("timer thread");
-
- while (!stop)
- {
- sleep(1);
-
- log_debug("check sessiontimeout");
- getScopemanager().checkSessionTimeout();
-
- log_debug("worker-timer");
- Worker::timer();
- }
-
- log_warn("stopping Tntnet");
-
- if (!pidFileName.empty())
- unlink(pidFileName.c_str());
-
- queue.noWaitThreads.signal();
- Worker::setMinThreads(0);
- pollerthread.doStop();
- }
-
- void Tntnet::loadConfiguration()
- {
- config = Tntconfig();
- config.load(configFile.c_str());
- }
-
- void Tntnet::shutdown()
- {
- stop = true;
- }
-
- void Tntnet::restart()
- {
- // stopping child with 111 signals monitor-process to restart child
- stop = true;
- ret = 111;
- }
-
-}
-
-////////////////////////////////////////////////////////////////////////
-// main
-//
-#ifdef HAVE_TNTNET_MAIN
-int main(int argc, char* argv[])
-{
- signal(SIGPIPE, SIG_IGN);
- signal(SIGABRT, SIG_IGN);
- signal(SIGTERM, sigEnd);
- std::ios::sync_with_stdio(false);
-
- try
- {
- tnt::Tntnet app(argc, argv);
- if (argc != 1)
- {
- std::cout << PACKAGE_STRING "\n\n" <<
- "usage: " << argv[0] << " {options}\n\n"
- " -c file configurationfile (default: " TNTNET_CONF ")\n"
- " -d enable all debug output (ignoring properties-file)\n";
- return -1;
- }
-
- return app.run();
- }
- catch(const std::exception& e)
- {
- log_fatal(e.what());
- std::cerr << e.what() << std::endl;
- return -1;
- }
-}
-#endif
diff --git a/httpd/worker.cpp b/httpd/worker.cpp
deleted file mode 100644
index 7552db9..0000000
--- a/httpd/worker.cpp
+++ /dev/null
@@ -1,364 +0,0 @@
-/* worker.cpp
- * Copyright (C) 2003-2005 Tommi Maekitalo
- *
- * This program 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 program is distributed in the hope that it will be useful, but
- * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
- * NON-INFRINGEMENT. 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include "tnt/worker.h"
-#include "tnt/dispatcher.h"
-#include "tnt/job.h"
-#include <tnt/httprequest.h>
-#include <tnt/httpreply.h>
-#include <tnt/httperror.h>
-#include <tnt/http.h>
-#include <tnt/poller.h>
-#include <cxxtools/log.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <locale>
-#include <errno.h>
-
-log_define("tntnet.worker")
-
-namespace
-{
- static const char stateStarting[] = "0 starting";
- static const char stateWaitingForJob[] = "1 waiting for job";
- static const char stateParsing[] = "2 parsing request";
- static const char statePostParsing[] = "3 post parsing";
- static const char stateDispatch[] = "4 dispatch";
- static const char stateProcessingRequest[] = "5 processing request";
- static const char stateFlush[] = "6 flush";
- static const char stateSendReply[] = "7 send reply";
- static const char stateSendError[] = "8 send error";
- static const char stateStopping[] = "9 stopping";
-}
-
-namespace tnt
-{
- cxxtools::Mutex Worker::mutex;
- unsigned Worker::nextThreadNumber = 0;
- Worker::workers_type Worker::workers;
- unsigned Worker::maxRequestTime = 600;
- unsigned Worker::minThreads = 5;
- bool Worker::enableCompression = true;
-
- Worker::ComploaderPoolType Worker::comploaderPool;
-
- Worker::Worker(Tntnet& app)
- : application(app),
- comploaderObject(comploaderPool.get()),
- comploader(comploaderObject),
- threadId(0),
- state(stateStarting),
- lastWaitTime(0)
- {
- log_debug("initialize thread " << threadId);
-
- cxxtools::MutexLock lock(mutex);
- workers.insert(this);
- }
-
- Worker::~Worker()
- {
- cxxtools::MutexLock lock(mutex);
- workers.erase(this);
-
- log_debug("delete worker " << threadId << " - " << workers.size() << " threads left - " << application.getQueue().getWaitThreadCount() << " waiting threads");
- }
-
- void Worker::run()
- {
- threadId = pthread_self();
- Jobqueue& queue = application.getQueue();
- log_debug("start thread " << threadId);
- while (queue.getWaitThreadCount() < minThreads)
- {
- log_debug("waiting for job");
- state = stateWaitingForJob;
- Jobqueue::JobPtr j = queue.get();
- if (Tntnet::shouldStop())
- {
- log_warn("stop worker");
- break;
- }
- log_debug("got job - fd=" << j->getFd());
-
- std::iostream& socket = j->getStream();
-
- try
- {
- bool keepAlive;
- do
- {
- time(&lastWaitTime);
-
- log_debug("read request");
-
- keepAlive = false;
- state = stateParsing;
- j->getParser().parse(socket);
- state = statePostParsing;
-
- if (socket.eof())
- log_debug("eof");
- else if (j->getParser().failed())
- {
- state = stateSendError;
- log_warn("bad request");
- socket << "HTTP/1.0 500 bad request\r\n"
- "Content-Type: text/html\r\n"
- "\r\n"
- "<html><body><h1>Error</h1><p>bad request</p></body></html>"
- << std::endl;
- }
- else if (socket.fail())
- log_error("socket failed");
- else
- {
- j->getRequest().doPostParse();
-
- j->setWrite();
- keepAlive = processRequest(j->getRequest(), socket,
- j->decrementKeepAliveCounter());
-
- if (keepAlive)
- {
- j->setRead();
- j->clear();
-
- // if there is something to do and no threads waiting, we take
- // the next job just to improve resposiveness.
- if (queue.getWaitThreadCount() == 0
- && !queue.empty())
- {
- application.getPoller().addIdleJob(j);
- keepAlive = false;
- }
- else
- {
- struct pollfd fd;
- fd.fd = j->getFd();
- fd.events = POLLIN;
- if (::poll(&fd, 1, Job::getSocketReadTimeout()) == 0)
- {
- application.getPoller().addIdleJob(j);
- keepAlive = false;
- }
- }
- }
- }
- } while (keepAlive);
- }
- catch (const cxxtools::net::Timeout& e)
- {
- log_debug("timeout - put job in poller");
- application.getPoller().addIdleJob(j);
- }
- catch (const cxxtools::net::Exception& e)
- {
- if (e.getErrno() != ENOENT)
- log_warn("unexpected exception: " << e.what());
- }
- catch (const std::exception& e)
- {
- log_warn("unexpected exception: " << e.what());
- }
- }
-
- time(&lastWaitTime);
-
- log_debug("end worker-thread " << threadId);
-
- state = stateStopping;
- }
-
- bool Worker::processRequest(HttpRequest& request, std::iostream& socket,
- unsigned keepAliveCount)
- {
- // log message
- log_info("process request: " << request.getMethod() << ' ' << request.getQuery()
- << " from client " << request.getPeerIp() << " user-Agent \"" << request.getUserAgent()
- << '"');
-
- // create reply-object
- HttpReply reply(socket);
- reply.setVersion(request.getMajorVersion(), request.getMinorVersion());
- reply.setMethod(request.getMethod());
-
- std::locale loc = request.getLocale();
- reply.out().imbue(loc);
- reply.sout().imbue(loc);
-
- if (request.keepAlive())
- reply.setKeepAliveCounter(keepAliveCount);
-
- if (enableCompression)
- reply.setAcceptEncoding(request.getEncoding());
-
- // process request
- try
- {
- try
- {
- dispatch(request, reply);
-
- if (!request.keepAlive() || !reply.keepAlive())
- keepAliveCount = 0;
-
- if (keepAliveCount > 0)
- log_debug("keep alive");
- else
- {
- log_debug("no keep alive request/reply="
- << request.keepAlive() << '/' << reply.keepAlive());
- }
- }
- catch (const HttpError& e)
- {
- throw;
- }
- catch (const std::exception& e)
- {
- throw HttpError(HTTP_INTERNAL_SERVER_ERROR, e.what());
- }
- }
- catch (const HttpError& e)
- {
- state = stateSendError;
- log_warn("http-Error: " << e.what());
- HttpReply reply(socket);
- reply.setVersion(request.getMajorVersion(), request.getMinorVersion());
- if (request.keepAlive())
- reply.setKeepAliveCounter(keepAliveCount);
- else
- keepAliveCount = 0;
- reply.out() << "<html><body><h1>Error</h1><p>"
- << e.what() << "</p></body></html>" << std::endl;
- reply.sendReply(e.getErrcode(), e.getErrmsg());
- }
-
- return keepAliveCount > 0;
- }
-
- void Worker::dispatch(HttpRequest& request, HttpReply& reply)
- {
- state = stateDispatch;
- const std::string& url = request.getUrl();
-
- log_debug("dispatch " << request.getQuery());
-
- if (!HttpRequest::checkUrl(url))
- throw HttpError(HTTP_BAD_REQUEST, "illegal url");
-
- request.setThreadScope(threadScope);
-
- Dispatcher::PosType pos(application.getDispatcher(), request.getUrl());
- while (true)
- {
- state = stateDispatch;
-
- // pos.getNext() throws NotFoundException at end
- Dispatcher::CompidentType ci = pos.getNext();
- try
- {
- log_debug("load component " << ci);
- Component& comp = comploader.fetchComp(ci, application.getDispatcher());
- request.setPathInfo(ci.hasPathInfo() ? ci.getPathInfo() : url);
- request.setArgs(ci.getArgs());
-
- application.getScopemanager().preCall(request, ci.libname);
-
- log_debug("call component " << ci << " path " << request.getPathInfo());
- state = stateProcessingRequest;
- unsigned http_return = comp(request, reply, request.getQueryParams());
- if (http_return != DECLINED)
- {
- if (reply.isDirectMode())
- {
- log_info("request ready, returncode " << http_return);
- state = stateFlush;
- reply.out().flush();
- }
- else
- {
- log_info("request ready, returncode " << http_return << " - ContentSize: " << reply.getContentSize());
-
- application.getScopemanager().postCall(request, reply, ci.libname);
-
- state = stateSendReply;
- reply.sendReply(http_return);
- }
-
- if (reply.out())
- log_debug("reply sent");
- else
- log_warn("stream error");
-
- return;
- }
- else
- log_debug("component " << ci << " returned DECLINED");
- }
- catch (const cxxtools::dl::DlopenError& e)
- {
- log_warn("DlopenError catched - libname " << e.getLibname());
- }
- catch (const cxxtools::dl::SymbolNotFound& e)
- {
- log_warn("SymbolNotFound catched - symbol " << e.getSymbol());
- }
- }
-
- throw NotFoundException(request.getUrl());
- }
-
- void Worker::timer()
- {
- time_t currentTime;
- time(¤tTime);
-
- cxxtools::MutexLock lock(mutex);
- for (workers_type::iterator it = workers.begin();
- it != workers.end(); ++it)
- {
- (*it)->healthCheck(currentTime);
- }
- }
-
- void Worker::healthCheck(time_t currentTime)
- {
- if (state == stateProcessingRequest
- && lastWaitTime != 0
- && maxRequestTime > 0)
- {
- if (static_cast<unsigned>(currentTime - lastWaitTime) > maxRequestTime)
- {
- log_fatal("requesttime " << maxRequestTime << " seconds in thread "
- << threadId << " exceeded - exit process");
- log_info("current state: " << state);
- exit(111);
- }
- }
- }
-
- Worker::workers_type::size_type Worker::getCountThreads()
- {
- cxxtools::MutexLock lock(mutex);
- return workers.size();
- }
-}
diff --git a/javascript/Makefile b/javascript/Makefile
index 50f3b52..bca2426 100644
--- a/javascript/Makefile
+++ b/javascript/Makefile
@@ -1,48 +1,19 @@
-# The official name of this plugin.
-
+### The official name of this plugin.
PLUGIN = live
### Additional options to silence TNTNET warnings
TNTFLAGS ?= -Wno-overloaded-virtual -Wno-unused-function
-TNTVERSION ?= $(shell tntnet-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }')
-
-### The C++ compiler and options:
-
-CXX ?= g++
-AR ?= ar
-ECPPC ?= ecppc
-
-CXXFLAGS ?= -O2 -Woverloaded-virtual -Wall -fPIC
-DEFINES ?= -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DTNTVERSION=$(TNTVERSION)
-
-### The directory environment:
-
-VDRDIR ?= ../../../..
-
-### Make sure that necessary options are included:
-
--include $(VDRDIR)/Make.global
-
-### Allow user defined options to overwrite defaults:
-
--include $(VDRDIR)/Make.config
### Includes and Defines (add further entries here):
-
INCLUDES += -I$(VDRDIR)/include -I..
### The object files (add further files here):
-
OBJS = treeview.o
-### Default rules:
-
-.PHONY: all clean
-
+### The main target:
all: libjavascript.a
### Implicit rules:
-
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(TNTFLAGS) -c $(DEFINES) $(PLUGINFEATURES) $(INCLUDES) $<
@@ -50,7 +21,6 @@ all: libjavascript.a
$(ECPPC) $(ECPPFLAGS) $(ECPPFLAGS_JS) -b -m "text/javascript" $<
### Targets:
-
libjavascript.a: $(OBJS)
$(AR) r $@ $^
diff --git a/pages/Makefile b/pages/Makefile
index 78a4a9c..07fd031 100644
--- a/pages/Makefile
+++ b/pages/Makefile
@@ -1,39 +1,13 @@
-# The official name of this plugin.
-
+### The official name of this plugin.
PLUGIN = live
### Additional options to silence TNTNET warnings
TNTFLAGS ?= -Wno-overloaded-virtual -Wno-unused-variable
-TNTVERSION ?= $(shell tntnet-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }')
-CXXTOOLVER ?= $(shell cxxtools-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }')
-
-### The C++ compiler and options:
-
-CXX ?= g++
-AR ?= ar
-ECPPC ?= ecppc
-
-CXXFLAGS ?= -O2 -Woverloaded-virtual -Wall -fPIC
-DEFINES ?= -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DTNTVERSION=$(TNTVERSION) -DCXXTOOLVER=$(CXXTOOLVER)
-
-### The directory environment:
-
-VDRDIR ?= ../../../..
-
-### Make sure that necessary options are included:
-
--include $(VDRDIR)/Make.global
-
-### Allow user defined options to overwrite defaults:
-
--include $(VDRDIR)/Make.config
### Includes and Defines (add further entries here):
-
INCLUDES += -I$(VDRDIR)/include -I..
### The object files (add further files here):
-
OBJS = menu.o recordings.o schedule.o multischedule.o screenshot.o \
timers.o whats_on.o switch_channel.o keypress.o remote.o \
channels_widget.o edit_timer.o error.o pageelems.o tooltip.o \
@@ -43,10 +17,7 @@ OBJS = menu.o recordings.o schedule.o multischedule.o screenshot.o \
rwd_recording.o setup.o content.o epginfo.o timerconflicts.o \
recstream.o users.o edit_user.o edit_recording.o
-### Default rules:
-
-.PHONY: all clean
-
+### The main target:
all: libpages.a
### Implicit rules:
@@ -57,8 +28,7 @@ all: libpages.a
%.cpp: %.ecpp
$(ECPPC) $(ECPPFLAGS) $(ECPPFLAGS_CPP) $<
-# Dependencies:
-
+### Dependencies:
MAKEDEP = $(CXX) -MM -MG
DEPFILE = .dependencies
$(DEPFILE): Makefile $(OBJS:%.o=%.cpp) $(OBJS:%.o=%.ecpp)
@@ -69,7 +39,6 @@ ifneq ($(MAKECMDGOALS),clean)
endif
### Targets:
-
libpages.a: $(OBJS)
$(AR) r $@ $^
diff --git a/pages/page_exit.eh b/pages/page_exit.eh
index 5101171..319260e 100644
--- a/pages/page_exit.eh
+++ b/pages/page_exit.eh
@@ -5,11 +5,7 @@
<%cpp>
spoint.commit();
} catch ( vdrlive::HtmlError const& ex ) {
-#if TNTVERSION >= 1606
tnt::QueryParams param = qparam;
-#else
- cxxtools::QueryParams param = qparam;
-#endif
param.add( "pageTitle", pageTitle );
param.add( "errorMessage", ex.what() );
callComp( "error", request, reply, param );
diff --git a/pages/recordings.ecpp b/pages/recordings.ecpp
index 80f145b..7975438 100644
--- a/pages/recordings.ecpp
+++ b/pages/recordings.ecpp
@@ -79,7 +79,11 @@ for (deletions_type::const_iterator it = deletions.begin(); it != deletions.end(
deletions.clear();
int FreeMB, UsedMB;
+#if APIVERSNUM > 20101
+int Percent = cVideoDirectory::VideoDiskSpace(&FreeMB, &UsedMB);
+#else
int Percent = VideoDiskSpace(&FreeMB, &UsedMB);
+#endif
int Minutes = int(double(FreeMB) / MB_PER_MINUTE);
int Hours = Minutes / 60;
Minutes %= 60;
@@ -204,15 +208,11 @@ for (recIter = recItems.begin(); recIter != recItems.end(); ++recIter) {
<li class="recording">
<& rec_item_dir name=(recItem->Name()) level=(level) &>
<%cpp>
-#if TNT_HAS_QUERYPARAMS
#if TNT_QUERYPARAMS_NO_BOOL
tnt::QueryParams recItemParams(qparam);
#else
tnt::QueryParams recItemParams(qparam, false);
#endif
-#else
- cxxtools::QueryParams recItemParams(qparam, false);
-#endif
for (path_type::const_iterator i = path.begin(); i != path.end(); ++i) {
recItemParams.add("path", *i);
}
diff --git a/pages/vlc.ecpp b/pages/vlc.ecpp
index d1f1405..480e949 100644
--- a/pages/vlc.ecpp
+++ b/pages/vlc.ecpp
@@ -98,12 +98,8 @@ using namespace vdrlive;
}
</%cpp>
<%cpp>
-#if TNT_HAS_GETHOST
string server = request.getHost();
server = server.substr(0, server.rfind(':'));
-#else
- string server = request.getServerIp();
-#endif
string videourl;
if (Channel != 0) {
int streamdevPort = LiveSetup().GetStreamdevPort();
diff --git a/po/ca_ES.po b/po/ca_ES.po
index 7d7cacd..6e4088f 100644
--- a/po/ca_ES.po
+++ b/po/ca_ES.po
@@ -12,7 +12,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Jordi Vil� <jvila at tinet.org>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: ca_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/cs_CZ.po b/po/cs_CZ.po
index 6211b5a..c1c9824 100644
--- a/po/cs_CZ.po
+++ b/po/cs_CZ.po
@@ -11,7 +11,7 @@ msgstr ""
"PO-Revision-Date: 2010-05-10 22:15+0200\n"
"Last-Translator: Vladimír Bárta <vladimir.barta at k2atmitec.cz>,Radek Stastny <dedkus at gmail.com> \n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: cs_CZ\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/da_DK.po b/po/da_DK.po
index 7c66235..8041518 100644
--- a/po/da_DK.po
+++ b/po/da_DK.po
@@ -10,7 +10,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Mogens Elneff <mogens at elneff.dk>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: da_DK\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-15\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/de_DE.po b/po/de_DE.po
index 3dd9cfb..69a0902 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -12,7 +12,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Dieter Hametner <dh+vdr at gekrumbel.de>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: de_DE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/el_GR.po b/po/el_GR.po
index 022541f..3126fa1 100644
--- a/po/el_GR.po
+++ b/po/el_GR.po
@@ -10,7 +10,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Dimitrios Dimitrakos <mail at dimitrios.de>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: el_GR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-7\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/es_ES.po b/po/es_ES.po
index 8407a6f..b7dfd03 100644
--- a/po/es_ES.po
+++ b/po/es_ES.po
@@ -10,7 +10,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Javier Bradineras <jbradi at hotmail.com>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: es_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-15\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/et_EE.po b/po/et_EE.po
index 2f34cc5..aa303b1 100644
--- a/po/et_EE.po
+++ b/po/et_EE.po
@@ -10,7 +10,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Arthur Konovalov <kasjas at hot.ee>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: et_EE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-13\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/fi_FI.po b/po/fi_FI.po
index e67cded..d89678e 100644
--- a/po/fi_FI.po
+++ b/po/fi_FI.po
@@ -10,7 +10,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Rolf Ahrenberg <rahrenbe at cc.hut.fi>\n"
"Language-Team: see developers in README\n"
-"Language: fi\n"
+"Language: fi_FI\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/fr_FR.po b/po/fr_FR.po
index 173a3f7..3a82cb4 100644
--- a/po/fr_FR.po
+++ b/po/fr_FR.po
@@ -13,7 +13,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Nicolas Huillard <nhuillard at e-dition.fr>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/hr_HR.po b/po/hr_HR.po
index 8fcca3b..f90ed21 100644
--- a/po/hr_HR.po
+++ b/po/hr_HR.po
@@ -11,7 +11,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Drazen Dupor <drazen.dupor at dupor.com>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: hr_HR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-2\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/hu_HU.po b/po/hu_HU.po
index 8f1eded..366ebfa 100644
--- a/po/hu_HU.po
+++ b/po/hu_HU.po
@@ -11,7 +11,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Istvan Koenigsberger <istvnko at hotmail.com>, Guido Josten <guido.josten at t-online.de>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: hu_HU\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-2\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/it_IT.po b/po/it_IT.po
index 18a7fb3..b5a061d 100644
--- a/po/it_IT.po
+++ b/po/it_IT.po
@@ -13,7 +13,7 @@ msgstr ""
"PO-Revision-Date: 2011-12-25 23:22+0100\n"
"Last-Translator: Diego Pierotto <vdr-italian at tiscali.it>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: it_IT\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/lt_LT.po b/po/lt_LT.po
index 7e07e15..36da893 100644
--- a/po/lt_LT.po
+++ b/po/lt_LT.po
@@ -10,7 +10,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Valdemaras Pipiras <varas at ambernet.lt>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: lt_LT\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/nl_NL.po b/po/nl_NL.po
index 808fa67..0541ed1 100644
--- a/po/nl_NL.po
+++ b/po/nl_NL.po
@@ -12,7 +12,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Maarten Wisse <Maarten.Wisse at urz.uni-hd.de>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: nl_NL\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-15\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/nn_NO.po b/po/nn_NO.po
index 3c59633..6f72e37 100644
--- a/po/nn_NO.po
+++ b/po/nn_NO.po
@@ -11,7 +11,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Truls Slevigen <truls at slevigen.no>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: nn_NO\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/pl_PL.po b/po/pl_PL.po
index 8abd004..3029511 100644
--- a/po/pl_PL.po
+++ b/po/pl_PL.po
@@ -10,7 +10,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Michael Rakowski <mrak at gmx.de>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: pl_PL\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-2\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/pt_PT.po b/po/pt_PT.po
index 6241542..aaafdf2 100644
--- a/po/pt_PT.po
+++ b/po/pt_PT.po
@@ -10,7 +10,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Paulo Lopes <pmml at netvita.pt>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: pt_PT\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/ro_RO.po b/po/ro_RO.po
index 1da81c9..1d94c22 100644
--- a/po/ro_RO.po
+++ b/po/ro_RO.po
@@ -11,7 +11,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Lucian Muresan <lucianm at users.sourceforge.net>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: ro_RO\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-2\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/ru_RU.po b/po/ru_RU.po
index 9543848..e61a1e5 100644
--- a/po/ru_RU.po
+++ b/po/ru_RU.po
@@ -1,80 +1,80 @@
# VDR LIVE plugin language source file.
# Copyright (C) 2007 LIVE Development team. See http://live.vdr-developer.org
# This file is distributed under the same license as the VDR-LIVE package.
-# Vyacheslav Dikonov <sdiconov at mail.ru>, 2004
+# Dmitrii Kiselev <wm.amid at gmail.com>, 2013
#
msgid ""
msgstr ""
-"Project-Id-Version: VDR-LIVE 0.2.0\n"
+"Project-Id-Version: VDR-LIVE 0.3.0\n"
"Report-Msgid-Bugs-To: <cwieninger at gmx.de>\n"
-"PO-Revision-Date: 2007-08-19 20:15+0200\n"
-"Last-Translator: Vyacheslav Dikonov <sdiconov at mail.ru>\n"
+"PO-Revision-Date: 2013-06-21 20:15+0200\n"
+"Last-Translator: Dmitrii Kiselev <wm.amid at gmail.com>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: ru\n"
"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=ISO-8859-5\n"
+"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "Last channel to display"
-msgstr ""
+msgstr "Последний канал для отображения"
msgid "No limit"
-msgstr ""
+msgstr "Без ограничений"
msgid "Use authentication"
-msgstr ""
+msgstr "Идентификация пользователя"
msgid "No"
-msgstr ""
+msgstr "Нет"
msgid "Yes"
-msgstr ""
+msgstr "Да"
msgid "Admin login"
-msgstr ""
+msgstr "Имя администратора"
msgid "Admin password"
-msgstr ""
+msgstr "Пароль администратора"
#, c-format
msgid "%A, %x"
msgstr ""
msgid "Searchtimer"
-msgstr ""
+msgstr "Поисковый таймер"
msgid "Error in timer settings"
-msgstr ""
+msgstr "Ошибка в настройках таймера"
msgid "Timer already defined"
-msgstr ""
+msgstr "Таймер установлен"
msgid "Timers are being edited - try again later"
-msgstr ""
+msgstr "Таймер редактируется - попробуйте позже"
msgid "Timer not defined"
-msgstr ""
+msgstr "Таймер не установлен"
msgid "On archive DVD No."
-msgstr ""
+msgstr "В архиве на DVD No."
msgid "On archive HDD No."
-msgstr ""
+msgstr "В архиве на HDD No."
msgid "Couldn't find channel or no channels available."
-msgstr ""
+msgstr "Канал не найден или недоступен."
msgid "Couldn't switch to channel."
-msgstr ""
+msgstr "Переключение на канал невозможно."
msgid "Couldn't find recording or no recordings available."
-msgstr ""
+msgstr "Запись не найдена или более недоступна."
msgid "Cannot control playback!"
-msgstr ""
+msgstr "Управление воспросизведением недоступно!"
msgid "Not playing a recording."
-msgstr ""
+msgstr "Запись не проигрывается."
msgid "Not playing the same recording as from request."
msgstr ""
@@ -83,629 +83,629 @@ msgid "Attempt to delete recording currently in playback."
msgstr ""
msgid "Epg error"
-msgstr ""
+msgstr "Ошибка телегида"
msgid "Wrong channel id"
-msgstr ""
+msgstr "Неверный id канала"
msgid "Channel has no schedule"
-msgstr ""
+msgstr "Нет расписания канала"
msgid "Wrong event id"
-msgstr ""
+msgstr "Ошибка id события"
msgid "Required minimum version of epgsearch: "
-msgstr ""
+msgstr "Минимальный требования к версии EPGSearch: "
msgid "All"
-msgstr ""
+msgstr "Все"
msgid "FTA"
-msgstr ""
+msgstr "Открытые"
msgid "%I:%M %p"
-msgstr ""
+msgstr "%H:%M"
msgid "EPGSearch version outdated! Please update."
-msgstr ""
+msgstr "Версия EPGSearch устарела! Пожалуйста обновите EPGSearch. "
msgid "Couldn't aquire primary device"
-msgstr ""
+msgstr "Нет доступа к основному устройству"
msgid "Couldn't grab image from primary device"
-msgstr ""
+msgstr "Не могу получить изображение с основного устройства"
msgid "Timer conflict check detected "
-msgstr ""
+msgstr "Обнаружен конфликт таймеров"
msgid "conflict"
-msgstr ""
+msgstr "конфликт"
msgid "conflicts"
-msgstr ""
+msgstr "конфликты"
msgid "Couldn't aquire access to channels, please try again later."
-msgstr ""
+msgstr "Нет доступа к каналу, попробуйте позже"
msgid "Sorry, no permission. Please contact your administrator!"
-msgstr ""
+msgstr "Нет доступа, обратитесь к администратору! "
msgid "Couldn't find recording. Maybe you mistyped your request?"
-msgstr ""
+msgstr "Запись не найдена. Проверьте правильность запроса."
msgid "Please set a name for the recording!"
-msgstr ""
+msgstr "Пожалуйста присвойте имя записи!"
msgid "Cannot copy, rename or move the recording."
-msgstr ""
+msgstr "Копирование невозможно, переименуйте или переместите запись. "
msgid "Edit recording"
-msgstr ""
+msgstr "Изменить запись."
msgid "Name"
-msgstr ""
+msgstr "Имя"
msgid "Directory"
-msgstr ""
+msgstr "Каталог"
msgid "Delete resume information"
-msgstr ""
+msgstr "Удалить информацию о воспроизведении"
msgid "Delete marks information"
-msgstr ""
+msgstr "Удалить маркеры"
msgid "Copy only"
-msgstr ""
+msgstr "Копировать"
msgid "Short description"
-msgstr ""
+msgstr "Краткое описание"
msgid "Description"
-msgstr ""
+msgstr "Описание"
msgid "Auxiliary info"
-msgstr ""
+msgstr "Другое"
msgid "Save"
-msgstr ""
+msgstr "Сохранить"
msgid "Cancel"
-msgstr ""
+msgstr "Отменить"
msgid "Couldn't find searchtimer. Maybe you mistyped your request?"
-msgstr ""
+msgstr "Поисковый таймер не найден. Проверьте правильность запроса."
#. TRANSLATORS: only adjust the ordering and separators, don't translate the m's, d's and y's
msgid "mm/dd/yyyy"
-msgstr ""
+msgstr "dd/mm/yyyy"
msgid "Edit search timer"
-msgstr ""
+msgstr "Изменить поисковый таймер"
msgid "New search timer"
-msgstr ""
+msgstr "Новый поисковый таймер"
msgid "Search text too short - use anyway?"
-msgstr ""
+msgstr "Текст запроса слишком короткий, продолжить?"
msgid "Search term"
-msgstr ""
+msgstr "Поисковый запрос"
msgid "Search mode"
-msgstr ""
+msgstr "Метод поиска"
msgid "phrase"
-msgstr ""
+msgstr "фраза"
msgid "all words"
-msgstr ""
+msgstr "все слова"
msgid "at least one word"
-msgstr ""
+msgstr "хотя бы одно слово"
msgid "match exactly"
-msgstr ""
+msgstr "точное совпадение"
msgid "regular expression"
-msgstr ""
+msgstr "стандартное выражение"
msgid "fuzzy"
-msgstr ""
+msgstr "неопределенное"
msgid "Tolerance"
-msgstr ""
+msgstr "Допустимое"
msgid "Match case"
-msgstr ""
+msgstr "С учетом регистра"
msgid "Search in"
-msgstr ""
+msgstr "Искать в"
msgid "Title"
-msgstr ""
+msgstr "Название"
msgid "Episode"
-msgstr ""
+msgstr "Эпизод"
msgid "Use extended EPG info"
-msgstr ""
+msgstr "Расширенная информацию телегида"
msgid "Ignore missing EPG info"
-msgstr ""
+msgstr "Игнорировать отсутствие информации телегида"
msgid "When active this can cause very many timers. So please always first test this search before using it as search timer!"
-msgstr ""
+msgstr "Внимание! Проверьте поисковый таймер перед включением этой функции. Это поможет избежать ошибочных записей."
msgid "Use channel"
-msgstr ""
+msgstr "Канал"
msgid "interval"
-msgstr ""
+msgstr "интервал"
msgid "channel group"
-msgstr ""
+msgstr "группа каналов"
msgid "only FTA"
-msgstr ""
+msgstr "только открытые"
msgid "from channel"
-msgstr ""
+msgstr "с канала"
msgid "to channel"
-msgstr ""
+msgstr "по канал"
msgid "Use time"
-msgstr ""
+msgstr "Время"
msgid "Start after"
-msgstr ""
+msgstr "Запускать после"
msgid "The time the show may start at the earliest"
-msgstr ""
+msgstr "Программа может начаться раньше"
msgid "Start before"
-msgstr ""
+msgstr "Запускать до"
msgid "The time the show may start at the latest"
-msgstr ""
+msgstr "Программа может начаться позже"
msgid "Use duration"
-msgstr ""
+msgstr "Продолжительность"
msgid "Min. duration"
-msgstr ""
+msgstr "Мин. продолжительность"
msgid "Max. duration"
-msgstr ""
+msgstr "Макс. продолжительность"
msgid "Use day of week"
-msgstr ""
+msgstr "День недели"
msgid "Monday"
-msgstr ""
+msgstr "Понедельник"
msgid "Tuesday"
-msgstr ""
+msgstr "Вторник"
msgid "Wednesday"
-msgstr ""
+msgstr "Среда"
msgid "Thursday"
-msgstr ""
+msgstr "Четверг"
msgid "Friday"
-msgstr ""
+msgstr "Пятница"
msgid "Saturday"
-msgstr ""
+msgstr "Суббота"
msgid "Sunday"
-msgstr ""
+msgstr "Воскресенье"
msgid "Use blacklists"
-msgstr ""
+msgstr "Черный список"
msgid "Selection"
-msgstr ""
+msgstr "Выбор"
msgid "all"
-msgstr ""
+msgstr "все"
msgid "Use in favorites menu"
-msgstr ""
+msgstr "В избранное меню"
msgid "Use as search timer"
-msgstr ""
+msgstr "Поисковый таймер"
msgid "user defined"
-msgstr ""
+msgstr "настроить"
msgid "from date"
-msgstr ""
+msgstr "с даты"
msgid "to date"
-msgstr ""
+msgstr "по дату"
msgid "Record"
-msgstr "������"
+msgstr "Запись"
msgid "Announce only"
-msgstr ""
+msgstr "Только объявлять"
msgid "Switch only"
-msgstr ""
+msgstr "Только переключать"
msgid "Series recording"
-msgstr ""
+msgstr "Запись серий"
msgid "Delete recordings after ... days"
-msgstr ""
+msgstr "Удалить запись после … дней"
msgid "Keep ... recordings"
-msgstr ""
+msgstr "Хранить запись … дней"
msgid "Pause when ... recordings exist"
-msgstr ""
+msgstr "Останавлить по достижению … записей"
msgid "Avoid repeats"
-msgstr ""
+msgstr "Избегать повторов"
msgid "Allowed repeats"
-msgstr ""
+msgstr "Разрешать повторы"
msgid "Only repeats within ... days"
-msgstr ""
+msgstr "Разрешать повторы … дней"
msgid "Compare title"
-msgstr ""
+msgstr "Сравнить название"
msgid "Compare subtitle"
-msgstr ""
+msgstr "Сравнить субтитры"
msgid "if present"
-msgstr ""
+msgstr "если есть"
msgid "Compare summary"
-msgstr ""
+msgstr "Сравнить размер"
msgid "Compare"
-msgstr ""
+msgstr "Сравнить"
msgid "Use VPS"
-msgstr ""
+msgstr "VPS"
msgid "Auto-delete search timer"
-msgstr ""
+msgstr "Автоматически удалять поисковый таймер"
msgid "after ... recordings"
-msgstr ""
+msgstr "после … записей"
msgid "after ... days after first rec."
-msgstr ""
+msgstr "после … дней после первой записи"
msgid "Switch ... minutes before start"
-msgstr ""
+msgstr "Переключаться за … минут до начала"
msgid "Test"
-msgstr ""
+msgstr "Тест"
msgid "Couldn't find timer. Maybe you mistyped your request?"
-msgstr ""
+msgstr "Таймер не найден. Проверьте правильность запроса."
msgid "Please set a title for the timer!"
-msgstr ""
+msgstr "Введите название таймера"
msgid "Edit timer"
-msgstr ""
+msgstr "Изменить таймер"
msgid "New timer"
-msgstr ""
+msgstr "Новый таймер"
msgid "Weekday"
-msgstr ""
+msgstr "День недели"
msgid "Couldn't find user. Maybe you mistyped your request?"
-msgstr ""
+msgstr "Пользователь не найден. Проверьте правильность запроса."
msgid "This user name is already in use!"
-msgstr ""
+msgstr "Это имя пользователя уже используется!"
msgid "Edit user"
-msgstr ""
+msgstr "Изменить пользователя"
msgid "New user"
-msgstr ""
+msgstr "Новый пользователь"
msgid "Password"
-msgstr ""
+msgstr "Пароль"
msgid "User rights"
-msgstr ""
+msgstr "Права пользователя"
msgid "Edit setup"
-msgstr ""
+msgstr "Изменять настройки"
msgid "Add or edit timers"
-msgstr ""
+msgstr "Добавлять или изменять таймеры"
msgid "Delete timers"
-msgstr ""
+msgstr "Удалять таймеры"
msgid "Delete recordings"
-msgstr ""
+msgstr "Удалять записи"
msgid "Use remote menu"
-msgstr ""
+msgstr "Удаленное управление"
msgid "Start replay"
-msgstr ""
+msgstr "Начинать воспроизведение"
msgid "Switch channel"
-msgstr ""
+msgstr "Переключать каналы"
msgid "Add or edit search timers"
-msgstr ""
+msgstr "Добавлять или изменять поисковые таймеры"
msgid "Delete search timers"
-msgstr ""
+msgstr "Удалять поисковые таймеры"
msgid "Edit recordings"
-msgstr ""
+msgstr "Изменять запись"
msgid "Electronic program guide information"
-msgstr ""
+msgstr "Информация телегида"
msgid "Couldn't find recording or no recordings available"
-msgstr ""
+msgstr "Запись не найдена или недоступна"
msgid "Error aquiring schedules lock"
-msgstr ""
+msgstr "Ошибка во время получения расписания"
msgid "Error aquiring schedules"
-msgstr ""
+msgstr "Ошибка в расписании"
msgid "%b %d %y"
msgstr ""
msgid "Page error"
-msgstr ""
+msgstr "Ошибка страницы"
msgid "playing recording"
-msgstr ""
+msgstr "воспроизведение записи"
msgid "no epg info for current event!"
-msgstr ""
+msgstr "нет информации телегида о текущем событии!"
msgid "no epg info for current channel!"
-msgstr ""
+msgstr "нет информации телегида на данном канале!"
msgid "no current channel!"
-msgstr ""
+msgstr "нет канала!"
msgid "error retrieving status info!"
-msgstr ""
+msgstr "ошибка при получении статуса"
msgid "%I:%M:%S %p"
-msgstr ""
+msgstr "%H:%M:%S"
msgid "Wrong username or password"
-msgstr ""
+msgstr "Неправильное имя пользователя или пароль"
msgid "Login"
-msgstr ""
+msgstr "Вход"
msgid "VDR Live Login"
-msgstr ""
+msgstr "VDR Live Login"
msgid "User"
-msgstr ""
+msgstr "Пользователь"
msgid "What's on?"
-msgstr ""
+msgstr "Сейчас"
msgid "MultiSchedule"
-msgstr ""
+msgstr "Мультирасписание"
msgid "Search"
-msgstr ""
+msgstr "Поиск"
msgid "Searchtimers"
-msgstr ""
+msgstr "Поисковый таймер"
msgid "Recordings"
-msgstr ""
+msgstr "Записи"
msgid "Remote Control"
-msgstr ""
+msgstr "Удаленное управление"
msgid "Logout"
-msgstr ""
+msgstr "Выход"
msgid "Your attention is required"
-msgstr ""
+msgstr "Требуется Ваше внимание"
msgid "React"
-msgstr ""
+msgstr "Реагировать"
msgid "Dismiss"
-msgstr ""
+msgstr "Освободить"
msgid "Now"
-msgstr ""
+msgstr "Сейчас"
msgid "%A, %b %d %Y"
-msgstr ""
+msgstr "%A, %d.%m.%Y"
msgid "Time"
-msgstr ""
+msgstr "Время"
msgid "Switch to this channel."
-msgstr ""
+msgstr "Переключиться на этот канал."
msgid "Search for repeats."
-msgstr ""
+msgstr "Найти повторы."
msgid "Click to view details."
-msgstr ""
+msgstr "Нажмите чтобы узнать больше."
msgid "more"
-msgstr ""
+msgstr "еще"
msgid "Channel"
-msgstr ""
+msgstr "Канал"
msgid "Find more at the Internet Movie Database."
-msgstr ""
+msgstr "Найти на Kinopoisk.ru."
msgid "Stream this channel into browser."
-msgstr ""
+msgstr "Стриминг этого канала в браузер."
msgid "Stream this recording into browser."
-msgstr ""
+msgstr "Стриминг этой записи в браузер."
msgid "Record this"
-msgstr ""
+msgstr "Запись."
msgid "loading data"
-msgstr ""
+msgstr "загрузка данных"
msgid "an error occured!"
-msgstr ""
+msgstr "обнаружена ошибка!"
msgid "Request succeeded!"
-msgstr ""
+msgstr "Запрос выполнен!"
msgid "Request failed!"
-msgstr ""
+msgstr "Запрос не выполнен!"
msgid "January"
-msgstr ""
+msgstr "Январь"
msgid "February"
-msgstr ""
+msgstr "Февраль"
msgid "March"
-msgstr ""
+msgstr "Март"
msgid "April"
-msgstr ""
+msgstr "Апрель"
msgid "May"
-msgstr ""
+msgstr "Май"
msgid "June"
-msgstr ""
+msgstr "Июнь"
msgid "July"
-msgstr ""
+msgstr "Июль"
msgid "August"
-msgstr ""
+msgstr "Август"
msgid "September"
-msgstr ""
+msgstr "Сентябрь"
msgid "October"
-msgstr ""
+msgstr "Октябрь"
msgid "November"
-msgstr ""
+msgstr "Ноябрь"
msgid "December"
-msgstr ""
+msgstr "Декабрь"
msgid "retrieving status ..."
-msgstr ""
+msgstr "получение статуса … "
msgid "Toggle updates on/off."
-msgstr ""
+msgstr "Включить обновления on/off."
msgid "stop playback"
-msgstr ""
+msgstr "остановить воспроизведение"
msgid "resume playback"
-msgstr ""
+msgstr "продолжить воспроизведение"
msgid "pause playback"
-msgstr ""
+msgstr "пауза"
msgid "fast rewind"
-msgstr ""
+msgstr "перемотка вперед"
msgid "fast forward"
-msgstr ""
+msgstr "перемотка назад"
msgid "previous channel"
-msgstr ""
+msgstr "предыдущий канал"
msgid "next channel"
-msgstr ""
+msgstr "следующий канал"
msgid "No server response!"
-msgstr ""
+msgstr "Сервер не отвечает!"
msgid "Failed to update infobox!"
-msgstr ""
+msgstr "Ошибка обновления infobox!"
msgid "Authors"
-msgstr ""
+msgstr "Авторы"
msgid "Project Idea"
-msgstr ""
+msgstr "Идея проекта"
msgid "Webserver"
-msgstr ""
+msgstr "WEB сервер"
msgid "Project leader"
-msgstr ""
+msgstr "Ведущий проекта"
msgid "Content"
-msgstr ""
+msgstr "Содержание"
msgid "Graphics"
-msgstr ""
+msgstr "Графика"
msgid "Information"
-msgstr ""
+msgstr "Информация"
msgid "LIVE version"
-msgstr ""
+msgstr "Версия LIVE"
msgid "VDR version"
-msgstr ""
+msgstr "Версия VDR"
msgid "Features"
-msgstr ""
+msgstr "Опции"
msgid "active"
-msgstr ""
+msgstr "активный"
msgid "required"
-msgstr ""
+msgstr "требуется"
msgid "Homepage"
-msgstr ""
+msgstr "Домашняя страница"
msgid "Bugs and suggestions"
-msgstr ""
+msgstr "Ошибки и пожелания"
msgid "If you encounter any bugs or would like to suggest new features, please use our bugtracker"
-msgstr ""
+msgstr "Если у вас возникнут ошибки или Вы хотите расширить функции LIVE, пожалуйста, воспользуйтесь bugtracker"
msgid "ERROR:"
-msgstr ""
+msgstr "ОШИБКА:"
msgid "Deleted recording:"
-msgstr ""
+msgstr "Удаленный записи:"
msgid "List of recordings"
-msgstr ""
+msgstr "Список записей"
msgid "No recordings found"
-msgstr ""
+msgstr "Записи не найдены"
msgid "Delete selected"
-msgstr ""
+msgstr "Удалить выбранные"
#, no-c-format
msgid "%a,"
@@ -717,227 +717,230 @@ msgid "(%d:%02d)"
msgstr ""
msgid "Sort by name"
-msgstr ""
+msgstr "Название"
msgid "Sort by date"
-msgstr ""
+msgstr "Дата"
msgid "Filter"
-msgstr ""
+msgstr "Фильтр"
msgid "Look in recordings titles and subtitles for the given string and display only the matching ones. You may also use perl compatible regular expressions (PCRE)."
-msgstr ""
+msgstr "Искать только в названиях записей и субтитров в данной строке и отобразить совпадающие. Также вы можете использовать perl совместимые стандартные команды (PCRE)."
msgid "Expand all folders"
-msgstr ""
+msgstr "Развернуть все папки"
msgid "Collapse all folders"
-msgstr ""
+msgstr "Свернуть все папки"
msgid "Delete this recording from hard disc!"
-msgstr ""
+msgstr "Удалить эту запись с жесткого диска!"
msgid "play this recording."
-msgstr ""
+msgstr "Проиграть эту запись."
msgid "Couldn't find channel or no channels available. Maybe you mistyped your request?"
-msgstr ""
+msgstr "Канал не найден или недоступен. Проверьте правильность запроса."
msgid "Snapshot interval"
-msgstr ""
+msgstr "Интервал между снимками"
msgid "No schedules available for this channel"
-msgstr ""
+msgstr "Расписание для данного канала недоступно"
msgid "Search settings"
-msgstr ""
+msgstr "Настройки поиска"
msgid "Extended search"
-msgstr ""
+msgstr "Расширенный поиск"
msgid "no"
-msgstr ""
+msgstr "нет"
msgid "Search results"
-msgstr ""
+msgstr "Результат поиска"
msgid "No search results"
-msgstr ""
+msgstr "Нет результатов поиска"
msgid "Expression"
-msgstr ""
+msgstr "Запрос"
msgid "Starts between"
-msgstr ""
+msgstr "Начинать между"
msgid "Toggle search timer actions (in)active"
-msgstr ""
+msgstr "Включить поисковый таймер"
msgid "Browse search timer results"
-msgstr ""
+msgstr "Просмотреть результаты поискового таймера"
msgid "Delete this search timer?"
-msgstr ""
+msgstr "Удалить этот поисковый таймер?"
msgid "Delete search timer"
-msgstr ""
+msgstr "Удалить поисковый таймер"
msgid "Trigger search timer update"
-msgstr ""
+msgstr "Обновить"
msgid "Please set login and password!"
-msgstr ""
+msgstr "Пожалуйста установите логин и пароль!"
msgid "Setup saved."
-msgstr ""
+msgstr "Настройки сохранены."
msgid "Setup"
-msgstr ""
+msgstr "Настройка"
msgid "User management"
-msgstr ""
+msgstr "Настройки пользователя"
msgid "Local net (no login required)"
-msgstr ""
+msgstr "Локальная сеть (авторизация не требуется)"
msgid "Show live logo image"
-msgstr ""
+msgstr "Показать логотип LIVE"
msgid "Use ajax technology"
-msgstr ""
+msgstr "Использовать ajax"
msgid "Show dynamic VDR information box"
-msgstr ""
+msgstr "Показывать инфо панель VDR"
msgid "Allow video streaming"
-msgstr ""
+msgstr "Разрешить видео стриминг"
msgid "Streamdev server port"
-msgstr ""
+msgstr "Streamdev порт"
msgid "Streamdev stream type"
-msgstr ""
+msgstr "Streamdev тип стриминга"
msgid "Add links to IMDb"
-msgstr ""
+msgstr "Добавить ссылки на Kinopoisk.ru"
msgid "Additional fixed times in 'What's on?'"
-msgstr ""
+msgstr "Поправка времени в разделе 'Сейчас'"
msgid "Format is HH:MM. Separate multiple times with a semicolon"
-msgstr ""
+msgstr "Формат HH:MM. Разделяется несколько раз при помощи запятой"
msgid "Channel groups for MultiSchedule"
-msgstr ""
+msgstr "Группа каналов для мультирасписания"
msgid "Separate channels with a comma ',', separate groups with a semi-colon ';'"
-msgstr ""
+msgstr "Разделить каналы при помощи ',', разделите группы при помощи ';'"
msgid "Duration of MultiSchedule in hours"
-msgstr ""
+msgstr "Продолжительность мультирасписания в часах"
msgid "Show channels without EPG"
-msgstr ""
+msgstr "Показывать каналы без EPG"
msgid "Start page"
-msgstr ""
+msgstr "Стартовая страница"
msgid "Theme"
-msgstr ""
+msgstr "Тема"
msgid "Timer conflicts"
-msgstr ""
+msgstr "Таймер конфликт"
msgid "No timer conflicts"
-msgstr ""
+msgstr "Нет конфликта таймеров"
msgid "Timer has a conflict."
-msgstr ""
+msgstr "Есть конфликт таймеров"
msgid "Timer is active."
-msgstr ""
+msgstr "Таймер активен"
msgid "Toggle timer active/inactive"
-msgstr ""
+msgstr "Переключить таймер активны/неактивный"
msgid "Delete timer"
-msgstr ""
+msgstr "Удалить таймер"
msgid "No timer defined"
-msgstr ""
+msgstr "Таймер не установлен"
msgid "Timer is recording."
-msgstr ""
+msgstr "Таймер записывает."
msgid "Users"
-msgstr ""
+msgstr "Пользователь"
msgid "Delete user"
-msgstr ""
+msgstr "Удалить пользователя"
msgid "VLC: live video stream"
-msgstr ""
+msgstr "VLC: live видео стриминг"
msgid "VLC: play recording"
-msgstr ""
+msgstr "VLC: проиграть запись"
msgid "Stop"
-msgstr ""
+msgstr "Стоп"
msgid "Play"
-msgstr ""
+msgstr "Воспроизведение"
msgid "Sound on"
-msgstr ""
+msgstr "Включить звук"
msgid "Sound off"
-msgstr ""
+msgstr "Выключить звук"
msgid "Fullscreen"
-msgstr ""
+msgstr "Полный экран"
msgid "Close"
-msgstr ""
+msgstr "Закрыть"
msgid "VLC media URL"
-msgstr ""
+msgstr "VLC медиа URL"
#, c-format
msgid "%a, %x"
msgstr ""
msgid "What's running on"
-msgstr ""
+msgstr "Что идет сейчас?"
msgid "at"
-msgstr ""
+msgstr "в"
msgid "What's on next?"
-msgstr ""
+msgstr "Что даллее?"
msgid "Favorites"
-msgstr ""
+msgstr "Избранные"
msgid "View the schedule of this channel"
-msgstr ""
+msgstr "Просмотреть расписание на этом канале"
msgid " - "
msgstr ""
msgid "Next"
-msgstr ""
+msgstr "Далее"
msgid "What's on"
-msgstr ""
+msgstr "Сейчас"
msgid "Details view"
-msgstr ""
+msgstr "Подробно"
msgid "List view"
-msgstr ""
+msgstr "Список"
msgid "Live Interactive VDR Environment"
msgstr ""
msgid "No EPG information available"
-msgstr ""
+msgstr "EPG информация недоступна"
+
+#~ msgid "ERROR"
+#~ msgstr "ОШИБКА"
diff --git a/po/sk_SK.po b/po/sk_SK.po
index e71dc99..2dc3fc4 100644
--- a/po/sk_SK.po
+++ b/po/sk_SK.po
@@ -11,7 +11,7 @@ msgstr ""
"PO-Revision-Date: 2012-12-03 21:41+0100\n"
"Last-Translator: Milan Hrala <hrala.milan at gmail.com>\n"
"Language-Team: Slovak <hrala.milan at gmail.com>\n"
-"Language: \n"
+"Language: sk_SK\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-2\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/sl_SI.po b/po/sl_SI.po
index b85ab0f..17df34c 100644
--- a/po/sl_SI.po
+++ b/po/sl_SI.po
@@ -11,7 +11,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Matjaz Thaler <matjaz.thaler at guest.arnes.si>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: sl_SI\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-2\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/sv_SE.po b/po/sv_SE.po
index e7ed734..ffb9aff 100644
--- a/po/sv_SE.po
+++ b/po/sv_SE.po
@@ -11,7 +11,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Tomas Prybil <tomas at prybil.se>\n"
"Language-Team: see developers in README\n"
-"Language: \n"
+"Language: sv_SE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/tr_TR.po b/po/tr_TR.po
index 1a3600d..92bd955 100644
--- a/po/tr_TR.po
+++ b/po/tr_TR.po
@@ -11,7 +11,7 @@ msgstr ""
"PO-Revision-Date: 2007-08-19 20:15+0200\n"
"Last-Translator: Oktay Yolge�en <oktay_73 at yahoo.de>\n"
"Language-Team: <vdr at linuxtv.org>\n"
-"Language: \n"
+"Language: tr_TR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-9\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/recman.cpp b/recman.cpp
index 6a2fc00..ade3d93 100644
--- a/recman.cpp
+++ b/recman.cpp
@@ -112,7 +112,11 @@ namespace vdrlive {
if (found == string::npos)
return false;
+#if APIVERSNUM > 20101
+ string newname = string(cVideoDirectory::Name()) + "/" + name + oldname.substr(found);
+#else
string newname = string(VideoDirectory) + "/" + name + oldname.substr(found);
+#endif
if (!MoveDirectory(oldname.c_str(), newname.c_str(), copy)) {
esyslog("[LIVE]: renaming failed from '%s' to '%s'", oldname.c_str(), newname.c_str());
diff --git a/setup.cpp b/setup.cpp
index f6bf168..00d496f 100644
--- a/setup.cpp
+++ b/setup.cpp
@@ -27,11 +27,9 @@ using namespace std;
Setup::Setup():
m_serverPort( 8008 ),
-#if TNT_SSL_SUPPORT
m_serverSslPort( 8443 ),
m_serverSslCert(),
m_serverSslKey(),
-#endif
m_lastChannel( 0 ),
m_screenshotInterval( 1000 ),
m_useAuth( 1 ),
@@ -62,11 +60,9 @@ bool Setup::ParseCommandLine( int argc, char* argv[] )
{ "ip", required_argument, NULL, 'i' },
{ "log", required_argument, NULL, 'l' },
{ "epgimages", required_argument, NULL, 'e' },
-#if TNT_SSL_SUPPORT
{ "sslport", required_argument, NULL, 's' },
{ "cert", required_argument, NULL, 'c' },
{ "key", required_argument, NULL, 'k' },
-#endif
{ 0 }
};
@@ -77,19 +73,15 @@ bool Setup::ParseCommandLine( int argc, char* argv[] )
case 'i': m_serverIps.push_back( optarg ); break;
case 'l': m_tntnetloglevel = optarg; break;
case 'e': m_epgimagedir = optarg; break;
-#if TNT_SSL_SUPPORT
case 's': m_serverSslPort = atoi( optarg ); break;
case 'c': m_serverSslCert = optarg; break;
case 'k': m_serverSslKey = optarg; break;
-#endif
default: return false;
}
}
return CheckServerPort() &&
-#if TNT_SSL_SUPPORT
CheckServerSslPort() &&
-#endif
CheckServerIps();
}
@@ -97,17 +89,15 @@ char const* Setup::CommandLineHelp() const
{
if ( m_helpString.empty() ) {
ostringstream builder;
- builder << " -p PORT, --port=PORT use PORT to listen for incoming connections\n"
+ builder << " -p PORT, --port=PORT use PORT to listen for incoming connections\n"
" (default: " << m_serverPort << ")\n"
<< " -i IP, --ip=IP bind server only to specified IP, may appear\n"
" multiple times\n"
" (default: 0.0.0.0)\n"
-#if TNT_SSL_SUPPORT
<< " -s PORT, --sslport=PORT use PORT to listen for incoming ssl connections\n"
" (default: " << m_serverSslPort << ")\n"
<< " -c CERT, --cert=CERT full path to a custom ssl certificate file\n"
<< " -k KEY, --key=KEY full path to a custom ssl certificate key file\n"
-#endif
<< " -l level, --log=level log level for tntnet (values: WARN, ERROR, INFO, DEBUG, TRACE)\n"
<< " -e <dir>, --epgimages=<dir> directory for epgimages\n";
m_helpString = builder.str();
@@ -153,7 +143,6 @@ bool Setup::CheckServerPort()
return true;
}
-#if TNT_SSL_SUPPORT
bool Setup::CheckServerSslPort()
{
if ( m_serverSslPort <= 0 || m_serverSslPort > numeric_limits< uint16_t >::max() ) {
@@ -163,7 +152,6 @@ bool Setup::CheckServerSslPort()
}
return true;
}
-#endif
namespace {
struct IpValidator
diff --git a/setup.h b/setup.h
index 58b4a11..3b4e388 100644
--- a/setup.h
+++ b/setup.h
@@ -29,11 +29,9 @@ class Setup
// commandline
int GetServerPort() const { return m_serverPort; }
-#if TNT_SSL_SUPPORT
int GetServerSslPort() const { return m_serverSslPort; }
std::string GetServerSslCert() const { return m_serverSslCert; }
std::string GetServerSslKey() const { return m_serverSslKey; }
-#endif
IpList const& GetServerIps() const { return m_serverIps; }
// vdr-setup
int GetLastChannel() const { return m_lastChannel == 0 ? std::numeric_limits< int >::max() : m_lastChannel; }
@@ -108,12 +106,10 @@ class Setup
mutable std::string m_helpString;
// commandline options
int m_serverPort;
-#if TNT_SSL_SUPPORT
int m_serverSslPort;
std::string m_serverSslCert;
std::string m_serverSslKey;
static std::string m_configDirectory;
-#endif
IpList m_serverIps;
std::string m_epgimagedir;
@@ -145,9 +141,7 @@ class Setup
bool CheckServerPort();
bool CheckServerIps();
-#if TNT_SSL_SUPPORT
bool CheckServerSslPort();
-#endif
};
Setup& LiveSetup();
diff --git a/thread.cpp b/thread.cpp
index 515e113..972b155 100644
--- a/thread.cpp
+++ b/thread.cpp
@@ -11,19 +11,6 @@ namespace vdrlive {
using namespace std;
using namespace tnt;
-#if ! TNT_CONFIG_INTERNAL
-class ProtectedCString
-{
-public:
- ProtectedCString( char const* string ): m_string( strdup( string ) ) {}
- ~ProtectedCString() { free( m_string ); }
-
- operator char*() { return m_string; }
-
-private:
- char* m_string;
-};
-#endif // ! TNT_CONFIG_INTERNAL
ServerThread::ServerThread()
{
@@ -45,17 +32,8 @@ void ServerThread::Stop()
void ServerThread::Action()
{
try {
-#if TNT_CONFIG_INTERNAL
m_server.reset(new Tntnet());
TntConfig::Get().Configure(*m_server);
-#else
- ProtectedCString configPath(TntConfig::Get().GetConfigPath().c_str());
-
- char* argv[] = { const_cast< char* >( "tntnet" ), const_cast< char* >( "-c" ), configPath };
- int argc = sizeof( argv ) / sizeof( argv[0] );
-
- m_server.reset(new Tntnet( argc, argv ));
-#endif // TNT_CONFIG_INTERNAL
m_server->run();
m_server.reset(0);
} catch (exception const& ex) {
diff --git a/tntconfig.cpp b/tntconfig.cpp
index 3325776..e4937ec 100644
--- a/tntconfig.cpp
+++ b/tntconfig.cpp
@@ -26,167 +26,8 @@ namespace vdrlive {
TntConfig::TntConfig()
{
-#if ! TNT_CONFIG_INTERNAL
- WriteConfig();
-#endif
- }
-
-#if ! TNT_CONFIG_INTERNAL
- void TntConfig::WriteConfig()
- {
- WriteProperties();
-
- string const configDir(Plugin::GetConfigDirectory());
-#if APIVERSNUM > 10729
- string const resourceDir(Plugin::GetResourceDirectory());
-#endif
-
- ostringstream builder;
- builder << configDir << "/httpd.config";
- m_configPath = builder.str();
-
- ofstream file( m_configPath.c_str(), ios::out | ios::trunc );
- if ( !file ) {
- ostringstream builder;
- builder << "Can't open " << m_configPath << " for writing: " << strerror( errno );
- throw runtime_error( builder.str() );
- }
-
- // +++ CAUTION +++ CAUTION +++ CAUTION +++ CAUTION +++ CAUTION +++
- // ------------------------------------------------------------------------
- // These MapUrl statements are very security sensitive!
- // A wrong mapping to content@ may allow retrieval of arbitrary files
- // from your VDR system via live.
- // Two meassures are taken against this in our implementation:
- // 1. The MapUrls need to be checked regulary against possible exploits
- // One tool to do this can be found here:
- // http://www.lumadis.be/regex/test_regex.php
- // Newly inserted MapUrls should be marked with author and confirmed
- // by a second party. (use source code comments for this)
- // 2. content.ecpp checks the given path to be
- // a. an absolute path starting at /
- // b. not containing ../ paths components
- // In order to do so, the MapUrl statements must create absolute
- // path arguments to content@
- // ------------------------------------------------------------------------
- // +++ CAUTION +++ CAUTION +++ CAUTION +++ CAUTION +++ CAUTION +++
-
-
- file << "MapUrl ^/$ login@" << endl;
-
- // the following redirects vdr_request URL to the component
- // specified by the action parameter.
- // inserted by 'tadi' -- verified with above, but not counterchecked yet!
- file << "MapUrl ^/vdr_request/([^.]+) $1@" << endl;
-
- // the following selects the theme specific 'theme.css' file
- // inserted by 'tadi' -- verified with above, but not counterchecked yet!
-#if APIVERSNUM > 10729
- file << "MapUrl ^/themes/([^/]*)/css.*/(.+\\.css) content@ " << resourceDir << "/themes/$1/css/$2 text/css" << endl;
-#else
- file << "MapUrl ^/themes/([^/]*)/css.*/(.+\\.css) content@ " << configDir << "/themes/$1/css/$2 text/css" << endl;
-#endif
-
- // the following rules provide a search scheme for images. The first
- // rule where a image is found, terminates the search.
- // 1. /themes/<theme>/img/<imgname>.<ext>
- // 2. /img/<imgname>.<ext>
- // deprecated: 3. <imgname>.<ext> (builtin images)
- // inserted by 'tadi' -- verified with above, but not counterchecked yet!
-#if APIVERSNUM > 10729
- file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) content@ " << resourceDir << "/themes/$1/img/$2.$3 image/$3" << endl;
- file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) content@ " << resourceDir << "/img/$2.$3 image/$3" << endl;
-#else
- file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) content@ " << configDir << "/themes/$1/img/$2.$3 image/$3" << endl;
- file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) content@ " << configDir << "/img/$2.$3 image/$3" << endl;
-#endif
- // deprecated: file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) $2@" << endl;
-
- // Epg images
- string const epgImgPath(LiveSetup().GetEpgImageDir());
- if (!epgImgPath.empty()) {
- // inserted by 'winni' -- EXPLOITABLE! (checked by tadi)
- // file << "MapUrl ^/epgimages/(.*)\\.(.+) content@ " << epgImgPath << "/$1.$2 image/$2" << endl;
-
- // inserted by 'tadi' -- verified with above, but not counterchecked yet!
- file << "MapUrl ^/epgimages/([^/]*)\\.([^./]+) content@ " << epgImgPath << "/$1.$2 image/$2" << endl;
- }
-
- // select additional (not build in) javascript.
- // WARNING: no path components with '.' in the name are allowed. Only
- // the basename may contain dots and must end with '.js'
- // inserted by 'tadi' -- verified with above, but not counterchecked yet!
-#if APIVERSNUM > 10729
- file << "MapUrl ^/js(/[^.]*)([^/]*\\.js) content@ " << resourceDir << "/js$1$2 text/javascript" << endl;
-#else
- file << "MapUrl ^/js(/[^.]*)([^/]*\\.js) content@ " << configDir << "/js$1$2 text/javascript" << endl;
-#endif
-
- // map to 'css/basename(uri)'
- // inserted by 'tadi' -- verified with above, but not counterchecked yet!
-#if APIVERSNUM > 10729
- file << "MapUrl ^/css.*/(.+) content@ " << resourceDir << "/css/$1 text/css" << endl;
-#else
- file << "MapUrl ^/css.*/(.+) content@ " << configDir << "/css/$1 text/css" << endl;
-#endif
-
- // map to 'img/basename(uri)'
- // inserted by 'tadi' -- verified with above, but not counterchecked yet!
-#if APIVERSNUM > 10729
- file << "MapUrl ^/img.*/(.+)\\.([^.]+) content@ " << resourceDir << "/img/$1.$2 image/$2" << endl;
-#else
- file << "MapUrl ^/img.*/(.+)\\.([^.]+) content@ " << configDir << "/img/$1.$2 image/$2" << endl;
-#endif
-
- // Map favicon.ico into img directory
-#if APIVERSNUM > 10729
- file << "MapUrl ^/favicon.ico$ content@ " << resourceDir << "/img/favicon.ico image/x-icon" << endl;
-#else
- file << "MapUrl ^/favicon.ico$ content@ " << configDir << "/img/favicon.ico image/x-icon" << endl;
-#endif
-
- // insecure by default: DO NOT UNKOMMENT!!!
- // file << "MapUrl /([^/]+/.+) content@ $1" << endl;
-
- // takes first path components without 'extension' when it does not
- // contain '.'
- // modified by 'tadi' -- verified with above, but not counterchecked yet!
- file << "MapUrl ^/([^./]+)(.*)? $1@" << endl;
-
- file << "PropertyFile " << m_propertiesPath << endl;
- file << "SessionTimeout 86400" << endl;
- file << "DefaultContentType \"text/html; charset=" << LiveI18n().CharacterEncoding() << "\"" << endl;
-
- Setup::IpList const& ips = LiveSetup().GetServerIps();
- int port = LiveSetup().GetServerPort();
- for ( Setup::IpList::const_iterator ip = ips.begin(); ip != ips.end(); ++ip ) {
- file << "Listen " << *ip << " " << port << endl;
- }
- }
-#endif
-
-#if ! TNT_CONFIG_INTERNAL
- void TntConfig::WriteProperties()
- {
- ostringstream builder;
- builder << Plugin::GetConfigDirectory() << "/httpd.properties";
- m_propertiesPath = builder.str();
-
- ofstream file( m_propertiesPath.c_str(), ios::out | ios::trunc );
- if ( !file ) {
- ostringstream builder;
- builder << "Can't open " << m_propertiesPath << " for writing: " << strerror( errno );
- throw runtime_error( builder.str() );
- }
-
- // XXX modularize
- file << "rootLogger=" << LiveSetup().GetTntnetLogLevel() << endl;
- file << "logger.tntnet=" << LiveSetup().GetTntnetLogLevel() << endl;
- file << "logger.cxxtools=" << LiveSetup().GetTntnetLogLevel() << endl;
}
-#endif
-#if TNT_CONFIG_INTERNAL
namespace {
std::string GetResourcePath()
{
@@ -391,7 +232,6 @@ namespace vdrlive {
}
}
-#if TNT_SSL_SUPPORT
int s_port = LiveSetup().GetServerSslPort();
string s_cert = LiveSetup().GetServerSslCert();
string s_key = LiveSetup().GetServerSslKey();
@@ -412,9 +252,7 @@ namespace vdrlive {
else {
esyslog( "[live] ERROR: Unable to load cert/key (%s/%s): %s", s_cert.c_str(), s_key.c_str(), strerror( errno ) );
}
-#endif // TNT_SSL_SUPPORT
}
-#endif
TntConfig const& TntConfig::Get()
{
diff --git a/tntconfig.h b/tntconfig.h
index 5e11175..118a6e5 100644
--- a/tntconfig.h
+++ b/tntconfig.h
@@ -8,7 +8,6 @@
namespace vdrlive {
-#if TNT_CONFIG_INTERNAL
class TntConfig
{
public:
@@ -20,31 +19,6 @@ namespace vdrlive {
TntConfig();
TntConfig( TntConfig const& );
};
-#else
- class TntConfig
- {
- public:
- static TntConfig const& Get();
-
- std::string const& GetConfigPath() const { return m_configPath; }
-#if APIVERSNUM > 10729
- std::string const& GetResourcePath() const { return m_resourcePath; }
-#endif
-
- private:
- std::string m_propertiesPath;
- std::string m_configPath;
-#if APIVERSNUM > 10729
- std::string m_resourcePath;
-#endif
-
- TntConfig();
- TntConfig( TntConfig const& );
-
- void WriteProperties();
- void WriteConfig();
- };
-#endif // TNT_CONFIG_INTERNAL
} // namespace vdrlive
diff --git a/tntfeatures.h b/tntfeatures.h
index 76d3757..fafe78f 100644
--- a/tntfeatures.h
+++ b/tntfeatures.h
@@ -7,22 +7,9 @@
// an other change in the structure of the version string was needed then only
// this file needs to be adapted.
-// SSL-Support works from tntnet version 1.6.1 onwards.
-#define TNT_SSL_SUPPORT (TNTVERSION >= 16100)
-
-// Configuration of tntnet from within the source code and not with a
-// dedicated config file.
-#define TNT_CONFIG_INTERNAL (TNTVERSION >= 16060)
-
-// Query params are now in tntnet and not in cxxtools
-#define TNT_HAS_QUERYPARAMS (TNTVERSION >= 16060)
-
// Query params without boolean parameter
#define TNT_QUERYPARAMS_NO_BOOL (TNTVERSION >= 22000)
-// One can request the host part of the request url
-#define TNT_HAS_GETHOST (TNTVERSION >= 16060)
-
// new version of TNTNET allow the request watchdog to be silenced.
#define TNT_WATCHDOG_SILENCE (TNTVERSION >= 16900)
diff --git a/tools.cpp b/tools.cpp
index c744d06..ddfacd0 100644
--- a/tools.cpp
+++ b/tools.cpp
@@ -365,7 +365,11 @@ namespace vdrlive {
stat(source.c_str(), &st1);
stat(target.c_str(),&st2);
if (!copy && (st1.st_dev == st2.st_dev)) {
+#if APIVERSNUM > 20101
+ if (!cVideoDirectory::RenameVideoFile(source.c_str(), target.c_str())) {
+#else
if (!RenameVideoFile(source.c_str(), target.c_str())) {
+#endif
esyslog("[LIVE]: rename failed from %s to %s", source.c_str(), target.c_str());
return false;
}
@@ -461,7 +465,11 @@ namespace vdrlive {
size_t found = source.find_last_of(delim);
if (found != std::string::npos) {
source = source.substr(0, found);
+#if APIVERSNUM > 20101
+ while (source != cVideoDirectory::Name()) {
+#else
while (source != VideoDirectory) {
+#endif
found = source.find_last_of(delim);
if (found == std::string::npos)
break;
@@ -478,7 +486,11 @@ namespace vdrlive {
size_t found = target.find_last_of(delim);
if (found != std::string::npos) {
target = target.substr(0, found);
+#if APIVERSNUM > 20101
+ while (target != cVideoDirectory::Name()) {
+#else
while (target != VideoDirectory) {
+#endif
found = target.find_last_of(delim);
if (found == std::string::npos)
break;
diff --git a/tools.h b/tools.h
index f283f12..1672e84 100644
--- a/tools.h
+++ b/tools.h
@@ -67,7 +67,7 @@ namespace vdrlive {
struct bad_lexical_cast: std::runtime_error
{
- bad_lexical_cast(): std::runtime_error( "bad lexical cast" ) {}
+ bad_lexical_cast(): std::runtime_error( "bad lexical cast" ) {}
};
template< typename To, typename From >
@@ -93,18 +93,36 @@ namespace vdrlive {
class ReadLock
{
- public:
- ReadLock( cRwLock& lock, int timeout = 100 ): m_lock( lock ), m_locked( false ) { if ( m_lock.Lock( false, timeout ) ) m_locked = true; }
- ~ReadLock() { if ( m_locked ) m_lock.Unlock(); }
+ private:
+ typedef void (ReadLock::*safe_bool)() const;
- operator bool() { return m_locked; }
- bool operator!() { return !m_locked; }
+ public:
+ ReadLock(cRwLock& lock, int timeout = 100)
+ : m_lock(lock)
+ , m_locked(false)
+ {
+ if (m_lock.Lock( false, timeout ))
+ m_locked = true;
+ }
+
+ ~ReadLock()
+ {
+ if (m_locked)
+ m_lock.Unlock();
+ }
+
+ operator safe_bool() const
+ {
+ return m_locked ? &ReadLock::safe_bool_idiom : 0;
+ }
private:
- ReadLock( ReadLock const& );
+ ReadLock(ReadLock const&);
cRwLock& m_lock;
bool m_locked;
+
+ void safe_bool_idiom() const {}
};
} // namespace vdrlive
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vdr-dvb/vdr-plugin-live.git
More information about the pkg-vdr-dvb-changes
mailing list