Remove in-place substituting .png for .gif

This commit is contained in:
Neale Pickett 2012-02-15 17:33:42 -07:00
parent 6ef2b74474
commit c8798ad669
2 changed files with 4 additions and 22 deletions

14
README
View File

@ -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.

12
fnord.c
View File

@ -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);