00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00028 #define _GNU_SOURCE
00029
00030 #include <stdio.h>
00031 #include <stdlib.h>
00032 #include <pthread.h>
00033 #include <string.h>
00034 #include <unistd.h>
00035 #include <syslog.h>
00036 #include <signal.h>
00037 #include <errno.h>
00038
00039 #include "httpd.h"
00040
00041 #include "../config.h"
00042 #include "common.h"
00043 #include "debug.h"
00044 #include "httpd_thread.h"
00045
00049 void
00050 thread_httpd(void *args)
00051 {
00052 void **params;
00053 httpd *webserver;
00054 request *r;
00055
00056 params = (void **)args;
00057 webserver = *params;
00058 r = *(params + 1);
00059 free(params);
00060
00061 if (httpdReadRequest(webserver, r) == 0) {
00062
00063
00064
00065 debug(LOG_DEBUG, "Processing request from %s", r->clientAddr);
00066 debug(LOG_DEBUG, "Calling httpdProcessRequest() for %s", r->clientAddr);
00067 httpdProcessRequest(webserver, r);
00068 debug(LOG_DEBUG, "Returned from httpdProcessRequest() for %s", r->clientAddr);
00069 }
00070 else {
00071 debug(LOG_DEBUG, "No valid request received from %s", r->clientAddr);
00072 }
00073 debug(LOG_DEBUG, "Closing connection with %s", r->clientAddr);
00074 httpdEndRequest(r);
00075 }