Deleted Added
full compact
simple_httpd.c (38590) simple_httpd.c (42714)
1/* simpleHTTPd (C) 1998 netSTOR Technologies, Inc. ("netSTOR")
2 FreeBSD port and additional work by Marc Nicholas <marc@netstor.com>
3 Based on work by:-
4 Thierry Leconte & Yury Shimanovsky
5 My Russian webserver writing friends :-)
6
7 This is an HTTP daemon that will serve up HTML, text files, JPEGs,
8 GIFs and do simple CGI work.
9
10 You may use this code for non-commercial distribution only. Commercial
11 distribution requires the express, written permission of netSTOR. No
12 warranty is implied or given -- use at your own risk!
13*/
14
15/*
1/* simpleHTTPd (C) 1998 netSTOR Technologies, Inc. ("netSTOR")
2 FreeBSD port and additional work by Marc Nicholas <marc@netstor.com>
3 Based on work by:-
4 Thierry Leconte & Yury Shimanovsky
5 My Russian webserver writing friends :-)
6
7 This is an HTTP daemon that will serve up HTML, text files, JPEGs,
8 GIFs and do simple CGI work.
9
10 You may use this code for non-commercial distribution only. Commercial
11 distribution requires the express, written permission of netSTOR. No
12 warranty is implied or given -- use at your own risk!
13*/
14
15/*
16 * $Id: simple_httpd.c,v 1.1 1998/08/19 16:24:06 abial Exp $
16 * $Id: simple_httpd.c,v 1.1.1.1 1998/08/27 17:38:45 abial Exp $
17 */
18
19#include <stdio.h>
20#include <unistd.h>
21#include <stdlib.h>
22#include <sys/stat.h>
23#include <sys/time.h>
24#include <sys/types.h>
25#include <time.h>
26#include <sys/socket.h>
27#include <netinet/in.h>
28#include <arpa/inet.h>
29#include <netdb.h>
30#include <fcntl.h>
31#include <string.h>
32#include <signal.h>
33#include <sys/wait.h>
17 */
18
19#include <stdio.h>
20#include <unistd.h>
21#include <stdlib.h>
22#include <sys/stat.h>
23#include <sys/time.h>
24#include <sys/types.h>
25#include <time.h>
26#include <sys/socket.h>
27#include <netinet/in.h>
28#include <arpa/inet.h>
29#include <netdb.h>
30#include <fcntl.h>
31#include <string.h>
32#include <signal.h>
33#include <sys/wait.h>
34#define LOGDIR "/var/log"
34
35int http_sock, con_sock;
36int http_port = 80;
37struct sockaddr_in source;
38char homedir[100];
39char *adate();
40struct hostent *hst;
41

--- 82 unchanged lines hidden (view full) ---

124 if (p=strstr(req,"\r")) *p=0;
125
126 if (geteuid())
127 {
128 strcpy(logfile,getenv("HOME"));
129 strcat(logfile,"/");
130 strcat(logfile,"jhttp.log");
131 }
35
36int http_sock, con_sock;
37int http_port = 80;
38struct sockaddr_in source;
39char homedir[100];
40char *adate();
41struct hostent *hst;
42

--- 82 unchanged lines hidden (view full) ---

125 if (p=strstr(req,"\r")) *p=0;
126
127 if (geteuid())
128 {
129 strcpy(logfile,getenv("HOME"));
130 strcat(logfile,"/");
131 strcat(logfile,"jhttp.log");
132 }
132 else strcpy(logfile,"/usr/adm/jhttpd.log");
133 else strcpy(logfile, LOGDIR "/jhttpd.log");
133
134 if ( access(logfile,W_OK))
135 {
136 lg=creat (logfile,O_WRONLY);
137 chmod (logfile,00600);
138 close(lg);
139 }
140

--- 203 unchanged lines hidden (view full) ---

344
345char *adate()
346{
347 static char out[50];
348 long now;
349 struct tm *t;
350 time(&now);
351 t = localtime(&now);
134
135 if ( access(logfile,W_OK))
136 {
137 lg=creat (logfile,O_WRONLY);
138 chmod (logfile,00600);
139 close(lg);
140 }
141

--- 203 unchanged lines hidden (view full) ---

345
346char *adate()
347{
348 static char out[50];
349 long now;
350 struct tm *t;
351 time(&now);
352 t = localtime(&now);
352 sprintf(out, "%02d:%02d:%02d %02d/%02d/%02d",
353 t->tm_hour, t->tm_min, t->tm_sec,
354 t->tm_mday, t->tm_mon+1, t->tm_year );
353
354 sprintf(out, "%4d/%02d/%02d %02d:%02d:%02d",
355 t->tm_year+1900, t->tm_mon+1, t->tm_mday,
356 t->tm_hour, t->tm_min, t->tm_sec );
355 return out;
356}
357 return out;
358}