1 diff -ur fnord-1.10-orig/httpd.c fnord-1.10/httpd.c
2 --- fnord-1.10-orig/httpd.c 2006-10-01 14:28:24.000000000 -0300
3 +++ fnord-1.10/httpd.c 2006-10-01 14:28:35.000000000 -0300
11 static const char *cgivars[CGIENVLEN] = {
23 static int iscgivar(const char *s) {
25 tmp+=realpath(pathinfo,tmp)?str_len(tmp):str_copy(tmp,pathinfo);
30 + tmp+=str_copy(tmp,"SCRIPT_FILENAME=");
31 + tmp+=str_copy(tmp,url+1+str_rchr(url,'/'));
34 + tmp+=str_copy(tmp,"REDIRECT_STATUS=");
35 + tmp+=str_copy(tmp,"");
42 static int findcgi(const char* c) {
43 return (c[0]=='.' && c[1]=='c' &&
44 c[2]=='g' && c[3]=='i' &&
45 + (c[4]=='/' || c[4]==0)) ||
46 + (c[0]=='.' && c[1]=='p' &&
47 + c[2]=='h' && c[3]=='p' &&
48 (c[4]=='/' || c[4]==0));
51 @@ -1675,3 +1690,17 @@
57 +unsigned long str_rchr(const char *haystack, char needle) {
58 + register const char* t=haystack;
59 + register const char c=needle;
60 + register const char* found=0;
62 + if (!*t) break; if (*t==c) found=t; ++t;
63 + if (!*t) break; if (*t==c) found=t; ++t;
64 + if (!*t) break; if (*t==c) found=t; ++t;
65 + if (!*t) break; if (*t==c) found=t; ++t;
67 + return (found?found:t)-haystack;
69 diff -ur fnord-1.10-orig/str.h fnord-1.10/str.h
70 --- fnord-1.10-orig/str.h 2006-10-01 14:28:24.000000000 -0300
71 +++ fnord-1.10/str.h 2006-10-01 14:29:08.000000000 -0300
73 extern unsigned int str_chr(const char *haystack,char needle) __pure__;
75 /* str_rchr returns the index of the last occurance of needle or \0 in haystack */
76 -extern unsigned int str_rchr(const char *haystack,char needle) __pure__;
77 +//extern unsigned int str_rchr(const char *haystack,char needle) __pure__;
78 +unsigned long str_rchr(const char *haystack, char needle);
80 /* str_start returns 1 if the b is a prefix of a, 0 otherwise */
81 extern int str_start(const char *a,const char *b) __pure__;