git: f36ae916a6be - main - www/pserv: Remove expired port

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Sat, 30 Sep 2023 02:23:40 UTC
The branch main has been updated by bofh:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f36ae916a6be94f0c356eb554527c23d1f46ad57

commit f36ae916a6be94f0c356eb554527c23d1f46ad57
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2023-09-29 23:25:39 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-09-30 02:22:45 +0000

    www/pserv: Remove expired port
    
    2023-09-30 www/pserv: Abandonware, last release in 2005. Consider migrating to www/apache24 , www/lighttpd or www/nginx
---
 MOVED                                |   1 +
 www/Makefile                         |   1 -
 www/pserv/Makefile                   |  46 ------
 www/pserv/distinfo                   |   2 -
 www/pserv/files/patch-handlers.c     | 279 -----------------------------------
 www/pserv/files/patch-handlers.h     |  10 --
 www/pserv/files/patch-log.c          |  45 ------
 www/pserv/files/patch-main.c         | 223 ----------------------------
 www/pserv/files/patch-main.h         |  58 --------
 www/pserv/files/patch-mime.c         |  34 -----
 www/pserv/files/patch-mime_types.dat |   7 -
 www/pserv/files/patch-pserv.conf     |  18 ---
 www/pserv/files/pserv.sh             |  25 ----
 www/pserv/pkg-descr                  |   6 -
 www/pserv/pkg-plist                  |   4 -
 15 files changed, 1 insertion(+), 758 deletions(-)

diff --git a/MOVED b/MOVED
index 4f56d666d17a..a63c5ad001df 100644
--- a/MOVED
+++ b/MOVED
@@ -7862,3 +7862,4 @@ sysutils/sysrc||2023-09-27|Has expired: Migrated into src
 deskutils/budgie-trash-applet||2023-09-29|Has expired: Merged into newer x11/budgie-desktop >= 10.8
 x11-fonts/sourcecodepro-ttf|x11-fonts/source-code-pro-ttf|2023-09-30|Move x11-fonts/sourcecodepro-ttf to x11-fonts/source-code-pro-ttf
 x11-fonts/sourceserifpro-ttf|x11-fonts/source-serif-ttf|2023-09-30|Move x11-fonts/sourceserifpro-ttf to x11-fonts/source-serif-ttf
+www/pserv||2023-09-30|Has expired: Abandonware, last release in 2005. Consider migrating to www/apache24 , www/lighttpd or www/nginx
diff --git a/www/Makefile b/www/Makefile
index fce00506ceff..4e64538d0589 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -1442,7 +1442,6 @@
     SUBDIR += privoxy
     SUBDIR += protovis
     SUBDIR += proxygen
-    SUBDIR += pserv
     SUBDIR += publicfile
     SUBDIR += punbb
     SUBDIR += py-Pituophis
