summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Woodfall <dave@slackbuilds.org>2021-04-16 17:33:06 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2021-04-16 17:33:06 +0700
commit41b95cf8cbf87711e286acc3bfe0e39f5aad36e9 (patch)
treec150760edaa89ddf3fac35f041a77df745376df9
parentce3630d8cd92f83f8a0c8e16f1b22281f6f65c3a (diff)
downloadslackbuilds-41b95cf8cbf87711e286acc3bfe0e39f5aad36e9.tar.gz
network/nweb: Added (tiny web server in C).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r--network/nweb/README23
-rw-r--r--network/nweb/README.client64
-rw-r--r--network/nweb/nweb.SlackBuild89
-rw-r--r--network/nweb/nweb.info10
-rw-r--r--network/nweb/slack-desc19
5 files changed, 205 insertions, 0 deletions
diff --git a/network/nweb/README b/network/nweb/README
new file mode 100644
index 0000000000..9f882d64d9
--- /dev/null
+++ b/network/nweb/README
@@ -0,0 +1,23 @@
+A tiny web server in C.
+
+nweb is a small and very safe mini web server nweb only servers out
+file/web pages with extensions named below and only from the named
+directory or its sub-directories.
+
+There is no fancy features = safe and secure.
+
+Example: nweb 8181 /home/nwebdir &
+
+Only Supports: gif jpg jpeg png ico zip gz tar htm html
+Not Supported: URLs including "..", Java, Javascript, CGI
+Not Supported: directories / /etc /bin /lib /tmp /usr /dev /sbin
+
+client.c:
+
+Also included is the source for a client. This client.c program is
+designed to fake being a web browser. It sends the expected requests to
+the web server over a network socket connection and displays the results
+as text rather than graphically displaying the results. In the code you
+will have to change the two lines as below to match your web server or
+nweb server. See README.client for instructions. The client.c source
+code can be found in the /usr/doc/nweb-<VERSION> directory.
diff --git a/network/nweb/README.client b/network/nweb/README.client
new file mode 100644
index 0000000000..1fd848e0bd
--- /dev/null
+++ b/network/nweb/README.client
@@ -0,0 +1,64 @@
+ client.c
+
+This client.c program is designed to fake being a web browser. It sends the
+expected requests to the web server over a network socket connection and
+displays the results as text rather than graphically displaying the results. In
+the code you will have to change the two lines as below to match your web
+server or nweb server.
+
+/* YOU WILL HAVE TO CHANGE THESE TWO LINES TO MATCH YOUR CONFIG / #define PORT
+ * 8181 /
+Port number as an integer - web server default is 80 / #define IP_ADDRESS
+"192.168.0.8" / IP Address as a string */
+
+The default is to request the /index.html from the web server. If you want to
+request another file then change the GET line as below:
+
+char *command = "GET /index.html HTTP/1.0 \r\n\r\n" ;
+
+To, for example:
+
+char *command = "GET /nigel.jpg HTTP/1.0 \r\n\r\n" ;
+
+Then compile the program with: cc client.c -o client
+
+I save the output in to a file as putting a non-test file like .jpg to the
+terminal screen can cause chaos: client >output
+
+Then edit the output file: vi output
+
+In real life, the interaction of web browser and web server can be much more complex.
+
+ 1. The web browser can tell the web server about its name, version and capabilities.
+
+ 2. The web server can send complex file types line JavaScript or Java programs
+or other active components.
+
+ 3. They can maintain a longer connection over the socket for efficiency.
+
+ 4. Below is an example of my Firefox brower requesting an index.html file. I
+have added newline characters to make it readable - it is 1300 bytes long! I
+have no idea what most of it is about. You will have to read the The World Wide
+Web Consortium (W3C) at http://www.w3.org for all the details.
+
+GET /index.html HTTP/1.1Host: myserver.home.com:80User-Agent: Mozilla/5.0 (W indows;
+U; Windows NT 5.1; en-GB; rv:1.9.2.28) Gecko/20120306 Firefox/3.6.28 (.NET CLR
+3.5.30729)Ac cept: image/png,image/;q=0.8,/*;q=0.5Accept-Language:
+en-gb,en;q=0.5Accept-Encoding: gzip,defla teAccept-Charset: ISO-8859-1,utf-8;
+q=0.7,*;q=0.7Keep-Alive: 115Connection: keep-alive**Referer:
+http://myserver.uk.home.com:8181/index.html**Cookie:
+__utma=101107545.1790272076.1316019590.13289002 55.1328908680.164;
+__utmz=101107545.1328566199.157.46.utmcsr=t.co|utmccn=(referral)|utmcmd=referral| u
+tmcct=/iTJx4DO1; UnicaNIODID=ZBr8gm79vIG-XKeoGGb; W3SSO_ACCESS=abc.home.com;
+ISP=70fdfc95
+d93011d783e4de784ea97766-70fdfc95d93011d783e4de784ea97766-f67749a8b899e8ceed7e940b8c4bf189;
+Prof ile=2000121913394303111032836125|EN|866|866.BDF|en-GB;
+_unam=693fb60-1337f162b72-11770d11-5; WLS intra_USERID=nigel@hotmail.com;
+ipcInfo=cc%3Duk%3Blc%3Den%3Bac%3Dall; iwm1p=214617669; bprememberme=nigel@
+hotmail.com; EPSPROFILE=EE2355DFE16AE020BE6C62FCB6BF5602;
+DWPERM=Xa.2/Xb.Xzso3-U35t8RWKvqBreGaQMgsP_RG
+Fl1124oIt-L-OPJIdSautkBN0D4NUp9JLlpUqPqB6CWOo-pgrJwhxNvvSfPAajgetaA2MOYwHfQPXPTRG9zwOMMR57EHQtXhOy5Om
+yzanyZthvVClm6uxvbwh0isEQ2Mm_9g2l7NjcA3RJdjuLaB3qlljOmyVuhDjBkgdNEb3PgYcCpbiu1FUzXrhPalhgsbAj7NBkaY88
+Yyg/Xc./Xd./Xf./Xg.1696801
+
+I hope this has been instructive, thanks, Nigel Griffiths
diff --git a/network/nweb/nweb.SlackBuild b/network/nweb/nweb.SlackBuild
new file mode 100644
index 0000000000..cd2ac1d290
--- /dev/null
+++ b/network/nweb/nweb.SlackBuild
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+# Slackware build script for nweb
+
+# Copyright 2021 Dave Woodfall <dave@slackbuilds.org>
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+PRGNAM=nweb
+COMMIT=${COMMIT:-867a6dd46298c882501f5c26d31ee821177542ab}
+VERSION=${VERSION:-23_"$( printf %s $COMMIT | cut -c 1-7 )"}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG/usr/bin $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$COMMIT
+tar xvf $CWD/$PRGNAM-$COMMIT.tar.gz
+cd $PRGNAM-$COMMIT
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+${CC:-gcc} $SLKCFLAGS nweb${VERSION:0:2}.c -o $PKG/usr/bin/nweb
+strip --strip-unneeded $PKG/usr/bin/nweb
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/{www-example,client}
+
+cp -a client.c $PKG/usr/doc/$PRGNAM-$VERSION/client
+cp -a nigel.jpg favicon.ico nweb.log index.html \
+ $PKG/usr/doc/$PRGNAM-$VERSION/www-example
+
+cp -a README.md $CWD/README.client $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/network/nweb/nweb.info b/network/nweb/nweb.info
new file mode 100644
index 0000000000..1690b8b5b1
--- /dev/null
+++ b/network/nweb/nweb.info
@@ -0,0 +1,10 @@
+PRGNAM="nweb"
+VERSION="23_867a6dd"
+HOMEPAGE="https://github.com/ankushagarwal/nweb"
+DOWNLOAD="https://github.com/ankushagarwal/nweb/archive/867a6dd46298c882501f5c26d31ee821177542ab/nweb-867a6dd46298c882501f5c26d31ee821177542ab.tar.gz"
+MD5SUM="7570ab89a441f1b11f2ab099660b9daa"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Dave Woodfall"
+EMAIL="dave@slackbuilds.org"
diff --git a/network/nweb/slack-desc b/network/nweb/slack-desc
new file mode 100644
index 0000000000..a271191935
--- /dev/null
+++ b/network/nweb/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+nweb: nweb (A tiny web server in C)
+nweb:
+nweb: nweb is a small and very safe mini web server nweb only servers out
+nweb: file/web pages with certain extensions and only from the named
+nweb: directory or its sub-directories.
+nweb:
+nweb: There is no fancy features = safe and secure.
+nweb:
+nweb: Example: nweb 8181 /home/nwebdir &
+nweb:
+nweb: