From c21ec74aecaae5cc2293d75879e663ec94b40c8f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Sun, 1 Nov 2015 21:56:25 +0200 Subject: [PATCH 1/1] new, version 1.11 based on fedora package 0ad15d4 --- darkhttpd.service | 27 +++++++++++++++ darkhttpd.spec | 81 +++++++++++++++++++++++++++++++++++++++++++++ darkhttpd.sysconfig | 3 ++ 3 files changed, 111 insertions(+) create mode 100644 darkhttpd.service create mode 100644 darkhttpd.spec create mode 100644 darkhttpd.sysconfig diff --git a/darkhttpd.service b/darkhttpd.service new file mode 100644 index 0000000..2baf7a5 --- /dev/null +++ b/darkhttpd.service @@ -0,0 +1,27 @@ +# It's not recommended to modify this file in-place, because it will be +# overwritten during package upgrades. If you want to customize, the best +# way is to create a file "/etc/systemd/system/darkhttpd.service", +# containing +# .include /lib/systemd/system/darkhttpd.service +# ...make your changes here... +# For more info about custom unit files, see +# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F + +# For example, to pass additional options to the +# darkhttpd binary at startup, you need to create a file named +# "/etc/systemd/system/darkhttpd.service" containing: +# .include /lib/systemd/system/darkhttpd.service +# [Service] +# Environment=OPTIONS=-DMY_DEFINE + +[Unit] +Description=Darkhttpd Web Server +After=network.target + +[Service] +EnvironmentFile=-/etc/sysconfig/darkhttpd +ExecStart=/usr/sbin/darkhttpd $DARKHTTPD_ROOT --daemon $DARKHTTPD_FLAGS $MIMETYPES +Type=forking + +[Install] +WantedBy=multi-user.target diff --git a/darkhttpd.spec b/darkhttpd.spec new file mode 100644 index 0000000..4d5dae1 --- /dev/null +++ b/darkhttpd.spec @@ -0,0 +1,81 @@ +Summary: A secure, lightweight, fast, single-threaded HTTP/1.1 server +Name: darkhttpd +Version: 1.11 +Release: 1 +License: BSD +Group: Networking/Daemons/HTTP +Source0: http://unix4lyfe.org/darkhttpd/%{name}-%{version}.tar.bz2 +# Source0-md5: 050e5a821b1fa71a82c6efba7fda1323 +Source1: %{name}.service +Source2: %{name}.sysconfig +URL: http://unix4lyfe.org/darkhttpd/ +BuildRequires: rpmbuild(macros) >= 1.647 +BuildRequires: systemd-devel +Requires(post,preun,postun): systemd-units >= 38 +Requires: /etc/mime.types +Requires: systemd-units >= 0.38 +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%description +darkhttpd is a secure, lightweight, fast and single-threaded HTTP/1.1 +server. + +Features: +- Simple to set up: + - Single binary, no other files. + - Standalone, doesn't need inetd or ucspi-tcp. + - No messing around with config files. +- Written in C - efficient and portable. +- Small memory footprint. +- Event loop, single threaded - no fork() or pthreads. +- Generates directory listings. +- Supports HTTP GET and HEAD requests. +- Supports Range / partial content. +- Supports If-Modified-Since. +- Supports Keep-Alive connections. +- Can serve 301 redirects based on Host header. +- Uses sendfile(). + +Security: +- Can log accesses, including Referer and User-Agent. +- Can chroot. +- Can drop privileges. +- Impervious to /../ sniffing. +- Times out idle connections. +- Drops overly long requests. + +Limitations: +- This server only serves static content - *NO* CGI supported! + +%prep +%setup -q + +%build +%{__cc} %{rpmcflags} %{rpmcppflags} darkhttpd.c -o %{name} %{rpmldflags} + +%install +rm -rf $RPM_BUILD_ROOT +install -d $RPM_BUILD_ROOT{%{_sbindir},/etc/sysconfig,%{systemdunitdir}} + +install -p %{name} $RPM_BUILD_ROOT%{_sbindir}/%{name} +cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service +cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} + +%post +%systemd_post %{name}.service + +%preun +%systemd_preun %{name}.service + +%postun +%systemd_reload + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(644,root,root,755) +%doc README +%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name} +%attr(755,root,root) %{_sbindir}/%{name} +%{systemdunitdir}/%{name}.service diff --git a/darkhttpd.sysconfig b/darkhttpd.sysconfig new file mode 100644 index 0000000..5e3eae4 --- /dev/null +++ b/darkhttpd.sysconfig @@ -0,0 +1,3 @@ +DARKHTTPD_ROOT="/var/www" +DARKHTTPD_FLAGS="--uid nobody --gid nobody --chroot" +MIMETYPES="--mimetypes /etc/mime.types" -- 2.43.0