diff --git a/www/pserv/Makefile b/www/pserv/Makefile
deleted file mode 100644
index 3ccdd647847e..000000000000
--- a/www/pserv/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-PORTNAME=	pserv
-PORTVERSION=	3.4
-CATEGORIES=	www
-MASTER_SITES=	SF
-EXTRACT_SUFX=	.tar.Z
-
-MAINTAINER=	ale@FreeBSD.org
-COMMENT=	Portable and small web server written in C
-WWW=		https://sourceforge.net/projects/pserv/
-
-LICENSE=	GPLv2
-LICENSE_FILE=	${WRKSRC}/COPYING
-
-DEPRECATED=	Abandonware, last release in 2005. Consider migrating to www/apache24 , www/lighttpd or www/nginx
-EXPIRATION_DATE=2023-09-30
-
-GNU_CONFIGURE=	yes
-
-CONFLICTS=	popular
-
-OPTIONS_DEFINE=	LOG PHP
-OPTIONS_DEFAULT=	LOG PHP
-LOG_DESC=	Enable loggin
-
-PHP_USES=	php:cgi
-
-post-patch:
-	@${REINPLACE_CMD} "s|%%PREFIX%%|${PREFIX}|g;s|%%LOCALBASE%%|${LOCALBASE}|g" \
-		${WRKSRC}/defaults/pserv.conf ${WRKSRC}/sources/main.h
-
-post-patch-LOG-off:
-	@${REINPLACE_CMD} "s|define LOG|undef LOG|" \
-		${WRKSRC}/sources/main.h
-
-post-patch-PHP-off:
-	@${REINPLACE_CMD} "s|define PHP|undef PHP|" \
-		${WRKSRC}/sources/main.h
-
-do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/sources/pserv ${STAGEDIR}${PREFIX}/sbin/
-	${MKDIR} ${STAGEDIR}${PREFIX}/etc/pserv
-	${INSTALL_DATA} ${WRKSRC}/defaults/mime_types.dat ${STAGEDIR}${PREFIX}/etc/pserv/mime.types
-	${INSTALL_DATA} ${WRKSRC}/defaults/pserv.conf ${STAGEDIR}${PREFIX}/etc/pserv/pserv.conf.sample
-	${INSTALL_SCRIPT} ${FILESDIR}/pserv.sh ${STAGEDIR}${PREFIX}/etc/rc.d/
-
-.include <bsd.port.mk>
diff --git a/www/pserv/distinfo b/www/pserv/distinfo
deleted file mode 100644
index c816d8a2a7d6..000000000000
--- a/www/pserv/distinfo
+++ /dev/null
@@ -1,2 +0,0 @@
-SHA256 (pserv-3.4.tar.Z) = 6a37e3056504db4e5623ce59fda95a759f7692f67dcb174ceb32d340b3441977
-SIZE (pserv-3.4.tar.Z) = 178760
diff --git a/www/pserv/files/patch-handlers.c b/www/pserv/files/patch-handlers.c
deleted file mode 100644
index ec95ce6bdfc4..000000000000
--- a/www/pserv/files/patch-handlers.c
+++ /dev/null
@@ -1,279 +0,0 @@
---- sources/handlers.c.orig	2005-06-01 12:36:18.000000000 +0200
-+++ sources/handlers.c	2008-09-03 14:25:41.000000000 +0200
-@@ -25,6 +25,7 @@
- #endif
- 
- 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 int  port;                            /* server port */
- extern char defaultFileName[MAX_PATH_LEN+1]; /* default name for index, default or similar file */
- 
-@@ -261,6 +262,17 @@
-         
-         i = 0;
- 	/* beware of not overfilling this array, check MAX_ENVP_LEN */
-+        if (req.contentLength != -1)
-+        {
-+            newEnvp[i] = (char *) calloc(35, sizeof(char));
-+            sprintf(newEnvp[i++], "CONTENT_LENGTH=%ld", req.contentLength);
-+            newEnvp[i] = (char *) calloc(CONTENT_TYPE_LEN + 14, sizeof(char));
-+            strcpy(newEnvp[i], "CONTENT_TYPE=");
-+            strcat(newEnvp[i++], req.contentType);
-+        }
-+        newEnvp[i] = (char *) calloc(strlen(DEFAULT_SERVER_NAME) + 13, sizeof(char));
-+        strcpy(newEnvp[i], "SERVER_NAME=");
-+        strcat(newEnvp[i++], DEFAULT_SERVER_NAME);
-         newEnvp[i] = (char *) calloc(128, sizeof(char));
-         strcpy(newEnvp[i], "SERVER_SOFTWARE=");
-         strcat(newEnvp[i], SERVER_SOFTWARE_STR);
-@@ -293,6 +305,12 @@
- 	completedPath[MAX_PATH_LEN]='\0';
- 	strcpy(newEnvp[i], "SCRIPT_FILENAME=");
- 	strcat(newEnvp[i++], completedPath);
-+        if (req.cookie[0] != '\0') 	 
-+        { 	 
-+            newEnvp[i] = (char *) calloc(MAX_COOKIE_LEN+13, sizeof(char));
-+            strcpy(newEnvp[i], "HTTP_COOKIE="); 	 
-+            strcat(newEnvp[i++], req.cookie); 	 
-+        }
- 
-         /* extracting PATH env variable */
-         envPath = getenv("PATH");
-@@ -333,8 +351,236 @@
- }
- #endif /* ENABLE_CGI */
- 
-+#ifdef PHP
-+int phpHandler(port, sock, phpFileName, completedPath, req, postStr)
-+int port;
-+int sock;
-+char *phpFileName;
-+char *completedPath;
-+struct request req;
-+char *postStr;
-+{
-+    char *envPath; /* pointer to the envrionment PATH variable */
-+    char *relativePath;
-+    char scriptWorkingDir[2*MAX_PATH_LEN+1];
-+    char **newArgv;
-+    char **newEnvp;
-+    int i;
-+    int outStdPipe[2]; /* we will redirect the script output to a pipe so we can read it */
-+    int inStdPipe[2];  /* we will redirect the script input to a pipe so we can read it */
-+    int pid;           /* we fork and execute inside the child the script */
-+    char pipeReadBuf[PIPE_READ_BUF+1];
-+    int howMany;
-+    int totalSentFromPipe; /* ampunt of bytes sucked from the pipe and pushed in to the socket */
-+    int fatal;
-+
-+    relativePath = strrchr(completedPath, '/');
-+    strncpy(scriptWorkingDir, completedPath, strlen(completedPath) - strlen(relativePath));
-+    scriptWorkingDir[strlen(completedPath) - strlen(relativePath)] = '\0';
-+
-+    /* first we create the pipes needed for stdout redirection */
-+    if (pipe(outStdPipe))
-+    {
-+        DBGPRINTF(("Pipe creation error\n"));
-+        return -1;
-+    }
-+    if (pipe(inStdPipe))
-+    {
-+        DBGPRINTF(("Pipe creation error\n"));
-+        return -1;
-+    }
-+
-+
-+    /* now we fork to subsequently execve */
-+    pid = fork();
-+    if (pid)
-+    { /* this is the parent process */
-+        if (pid < 0)
-+        { /* we check for creation error */
-+            DBGPRINTF(("Forking error during cgi exec: %d\n", errno));
-+            return -1;
-+        }
-+        /* we close the unused end of the pipe */
-+        close(outStdPipe[WRITE]);
-+        close(inStdPipe[READ]);
-+
-+        if (req.method[0]=='P' && req.method[1]=='O' && req.method[2]=='S' && req.method[3]=='T' && req.method[4]=='\0')
-+        {
-+            /* we have to feed the stdin of the script */
-+            if(!strlen(postStr))
-+            {
-+                DBGPRINTF(("cannot post empty data\n"));
-+                return -1;
-+            }
-+            howMany = write(inStdPipe[WRITE], postStr, strlen(postStr));
-+            if (howMany < 0)
-+                DBGPRINTF(("Error during script pipe read (POST).\n"));
-+        }
-+        totalSentFromPipe = 0;
-+        fatal = NO;
-+        howMany = 1;
-+        while (howMany > 0 && !fatal)
-+        {
-+            howMany = read(outStdPipe[READ], pipeReadBuf, PIPE_READ_BUF);
-+            if (howMany > 0)
-+            {
-+                if (sendChunk(sock, pipeReadBuf, howMany) < 0)
-+                    fatal = YES;
-+                else
-+                    totalSentFromPipe += howMany;
-+            } else
-+                fatal = YES; /* it may be EOF too */
-+        }
-+        /* now we finished and we clean up */
-+        wait(&i);
-+        if (i) /* check if execution exited cleanly or with code */
-+            logWriter(LOG_CGI_FAILURE, NULL, 0, req, i);
-+        else
-+            logWriter(LOG_CGI_SUCCESS, NULL, totalSentFromPipe, req, 0);
-+        close(outStdPipe[READ]);
-+        close(inStdPipe[WRITE]);
-+    } else
-+    { /* this is the child process */
-+        /* now we do some environment setup work */
-+        newArgv = (char **)calloc(MAX_ARGV_LEN + 1, sizeof(char*));
-+        for (i = 0; i < MAX_ARGV_LEN + 1; i++)
-+        {
-+            newArgv[i] = (char *)calloc(MAX_PATH_LEN, sizeof(char));
-+        }
-+
-+        newEnvp = (char **)calloc(MAX_ENVP_LEN + 1, sizeof(char*));
-+
-+        i = 0;
-+        strcpy(newArgv[i++], phpFileName);     /* here we should pass the phppath */
-+        strcpy(newArgv[i++], completedPath);  /* here we should pass the scriptpath */
-+        if (strlen(req.queryString))
-+        {
-+            int toParse;
-+            int j, k;
-+
-+            toParse = YES;
-+            j = strlen(req.queryString);
-+            while (toParse && j > 0)
-+            {
-+                if (req.queryString[j] == '=')
-+                    toParse = NO;
-+                j--;
-+            }
-+            if (toParse)
-+            {
-+                j = 0;
-+                k = 0;
-+                howMany = strlen(req.queryString);
-+                while (j < howMany)
-+                {
-+                    if (req.queryString[j] == '+')
-+                    {
-+                        newArgv[i++][k] = '\0';
-+                        k = 0;
-+                    } else
-+                        newArgv[i][k++] = req.queryString[j];
-+                    j++;
-+                }
-+                i++; /* after all we will have at least one argument! */
-+            }
-+        }
-+        newArgv[i] = NULL; /* we correctly terminate argv */
-+
-+        i = 0;
-+        /* beware of not overfilling this array, check MAX_ENVP_LEN */
-+        if (req.contentLength != -1)
-+        {
-+            newEnvp[i] = (char *) calloc(35, sizeof(char));
-+            sprintf(newEnvp[i++], "CONTENT_LENGTH=%ld", req.contentLength);
-+            newEnvp[i] = (char *) calloc(CONTENT_TYPE_LEN + 14, sizeof(char));
-+            strcpy(newEnvp[i], "CONTENT_TYPE=");
-+            strcat(newEnvp[i++], req.contentType);
-+        }
-+        newEnvp[i] = (char *) calloc(strlen(DEFAULT_SERVER_NAME) + 13, sizeof(char));
-+        strcpy(newEnvp[i], "SERVER_NAME=");
-+        strcat(newEnvp[i++], DEFAULT_SERVER_NAME);
-+        newEnvp[i] = (char *) calloc(128, sizeof(char));
-+        strcpy(newEnvp[i], "SERVER_SOFTWARE=");
-+        strcat(newEnvp[i], SERVER_SOFTWARE_STR);
-+        strcat(newEnvp[i], "/");
-+        strcat(newEnvp[i++], SERVER_VERSION_STR);
-+        newEnvp[i] = (char *) calloc(METHOD_LEN+16, sizeof(char));
-+        strcpy(newEnvp[i], "REQUEST_METHOD=");
-+        strcat(newEnvp[i++], req.method);
-+        newEnvp[i] = (char *) calloc(MAX_PATH_LEN+16, sizeof(char));
-+        strcpy(newEnvp[i], "SCRIPT_NAME=");
-+        strcat(newEnvp[i++], req.documentAddress);
-+        newEnvp[i] = (char *) calloc(32, sizeof(char));
-+        strcpy(newEnvp[i], "GATEWAY_INTERFACE=");
-+        strcat(newEnvp[i++], CGI_VERSION);
-+        newEnvp[i] = (char *) calloc(18, sizeof(char));
-+        sprintf(newEnvp[i++], "SERVER_PORT=%d", port);
-+        newEnvp[i] = (char *) calloc(MAX_QUERY_STRING_LEN+16, sizeof(char));
-+        strcpy(newEnvp[i], "QUERY_STRING=");
-+        strcat(newEnvp[i++], req.queryString);
-+        newEnvp[i] = (char *) calloc(PROTOCOL_LEN+17, sizeof(char));
-+        strcpy(newEnvp[i], "SERVER_PROTOCOL=");
-+        strcat(newEnvp[i++], req.protocolVersion);
-+        newEnvp[i] = (char *) calloc(ADDRESS_LEN+13, sizeof(char));
-+        strcpy(newEnvp[i], "REMOTE_ADDR=");
-+        strcat(newEnvp[i++], req.address);
-+        newEnvp[i] = (char *) calloc(USER_AGENT_LEN+17, sizeof(char));
-+        strcpy(newEnvp[i], "HTTP_USER_AGENT=");
-+        strcat(newEnvp[i++], req.userAgent);
-+        newEnvp[i] = (char *) calloc(MAX_PATH_LEN+17, sizeof(char));
-+        completedPath[MAX_PATH_LEN]='\0';
-+        strcpy(newEnvp[i], "SCRIPT_FILENAME=");
-+        strcat(newEnvp[i++], completedPath);
-+        if (req.cookie[0] != '\0')
-+        {
-+            newEnvp[i] = (char *) calloc(MAX_COOKIE_LEN+13, sizeof(char));
-+            strcpy(newEnvp[i], "HTTP_COOKIE=");
-+            strcat(newEnvp[i++], req.cookie);
-+        }
-+
-+        /* extracting PATH env variable */
-+        envPath = getenv("PATH");
-+        /* we get the path from the env itself so we assume it safe */
-+        newEnvp[i] = (char *) calloc(MAX_PATH_LEN+16, sizeof(char));
-+        strcpy(newEnvp[i], "PATH=");
-+        strcat(newEnvp[i++], envPath);
-+
-+        /* terminate the array */
-+        newEnvp[i] = NULL;
-+
-+        /* we change the current working directory to the scripts one */
-+        if(chdir(scriptWorkingDir))
-+        {
-+            DBGPRINTF(("error while changing PWD in script execution: %d\n", errno));
-+        }
-+
-+        close(outStdPipe[READ]);    /* we close the unused end*/
-+        dup2(outStdPipe[WRITE], 1); /* we duplicate the pipe to the stdout */
-+        close(outStdPipe[WRITE]);   /* we close the pipe, since we use the duplicate */
-+
-+        close(inStdPipe[WRITE]);    /* we close the unused end*/
-+        dup2(inStdPipe[READ], 0);   /* we duplicate the pipe to the stdin */
-+        close(inStdPipe[READ]);     /* we close the pipe, since we use the duplicate */
-+
-+
-+        /* generate a reduced mimeHeader, no type, no size, etc */
-+        generateMimeHeader(sock, 200, "", NULL, req.protocolVersion, CGI_ONLY_HEADER);
-+
-+        /* now we execute the script replacing the current child */
-+        execve(phpFileName, newArgv, newEnvp);
-+        /* we reach this line only if an execution error occoured */
-+        /* logging will happen in the father */
-+        printf("\n<HTML><HEAD><TITLE>PHP Error</TITLE></HEAD><BODY><H1>PHP Exec error</H1></BODY></HTML>\n");
-+        exit(-1);
-+    }
-+    return 0;
-+}
-+#endif
-+
-+
- /* generate a full header for a given file */
--int dumpHeader(sock, filePath, mimeType, req)
-+int dumpHeader(port, sock, filePath, mimeType, req)
-+int port;
- int sock;
- char filePath[];
- char mimeType[];
diff --git a/www/pserv/files/patch-handlers.h b/www/pserv/files/patch-handlers.h
deleted file mode 100644
index 3efbeb92f563..000000000000
--- a/www/pserv/files/patch-handlers.h
+++ /dev/null
@@ -1,10 +0,0 @@
---- sources/handlers.h.orig	Wed Oct 15 17:06:59 2003
-+++ sources/handlers.h	Wed Oct 15 17:07:08 2003
-@@ -19,6 +19,7 @@
- 
- /* handlers.c */
- int cgiHandler();
-+int phpHandler();
- int dumpHeader();
- int dumpFile();
- int generateIndex();
diff --git a/www/pserv/files/patch-log.c b/www/pserv/files/patch-log.c
deleted file mode 100644
index 9f49b31c926a..000000000000
--- a/www/pserv/files/patch-log.c
+++ /dev/null
@@ -1,45 +0,0 @@
---- sources/log.c.orig	Mon May 16 23:03:16 2005
-+++ sources/log.c	Sat May 28 10:41:25 2005
-@@ -23,6 +23,7 @@
-  */
- int logFileOpen()
- {
-+#ifdef LOG
-     char timeStr[256];
-     struct tm *timeStruct;
-     time_t timeTemp;
-@@ -38,6 +39,7 @@
-     fflush(lf); /* otherwise we have mysterious problems with fork() !! */ 
- 
-     DBGPRINTF(("Opened Log File.\n"));
-+#endif
-     return 0;
- }
- 
-@@ -45,8 +47,10 @@
-  */
- int logFileClose()
- {
-+#ifdef LOG
-     fclose(lf);
-     DBGPRINTF(("Closed Log File.\n"));
-+#endif
-     return 0;
- }
- 
-@@ -61,6 +65,7 @@
- struct request req;
- int code;
- {
-+#ifdef LOG
-     char timeStr[256];
-     struct tm *timeStruct;
-     time_t timeTemp;
-@@ -108,6 +113,7 @@
-         printf ("Unknown event to log! Programming error!\n");
-     }
-     fflush(lf);
-+#endif
-     return 0;
- }
- 
diff --git a/www/pserv/files/patch-main.c b/www/pserv/files/patch-main.c
deleted file mode 100644
index d3be8f83dd11..000000000000
--- a/www/pserv/files/patch-main.c
+++ /dev/null
@@ -1,223 +0,0 @@
---- sources/main.c.orig	2005-06-01 12:36:18.000000000 +0200
-+++ sources/main.c	2008-09-03 13:13:27.000000000 +0200
-@@ -27,6 +27,7 @@
- char	    	defaultFileName[MAX_PATH_LEN+1];
- char	    	logFileName[MAX_PATH_LEN+1];
- char	    	mimeTypesFileName[MAX_PATH_LEN+1];
-+char            phpFileName[MAX_PATH_LEN+1];
- char	    	cgiRoot[MAX_PATH_LEN+1]; /* root for CGI scripts exec */
- struct timeval	sockTimeVal;
- mimeData    	*mimeArray;  /* here we will hold all MIME data, inited once, never to be changed */
-@@ -302,10 +303,13 @@
-         reqStruct->keepAlive = YES;
-     else if (!strncmp(reqArray[1], "Connection: keep-alive", strlen("Connection: keep-alive")))
-         reqStruct->keepAlive = YES;
--    /* user-agent, content-length and else */
-+    /* user-agent, content-length, content-type, cookie and else */
-     i = 1;
-     j = NO;
-     reqStruct->userAgent[0] = '\0';
-+    reqStruct->contentLength = -1;
-+    reqStruct->contentType[0] = '\0';
-+    reqStruct->cookie[0] = '\0';
-     while (i < readLines)
-     {
-         if (!strncmp(reqArray[i], "User-Agent:", strlen("User-Agent:")))
-@@ -320,6 +324,20 @@
- #ifdef PRINTF_DEBUG
- 	    printf("content length %ld\n", reqStruct->contentLength);
- #endif
-+        }
-+        else if (!strncmp(reqArray[i], "Content-Type:", strlen("Content-type:")) || !strncmp(reqArray[i], "Content-type:", strlen("Content-type:")))
-+        {
-+            strncpy(reqStruct->contentType, &reqArray[i][strlen("Content-type: ")], CONTENT_TYPE_LEN - 1);
-+#ifdef PRINTF_DEBUG
-+            printf("content type %s\n", reqStruct->contentType);
-+#endif
-+        }
-+        else if (!strncmp(reqArray[i], "Cookie:", strlen("Cookie:")))
-+        {
-+            strncpy(reqStruct->cookie, &reqArray[i][strlen("Cookie: ")], MAX_COOKIE_LEN - 1);
-+#ifdef PRINTF_DEBUG
-+            printf("cookie %s\n", reqStruct->cookie);
-+#endif
- 	}
-         i++;
-     }
-@@ -433,18 +451,39 @@
-                      * we append the default file name */
-                     strcat(completeFilePath, defaultFileName);
-                     analyzeExtension(mimeType, completeFilePath);
--                    dumpFile(sock, completeFilePath, mimeType, req);
-+#ifdef PHP
-+                    if (strncmp(mimeType, "application/x-httpd-php", 23))
-+#endif
-+                        dumpFile(sock, completeFilePath, mimeType, req);
-+#ifdef PHP
-+                    else
-+                        phpHandler(port, sock, phpFileName, completeFilePath, req, NULL);
-+#endif
-                 }
- #else
-                 /* we append the default file name */
-                 strcat(completeFilePath, defaultFileName);
-                 analyzeExtension(mimeType, completeFilePath);
--                dumpFile(sock, completeFilePath, mimeType, req);
-+#ifdef PHP
-+                if (strncmp(mimeType, "application/x-httpd-php", 23))
-+#endif
-+                    dumpFile(sock, completeFilePath, mimeType, req);
-+#ifdef PHP
-+                else
-+                    phpHandler(port, sock, phpFileName, completeFilePath, req, NULL);
-+#endif
- #endif
-             } else
-             { /* it is a plain file */
-                 analyzeExtension(mimeType, completeFilePath);
--                dumpFile(sock, completeFilePath, mimeType, req);
-+#ifdef PHP
-+                if (strncmp(mimeType, "application/x-httpd-php", 23))
-+#endif
-+                    dumpFile(sock, completeFilePath, mimeType, req);
-+#ifdef PHP
-+                else
-+                    phpHandler(port, sock, phpFileName, completeFilePath, req, NULL);
-+#endif
-             }
-         }
-     } else if (req.method[0]=='H' && req.method[1]=='E' && req.method[2]=='A' && req.method[3]=='D' && req.method[4]=='\0')
-@@ -461,6 +500,7 @@
-         {
-             strcpy(completeFilePath, homePath);
-             strcat(completeFilePath, req.documentAddress);
-+
-             /* now we check if the given file is a directory or a plain file */
-             stat(completeFilePath, &fileStats);
-             if ((fileStats.st_mode & S_IFDIR) == S_IFDIR)
-@@ -475,7 +515,14 @@
-                 strcat(completeFilePath, defaultFileName);
-             }
-             analyzeExtension(mimeType, completeFilePath);
--            dumpHeader(sock, completeFilePath, mimeType, req);
-+#ifdef PHP
-+            if (strncmp(mimeType, "application/x-httpd-php", 23))
-+#endif
-+                dumpFile(sock, completeFilePath, mimeType, req);
-+#ifdef PHP
-+            else
-+                phpHandler(port, sock, phpFileName, completeFilePath, req, NULL);
-+#endif
-         }
-     } else if (req.method[0]=='P' && req.method[1]=='O' && req.method[2]=='S' && req.method[3]=='T' && req.method[4]=='\0')
-     {
-@@ -488,13 +535,6 @@
- 	int ch;
-         
-         DBGPRINTF(("Handling of POST method\n"));
--        /* first we check if the path contains the directory selected for cgi's and in case handle it */
--        if (strncmp(req.documentAddress, CGI_MATCH_STRING, strlen(CGI_MATCH_STRING)))
--        {
--            /* non cgi POST is not supported */
--            sayError(sock, UNHANDLED_METHOD, "", req);
--            return -1;
--        }
- #ifdef ENABLE_CGI
-         DBGPRINTF(("begin of post handling\n"));
-         buff[0] = '\0';
-@@ -507,7 +547,7 @@
-             return -1;
-         } else if (req.contentLength >= POST_BUFFER_SIZE)
-         {
--            sayError(sock, BUFFER_OVERFLOW, "", req);
-+            sayError(sock, POST_BUFFER_OVERFLOW, "", req);
-             return -1;
-         }
-         while (!readFinished)
-@@ -557,7 +597,38 @@
-                 buff[totalRead] = '\0';
-             }
-             DBGPRINTF(("buff: |%s|\n", buff));
--            cgiHandler(port, sock, req, buff);
-+            if (!strncmp(req.documentAddress, CGI_MATCH_STRING, strlen(CGI_MATCH_STRING)))
-+            {
-+                cgiHandler(port, sock, req, buff);
-+            } else
-+            {
-+#ifdef PHP
-+                strcpy(completeFilePath, homePath);
-+                strcat(completeFilePath, req.documentAddress);
-+                /* now we check if the given file is a directory or a plain file */
-+                stat(completeFilePath, &fileStats);
-+                if ((fileStats.st_mode & S_IFDIR) == S_IFDIR)
-+                {
-+                    /* if does not end with a slash, we get an error */
-+                    if(completeFilePath[strlen(completeFilePath)-1] != '/')
-+                    {
-+                        sayError(sock, NOT_FOUND, req.documentAddress, req);
-+                        return -1;
-+                    }
-+                    /* we append the default file name */
-+                    strcat(completeFilePath, defaultFileName);
-+                }
-+                analyzeExtension(mimeType, completeFilePath);
-+                if (strncmp(mimeType, "application/x-httpd-php", 23))
-+                {
-+#endif
-+                    /* non cgi POST is not supported */
-+                    sayError(sock, UNHANDLED_METHOD, "", req);
-+                    return -1;
-+#ifdef PHP
-+                } else phpHandler(port, sock, phpFileName, completeFilePath, req, buff);
-+#endif
-+            }
-         }
- #endif /* ENABLE_CGI */
- #ifndef ENABLE_CGI
-@@ -593,7 +664,7 @@
-     f = fopen(configFile, "r");
-     if (f == NULL)
-     {
--        printf("Error opening config file. Setting defaults.\n");
-+        printf("Config file not found. Setting defaults.\n");
-         *serverPort = DEFAULT_PORT;
-         *maxChildren = DEFAULT_MAX_CHILDREN;
-         strcpy(homePath, DEFAULT_DOCS_LOCATION);
-@@ -602,7 +673,9 @@
-         sockTimeVal.tv_usec = DEFAULT_USEC_TO;
-         strcpy(logFileName, DEFAULT_LOG_FILE);
-         strcpy(mimeTypesFileName, DEFAULT_MIME_FILE);
-+        strcpy(phpFileName, DEFAULT_PHP_FILE);
-         strcpy(cgiRoot, DEFAULT_CGI_ROOT);
-+        initMimeTypes();
-         return -1;
-     }
-     if (!feof(f)) fscanf(f, "%s %s", str1, str2);
-@@ -703,11 +776,25 @@
-         if (mimeTypesFileName == NULL)
-         {
-             strcpy(mimeTypesFileName, DEFAULT_MIME_FILE);
--            printf("Error reading mimeTypesFileName from file, setting default, %s\n", mimeTypesFileName);
-+            printf("Error reading mimeTypesFile from file, setting default, %s\n", mimeTypesFileName);
-         }
-     } else {
-         strcpy(mimeTypesFileName, DEFAULT_MIME_FILE);
--        printf("Error reading mimeTypesFileName from file, setting default, %s\n", mimeTypesFileName);
-+        printf("Error reading mimeTypesFile from file, setting default, %s\n", mimeTypesFileName);
-+    }
-+    if (!feof(f)) fscanf(f, "%s %s", str1, str2);
-+    if (str1 != NULL && str2 != NULL && !strcmp(str1, "phpFile"))
-+    {
-+        sscanf(str2, "%s", phpFileName);
-+        if (logFileName == NULL)
-+        {
-+            strcpy(phpFileName, DEFAULT_LOG_FILE);
-+            printf("Error reading phpFile from file, setting default, %s\n", phpFileName);
-+        }
-+    } else
-+    {
-+        strcpy(phpFileName, DEFAULT_PHP_FILE);
-+        printf("Error reading phpFile from file, setting default, %s\n", phpFileName);
-     }
-     if (!feof(f)) fscanf(f, "%s %s", str1, str2);
-     if (str1 != NULL && str2 != NULL && !strcmp(str1, "cgiRoot"))
diff --git a/www/pserv/files/patch-main.h b/www/pserv/files/patch-main.h
deleted file mode 100644
index 6bc63310019c..000000000000
--- a/www/pserv/files/patch-main.h
+++ /dev/null
@@ -1,58 +0,0 @@
---- sources/main.h.orig	Mon May 16 23:08:30 2005
-+++ sources/main.h	Sat May 28 10:47:09 2005
-@@ -27,6 +27,8 @@
- 
- #define AUTO_INDEX              /* enables auto-index of directories */
- #define SOCKADDR_REUSE          /* enables reuse oth the socket (quick relaunch) */
-+#define LOG                     /* enable logging to file */
-+#define PHP                     /* enables transparent PHP support */
- 
- 
- /* --- Configure options --- */
-@@ -38,18 +40,19 @@
- #define MIME_TYPE_DEFAULT   "application/octet-stream"
- 
- /* configuration file location */
--#define DEFAULT_CONFIG_LOCATION "/usr/local/etc/pserv/"
-+#define DEFAULT_CONFIG_LOCATION "%%PREFIX%%/etc/pserv/"
- 
- /* hard-wired defaults, if loading of config file fails */
--#define DEFAULT_PORT	    	2000
-+#define DEFAULT_PORT	    	80
- #define DEFAULT_MAX_CHILDREN	5
--#define DEFAULT_DOCS_LOCATION	"/usr/local/var/www"
-+#define DEFAULT_DOCS_LOCATION	"%%PREFIX%%/www/data"
- #define DEFAULT_FILE_NAME   	"index.html"
- #define DEFAULT_SEC_TO	    	1
- #define DEFAULT_USEC_TO     	100
--#define DEFAULT_LOG_FILE    	"/usr/local/var/log/pserv.log"
--#define DEFAULT_MIME_FILE   	"/usr/local/etc/pserv/mime_types.dat"
--#define DEFAULT_CGI_ROOT    	"/usr/local/var/www/cgi-bin"
-+#define DEFAULT_LOG_FILE    	"/var/log/pserv.log"
-+#define DEFAULT_MIME_FILE   	"%%PREFIX%%/etc/pserv/mime.types"
-+#define DEFAULT_PHP_FILE    	"%%LOCALBASE%%/bin/php"
-+#define DEFAULT_CGI_ROOT    	"%%PREFIX%%/www/cgi-bin"
- #define DEFAULT_SERVER_NAME 	"localhost"
- 
- /* amount of connections queued in listening */
-@@ -122,8 +125,10 @@
- #define ADDRESS_LEN 	    	16
- #define METHOD_LEN  	    	16
- #define PROTOCOL_LEN	    	16
-+#define CONTENT_TYPE_LEN   	256
- #define USER_AGENT_LEN	    	256
- #define MAX_QUERY_STRING_LEN	1024
-+#define MAX_COOKIE_LEN     	4096
- 
- /* ------ Structures ------- */
- /* we use +1 to be safe with handling the end-of-string */
-@@ -141,7 +146,9 @@
-     char     protocolVersion[PROTOCOL_LEN+1];
-     int      keepAlive;
-     char     userAgent[USER_AGENT_LEN+1];
-+    char     cookie[MAX_COOKIE_LEN+1];
-     long int contentLength;
-+    char     contentType[CONTENT_TYPE_LEN+1];
-     char     rest[BUFFER_SIZE+1];
- };
- 
diff --git a/www/pserv/files/patch-mime.c b/www/pserv/files/patch-mime.c
deleted file mode 100644
index 0448ed4d911e..000000000000
--- a/www/pserv/files/patch-mime.c
+++ /dev/null
@@ -1,34 +0,0 @@
---- sources/mime.c.orig	Thu Sep 18 15:26:55 2003
-+++ sources/mime.c	Wed Oct 15 18:38:42 2003
-@@ -43,8 +43,8 @@
-     f = fopen(mimeTypesFileName, "r");
-     if (f == NULL)
-     {
--        printf("Error opening mime types file. Setting defaults.\n");
--        entries = 3;
-+        printf("Mime types file not found. Setting defaults.\n");
-+        entries = 6;
-         mimeArray = (mimeData *) calloc(entries, sizeof(mimeData));
-         if (mimeArray == NULL) {
-             printf("Errory while allocating mime types Array. Exiting.\n");
-@@ -52,10 +52,16 @@
-         }
-         strcpy(mimeArray[0].ext, "html");
-         strcpy(mimeArray[0].type, "text/html");
--        strcpy(mimeArray[1].ext, "gif");
--        strcpy(mimeArray[1].type, "image/gif");
--        strcpy(mimeArray[2].ext, "jpg");
--        strcpy(mimeArray[2].type, "image/jpg");
-+        strcpy(mimeArray[1].ext, "htm");
-+        strcpy(mimeArray[1].type, "text/html");
-+        strcpy(mimeArray[2].ext, "gif");
-+        strcpy(mimeArray[2].type, "image/gif");
-+        strcpy(mimeArray[3].ext, "jpg");
-+        strcpy(mimeArray[3].type, "image/jpg");
-+        strcpy(mimeArray[4].ext, "png");
-+        strcpy(mimeArray[4].type, "image/png");
-+        strcpy(mimeArray[5].ext, "php");
-+        strcpy(mimeArray[5].type, "application/x-httpd-php");
-         mimeEntries = entries;
-         return -1;
-     }
diff --git a/www/pserv/files/patch-mime_types.dat b/www/pserv/files/patch-mime_types.dat
deleted file mode 100644
index ce9083744767..000000000000
--- a/www/pserv/files/patch-mime_types.dat
+++ /dev/null
@@ -1,7 +0,0 @@
---- defaults/mime_types.dat.orig	Wed Oct 15 15:57:08 2003
-+++ defaults/mime_types.dat	Wed Oct 15 15:57:22 2003
-@@ -14,3 +14,4 @@
- tar	application/x-tar
- lha	application/octet-stream
- lzh	application/octet-stream
-+php	application/x-httpd-php
diff --git a/www/pserv/files/patch-pserv.conf b/www/pserv/files/patch-pserv.conf
deleted file mode 100644
index c32992ce16e4..000000000000
--- a/www/pserv/files/patch-pserv.conf
+++ /dev/null
@@ -1,18 +0,0 @@
---- defaults/pserv.conf.orig	Mon May 16 23:08:29 2005
-+++ defaults/pserv.conf	Sat May 28 10:50:28 2005
-@@ -1,9 +1,10 @@
--port	8080
-+port	80
- maxChildren	4
--documentsPath   /usr/local/var/www
-+documentsPath   %%PREFIX%%/www/data
- defaultFile	index.html
- secTimeout	1
- uSecTimeout	100000
--logFile		/usr/local/var/log/pserv.log
--mimeTypesFile	/usr/local/etc/pserv/mime_types.dat
--cgiRoot		/usr/local/var/www/cgi-bin
-+logFile		/var/log/pserv.log
-+mimeTypesFile	%%PREFIX%%/etc/pserv/mime.types
-+phpFile		%%LOCALBASE%%/bin/php-cgi
-+cgiRoot		%%PREFIX%%/www/cgi-bin
diff --git a/www/pserv/files/pserv.sh b/www/pserv/files/pserv.sh
deleted file mode 100644
index 9930e58c7886..000000000000
--- a/www/pserv/files/pserv.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/${0##*/}\$"); then
-	echo "$0: Cannot determine the PREFIX" >&2
-	exit 64
-fi
-
-case "$1" in
-start)
-	if [ -x ${PREFIX}/sbin/pserv ]; then
-		${PREFIX}/sbin/pserv > /dev/null &
-		echo -n ' pserv'
-	fi
-	;;
-stop)
-	killall pserv > /dev/null 2>&1
-	echo -n ' pserv'
-	;;
-*)
-	echo "Usage: `basename $0` {start|stop}" >&2
-	exit 64
-	;;
-esac
-
-exit 0
diff --git a/www/pserv/pkg-descr b/www/pserv/pkg-descr
deleted file mode 100644
index 801c05958c29..000000000000
--- a/www/pserv/pkg-descr
+++ /dev/null
@@ -1,6 +0,0 @@
-pServ is a small, portable HTTP server. It is written in pure C for speed and
-portability. It runs as a standalone program and does not require inetd.
-It should be small enough to be used in a mobile computer or to be run on your
-obsolete workstation you have somewhere.
-
-This port contains a patched version to support the execution of php scripts.
diff --git a/www/pserv/pkg-plist b/www/pserv/pkg-plist
deleted file mode 100644
index 241b8b76f219..000000000000
--- a/www/pserv/pkg-plist
+++ /dev/null
@@ -1,4 +0,0 @@
-sbin/pserv
-etc/pserv/mime.types
-etc/pserv/pserv.conf.sample
-etc/rc.d/pserv.sh