diff options
author | Leah Neukirchen <leah@vuxu.org> | 2020-05-09 22:02:26 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2020-05-09 22:02:26 +0200 |
commit | 92e835113c095428b049f966c7976d9d169e8611 (patch) | |
tree | 8478e7d2b47d5f4dba148c0c5993749edf8996af | |
parent | 25dae8d17f31a9190dd13a9bb3bc10ff7ffce79d (diff) | |
download | hittpd-92e835113c095428b049f966c7976d9d169e8611.tar.gz hittpd-92e835113c095428b049f966c7976d9d169e8611.tar.xz hittpd-92e835113c095428b049f966c7976d9d169e8611.zip |
allow setting default mimetype, default to application/octet-stream
-rw-r--r-- | hittpd.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/hittpd.c b/hittpd.c index 857153e..9e3a90e 100644 --- a/hittpd.c +++ b/hittpd.c @@ -92,12 +92,11 @@ char mimetypes[] = ":.svg=image/svg+xml" ":.ico=image/x-icon"; -char default_mimetype[] = "text/plain"; // "application/octet-stream" -char default_wwwroot[] = "/var/www"; +const char *default_mimetype = "application/octet-stream"; char default_vhost[] = "_default"; char default_port[] = "80"; -char *wwwroot = default_wwwroot; +const char *wwwroot = "/var/www"; int tilde = 0; int vhost = 0; int quiet = 0; @@ -455,7 +454,7 @@ send_ok(http_parser *p, time_t modified, const char *mimetype, off_t filesize) } } -char * +const char * mimetype(char *ext) { static char type[16]; @@ -889,7 +888,7 @@ main(int argc, char *argv[]) char *uds = 0; int c; - while ((c = getopt(argc, argv, "h:m:p:qu:IHPV")) != -1) + while ((c = getopt(argc, argv, "h:m:p:qu:IHM:PV")) != -1) switch (c) { case 'h': host = optarg; break; case 'm': custom_mimetypes = optarg; break; @@ -898,12 +897,13 @@ main(int argc, char *argv[]) case 'q': quiet = 1; break; case 'I': show_index = 0; break; case 'H': tilde = 1; break; + case 'M': default_mimetype = optarg; break; case 'P': only_public = 1; break; case 'V': vhost = 1; break; default: fprintf(stderr, "Usage: %s [-h HOST] [-p PORT] [-u SOCKET] " - "[-m :.ext=mime/type:...] " + "[-m :.ext=mime/type:...] [-M DEFAULT_MIMETYPE] " "[-IHPVq] [DIRECTORY]\n", argv[0]); exit(1); } |