Update to 3.0 final release.

This commit is contained in:
Alex Dupre 2004-10-15 22:18:15 +00:00
parent acc91154aa
commit aa37cc6e66
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=119535
7 changed files with 91 additions and 91 deletions

View file

@ -6,12 +6,10 @@
# #
PORTNAME= pserv PORTNAME= pserv
PORTVERSION= 3.0.b3 PORTVERSION= 3.0
PORTREVISION= 1
CATEGORIES= www CATEGORIES= www
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME} MASTER_SITE_SUBDIR= ${PORTNAME}
DISTNAME= ${PORTNAME}-08-Jan-04
EXTRACT_SUFX= .tar.Z EXTRACT_SUFX= .tar.Z
MAINTAINER= ale@FreeBSD.org MAINTAINER= ale@FreeBSD.org

View file

@ -1,2 +1,2 @@
MD5 (pserv-08-Jan-04.tar.Z) = 716795e74babdf70daeb7b93dbb7f47b MD5 (pserv-3.0.tar.Z) = 2c38f859631ab09f3cd4ff15b4de457e
SIZE (pserv-08-Jan-04.tar.Z) = 46734 SIZE (pserv-3.0.tar.Z) = 49961

View file

@ -1,10 +1,10 @@
--- sources/Makefile.orig Thu Oct 23 12:43:08 2003 --- sources/Makefile.orig Mon Aug 30 13:19:03 2004
+++ sources/Makefile Thu Jan 8 12:37:57 2004 +++ sources/Makefile Wed Sep 15 14:38:14 2004
@@ -1,11 +1,11 @@ @@ -1,11 +1,11 @@
#Change the following to your needs #Change the following to your needs
-CC = cc -CC = gcc
-#insert here flags, eg. optimizations -#insert here flags, eg. optimizations
-CFLAGS = -Wall -CFLAGS = -Wall -Os
+CC ?= gcc +CC ?= gcc
LIBS = LIBS =
SRCS = main.c handlers.c mime.c log.c SRCS = main.c handlers.c mime.c log.c

View file

