2001-04-22 14:00:53 +00:00
|
|
|
diff -ur thttpd-2.21/Makefile.in thttpd-2.21-p/Makefile.in
|
|
|
|
--- thttpd-2.21/Makefile.in Thu Mar 29 20:36:21 2001
|
|
|
|
+++ thttpd-2.21-p/Makefile.in Sun Apr 22 15:59:42 2001
|
1999-12-20 07:11:14 +00:00
|
|
|
@@ -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@
|
|
|
|
|
2000-08-07 13:54:35 +00:00
|
|
|
@@ -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` ; \
|
2001-04-22 14:00:53 +00:00
|
|
|
diff -ur thttpd-2.21/libhttpd.c thttpd-2.21-p/libhttpd.c
|
|
|
|
--- thttpd-2.21/libhttpd.c Sat Apr 21 02:11:32 2001
|
|
|
|
+++ thttpd-2.21-p/libhttpd.c Sun Apr 22 16:01:41 2001
|
|
|
|
@@ -85,6 +85,8 @@
|
1999-12-20 07:11:14 +00:00
|
|
|
#include "match.h"
|
|
|
|
#include "tdate_parse.h"
|
|
|
|
|
|
|
|
+#include "php_thttpd.h"
|
|
|
|
+
|
|
|
|
#ifndef STDIN_FILENO
|
|
|
|
#define STDIN_FILENO 0
|
|
|
|
#endif
|
2001-04-22 14:00:53 +00:00
|
|
|
@@ -243,6 +245,8 @@
|
1999-12-20 07:11:14 +00:00
|
|
|
free( (void*) hs->cwd );
|
|
|
|
if ( hs->cgi_pattern != (char*) 0 )
|
|
|
|
free( (void*) hs->cgi_pattern );
|
|
|
|
+ if ( hs->php_pattern != (char*) 0 )
|
2000-08-07 13:54:35 +00:00
|
|
|
+ free( (void*) hs->php_pattern );
|
|
|
|
if ( hs->charset != (char*) 0 )
|
|
|
|
free( (void*) hs->charset );
|
|
|
|
if ( hs->url_pattern != (char*) 0 )
|
2001-04-22 14:00:53 +00:00
|
|
|
@@ -250,6 +254,7 @@
|
2000-08-07 13:54:35 +00:00
|
|
|
if ( hs->local_pattern != (char*) 0 )
|
|
|
|
free( (void*) hs->local_pattern );
|
1999-12-20 07:11:14 +00:00
|
|
|
free( (void*) hs );
|
|
|
|
+ thttpd_php_shutdown();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-04-22 14:00:53 +00:00
|
|
|
@@ -313,6 +318,7 @@
|
2000-08-07 13:54:35 +00:00
|
|
|
}
|
|
|
|
|
1999-12-20 07:11:14 +00:00
|
|
|
hs->port = port;
|
2000-08-20 09:37:15 +00:00
|
|
|
+ hs->php_pattern = strdup("**.php");
|
1999-12-20 07:11:14 +00:00
|
|
|
if ( cgi_pattern == (char*) 0 )
|
|
|
|
hs->cgi_pattern = (char*) 0;
|
|
|
|
else
|
2001-04-22 14:00:53 +00:00
|
|
|
@@ -386,6 +392,8 @@
|
2000-08-21 03:04:35 +00:00
|
|
|
return (httpd_server*) 0;
|
|
|
|
}
|
1999-12-20 07:11:14 +00:00
|
|
|
|
|
|
|
+ thttpd_php_init();
|
|
|
|
+
|
2000-08-21 03:04:35 +00:00
|
|
|
/* Done initializing. */
|
|
|
|
if ( hs->binding_hostname == (char*) 0 )
|
2001-04-22 14:00:53 +00:00
|
|
|
syslog( LOG_INFO, "%.80s starting on port %d", SERVER_SOFTWARE, hs->port );
|
|
|
|
@@ -2336,7 +2344,10 @@
|
2000-11-13 13:33:12 +00:00
|
|
|
{
|
2001-04-22 14:00:53 +00:00
|
|
|
make_log_entry( hc, nowP );
|
|
|
|
|
2000-11-13 13:33:12 +00:00
|
|
|
- if ( hc->file_address != (char*) 0 )
|
2001-04-22 14:00:53 +00:00
|
|
|
+ if ( hc->file_address == (char*) 1 )
|
|
|
|
+ {
|
|
|
|
+ thttpd_closed_conn(hc->conn_fd);
|
|
|
|
+ } else if ( hc->file_address != (char*) 0 )
|
2000-11-13 13:33:12 +00:00
|
|
|
{
|
2001-04-22 14:00:53 +00:00
|
|
|
mmc_unmap( hc->file_address, &(hc->sb), nowP );
|
2000-11-13 13:33:12 +00:00
|
|
|
hc->file_address = (char*) 0;
|
2001-04-22 14:00:53 +00:00
|
|
|
@@ -3543,6 +3554,11 @@
|
1999-12-20 07:11:14 +00:00
|
|
|
( 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
|
2001-04-22 14:00:53 +00:00
|
|
|
diff -ur thttpd-2.21/libhttpd.h thttpd-2.21-p/libhttpd.h
|
|
|
|
--- thttpd-2.21/libhttpd.h Fri Apr 13 07:37:17 2001
|
|
|
|
+++ thttpd-2.21-p/libhttpd.h Sun Apr 22 15:59:42 2001
|
2000-08-07 13:54:35 +00:00
|
|
|
@@ -69,6 +69,7 @@
|
|
|
|
char* server_hostname;
|
1999-12-20 07:11:14 +00:00
|
|
|
int port;
|
|
|
|
char* cgi_pattern;
|
|
|
|
+ char* php_pattern;
|
2000-08-07 13:54:35 +00:00
|
|
|
char* charset;
|
1999-12-20 07:11:14 +00:00
|
|
|
char* cwd;
|
2000-08-07 13:54:35 +00:00
|
|
|
int listen4_fd, listen6_fd;
|
2001-04-22 14:00:53 +00:00
|
|
|
diff -ur thttpd-2.21/thttpd.c thttpd-2.21-p/thttpd.c
|
|
|
|
--- thttpd-2.21/thttpd.c Sun Apr 15 18:09:20 2001
|
|
|
|
+++ thttpd-2.21-p/thttpd.c Sun Apr 22 15:59:42 2001
|
|
|
|
@@ -1392,6 +1392,12 @@
|
2000-11-13 13:33:12 +00:00
|
|
|
clear_connection( c, tvP );
|
|
|
|
return;
|
2001-04-22 14:00:53 +00:00
|
|
|
}
|
2000-11-13 13:33:12 +00:00
|
|
|
+ if (hc->file_address == (char *) 1) {
|
|
|
|
+ tmr_cancel( c->idle_read_timer );
|
2000-11-15 23:37:50 +00:00
|
|
|
+ c->idle_read_timer = (Timer*) 0;
|
|
|
|
+ c->wouldblock_delay = 0;
|
2000-11-13 13:33:12 +00:00
|
|
|
+ return;
|
2001-04-22 14:00:53 +00:00
|
|
|
+ }
|
2000-11-13 13:33:12 +00:00
|
|
|
if ( c->bytes_sent >= c->bytes_to_send )
|
|
|
|
{
|
2001-04-22 14:00:53 +00:00
|
|
|
/* There's nothing to send. */
|