updated on Mon Jan 16 12:07:49 UTC 2012
[aur-mirror.git] / fnord / php.patch
blob3c7343247f4a5e697dae03f4a14013ad6f9e98e5
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
4 @@ -259,7 +259,7 @@
7 #ifdef CGI
8 -#define CGIENVLEN 21
9 +#define CGIENVLEN 23
11 static const char *cgivars[CGIENVLEN] = {
12 "GATEWAY_INTERFACE=",
13 @@ -282,7 +282,9 @@
14 "CONTENT_LENGTH=",
15 "QUERY_STRING=",
16 "PATH_INFO=",
17 - "PATH_TRANSLATED="
18 + "PATH_TRANSLATED=",
19 + "SCRIPT_FILENAME=",
20 + "REDIRECT_STATUS="
23 static int iscgivar(const char *s) {
24 @@ -421,6 +423,16 @@
25 tmp+=realpath(pathinfo,tmp)?str_len(tmp):str_copy(tmp,pathinfo);
26 ++tmp;
28 + else {
29 + cgi_env[++i]=tmp;
30 + tmp+=str_copy(tmp,"SCRIPT_FILENAME=");
31 + tmp+=str_copy(tmp,url+1+str_rchr(url,'/'));
32 + *tmp=0; ++tmp;
33 + cgi_env[++i]=tmp;
34 + tmp+=str_copy(tmp,"REDIRECT_STATUS=");
35 + tmp+=str_copy(tmp,"");
36 + ++tmp;
37 + }
40 unsigned int j=0;
41 @@ -1077,6 +1089,9 @@
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));
50 #endif
51 @@ -1675,3 +1690,17 @@
53 return 1;
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;
61 + for (;;) {
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;
66 + }
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
72 @@ -32,7 +32,8 @@
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__;