1 diff -ur tinyhttpd-0.1.0/httpd.c tinyhttpd-0.1.0-patched/httpd.c
2 --- tinyhttpd-0.1.0/httpd.c 2001-04-21 19:13:13.000000000 -0500
3 +++ tinyhttpd-0.1.0-patched/httpd.c 2007-07-02 09:19:27.000000000 -0500
5 * CSE 4344 (Network concepts), Prof. Zeigler
6 * University of Texas at Arlington
8 -/* This program compiles for Sparc Solaris 2.6.
9 - * To compile for Linux:
10 - * 1) Comment out the #include <pthread.h> line.
11 - * 2) Comment out the line that defines the variable newthread.
12 - * 3) Comment out the two lines that run pthread_create().
13 - * 4) Uncomment the line that runs accept_request().
14 - * 5) Remove -lsocket from the Makefile.
17 #include <sys/socket.h>
18 #include <sys/types.h>
29 #define SERVER_STRING "Server: jdbhttpd/0.1.0\r\n"
31 -void accept_request(int);
32 void bad_request(int);
33 void cat(int, FILE *);
34 void cannot_execute(int);
39 - sprintf(path, "htdocs%s", url);
40 + sprintf(path, "/var/www%s", url);
41 if (path[strlen(path) - 1] == '/')
42 strcat(path, "index.html");
43 if (stat(path, &st) == -1) {
51 struct sockaddr_in client_name;
52 int client_name_len = sizeof(client_name);
53 - pthread_t newthread;
55 server_sock = startup(&port);
56 printf("httpd running on port %d\n", port);
59 if (client_sock == -1)
61 - /* accept_request(client_sock); */
62 - if (pthread_create(&newthread , NULL, accept_request, client_sock) != 0)
63 - perror("pthread_create");
64 + accept_request(client_sock);
68 diff -ur tinyhttpd-0.1.0/Makefile tinyhttpd-0.1.0-patched/Makefile
69 --- tinyhttpd-0.1.0/Makefile 2001-04-21 17:03:39.000000000 -0500
70 +++ tinyhttpd-0.1.0-patched/Makefile 2007-07-02 10:29:41.000000000 -0500
75 - gcc -W -Wall -lsocket -lpthread -o httpd httpd.c
76 + $(CC) $(CFLAGS) $(LDFLAGS) -W -Wall -o httpd httpd.c