]> code.citadel.org Git - citadel.git/blobdiff - webcit/webserver.c
* finish migrating the hdr struct
[citadel.git] / webcit / webserver.c
index 31025cf2b347d881843a35e2696ff356f0c5a8fd..3bd25181843369611e13cba7cadc2c6602d9c2ba 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,7 +623,11 @@ void worker_entry(void)
        int ret;
        struct timeval tv;
        fd_set readset, tempset;
+       ParsedHttpHdrs Hdr;
 
+       memset(&Hdr, 0, sizeof(ParsedHttpHdrs));
+       Hdr.HR.eReqType = eGET;
+       http_new_modules(&Hdr); 
        tv.tv_sec = 0;
        tv.tv_usec = 10000;
        FD_ZERO(&readset);
@@ -668,6 +676,7 @@ void worker_entry(void)
                        end_critical_section(S_SHUTDOWN);
                        if (shutdown == 1)
                        {/* we're the one to cleanup the mess. */
+                               http_destroy_modules(&Hdr);
                                lprintf(2, "I'm master shutdown: tagging sessions to be killed.\n");
                                shutdown_sessions();
                                lprintf(2, "master shutdown: waiting for others\n");
@@ -718,9 +727,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 +742,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);
 }