@ -1,11 +1,11 @@
--- sources/handlers.c.orig Thu Oct 23 12:43:05 2003 --- sources/handlers.c.orig Fri May 21 16:58:26 2004
+++ sources/handlers.c Fri Apr 23 16:19:52 2004 +++ sources/handlers.c Wed Sep 15 14:47:49 2004
@@ -24,6 +24,7 @@ @@ -24,6 +24,7 @@
#endif #endif
extern char cgiRoot[MAX_PATH_LEN+1]; /* root for CGI scripts exec */ extern char cgiRoot[MAX_PATH_LEN+1]; /* root for CGI scripts exec */
+extern char homePath[MAX_PATH_LEN+1]; /* root for PHP scripts exec */ +extern char homePath[MAX_PATH_LEN+1]; /* root for PHP scripts exec */
extern int port; /* server port */ extern int port; /* server port */
extern char defaultFileName[MAX_PATH_LEN+1]; /* default name for index, default or similar file */ extern char defaultFileName[MAX_PATH_LEN+1]; /* default name for index, default or similar file */
@@ -263,6 +264,14 @@ @@ -263,6 +264,14 @@
@ -35,12 +35,10 @@
newEnvp[i] = NULL; newEnvp[i] = NULL;
/* we change the current working directory to the scripts one */ /* we change the current working directory to the scripts one */
@@ -317,7 +331,251 @@ @@ -317,8 +331,252 @@
return 0; return 0;
} }
-int dumpHeader(sock, filePath, mimeType, req)
+
+#ifdef PHP +#ifdef PHP
+int phpHandler(port, sock, phpFileName, completedPath, req, postStr) +int phpHandler(port, sock, phpFileName, completedPath, req, postStr)
+int port; +int port;
@ -116,7 +114,7 @@
+ howMany = 1; + howMany = 1;
+ while (howMany > 0 && !fatal) + while (howMany > 0 && !fatal)
+ { + {
+ howMany = read(outStdPipe[READ], &pipeReadBuf, PIPE_READ_BUF); + howMany = read(outStdPipe[READ], pipeReadBuf, PIPE_READ_BUF);
+ if (howMany < 0) + if (howMany < 0)
+ printf("Error during script pipe read.\n"); + printf("Error during script pipe read.\n");
+ else if (!howMany) + else if (!howMany)
@ -154,13 +152,13 @@
+ } else + } else
+ { /* this is the child process */ + { /* this is the child process */
+ /* now we do some environment setup work */ + /* now we do some environment setup work */
+ newArgv = calloc(MAX_ARGV_LEN + 1, sizeof(char*)); + newArgv = (char **)calloc(MAX_ARGV_LEN + 1, sizeof(char*));
+ for (i = 0; i < MAX_ARGV_LEN + 1; i++) + for (i = 0; i < MAX_ARGV_LEN + 1; i++)
+ { + {
+ newArgv[i] = calloc(MAX_PATH_LEN, sizeof(char)); + newArgv[i] = (char *)calloc(MAX_PATH_LEN, sizeof(char));
+ } + }
+ +
+ newEnvp = calloc(MAX_ENVP_LEN + 1, sizeof(char*)); + newEnvp = (char **)calloc(MAX_ENVP_LEN + 1, sizeof(char*));
+ for (i = 0; i < MAX_ENVP_LEN + 1; i++) + for (i = 0; i < MAX_ENVP_LEN + 1; i++)
+ { + {
+ newEnvp[i] = calloc(MAX_PATH_LEN, sizeof(char)); + newEnvp[i] = calloc(MAX_PATH_LEN, sizeof(char));
@ -283,6 +281,9 @@
+} +}
+#endif +#endif
+ +
+
/* generate a full header for a given file */
-int dumpHeader(sock, filePath, mimeType, req)
+int dumpHeader(port, sock, filePath, mimeType, req) +int dumpHeader(port, sock, filePath, mimeType, req)
+int port; +int port;
int sock; int sock;

View file

@ -1,14 +1,14 @@
--- sources/main.c.orig Sat Dec 20 11:16:21 2003 --- sources/main.c.orig Mon Aug 30 13:19:03 2004
+++ sources/main.c Wed May 5 11:28:52 2004 +++ sources/main.c Wed Sep 15 15:03:04 2004
@@ -23,6 +23,7 @@ @@ -23,6 +23,7 @@
char defaultFileName[MAX_PATH_LEN+1]; char defaultFileName[MAX_PATH_LEN+1];
char logFileName[MAX_PATH_LEN+1]; char logFileName[MAX_PATH_LEN+1];
char mimeTypesFileName[MAX_PATH_LEN+1]; char mimeTypesFileName[MAX_PATH_LEN+1];
+char phpFileName[MAX_PATH_LEN+1]; +char phpFileName[MAX_PATH_LEN+1];
char cgiRoot[MAX_PATH_LEN+1]; /* root for CGI scripts exec */ char cgiRoot[MAX_PATH_LEN+1]; /* root for CGI scripts exec */
struct timeval sockTimeVal; struct timeval sockTimeVal;
mimeData *mimeArray; /* here we will hold all MIME data, inited once, never to be changed */ mimeData *mimeArray; /* here we will hold all MIME data, inited once, never to be changed */
@@ -316,10 +317,13 @@ @@ -322,10 +323,13 @@
reqStruct->keepAlive = YES; reqStruct->keepAlive = YES;
else if (!strncmp(reqArray[1], "Connection: Keep-Alive", strlen("Connection: keep-alive"))) else if (!strncmp(reqArray[1], "Connection: Keep-Alive", strlen("Connection: keep-alive")))
reqStruct->keepAlive = YES; reqStruct->keepAlive = YES;
@ -23,7 +23,7 @@
while (i < readLines) while (i < readLines)
{ {
if (!strncmp(reqArray[i], "User-Agent:", strlen("User-Agent:"))) if (!strncmp(reqArray[i], "User-Agent:", strlen("User-Agent:")))
@@ -334,6 +338,20 @@ @@ -340,6 +344,20 @@
#ifdef PRINTF_DEBUG #ifdef PRINTF_DEBUG
printf("content length %ld\n", reqStruct->contentLength); printf("content length %ld\n", reqStruct->contentLength);
#endif #endif
@ -44,7 +44,7 @@
} }
i++; i++;
} }
@@ -431,18 +449,39 @@ @@ -437,18 +455,39 @@
/* we append the default file name */ /* we append the default file name */
strcat(completeFilePath, defaultFileName); strcat(completeFilePath, defaultFileName);
analyzeExtension(mimeType, completeFilePath); analyzeExtension(mimeType, completeFilePath);
@ -87,7 +87,7 @@
} }
} }
} else if (!strcmp(req.method, "HEAD")) } else if (!strcmp(req.method, "HEAD"))
@@ -511,7 +550,14 @@ @@ -517,7 +556,14 @@
strcat(completeFilePath, defaultFileName); strcat(completeFilePath, defaultFileName);
} }
analyzeExtension(mimeType, completeFilePath); analyzeExtension(mimeType, completeFilePath);
@ -103,7 +103,7 @@
} }
} else if (!strcmp(req.method, "POST")) } else if (!strcmp(req.method, "POST"))
{ {
@@ -525,13 +571,6 @@ @@ -531,13 +577,6 @@
int readFinished; int readFinished;
printf("Handling of POST method\n"); printf("Handling of POST method\n");
@ -117,7 +117,7 @@
#ifdef PRINTF_DEBUG #ifdef PRINTF_DEBUG
printf ("begin of post handling\n"); printf ("begin of post handling\n");
@@ -547,7 +586,7 @@ @@ -553,7 +592,7 @@
return -1; return -1;
} else if (req.contentLength >= BUFFER_SIZE) } else if (req.contentLength >= BUFFER_SIZE)
{ {
@ -126,7 +126,7 @@
return -1; return -1;
} }
while (!readFinished) while (!readFinished)
@@ -625,7 +664,77 @@ @@ -631,7 +670,77 @@
#ifdef PRINTF_DEBUG #ifdef PRINTF_DEBUG
printf("buff: |%s|\n", buff); printf("buff: |%s|\n", buff);
#endif #endif
@ -205,7 +205,7 @@
} }
} else } else
{ {
@@ -654,7 +763,7 @@ @@ -660,7 +769,7 @@
f = fopen(configFile, "r"); f = fopen(configFile, "r");
if (f == NULL) if (f == NULL)
{ {
@ -214,7 +214,7 @@
*serverPort = DEFAULT_PORT; *serverPort = DEFAULT_PORT;
*maxChildren = DEFAULT_MAX_CHILDREN; *maxChildren = DEFAULT_MAX_CHILDREN;
strcpy(homePath, DEFAULT_DOCS_LOCATION); strcpy(homePath, DEFAULT_DOCS_LOCATION);
@@ -663,7 +772,9 @@ @@ -669,7 +778,9 @@
sockTimeVal.tv_usec = DEFAULT_USEC_TO; sockTimeVal.tv_usec = DEFAULT_USEC_TO;
strcpy(logFileName, DEFAULT_LOG_FILE); strcpy(logFileName, DEFAULT_LOG_FILE);
strcpy(mimeTypesFileName, DEFAULT_MIME_FILE); strcpy(mimeTypesFileName, DEFAULT_MIME_FILE);
@ -224,7 +224,7 @@
return -1; return -1;
} }
if (!feof(f)) fscanf(f, "%s %s", str1, str2); if (!feof(f)) fscanf(f, "%s %s", str1, str2);
@@ -764,11 +875,25 @@ @@ -770,11 +881,25 @@
if (mimeTypesFileName == NULL) if (mimeTypesFileName == NULL)
{ {
strcpy(mimeTypesFileName, DEFAULT_MIME_FILE); strcpy(mimeTypesFileName, DEFAULT_MIME_FILE);
@ -252,7 +252,7 @@
} }
if (!feof(f)) fscanf(f, "%s %s", str1, str2); if (!feof(f)) fscanf(f, "%s %s", str1, str2);
if (str1 != NULL && str2 != NULL && !strcmp(str1, "cgiRoot")) if (str1 != NULL && str2 != NULL && !strcmp(str1, "cgiRoot"))
@@ -1002,7 +1127,7 @@ @@ -1008,7 +1133,7 @@
} */ } */
} else } else
{ {

View file

@ -1,59 +1,61 @@
--- sources/main.h.orig Sat Dec 20 11:16:21 2003 --- sources/main.h.orig Mon Aug 30 13:19:03 2004
+++ sources/main.h Wed May 5 12:06:07 2004 +++ sources/main.h Wed Sep 15 15:24:32 2004
@@ -27,12 +27,14 @@ @@ -18,14 +18,16 @@
/* --- CPP parsing options --- */ /* --- CPP parsing options --- */
-#define PRINTF_DEBUG /* enable this to print some debugging messages */ -#define PRINTF_DEBUG /* enable this to print some debugging messages */
+#undef PRINTF_DEBUG /* enable this to print some debugging messages */ +#undef PRINTF_DEBUG /* enable this to print some debugging messages */
#undef ON_THE_FLY_CONVERSION /* enable this for line ending conversion */ #undef ON_THE_FLY_CONVERSION /* enable this for line ending conversion */
+#define LOG /* enable logging to file */ +#define LOG /* enable logging to file */
#define BRAIN_DEAD_CAST /* if your compiler is brainwashed and does not cast standard types.h structures */ #define BRAIN_DEAD_CAST /* if your compiler is brainwashed and does not cast standard types.h structures */
#define FORKING_SERVER /* enables to fork for every request */ #define FORKING_SERVER /* enables to fork for every request */
#define AUTO_INDEX /* enables auto-index of directories */ #define AUTO_INDEX /* enables auto-index of directories */
#define SOCKADDR_REUSE /* enables reuse oth the socket (quick relaunch) */ #define SOCKADDR_REUSE /* enables reuse oth the socket (quick relaunch) */
+#define PHP /* enables transparent PHP support */ #define VOID_SIG_HANDLERS /* enables different signal functíon types */
#define ADDR_LEN_TYPE_INT /* in accept() if addrlen is int */
+#define PHP /* enables transparent PHP support */
/* --- Configure options --- */ /* --- Configure options --- */
@@ -44,18 +46,19 @@ @@ -37,18 +39,19 @@
#define MIME_TYPE_DEFAULT "application/octet-stream" #define MIME_TYPE_DEFAULT "application/octet-stream"
/* configuration file location */ /* configuration file location */
-#define DEFAULT_CONFIG_LOCATION "/home/multix/pserv/defaults/" -#define DEFAULT_CONFIG_LOCATION "/usr/people/multix/pserv/defaults/"
+#define DEFAULT_CONFIG_LOCATION "/usr/local/etc/" +#define DEFAULT_CONFIG_LOCATION "/usr/local/etc/"
/* hard-wired defaults, if loading of config file fails */ /* hard-wired defaults, if loading of config file fails */
-#define DEFAULT_PORT 2000 -#define DEFAULT_PORT 2000
+#define DEFAULT_PORT 80 +#define DEFAULT_PORT 80
#define DEFAULT_MAX_CHILDREN 5 #define DEFAULT_MAX_CHILDREN 5
-#define DEFAULT_DOCS_LOCATION "/home/multix/public_html" -#define DEFAULT_DOCS_LOCATION "/home/multix/public_html"
+#define DEFAULT_DOCS_LOCATION "/usr/local/www/data" +#define DEFAULT_DOCS_LOCATION "/usr/local/www/data"
#define DEFAULT_FILE_NAME "index.html" #define DEFAULT_FILE_NAME "index.html"
#define DEFAULT_SEC_TO 1 #define DEFAULT_SEC_TO 1
#define DEFAULT_USEC_TO 100 #define DEFAULT_USEC_TO 100
-#define DEFAULT_LOG_FILE "/home/multix/pserv/pserv.log" -#define DEFAULT_LOG_FILE "/home/multix/pserv/pserv.log"
-#define DEFAULT_MIME_FILE "/home/multix/pserv/mime_types.dat" -#define DEFAULT_MIME_FILE "/home/multix/pserv/mime_types.dat"
-#define DEFAULT_CGI_ROOT "/home/multix/public_html/cgi-bin" -#define DEFAULT_CGI_ROOT "/home/multix/public_html/cgi-bin"
+#define DEFAULT_LOG_FILE "/var/log/pserv.log" +#define DEFAULT_LOG_FILE "/var/log/pserv.log"
+#define DEFAULT_MIME_FILE "/usr/local/etc/mime.types" +#define DEFAULT_MIME_FILE "/usr/local/etc/mime.types"
+#define DEFAULT_PHP_FILE "/usr/local/bin/php" +#define DEFAULT_PHP_FILE "/usr/local/bin/php"
+#define DEFAULT_CGI_ROOT "/usr/local/www/cgi-bin" +#define DEFAULT_CGI_ROOT "/usr/local/www/cgi-bin"
#define DEFAULT_SERVER_NAME "localhost" #define DEFAULT_SERVER_NAME "localhost"
/* amount of connections queued in listening */ /* amount of connections queued in listening */
@@ -127,8 +130,10 @@ @@ -122,8 +125,10 @@
#define ADDRESS_LEN 16 #define ADDRESS_LEN 16
#define METHOD_LEN 16 #define METHOD_LEN 16
#define PROTOCOL_LEN 16 #define PROTOCOL_LEN 16
+#define CONTENT_TYPE_LEN 256 +#define CONTENT_TYPE_LEN 256
#define USER_AGENT_LEN 256 #define USER_AGENT_LEN 256
#define MAX_QUERY_STRING_LEN 1024 #define MAX_QUERY_STRING_LEN 1024
+#define MAX_COOKIE_LEN 4096 +#define MAX_COOKIE_LEN 4096
/* the maximum path name of your system should be available in MAXNAMLEN /* ------ Structures ------- */
defined in dirent.h. If not, set a reasonable value like 1024 */ /* we use +1 to be safe with handling the end-of-string */
@@ -143,7 +148,9 @@ @@ -141,7 +146,9 @@
char protocolVersion[PROTOCOL_LEN+1]; char protocolVersion[PROTOCOL_LEN+1];
int keepAlive; int keepAlive;
char userAgent[USER_AGENT_LEN+1]; char userAgent[USER_AGENT_LEN+1];

View file

@ -1,18 +1,17 @@
--- defaults/pserv.conf.orig Sat Dec 20 01:22:10 2003 --- defaults/pserv.conf.orig Tue Apr 13 18:19:55 2004
+++ defaults/pserv.conf Thu Jan 8 12:33:51 2004 +++ defaults/pserv.conf Wed Sep 15 15:26:34 2004
@@ -1,9 +1,10 @@ @@ -1,9 +1,10 @@
-port 8080 port 80
+port 80
maxChildren 4 maxChildren 4
-documentsPath /home/multix/public_html -documentsPath /usr/people/multix/public_html
+documentsPath %%PREFIX%%/www/data +documentsPath %%PREFIX%%/www/data
defaultFile index.html defaultFile index.html
secTimeout 1 secTimeout 1
uSecTimeout 100000 uSecTimeout 100000
-logFile /home/multix/pserv/pserv.log -logFile /usr/people/multix/pserv/pserv.log
-mimeTypesFile /home/multix/pserv/defaults/mime_types.dat -mimeTypesFile /usr/people/multix/pserv/defaults/mime_types.dat
-cgiRoot /home/multix/public_html/cgi-bin -cgiRoot /usr/people/multix/public_html/cgi-bin
+logFile /var/log/pserv.log +logFile /var/log/pserv.log
+mimeTypesFile %%PREFIX%%/etc/mime.types +mimeTypesFile %%PREFIX%%/etc/mime.types
+phpFile %%LOCALBASE%%/bin/php +phpFile %%LOCALBASE%%/bin/php
+cgiRoot %%PREFIX%%/www/cgi-bin +cgiRoot %%PREFIX%%/www/cgi-bin