# -*- Makefile -*- # # This is a make+ file. Make+ is a set of scripts which enhance GNU # make and let you build RPMs, and other package types with just one # control file. To build this package you will need to download make+ # from this site: http://www.annexia.org/freeware/makeplus/ PACKAGE := rws VERSION_MAJOR := 1 VERSION_MINOR := 2.0 VERSION := $(VERSION_MAJOR).$(VERSION_MINOR) SUMMARY := Rich\'s Web Server COPYRIGHT := GNU LGPL AUTHOR := Richard W.M. Jones define DESCRIPTION RWS is a tiny, fast and elegant web server. It can serve simple files or run CGI scripts. It supports virtual hosts. endef RPM_REQUIRES := pthrlib >= 3.2.0, c2lib >= 1.3.0 RPM_GROUP := System Environment/Daemons CFLAGS += -Wall -Werror -g -O2 -I$(includedir)/c2lib \ -I$(shell pg_config --includedir) ifneq ($(shell uname), SunOS) # Avoid a warning about reordering system include paths. CFLAGS += $(shell pcre-config --cflags) endif LIBS += -L$(libdir) -lpthrlib -lc2lib \ -L$(shell pg_config --libdir) -lpq \ $(shell pcre-config --libs) # make+ needs to support a better method of handling libraries than this: ifneq ($(shell uname), OpenBSD) ifneq ($(shell uname), FreeBSD) LIBS += -ldl endif endif ifeq ($(shell uname), SunOS) LIBS += -lnsl -lsocket endif LIBS += -lm OBJS := main.o cfg.o dir.o errors.o exec.o exec_so.o file.o mime_types.o \ process_rq.o rewrite.o HEADERS := $(srcdir)/rws_request.h all: build configure: $(MP_CONFIGURE_START) $(MP_CHECK_LIB) precomp c2lib $(MP_CHECK_LIB) current_pth pthrlib $(MP_CHECK_FUNCS) dlclose dlerror dlopen dlsym glob globfree \ putenv setenv $(MP_CHECK_HEADERS) alloca.h arpa/inet.h dirent.h dlfcn.h fcntl.h \ glob.h grp.h netinet/in.h pwd.h setjmp.h signal.h string.h \ sys/mman.h sys/socket.h sys/stat.h sys/syslimits.h sys/types.h \ sys/wait.h syslog.h time.h unistd.h $(MP_CONFIGURE_END) build: librws.a librws.so rwsd manpages conffiles syms \ examples/hello.so examples/show_params.so # Program. rwsd: $(OBJS) $(CC) $(CFLAGS) $^ -L. -lrws $(LIBS) -o $@ # Library. librws.a: rws_request.o $(MP_LINK_STATIC) $@ $^ librws.so: rws_request.lo $(MP_LINK_DYNAMIC) $@ $^ # Examples. examples/%.so: examples/%.lo ifneq ($(shell uname), SunOS) $(CC) $(CFLAGS) -shared -Wl,-soname,$@ $^ -L. -lrws $(LIBS) -o $@ else # XXX make+ needs to support this. $(CC) $(CFLAGS) -shared -Wl,-h,$@ $^ -L. -lrws $(LIBS) -o $@ endif # Build the manual pages. manpages: $(srcdir)/*.h if cdoc; then \ rm -f *.3; \ cdoc \ --author '$(AUTHOR)' \ --license '$(COPYRIGHT)' \ --version '$(PACKAGE)-$(VERSION)' \ $^; \ fi # Build the configuration files. conffiles: conf/default conf/rws.conf conf/default: conf/default.in sed 's,@pkgdatadir@,$(pkgdatadir),g' < $^ > $@ conf/rws.conf: conf/rws.conf.in sed 's,@pkgdatadir@,$(pkgdatadir),g' < $^ > $@ # Build the symbols table. syms: rwsd.syms librws.syms rwsd.syms: rwsd nm $< | sort | grep -i '^[0-9a-f]' | awk '{print $$1 " " $$3}' > $@ librws.syms: librws.so nm $< | sort | grep -i '^[0-9a-f]' | awk '{print $$1 " " $$3}' > $@ # Run the simple test. test: test_rws.sh LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) $(MP_RUN_TESTS) $^ install: install -d $(DESTDIR)$(sbindir) install -d $(DESTDIR)$(libdir) install -d $(DESTDIR)$(includedir) install -d $(DESTDIR)$(sysconfdir)/init.d install -d $(DESTDIR)$(sysconfdir)/rws install -d $(DESTDIR)$(sysconfdir)/rws/hosts install -d $(DESTDIR)$(pkgdatadir)/symtabs install -d $(DESTDIR)$(pkgdatadir)/so-bin install -d $(DESTDIR)$(pkgdatadir)/html install -d $(DESTDIR)$(man1dir) install -d $(DESTDIR)$(man3dir) install -m 0755 rwsd $(DESTDIR)$(sbindir) $(MP_INSTALL_STATIC_LIB) librws.a $(MP_INSTALL_DYNAMIC_LIB) librws.so install -m 0644 $(HEADERS) $(DESTDIR)$(includedir) install -m 0755 $(srcdir)/rws.rc $(DESTDIR)$(sysconfdir)/init.d/rws if [ ! -f $(DESTDIR)$(sysconfdir)/rws/rws.conf ]; then \ install -m 0644 conf/rws.conf $(DESTDIR)$(sysconfdir)/rws; \ fi if [ ! -f $(DESTDIR)$(sysconfdir)/rws/hosts/default ]; then \ install -m 0644 conf/default $(DESTDIR)$(sysconfdir)/rws/hosts; \ fi install -m 0644 *.syms $(DESTDIR)$(pkgdatadir)/symtabs install -m 0755 examples/*.so $(DESTDIR)$(pkgdatadir)/so-bin install -m 0644 $(srcdir)/html/*.html $(DESTDIR)$(pkgdatadir)/html install -m 0644 $(srcdir)/rwsd.1 $(DESTDIR)$(man1dir) install -m 0644 *.3 $(DESTDIR)$(man3dir) define WEBSITE <% include page_header.msp %>

