View | Details | Raw Unified | Return to bug 80363
Collapse All | Expand All

(-)pserv/Makefile (-5 / +18 lines)
Lines 6-28 Link Here
6
#
6
#
7
7
8
PORTNAME=	pserv
8
PORTNAME=	pserv
9
PORTVERSION=	3.1
9
PORTVERSION=	3.2
10
CATEGORIES=	www
10
CATEGORIES=	www
11
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
11
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
12
MASTER_SITE_SUBDIR=	${PORTNAME}
12
MASTER_SITE_SUBDIR=	${PORTNAME}
13
EXTRACT_SUFX=	.tar.Z
14
13
15
MAINTAINER=	ale@FreeBSD.org
14
MAINTAINER=	ale@FreeBSD.org
16
COMMENT=	A portable and small webserver written in C
15
COMMENT=	A portable and small webserver written in C
17
16
18
WRKSRC=		${WRKDIR}/${PORTNAME}
19
BUILD_WRKSRC=	${WRKSRC}/sources
20
USE_REINPLACE=	yes
17
USE_REINPLACE=	yes
21
18
22
OPTIONS=	LOG "Enable logging" on \
19
OPTIONS=	LOG "Enable logging" on \
23
		PHP "Enable PHP support" on
20
		PHP "Enable PHP support" on \
21
		PARALLEL "Build parallel server (fork after request)" on \
22
		CGI "CGI support" on
23
24
GNU_CONFIGURE=  yes
24
25
25
.include <bsd.port.pre.mk>
26
.include <bsd.port.pre.mk>
27
28
.if defined(WITH_PARALLEL)
29
CONFIGURE_ARGS+=	--enable-forking
30
.else
31
CONFIGURE_ARGS+=	--disable-forking
32
.endif
33
34
.if defined(WITH_CGI)
35
CONFIGURE_ARGS+=	--enable-cgi
36
.else
37
CONFIGURE_ARGS+=	--disable-cgi
38
.endif
26
39
27
post-patch:
40
post-patch:
28
	@${REINPLACE_CMD} "s|%%PREFIX%%|${PREFIX}|g;s|%%LOCALBASE%%|${LOCALBASE}|g" \
41
	@${REINPLACE_CMD} "s|%%PREFIX%%|${PREFIX}|g;s|%%LOCALBASE%%|${LOCALBASE}|g" \
(-)pserv/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
MD5 (pserv-3.1.tar.Z) = c106d7709bf2a65e9acf16147f2e3a1f
1
MD5 (pserv-3.2.tar.gz) = d20e49388004553f55bb44b025b0e01b
2
SIZE (pserv-3.1.tar.Z) = 49511
2
SIZE (pserv-3.2.tar.gz) = 108399
(-)pserv/files/patch-Makefile (-17 lines)
Lines 1-17 Link Here
1
--- sources/Makefile.orig	Fri Nov  5 23:04:15 2004
2
+++ sources/Makefile	Wed Nov 24 14:52:32 2004
3
@@ -1,11 +1,11 @@
4
 #Change the following to your needs
5
-CC = gcc
6
-#insert here flags, eg. optimizations
7
-CFLAGS = -Wall -Os -pedantic
8
+CC ?= gcc
9
 LIBS = 
10
 SRCS = main.c handlers.c mime.c log.c
11
 OBJS = main.o handlers.o mime.o log.o
12
 PROGRAM = pserv
13
+
14
+all : $(PROGRAM)
15
 
16
 $(PROGRAM) : $(OBJS)
17
 	$(CC) -o $(PROGRAM) $(OBJS) $(LIBS)
(-)pserv/files/patch-log.c (-9 / +11 lines)
Lines 1-21 Link Here
1
--- sources/log.c.orig	Wed May  5 12:12:12 2004
1
--- sources/log.c.orig	Fri Apr 22 17:34:15 2005
2
+++ sources/log.c	Wed May  5 12:04:57 2004
2
+++ sources/log.c	Fri Apr 22 17:36:52 2005
3
@@ -20,6 +20,7 @@
3
@@ -23,6 +23,7 @@
4
 
4
  */
5
 int logFileOpen()
5
 int logFileOpen()
6
 {
6
 {
7
+#ifdef LOG
7
+#ifdef LOG
8
     char timeStr[256];
8
     char timeStr[256];
9
     struct tm *timeStruct;
9
     struct tm *timeStruct;
10
     time_t timeTemp;
10
     time_t timeTemp;
11
@@ -37,15 +38,18 @@
11
@@ -40,6 +41,7 @@
12
 #ifdef PRINTF_DEBUG
12
 #ifdef PRINTF_DEBUG
13
     printf("Opened Log File.\n");
13
     printf("Opened Log File.\n");
14
 #endif    
14
 #endif    
15
+#endif    
15
+#endif
16
     return 0;
16
     return 0;
17
 }
17
 }
