Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
all:
cc httpd.c -o httpd
DESTDIR= /usr/libexec
CFLAGS= -O
PROGRAM= httpd
SRCS= httpd.c
OBJS= httpd.o
LIBS=

all: ${PROGRAM}

${PROGRAM}: ${OBJS}
${CC} ${CFLAGS} -o $@ ${OBJS} ${LIBS}

install: ${PROGRAM}
install -s -m 755 ${PROGRAM} ${DESTDIR}

tags:
ctags -tdw *.c

clean:
rm -f a.out core *.o ${PROGRAM}
58 changes: 57 additions & 1 deletion README.org
Original file line number Diff line number Diff line change
@@ -1,7 +1,63 @@
* 2.11BSD httpd

This web server rapidly grew into something very different and reasonably powerful. Strongly recommended that you use the later versions, which can be found on the PiDP-11 google groups. At the time of writing, the latest version is https://groups.google.com/forum/#!msg/pidp-11/nE5W6wAEIxA/7mGpfjAYAwAJ
A web server for 2.11 BSD running on the PiDP-11/70

#+html: <p><img src="pidp11-cropped-small.png" width="287" /></p>

The original thread discussing the server can be found at https://groups.google.com/g/pidp-11/c/nE5W6wAEIxA/m/7mGpfjAYAwAJ

The current version:
- Supports static file retrieval (HTML and images)
- Supports CGI GET and POST requests
- Assumes web root is /home/www
- Assumes CGI root is /home/www/cgi-bin
- Places HTTP headers in the environment for CGI programs
- Passes QUERY_STRING and CONTENT_LENGTH enviroment variables, aligning with Apache HTTPD CGI
- Only supports HTTP (insecure)
- Welcomes further contributions

** Latest Update Notes from Dave Read (Feb, 2025)

I've added passing of request header data to the CGI program's environment.
Constraints on the amount of data that will be passed are set conservatively. The
stdin channel has been set to unbuffered so that CGI applications called with POST
will be able to read the content.

Also, I've created a version of Dr. Nim (ESR 1960's mechanical computer game) as a
proof-of-concept for accessing the request parameters and content. That code is
available in my https://github.com/DaveRead/2.11BSD-Dr.Nim repository.

** Key Update Notes from Chase Covello (Aug, 2019)

I've recently made these changes to httpd.c, which I'm running on my PiDP-11 at http://chasecovello.ddns.net/:

1) Logging with source IP, date, HTTP request, response code, and file size or error message. Make sure /usr/adm/httpd.log exists and has correct permissions or all requests will return an HTTP 500.
2) Rudimentary CGI support. It will execute non-setuid/setuid binaries only if they are in a path that includes /cgi-bin/ somewhere. It doesn't pass an environment because I didn't need it.
3) More robust error checking and some buffer overrun fixes.
4) Use of a buffer and fread/fwrite to serve the file instead of fgetc/fputc. It's noticeably faster now.

I've made a few more changes since the last version; I will be including this one in the new 2.11BSD disk image for testing. I think it's time I set up a github repo, but for now the new httpd.c is attached, along with a Makefile to make rebuilding and installing easier.

The big changes are:

Added a 60 second timeout to kill the httpd process if the client fails to complete the HTTP request. I noticed after a few days I have several httpd processes sitting there and I got tired of manually killing them.
Changed document dir to /home/www because /home has much more free space than / on the PiDP-11 2.11BSD disk image.
Tuned the buffer size to save memory; testing shows little to no performance improvement beyond 64 bytes when serving big files. I went with 256 for no real reason other than it's not too big and not too small. Below are the test results for a 30MB file from my system:

BUF_SIZE SPEED (kB/s)
1 20
2 36
4 44
8 90
16 120
32 120
64 125
128 125
256 125

** Original Release Notes from Aaron Jackson (Aug, 2019)

This web server rapidly grew into something very different and reasonably powerful. Strongly recommended that you use the later versions, which can be found on the PiDP-11 google groups. At the time of writing, the latest version is https://groups.google.com/forum/#!msg/pidp-11/nE5W6wAEIxA/7mGpfjAYAwAJ

A small, and fairly bad, web server which runs under 2.11BSD.

Expand Down
Loading