* move serv_info into the session, here we can control its de/allocation the right...
[citadel.git] / webcit / groupdav_main.c
index 19b060c13eca53c369e064eac0a20f9c148a4343..6a7f8beacada8e943b9860e97afbeab0b919e0e6 100644 (file)
@@ -22,7 +22,7 @@ void groupdav_common_headers(void) {
        hprintf(
                "Server: %s / %s\r\n"
                "Connection: close\r\n",
-               PACKAGE_STRING, ChrPtr(serv_info.serv_software)
+               PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software)
        );
 }
 
@@ -92,6 +92,7 @@ void groupdav_main(HashList *HTTPHeaders,
                   StrBuf *dav_content,
                   int Offset
 ) {
+       wcsession *WCC = WC;
        void *vLine;
        char dav_ifmatch[256];
        int dav_depth;
@@ -101,11 +102,10 @@ void groupdav_main(HashList *HTTPHeaders,
        strcpy(dav_ifmatch, "");
        dav_depth = 0;
 
-       if (IsEmptyStr(WC->http_host) &&
+       if ((StrLength(WCC->http_host) == 0) &&
            GetHash(HTTPHeaders, HKEY("HOST"), &vLine) && 
            (vLine != NULL)) {
-               safestrncpy(WC->http_host, ChrPtr((StrBuf*)vLine),
-                           sizeof WC->http_host);
+               WCC->http_host = (StrBuf*)vLine;
        }
        if (GetHash(HTTPHeaders, HKEY("IF-MATCH"), &vLine) && 
            (vLine != NULL)) {
@@ -129,7 +129,7 @@ void groupdav_main(HashList *HTTPHeaders,
                hprintf("HTTP/1.1 401 Unauthorized\r\n");
                groupdav_common_headers();
                hprintf("WWW-Authenticate: Basic realm=\"%s\"\r\n",
-                       ChrPtr(serv_info.serv_humannode));
+                       ChrPtr(WCC->serv_info->serv_humannode));
                hprintf("Content-Length: 0\r\n");
                end_burst();
                return;
@@ -243,9 +243,11 @@ void groupdav_main(HashList *HTTPHeaders,
  * Output our host prefix for globally absolute URL's.
  */  
 void groupdav_identify_host(void) {
-       if (!IsEmptyStr(WC->http_host)) {
+       wcsession *WCC = WC;
+
+       if (StrLength(WCC->http_host)!=0) {
                wprintf("%s://%s",
                        (is_https ? "https" : "http"),
-                       WC->http_host);
+                       ChrPtr(WCC->http_host));
        }
 }