18
 
18
 
19
@@ -47,10 +49,12 @@
20
  */
19
 int logFileClose()
21
 int logFileClose()
20
 {
22
 {
21
+#ifdef LOG
23
+#ifdef LOG
Lines 23-33 Link Here
23
 #ifdef PRINTF_DEBUG
25
 #ifdef PRINTF_DEBUG
24
     printf("Closed Log File.\n");
26
     printf("Closed Log File.\n");
25
 #endif    
27
 #endif    
26
+#endif    
28
+#endif
27
     return 0;
29
     return 0;
28
 }
30
 }
29
 
31
 
30
@@ -57,6 +61,7 @@
32
@@ -65,6 +69,7 @@
31
 struct request req;
33
 struct request req;
32
 int code;
34
 int code;
33
 {
35
 {
Lines 35-41 Link Here
35
     char timeStr[256];
37
     char timeStr[256];
36
     struct tm *timeStruct;
38
     struct tm *timeStruct;
37
     time_t timeTemp;
39
     time_t timeTemp;
38
@@ -104,6 +109,7 @@
40
@@ -112,6 +117,7 @@
39
         printf ("Unknown event to log! Programming error!\n");
41
         printf ("Unknown event to log! Programming error!\n");
40
     }
42
     }
41
     fflush(lf);
43
     fflush(lf);
(-)pserv/files/patch-main.c (-16 / +16 lines)
Lines 1-5 Link Here
1
--- sources/main.c.orig	Mon Aug 30 13:19:03 2004
1
--- sources/main.c.orig	Fri Feb 11 14:25:20 2005
2
+++ sources/main.c	Wed Sep 15 15:03:04 2004
2
+++ sources/main.c	Fri Apr 22 17:47:18 2005
3
@@ -23,6 +23,7 @@
3
@@ -23,6 +23,7 @@
4
 char	    	defaultFileName[MAX_PATH_LEN+1];
4
 char	    	defaultFileName[MAX_PATH_LEN+1];
5
 char	    	logFileName[MAX_PATH_LEN+1];
5
 char	    	logFileName[MAX_PATH_LEN+1];
Lines 8-14 Link Here
8
 char	    	cgiRoot[MAX_PATH_LEN+1]; /* root for CGI scripts exec */
8
 char	    	cgiRoot[MAX_PATH_LEN+1]; /* root for CGI scripts exec */
9
 struct timeval	sockTimeVal;
9
 struct timeval	sockTimeVal;
10
 mimeData    	*mimeArray;  /* here we will hold all MIME data, inited once, never to be changed */
10
 mimeData    	*mimeArray;  /* here we will hold all MIME data, inited once, never to be changed */
11
@@ -322,10 +323,13 @@
11
@@ -314,10 +315,13 @@
12
         reqStruct->keepAlive = YES;
12
         reqStruct->keepAlive = YES;
13
     else if (!strncmp(reqArray[1], "Connection: Keep-Alive", strlen("Connection: keep-alive")))
13
     else if (!strncmp(reqArray[1], "Connection: Keep-Alive", strlen("Connection: keep-alive")))
14
         reqStruct->keepAlive = YES;
14
         reqStruct->keepAlive = YES;
Lines 23-29 Link Here
23
     while (i < readLines)
23
     while (i < readLines)
24
     {
24
     {
25
         if (!strncmp(reqArray[i], "User-Agent:", strlen("User-Agent:")))
25
         if (!strncmp(reqArray[i], "User-Agent:", strlen("User-Agent:")))
26
@@ -340,6 +344,20 @@
26
@@ -332,6 +336,20 @@
27
 #ifdef PRINTF_DEBUG
27
 #ifdef PRINTF_DEBUG
28
 	    printf("content length %ld\n", reqStruct->contentLength);
28
 	    printf("content length %ld\n", reqStruct->contentLength);
29
 #endif
29
 #endif
Lines 44-50 Link Here
44
 	}
44
 	}
45
         i++;
45
         i++;
46
     }
46
     }
47
@@ -437,18 +455,39 @@
47
@@ -431,18 +449,39 @@
48
                     /* we append the default file name */
48
                     /* we append the default file name */
49
                     strcat(completeFilePath, defaultFileName);
49
                     strcat(completeFilePath, defaultFileName);
50
                     analyzeExtension(mimeType, completeFilePath);
50
                     analyzeExtension(mimeType, completeFilePath);
