CS 241: HTTP Push Server Online Source

The following code implements a very basic HTTP server with server-side push. The server sits at port 5012. When a client requests a file, the server sends the file and begins to monitor the modification timestamp on the file. If the file changes, the server pushes a fresh copy to the client.

The code provides examples of the use of POSIX thread functions, including those used with thread creation, thread-specific data, and cleanup functions.

The read_line code handles both UNIX and PC flavors of end-of-line sequences (which makes it somewhat complex).

Oh, and the code is nicely commented and all that. Enjoy!

Makefile

exit_codes.h
local_assert.h
print_error.h
pushy.h
read_line.h

print_error.c
push_thr_code.c
pushy.c
read_line.c

To use the push server, you must run Firefox or Netscape and connect to http://<machinename>:5012/<filename>. For my example, I used filename = test.html. Then, I ran a simple script that changed test.html. You can access test.html, the script (swap.sh), or simply download all the necessary files here.