nonhttpd

A httpd serving nothing.
git clone git://r-36.net/nonhttpd
Log | Files | Refs | LICENSE

commit 2e38ff9cdec602aae0b5470ea81f73d691960153
Author: Christoph Lohmann <20h@r-36.net>
Date:   Tue, 20 Nov 2012 16:59:33 +0100

Initial commit of nonhttpd.

Diffstat:
LICENSE | 21+++++++++++++++++++++
Makefile | 38++++++++++++++++++++++++++++++++++++++
README.md | 9+++++++++
config.mk | 10++++++++++
nonhttpd | 9+++++++++
nonhttpd.1 | 20++++++++++++++++++++
socat-nonhttpd.sh | 4++++
7 files changed, 111 insertions(+), 0 deletions(-)

diff --git a/LICENSE b/LICENSE @@ -0,0 +1,21 @@ +MIT/X Consortium License + +© 2012 Christoph Lohmann <20h@r-36.net> + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/Makefile b/Makefile @@ -0,0 +1,38 @@ +# nonhttpd - a commandline mail client +# See LICENSE file for copyright and license details. + +include config.mk + +all: config.mk notice + +notice: + @echo Just use »make install«. + +dist: clean + @echo creating dist tarball + @mkdir -p ${NAME}-${VERSION} + @cp -R LICENSE Makefile README.md config.mk \ + nonhttpd socat-nonhttpd.sh ${NAME}-${VERSION} + @tar -cf ${NAME}-${VERSION}.tar ${NAME}-${VERSION} + @gzip ${NAME}-${VERSION}.tar + @rm -rf ${NAME}-${VERSION} + +install: all + @echo installing executable files to ${DESTDIR}${PREFIX}/bin + @mkdir -p ${DESTDIR}${PREFIX}/bin + @cp -f nonhttpd ${DESTDIR}${PREFIX}/bin + @chmod 755 ${DESTDIR}${PREFIX}/bin/nonhttpd + @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 + @mkdir -p ${DESTDIR}${MANPREFIX}/man1 + @sed "s/VERSION/${VERSION}/g" < nonhttpd.1 > ${DESTDIR}${MANPREFIX}/man1/nonhttpd.1 + @chmod 644 ${DESTDIR}${MANPREFIX}/man1/nonhttpd.1 + +uninstall: + @echo removing executable file from ${DESTDIR}${PREFIX}/bin + @rm -f ${DESTDIR}${PREFIX}/bin/nonhttpd + @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 + @rm -f ${DESTDIR}${MANPREFIX}/man1/nonhttpd.1 + + +.PHONY: all clean dist install uninstall + diff --git a/README.md b/README.md @@ -0,0 +1,9 @@ +# nonhttpd – not an httpd + +This httpd will serve nothing. You will need some way to handle TCP re‐ +quests, like socat(1), inetd(8) or xinetd(8). + +## Using with socat + +see socat-nohttpd.sh + diff --git a/config.mk b/config.mk @@ -0,0 +1,10 @@ +# nonhttpd metadata +NAME = nonhttpd +VERSION = 0.6 + +# Customize below to fit your system + +# paths +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/share/man + diff --git a/nonhttpd b/nonhttpd @@ -0,0 +1,9 @@ +#!/bin/sh + +printf "HTTP/1.1 OK\r +Content-Type: text/html;\r +Last-Modified: Fr, 07 Mar 1492 02:04:03 GMT\r +Content-Length: 15\r +\r +<html> </html>\r\n" + diff --git a/nonhttpd.1 b/nonhttpd.1 @@ -0,0 +1,20 @@ +.TH NONHTTPD 1 nonhttpd\-VERSION +.SH NAME +nonhttpd \- an httpd server serving nothing +.SH SYNOPSIS +.B nonhttpd +.SH DESCRIPTION +.B nonhttpd +is a simple httpd server that should be used in conjunction with situations in +browsers where requests need to be redirected to something fast. +.SH EXAMPLES +$ socat tcp-l:8080,reuseaddr,fork,su=nobody exec=/usr/bin/nonhttpd +.SH AUTHORS +See the LICENSE file for the authors. +.SH LICENSE +See the LICENSE file for the terms of redistribution. +.SH SEE ALSO +.BR socat (1) +.SH BUGS +Please report them. + diff --git a/socat-nonhttpd.sh b/socat-nonhttpd.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +socat tcp-l:8080,reuseaddr,fork exec:/usr/bin/nonhttpd +