Lines 87-93 Link Here
87
             }
87
             }
88
         }
88
         }
89
     } else if (!strcmp(req.method, "HEAD"))
89
     } else if (!strcmp(req.method, "HEAD"))
90
@@ -517,7 +556,14 @@
90
@@ -513,7 +552,14 @@
91
                 strcat(completeFilePath, defaultFileName);
91
                 strcat(completeFilePath, defaultFileName);
92
             }
92
             }
93
             analyzeExtension(mimeType, completeFilePath);
93
             analyzeExtension(mimeType, completeFilePath);
Lines 103-109 Link Here
103
         }
103
         }
104
     } else if (!strcmp(req.method, "POST"))
104
     } else if (!strcmp(req.method, "POST"))
105
     {
105
     {
106
@@ -531,13 +577,6 @@
106
@@ -527,13 +573,6 @@
107
         int readFinished;
107
         int readFinished;
108
         
108
         
109
         printf("Handling of POST method\n");
109
         printf("Handling of POST method\n");
Lines 114-123 Link Here
114
-            sayError(sock, UNHANDLED_METHOD, "", req);
114
-            sayError(sock, UNHANDLED_METHOD, "", req);
115
-            return -1;
115
-            return -1;
116
-        }
116
-        }
117
 #ifdef ENABLE_CGI
117
 #ifdef PRINTF_DEBUG
118
 #ifdef PRINTF_DEBUG
118
         printf ("begin of post handling\n");
119
         printf ("begin of post handling\n");
119
 
120
@@ -550,7 +589,7 @@
120
@@ -553,7 +592,7 @@
121
             return -1;
121
             return -1;
122
         } else if (req.contentLength >= BUFFER_SIZE)
122
         } else if (req.contentLength >= BUFFER_SIZE)
123
         {
123
         {
Lines 126-132 Link Here
126
             return -1;
126
             return -1;
127
         }
127
         }
128
         while (!readFinished)
128
         while (!readFinished)
129
@@ -631,7 +670,77 @@
129
@@ -628,7 +667,77 @@
130
 #ifdef PRINTF_DEBUG
130
 #ifdef PRINTF_DEBUG
131
             printf("buff: |%s|\n", buff);
131
             printf("buff: |%s|\n", buff);
132
 #endif
132
 #endif
Lines 203-211 Link Here
203
+#endif
203
+#endif
204
+            }
204
+            }
205
         }
205
         }
206
     } else
206
 #endif /* ENABLE_CGI */
207
     {
207
 #ifndef ENABLE_CGI
208
@@ -660,7 +769,7 @@
208
@@ -664,7 +773,7 @@
209
     f = fopen(configFile, "r");
209
     f = fopen(configFile, "r");
210
     if (f == NULL)
210
     if (f == NULL)
211
     {
211
     {
Lines 214-220 Link Here
214
         *serverPort = DEFAULT_PORT;
214
         *serverPort = DEFAULT_PORT;
215
         *maxChildren = DEFAULT_MAX_CHILDREN;
215
         *maxChildren = DEFAULT_MAX_CHILDREN;
216
         strcpy(homePath, DEFAULT_DOCS_LOCATION);
216
         strcpy(homePath, DEFAULT_DOCS_LOCATION);
217
@@ -669,7 +778,9 @@
217
@@ -673,7 +782,9 @@
218
         sockTimeVal.tv_usec = DEFAULT_USEC_TO;
218
         sockTimeVal.tv_usec = DEFAULT_USEC_TO;
219
         strcpy(logFileName, DEFAULT_LOG_FILE);
219
         strcpy(logFileName, DEFAULT_LOG_FILE);
220
         strcpy(mimeTypesFileName, DEFAULT_MIME_FILE);
220
         strcpy(mimeTypesFileName, DEFAULT_MIME_FILE);
Lines 224-230 Link Here
224
         return -1;
224
         return -1;
225
     }
225
     }
226
     if (!feof(f)) fscanf(f, "%s %s", str1, str2);
226
     if (!feof(f)) fscanf(f, "%s %s", str1, str2);
227
@@ -770,11 +881,25 @@
227
@@ -774,11 +885,25 @@
228
         if (mimeTypesFileName == NULL)
228
         if (mimeTypesFileName == NULL)
229
         {
229
         {
230
             strcpy(mimeTypesFileName, DEFAULT_MIME_FILE);
230
             strcpy(mimeTypesFileName, DEFAULT_MIME_FILE);
Lines 252-258 Link Here
252
     }
252
     }
253
     if (!feof(f)) fscanf(f, "%s %s", str1, str2);
253
     if (!feof(f)) fscanf(f, "%s %s", str1, str2);
254
     if (str1 != NULL && str2 != NULL && !strcmp(str1, "cgiRoot"))
254
     if (str1 != NULL && str2 != NULL && !strcmp(str1, "cgiRoot"))
255
@@ -1008,7 +1133,7 @@
255
@@ -1012,7 +1137,7 @@
256
                         } */
