]> code.citadel.org Git - citadel.git/blobdiff - webcit/webcit.c
* merge in much of the dav_rework branch: (the drift was becoming to big, no function...
[citadel.git] / webcit / webcit.c
index 279fc7dcff5bccbd8be8c2b13b0f30db9f33151d..5912de4f753334abbe38797b15e278c455d48eac 100644 (file)
 #include "webserver.h"
 
 
-/*
- * String to unset the cookie.
- * Any date "in the past" will work, so I chose my birthday, right down to
- * the exact minute.  :)
- */
-static char *unset = "; expires=28-May-1971 18:10:00 GMT";
 StrBuf *csslocal = NULL;
 HashList *HandlerHash = NULL;
 
@@ -27,8 +21,8 @@ void DeleteWebcitHandler(void *vHandler)
 {
        WebcitHandler *Handler = (WebcitHandler*) vHandler;
        FreeStrBuf(&Handler->Name);
+       FreeStrBuf(&Handler->DisplayName);
        free (Handler);
-
 }
 
 void WebcitAddUrlHandler(const char * UrlString, long UrlSLen, 
@@ -118,7 +112,6 @@ void output_headers(        int do_httpheaders,     /* 1 = output HTTP headers
                        int cache               /* 1 = allow browser to cache this page             */
 ) {
        wcsession *WCC = WC;
-       char cookie[1024];
        char httpnow[128];
 
        hprintf("HTTP/1.1 200 OK\n");
@@ -159,25 +152,7 @@ void output_headers(       int do_httpheaders,     /* 1 = output HTTP headers
                );
        }
 
-       if (cache < 2) {
-
-               stuff_to_cookie(cookie, 1024, 
-                               WCC->wc_session,
-                               WCC->wc_username,
-                               WCC->wc_password,
-                               WCC->wc_roomname,
-                               get_selected_language()
-                       );
-               
-               if (unset_cookies) {
-                       hprintf("Set-cookie: webcit=%s; path=/\r\n", unset);
-               } else {
-                       hprintf("Set-cookie: webcit=%s; path=/\r\n", cookie);
-                       if (server_cookie != NULL) {
-                               hprintf("%s\n", server_cookie);
-                       }
-               }
-       }
+       if (cache < 2) stuff_to_cookie(unset_cookies);
 
        if (do_htmlhead) {
                begin_burst();
@@ -561,7 +536,7 @@ void ParseREST_URL(void)
                if (Floors != NULL)
                {
                        if (GetHash(Floors, SKEY(pFloor), &vFloor))
-                               WCC->CurrentFloor = (floor*) vFloor;
+                               WCC->CurrentFloor = (Floor*) vFloor;
                }
        }
 }
@@ -612,7 +587,7 @@ void session_loop(void)
                if (ibstr("nonce") != WCC->nonce) {
                        lprintf(9, "Ignoring request with mismatched nonce.\n");
                        hprintf("HTTP/1.1 404 Security check failed\r\n");
-                       hprintf("Content-Type: text/plain\r\n\r\n");
+                       hprintf("Content-Type: text/plain\r\n");
                        begin_burst();
                        wc_printf("Security check failed.\r\n");
                        end_burst();
@@ -678,11 +653,11 @@ void session_loop(void)
         * If we aren't in any room yet, but we have cookie data telling us where we're
         * supposed to be, and 'gotofirst' was not specified, then go there.
         */
-       else if ( (StrLength(WCC->wc_roomname) == 0) && ( (StrLength(WCC->Hdr->c_roomname) > 0) )) {
+       else if ( (StrLength(WCC->CurRoom.name) == 0) && ( (StrLength(WCC->Hdr->c_roomname) > 0) )) {
                int ret;
 
                lprintf(9, "We are in '%s' but cookie indicates '%s', going there...\n",
-                       ChrPtr(WCC->wc_roomname),
+                       ChrPtr(WCC->CurRoom.name),
                        ChrPtr(WCC->Hdr->c_roomname)
                );
                ret = gotoroom(WCC->Hdr->c_roomname);   /* do quietly to avoid session output! */
@@ -813,7 +788,7 @@ InitModule_WEBCIT
        snprintf(dir, SIZ, "%s/webcit.css", static_local_dir);
        if (!access(dir, R_OK)) {
                lprintf(9, "Using local Stylesheet [%s]\n", dir);
-               csslocal = NewStrBufPlain(HKEY("<link href=\"static.local/webcit.css\" rel=\"stylesheet\" type=\"text/css\">"));
+               csslocal = NewStrBufPlain(HKEY("<link href=\"static.local/webcit.css\" rel=\"stylesheet\" type=\"text/css\" />"));
        }
        else
                lprintf(9, "No Site-local Stylesheet [%s] installed. \n", dir);