Deleted Added
sdiff udiff text old ( 42714 ) new ( 43939 )
full compact
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.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>
34#define LOGDIR "/var/log"
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 }
133 else strcpy(logfile, LOGDIR "/jhttpd.log");
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);
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 );
357 return out;
358}