From c8798ad669cd1b68b3b768af16cc7f85a3ec82c8 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Wed, 15 Feb 2012 17:33:42 -0700 Subject: [PATCH] Remove in-place substituting .png for .gif --- README | 14 ++------------ fnord.c | 12 ++---------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/README b/README index 39b5b02..9673185 100644 --- a/README +++ b/README @@ -42,7 +42,7 @@ symlink must point to a full URL, i.e. ln -s ftp://foobar.math.fu-berlin.de/pub/dietlibc/dietlibc-0.11.tar.bz2 dietlibc-0.11.tar.bz2 -fnord implements in-place substitution of .gif to .png and of * to *.gz +fnord implements in-place substitution of * to *.gz if the file is available and the client supports the mime-type and content-encoding. That means you can save substantial bandwidth by having an index.html.gz for each index.html, as most clients can @@ -55,18 +55,8 @@ fnord understands and implements keep-alive connections. fnord can use sendfile on Linux to enable zero-copy TCP. -If fnord is compiled with CGI support enabled, it will regard files +If fnord is given the -c option, it will regard files whose names end with ".cgi" as CGI programs and try to execute them. CGI programs starting with "nph-" will be handled as no-parse-header CGIs. Please see http://hoohoo.ncsa.uiuc.edu/cgi/interface.html for the CGI specification. - -fnord 1.3 introduced a different method of whole-host redirection, which -can still be enabled by compiling fnord with with -DOLD_STYLE_REDIRECT. -Files that are not found locally will be redirected to $REDIRECT_HOST -with the current URI stripped of leading slashes, i.e. if -http://your.server/foo/bar.html is requested but not found, and -$REDIRECT_HOST is set to http://www.yahoo.com/, a redirect to -http://www.yahoo.com/foo/bar.html will be issued. If $REDIRECT_HOST is -unset but $REDIRECT_URI is set, the URI part will be discarded and all -URLs will be redirected to $REDIRECT_URI. diff --git a/fnord.c b/fnord.c index 434569b..2723442 100644 --- a/fnord.c +++ b/fnord.c @@ -1762,17 +1762,11 @@ main(int argc, char *argv[], const char *const *envp) */ int ul = strlen(url); char *fnord = alloca(ul + 4); - int fd2, - trypng = 0; + int fd2; char *oldencoding = encoding; - char *oldmimetype = mimetype; strcpy(fnord, url); - if (ul > 4 && !strcmp(fnord + ul - 4, ".gif")) { - trypng = 1; - strcpy(fnord + ul - 3, "png"); - } else - strcpy(fnord + ul, ".gz"); + strcpy(fnord + ul, ".gz"); fd2 = doit(buf, len, fnord, 0); if (fd2 >= 0) { /* yeah! */ url = fnord; @@ -1780,8 +1774,6 @@ main(int argc, char *argv[], const char *const *envp) fd = fd2; } else { encoding = oldencoding; - if (trypng) - mimetype = oldmimetype; } retcode = 200; dolog(st.st_size);