. INADDR_NONE is -1
. Change bindport to an unsigned short (ntohs implies short).
. Conditionally implement our own errx() and err().
. Conditionally use a custom vasprintf() that depends on vsnprintf().
. Added conn_close to struct connection.
0 = Keep-Alive, 1 = Connection: close
. Added keepalive_connection() for recycling connection structs.
. Made "Connection: close\r\n" in reply headers optional.
. If protocol is HTTP/1.1, use Keep-Alive, unless Connection: close is
given in the request.
Offtopic:
. Improved request parsing - allow extraneous spaces.
. Make some empty for() loops more obvious.
. Missed a 0 -> '\0' last time.
. err(EXIT_FAILURE, ...) -> err(1, ...) to retain existing style.
. Annotate default_extension_map[] - it must be NULL terminated.
. Don't expand_tilde() -- unsure about this.
. Changed `#if IDLETIME' to `if (IDLETIME)' - it will be
optimized away by the compiler.
. Some casts and an int->size_t change to keep splint happy about
integer types.
. Added add_mime_mapping() to add to mime_map in unsorted order.
. Added sort_mime_map() - uses qsort() and mime_mapping_cmp() to sort
the mime_map.
. uri_content_type() uses bsearch() and mime_mapping_cmp_str() to search
through the mime_map for an extension parsed out of a specified URI.
. Free mime_map in exit_quickly()
. Completely deallocate connlist in exit_quickly()
. In main(), parse_commandline() after parse_default_extension_map() so
that a specified --mimetypes file will -override- the defaults.
. bindport is uint16_t like in Linux.
. Fix a bounds error in make_safe_uri().
. Remember to free temporaries in make_safe_uri().
. Free if_mod_since in process_get()
. Set reply_file to NULL after closing it in poll_send_reply() to avoid
double fclose() in free_connection().
. Don't log connections with http_code == 0; these are connections that
failed while receiving the request string.
. Initialise timeout more cleanly in httpd_poll().
. Made MAX_FD_SET use a { block } to keep gcc 3 happy.
. Don't free items in a LIST_FOREACH() block; use a temporary next
pointer and LIST_NEXT().
. exit_quickly() closes logfile if it's open.
. exit_quickly() doesn't re-throw the signal that triggered it.
. Decrease send BUFSIZE to 40,000 (max I've seen is 33,000).
. Remove a debugf() from poll_send_reply().
. Add exit_quickly().
. SIGINT and SIGQUIT exit_quickly().
. Added reply_start to struct connection.
. Added debugf() to free_connection().
. Construct HTTP 206 reply if Range specified.
. Take reply_start into consideration in poll_send_reply().
. Added fread() error handling - eof is non-fatal.
. Added xstrdup()
. Made expand_tilde use xstrdup() instead of strdup() (whoops)
. process_get() now handles "If-Modified-Since:"
. lastmod is generated before Date: so that only one asprintf() is
needed to construct the header in process_get()
. Added make_safe_uri()
. Modified split_string() calls to match new prototype
. process_get() uses make_safe_uri() to prevent walking out of wwwroot
. free(target) AFTER we finish using it in process_get (whoops)
. Reordered default_extension_map[] for search speed
. Added uri_content_type()
. process_get() calls uri_content_type() when needed
. Removed a couple of debugf()s from process_request
. Moved xrealloc() to top of file
. Added parse_field()
. parse_request() calls parse_field() for referer, ua
. Logfile is opened in append mode, not write mode
. strip_endslash() calls xrealloc(), not realloc()
. Moved parse_request's {method|url} to conn->{method|uri}
. Added http_code, total_sent to struct connection
. Added out-of-memory checks on a few asprintf()s
. Added assert()s where I tripped up before or could again
. Added log_connection()
. Open logfile from logfile_name in main()
. TODO: Marked off Actually serve files
. Added min(a,b) macro
. Moved header_only from process_get() to struct connection
. MAX_REQUEST_LENGTH from 20000 to 4000
. xrealloc() to strlen+1 in urldecode()
. Made default_reply() take variable arguments like printf
. Mostly implemented process_get()
. Handling of file-not-found
. Handling of other fopen() errors
. Header generation (except Content-Type)
. Made default_replies more specific
. poll_send_header() advances state to DONE if header_only
. Completed poll_send_reply() (implemented REPLY_FROMFILE)