]> code.citadel.org Git - citadel.git/blobdiff - webcit/static.c
* add logging if auth-basic session connecting fails with weird conditions
[citadel.git] / webcit / static.c
index 4f9c8c8685eea506f75124155e09a2dc908e6efc..139cd32b481790d5b44173e58c26652bfaf3aaef 100644 (file)
@@ -46,6 +46,7 @@ void output_static(const char *what)
                lprintf(9, "output_static('%s') [%s]  -- NOT FOUND --\n", what, ChrPtr(WC->Hdr->this_page));
                hprintf("HTTP/1.1 404 %s\r\n", strerror(errno));
                hprintf("Content-Type: text/plain\r\n");
+               begin_burst();
                wprintf("Cannot open %s: %s\r\n", what, strerror(errno));
                end_burst();
        } else {
@@ -56,6 +57,7 @@ void output_static(const char *what)
                        lprintf(9, "output_static('%s')  -- FSTAT FAILED --\n", what);
                        hprintf("HTTP/1.1 404 %s\r\n", strerror(errno));
                        hprintf("Content-Type: text/plain\r\n");
+                       begin_burst();
                        wprintf("Cannot fstat %s: %s\n", what, strerror(errno));
                        end_burst();
                        return;
@@ -123,6 +125,16 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir)
 #endif
                d_without_ext = d_namelen;
 
+               if (filedir_entry->d_type == DT_UNKNOWN) {
+                       struct stat s;
+                       char path[PATH_MAX];
+                       snprintf(path, PATH_MAX, "%s/%s", 
+                               DirName, filedir_entry->d_name);
+                       if (stat(path, &s) == 0) {
+                               filedir_entry->d_type = IFTODT(s.st_mode);
+                       }
+               }
+
                if ((d_namelen > 1) && filedir_entry->d_name[d_namelen - 1] == '~')
                        continue; /* Ignore backup files... */
 
@@ -170,7 +182,7 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir)
                        StrBufAppendBufPlain(OneWebName, filedir_entry->d_name, d_namelen, 0);
 
                        Put(DirList, SKEY(OneWebName), FileName, HFreeStrBuf);
-/*                     printf("[%s | %s]  \n", ChrPtr(OneWebName), ChrPtr(FileName));*/
+                       /* lprintf(9, "[%s | %s]\n", ChrPtr(OneWebName), ChrPtr(FileName)); */
                        break;
                default:
                        break;