]> code.citadel.org Git - citadel.git/blobdiff - webcit/webserver.c
* start moving the hdr struct up, and add detach callback. Unfinished.
[citadel.git] / webcit / webserver.c
index 31025cf2b347d881843a35e2696ff356f0c5a8fd..f72910f114db0e835f9f79a76bb1301ab064f31f 100644 (file)
@@ -28,7 +28,7 @@ int follow_xff = 0;           /* Follow X-Forwarded-For: header */
 int home_specified = 0;                /* did the user specify a homedir? */
 int time_to_die = 0;            /* Nonzero if server is shutting down */
 int DisableGzip = 0;
-extern void *context_loop(int*);
+extern void *context_loop(ParsedHttpHdrs *Hdr);
 extern void *housekeeping_loop(void);
 extern pthread_mutex_t SessionListMutex;
 extern pthread_key_t MyConKey;
@@ -262,6 +262,7 @@ extern int LoadTemplates;
 extern HashList *HandlerHash;
 
 
+
 void
 webcit_calc_dirs_n_files(int relh, const char *basedir, int home, char *webcitdir, char *relhome)
 {
@@ -286,6 +287,9 @@ webcit_calc_dirs_n_files(int relh, const char *basedir, int home, char *webcitdi
        COMPUTE_DIRECTORY(static_icon_dir);
        basedir=WWWDIR "/static.local";
        COMPUTE_DIRECTORY(static_local_dir);
+       StripSlashes(static_dir, 1);
+       StripSlashes(static_icon_dir, 1);
+       StripSlashes(static_local_dir, 1);
 
        snprintf(file_crpt_file_key,
                 sizeof file_crpt_file_key, 
@@ -619,6 +623,10 @@ void worker_entry(void)
        int ret;
        struct timeval tv;
        fd_set readset, tempset;
+       ParsedHttpHdrs Hdr;
+
+       memset(&Hdr, 0, sizeof(ParsedHttpHdrs));
+       Hdr.HR.eReqType = eGET;
 
        tv.tv_sec = 0;
        tv.tv_usec = 10000;
@@ -718,9 +726,6 @@ void worker_entry(void)
 #endif
 
                        if (fail_this_transaction == 0) {
-                               ParsedHttpHdrs Hdr;
-                               memset(&Hdr, 0, sizeof(ParsedHttpHdrs));
-                               Hdr.HR.eReqType = eGET;
                                Hdr.http_sock = ssock;
 
                                /* Perform an HTTP transaction... */
@@ -736,12 +741,15 @@ void worker_entry(void)
                                /* ...and close the socket. */
                                if (Hdr.http_sock > 0)
                                        lingering_close(ssock);
+                               http_detach_modules(&Hdr);
+
                        }
 
                }
 
        } while (!time_to_die);
 
+       http_destroy_modules(&Hdr);
        lprintf (1, "bye\n");
        pthread_exit(NULL);
 }