256
                         } */
257
                     } else
257
                     } else
258
                     {
258
                     {
(-)pserv/files/patch-main.h (-20 / +18 lines)
Lines 1-47 Link Here
1
--- sources/main.h.orig	Wed Nov 24 11:12:35 2004
1
--- sources/main.h.orig	Fri Feb 11 14:25:20 2005
2
+++ sources/main.h	Wed Nov 24 14:58:06 2004
2
+++ sources/main.h	Tue Apr 26 11:47:35 2005
3
@@ -20,12 +20,14 @@
3
@@ -24,10 +24,10 @@
4
 /* --- CPP parsing options --- */
4
 #define PRINTF_DEBUG           /* enable this to print some debugging messages */
5
 #undef PRINTF_DEBUG           /* enable this to print some debugging messages */
6
 #undef ON_THE_FLY_CONVERSION /* enable this for line ending conversion */
5
 #undef ON_THE_FLY_CONVERSION /* enable this for line ending conversion */
7
+#define LOG                     /* enable logging to file */
8
 #define BRAIN_DEAD_CAST         /* if your compiler is brainwashed and does not cast standard types.h structures */
6
 #define BRAIN_DEAD_CAST         /* if your compiler is brainwashed and does not cast standard types.h structures */
9
 #define FORKING_SERVER          /* enables to fork for every request */
7
-
8
+#define LOG                     /* enable logging to file */
10
 #define AUTO_INDEX              /* enables auto-index of directories */
9
 #define AUTO_INDEX              /* enables auto-index of directories */
11
 #define SOCKADDR_REUSE          /* enables reuse oth the socket (quick relaunch) */
10
 #define SOCKADDR_REUSE          /* enables reuse oth the socket (quick relaunch) */
12
 #define VOID_SIG_HANDLERS       /* enables different signal function types */
11
-
13
 #undef ADDR_LEN_TYPE_INT       /* in accept() if addrlen is int */
14
+#define PHP                     /* enables transparent PHP support */
12
+#define PHP                     /* enables transparent PHP support */
15
 
13
 
16
 /* --- Configure options --- */
14
 /* --- Configure options --- */
17
 #define CONFIG_FILE_NAME    "pserv.conf"  /* name of the configuration file, concatenated to DEFAULT_CONFIG_LOCATION */
15
 #define CONFIG_FILE_NAME    "pserv.conf"  /* name of the configuration file, concatenated to DEFAULT_CONFIG_LOCATION */
18
@@ -36,18 +38,19 @@
16
@@ -38,18 +38,19 @@
19
 #define MIME_TYPE_DEFAULT   "application/octet-stream"
17
 #define MIME_TYPE_DEFAULT   "application/octet-stream"
20
 
18
 
21
 /* configuration file location */
19
 /* configuration file location */
22
-#define DEFAULT_CONFIG_LOCATION "/usr/people/multix/pserv/defaults/"
20
-#define DEFAULT_CONFIG_LOCATION "/usr/local/etc/pserv/"
23
+#define DEFAULT_CONFIG_LOCATION "/usr/local/etc/"
21
+#define DEFAULT_CONFIG_LOCATION "/usr/local/etc/"
24
 
22
 
25
 /* hard-wired defaults, if loading of config file fails */
23
 /* hard-wired defaults, if loading of config file fails */
26
-#define DEFAULT_PORT	    	2000
24
-#define DEFAULT_PORT	    	2000
27
+#define DEFAULT_PORT	    	80
25
+#define DEFAULT_PORT	    	80
28
 #define DEFAULT_MAX_CHILDREN	5
26
 #define DEFAULT_MAX_CHILDREN	5
29
-#define DEFAULT_DOCS_LOCATION	"/usr/people/multix/public_html"
27
-#define DEFAULT_DOCS_LOCATION	"/usr/local/var/www"
30
+#define DEFAULT_DOCS_LOCATION	"/usr/local/www/data"
28
+#define DEFAULT_DOCS_LOCATION	"/usr/local/www/data"
31
 #define DEFAULT_FILE_NAME   	"index.html"
29
 #define DEFAULT_FILE_NAME   	"index.html"
32
 #define DEFAULT_SEC_TO	    	1
30
 #define DEFAULT_SEC_TO	    	1
33
 #define DEFAULT_USEC_TO     	100
31
 #define DEFAULT_USEC_TO     	100
34
-#define DEFAULT_LOG_FILE    	"/home/multix/pserv/pserv.log"
32
-#define DEFAULT_LOG_FILE    	"/usr/local/var/log/pserv.log"
35
-#define DEFAULT_MIME_FILE   	"/home/multix/pserv/mime_types.dat"
33
-#define DEFAULT_MIME_FILE   	"/usr/local/etc/pserv/mime_types.dat"
36
-#define DEFAULT_CGI_ROOT    	"/home/multix/public_html/cgi-bin"
34
-#define DEFAULT_CGI_ROOT    	"/usr/local/var/www/cgi-bin"
37
+#define DEFAULT_LOG_FILE	"/var/log/pserv.log"
35
+#define DEFAULT_LOG_FILE    	"/var/log/pserv.log"
38
+#define DEFAULT_MIME_FILE	"/usr/local/etc/mime.types"
36
+#define DEFAULT_MIME_FILE   	"/usr/local/etc/mime.types"
39
+#define DEFAULT_PHP_FILE	"/usr/local/bin/php"
37
+#define DEFAULT_PHP_FILE	"/usr/local/bin/php"
40
+#define DEFAULT_CGI_ROOT	"/usr/local/www/cgi-bin"
38
+#define DEFAULT_CGI_ROOT    	"/usr/local/www/cgi-bin"
41
 #define DEFAULT_SERVER_NAME 	"localhost"
39
 #define DEFAULT_SERVER_NAME 	"localhost"
42
 
40
 
43
 /* amount of connections queued in listening */
41
 /* amount of connections queued in listening */
44
@@ -120,8 +123,10 @@
42
@@ -122,8 +123,10 @@
45
 #define ADDRESS_LEN 	    	16
43
 #define ADDRESS_LEN 	    	16
46
 #define METHOD_LEN  	    	16
44
 #define METHOD_LEN  	    	16
47
 #define PROTOCOL_LEN	    	16
45
 #define PROTOCOL_LEN	    	16
Lines 52-58 Link Here
52
 
50
 
53
 /* ------ Structures ------- */
51
 /* ------ Structures ------- */
54
 /* we use +1 to be safe with handling the end-of-string */
52
 /* we use +1 to be safe with handling the end-of-string */
55
@@ -139,7 +144,9 @@
53
@@ -141,7 +144,9 @@
56
     char     protocolVersion[PROTOCOL_LEN+1];
54
     char     protocolVersion[PROTOCOL_LEN+1];
57
     int      keepAlive;
55
     int      keepAlive;
58
     char     userAgent[USER_AGENT_LEN+1];
56
     char     userAgent[USER_AGENT_LEN+1];
(-)pserv/files/patch-pserv.conf (-7 / +7 lines)
Lines 1-17 Link Here
1
--- defaults/pserv.conf.orig	Tue Nov  9 19:03:50 2004
1
--- defaults/pserv.conf.orig	Mon Apr 25 10:38:40 2005
2
+++ defaults/pserv.conf	Wed Nov 24 15:00:53 2004
2
+++ defaults/pserv.conf	Mon Apr 25 10:40:00 2005
3
@@ -1,9 +1,10 @@
3
@@ -1,9 +1,10 @@
4
-port	8080
4
-port	8080
5
+port		80
5
+port	80
6
 maxChildren	4
6
 maxChildren	4
7
-documentsPath   /usr/people/multix/public_html
7
-documentsPath   /usr/local/var/www
8
+documentsPath   %%PREFIX%%/www/data
8
+documentsPath   %%PREFIX%%/www/data
9
 defaultFile	index.html
9
 defaultFile	index.html
10
 secTimeout	1
10
 secTimeout	1
11
 uSecTimeout	100000
11
 uSecTimeout	100000
12
-logFile		/usr/people/multix/pserv/pserv.log
12
-logFile		/usr/local/var/log/pserv.log
13
-mimeTypesFile	/usr/people/multix/pserv/defaults/mime_types.dat
13
-mimeTypesFile	/usr/local/etc/pserv/mime_types.dat
14
-cgiRoot		/usr/people/multix/public_html/cgi-bin
14
-cgiRoot		/usr/local/var/www/cgi-bin
15
+logFile		/var/log/pserv.log
15
+logFile		/var/log/pserv.log
16
+mimeTypesFile	%%PREFIX%%/etc/mime.types
16
+mimeTypesFile	%%PREFIX%%/etc/mime.types
17
+phpFile		%%LOCALBASE%%/bin/php
17
+phpFile		%%LOCALBASE%%/bin/php

Return to bug 80363