php-src/sapi/thttpd/thttpd_patch
Sascha Schumann 251b83076e Move thttpd_php_init() call to httpd_initialize().
Otherwise, some init stuff was done twice (like resetting the
known_post_content_types hash table which caused post requests
to fail).
2000-08-21 03:04:35 +00:00

110 lines
2.9 KiB
Plaintext

diff -ur thttpd-2.19-t/Makefile.in thttpd-2.19/Makefile.in
--- thttpd-2.19-t/Makefile.in Tue Jul 4 18:21:32 2000
+++ thttpd-2.19/Makefile.in Mon Aug 21 04:58:29 2000
@@ -46,13 +46,15 @@
# You shouldn't need to edit anything below here.
+include php_makefile
+
CC = @CC@
CCOPT = @V_CCOPT@
DEFS = @DEFS@
INCLS = -I.
CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
+LDFLAGS = @LDFLAGS@ $(PHP_LDFLAGS)
+LIBS = @LIBS@ $(PHP_LIBS)
NETLIBS = @V_NETLIBS@
INSTALL = @INSTALL@
@@ -62,7 +64,7 @@
@rm -f $@
$(CC) $(CFLAGS) -c $*.c
-SRC = thttpd.c libhttpd.c fdwatch.c mmc.c timers.c match.c tdate_parse.c syslog.c
+SRC = thttpd.c libhttpd.c fdwatch.c mmc.c timers.c match.c tdate_parse.c syslog.c php_thttpd.c
OBJ = $(SRC:.c=.o) @LIBOBJS@
@@ -151,6 +153,9 @@
tags:
ctags -wtd *.c *.h
+
+php_thttpd.o: php_thttpd.c
+ $(CC) $(PHP_CFLAGS) $(CFLAGS) -c php_thttpd.c
tar:
@name=`sed -n -e '/SERVER_SOFTWARE/!d' -e 's,.*thttpd/,thttpd-,' -e 's, .*,,p' version.h` ; \
diff -ur thttpd-2.19-t/libhttpd.c thttpd-2.19/libhttpd.c
--- thttpd-2.19-t/libhttpd.c Fri Jun 23 05:43:40 2000
+++ thttpd-2.19/libhttpd.c Mon Aug 21 04:59:13 2000
@@ -75,6 +75,8 @@
#include "match.h"
#include "tdate_parse.h"
+#include "php_thttpd.h"
+
#ifndef STDIN_FILENO
#define STDIN_FILENO 0
#endif
@@ -224,6 +226,8 @@
free( (void*) hs->cwd );
if ( hs->cgi_pattern != (char*) 0 )
free( (void*) hs->cgi_pattern );
+ if ( hs->php_pattern != (char*) 0 )
+ free( (void*) hs->php_pattern );
if ( hs->charset != (char*) 0 )
free( (void*) hs->charset );
if ( hs->url_pattern != (char*) 0 )
@@ -231,6 +235,7 @@
if ( hs->local_pattern != (char*) 0 )
free( (void*) hs->local_pattern );
free( (void*) hs );
+ thttpd_php_shutdown();
}
@@ -291,6 +296,7 @@
}
hs->port = port;
+ hs->php_pattern = strdup("**.php");
if ( cgi_pattern == (char*) 0 )
hs->cgi_pattern = (char*) 0;
else
@@ -362,6 +368,8 @@
return (httpd_server*) 0;
}
+ thttpd_php_init();
+
/* Done initializing. */
if ( hs->binding_hostname == (char*) 0 )
syslog( LOG_INFO, "%s starting on port %d", SERVER_SOFTWARE, hs->port );
@@ -3302,6 +3310,11 @@
( hc->sb.st_mode & S_IXOTH ) &&
match( hc->hs->cgi_pattern, hc->expnfilename ) )
return cgi( hc );
+
+ if ( hc->hs->php_pattern != (char*) 0 &&
+ match( hc->hs->php_pattern, hc->expnfilename)) {
+ return thttpd_php_request( hc );
+ }
/* It's not CGI. If it's executable or there's pathinfo, someone's
** trying to either serve or run a non-CGI file as CGI. Either case
diff -ur thttpd-2.19-t/libhttpd.h thttpd-2.19/libhttpd.h
--- thttpd-2.19-t/libhttpd.h Tue Jun 13 20:48:56 2000
+++ thttpd-2.19/libhttpd.h Mon Aug 21 04:58:29 2000
@@ -69,6 +69,7 @@
char* server_hostname;
int port;
char* cgi_pattern;
+ char* php_pattern;
char* charset;
char* cwd;
int listen4_fd, listen6_fd;