$(PACKAGE) - $(SUMMARY)

rws is a small, fast web server written in C. It uses the pthrlib threading/server library and the c2lib library of Perl-like basics for C. These make it amongst the smallest, fastest and most straightforwardly written web servers available now.

As of version 1.0.11, the stripped binary is 27K and size reports:

   text    data     bss     dec     hex filename
  24332     828      88   25248    62a0 rwsd

Of course, most of the magic is in pthrlib.

It supports a fairly minimal set of features so far:

There is extensive documentation and a tutorial here.

Download

File Format Contents
$(PACKAGE)-$(VERSION).tar.gz tar.gz Latest source distribution
$(PACKAGE)-$(VERSION)-1.i686.rpm i686 binary RPM Binary server, header files, man pages for Red Hat Linux
$(PACKAGE)-$(VERSION)-1.src.rpm source RPM Source files for Red Hat Linux

You must install the latest pthrlib and c2lib libraries first!

News

Sat Feb 8 17:00:47 GMT 2003: Ported to Solaris, OpenBSD and FreeBSD (thanks to Jeremy Sowden and Richard Baker for help and equipment). Added a test script which actually starts up and runs rws and verifies static file serving, CGI scripts and shared object scripts. Added -ldl to LIBS (thanks to jeffrey at box-sol.com). Build fixes for RH 7.3.

Sun Dec 8 16:07:20 GMT 2002: Enabled debugging and optimisations. Converted to use make+. Changed to support changes in the pthrlib API. The -f option prevents the server from changing directory as well. More descriptive thread names. Give idle threads a different name.

Mon Nov 25 09:31:37 GMT 2002: Added a symbols file for full symbol resolution in monolith. Added debian/conffiles so that Debian package won't splat configuration files. Changed process_rq to set thread name to the canonical path (useful for debugging, stats). Set a maximum number of requests that we will service with a single thread. Enable stack traces.

Sun Nov 17 23:31:32 GMT 2002: Debian packages. Added MSP files. rws_request_* symbols are now in a separate library. Added rwsd.1 manual page. RWS now forces connection close on bad requests. Multiple fixes to the way directories/subdirectories are handled. exec_so catches pth_die exceptions and prints a message. More rewrite fixes. Change the default root to /var/www. Added postinst script for Debian.

Thu Nov 14 15:33:29 GMT 2002: Major checkpoint release for Monolith.

Sun Oct 20 14:57:29 BST 2002: Allow empty entries in rws configuration file. Correct compilation flags for PCRE. Allow the stack size to be selected from the configuration file. Fixed path parsing. Added include files to RPM. Added example MSP configuration to configuration file.

Tue Oct 15 23:40:42 BST 2002: Multiple bug fixes.

Sun Oct 13 19:04:16 BST 2002: Added -a, -d and -f flags which allow you to run the server on only a single interface and make it simpler to debug. (Thanks to Steve Atkins, steve at blighty com, for this patch). You need the most recent pthrlib.

Sun Oct 6 13:00:39 BST 2002: New rewrite module allows comprehensive URL rewriting. Updated to use the newest version of c2lib.

Sat Sep 7 15:51:10 BST 2002: Packages are now available as i686 binary RPMs and source RPMs.

Old news and old versions

Sat Aug 31 17:39:36 BST 2002

rws-1.0.0.tar.gz released. This includes a tutorial.

Thu Aug 22 13:20:32 BST 2002

rws-0.9.6.tar.gz released. This includes manual pages.

Thu Aug 22 12:27:16 BST 2002

rws-0.9.5.tar.gz released. I have changed the interface to shared object scripts to allow me to extend it in the future without ever changing it again (hopefully :-) See the README file and <rws_request.h> for more details.

Wed Aug 21 14:20:12 BST 2002

rws-0.9.4.tar.gz released. Support for shared object scripts.

Thu Jun 21 23:14:48 BST 2001

rws-0.9.2.tar.gz released. Directory listings are sorted alphabetically. Server signature is printed at the bottom of directory listings. Make sure you have c2lib >= 1.2.12.

Tue May 22 14:22:06 BST 2001

rws-0.0.9.tar.gz released. URL paths are now unescaped correctly. Make sure you have pthrlib >= 2.0.5.

Tue May 22 11:37:10 BST 2001

rws-0.0.8.tar.gz released. Added configuration files and init scripts to RPM. Don't hold file descriptors open for files in the mmapped file cache. Fixes to example rws.conf file. Fixed the mmapped file cache so it no longer grows indefinitely (:-) Make sure you have pthrlib >= 2.0.4.

Tue Apr 10 16:04:41 BST 2001

rws-0.0.7.tar.gz released. Generates access_log file. Directory listings have been improved considerably.

Mon Apr 9 17:34:31 BST 2001

rws-0.0.6.tar.gz released. This is the first public version.

<% include page_footer.msp %> endef upload_website: scp $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)-1.*.rpm \ $(PACKAGE)-$(VERSION).bin.tar.gz \ 10.0.0.248:annexia.org/freeware/$(PACKAGE)/ scp index.html \ 10.0.0.248:annexia.org/freeware/$(PACKAGE)/index.msp .PHONY: build configure test upload_website