+/* XXX: This could be made far better and check for other attributes
+ * and stuff, but not now. */
+static const char *ckctype(const char *ctype)
+{
+ if(!strncmp(ctype, "text/", 5) && (strchr(ctype, ';') == NULL))
+ return(sprintf2("%s; charset=%s", ctype, nl_langinfo(CODESET)));
+ return(ctype);
+}
+
+static void checkcache(char *file, struct stat *sb)
+{
+ char *hdr;
+
+ if((hdr = getenv("REQ_IF_MODIFIED_SINCE")) != NULL) {
+ if(parsehttpdate(hdr) < sb->st_mtime)
+ return;
+ printf("HTTP/1.1 304 Not Modified\n");
+ printf("Date: %s\n", fmthttpdate(time(NULL)));
+ printf("Content-Length: 0\n");
+ printf("\n");
+ exit(0);
+ }
+}
+
+static void usage(void)
+{
+ flog(LOG_ERR, "usage: sendfile [-c CONTENT-TYPE] METHOD URL REST");
+}
+