]> code.citadel.org Git - citadel.git/commitdiff
* Don't tell browsers not to cache static documents
authorMichael Hampton <io_error@uncensored.citadel.org>
Sat, 28 Jun 2003 03:52:51 +0000 (03:52 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Sat, 28 Jun 2003 03:52:51 +0000 (03:52 +0000)
webcit/ChangeLog
webcit/calendar.c
webcit/webcit.c
webcit/webcit.h

index 04bf6c368029a2ccdbe2ee662803df02dac05212..c60279867b529e5e2fee7250b49b5f435946f078 100644 (file)
@@ -1,4 +1,7 @@
 $Log$
+Revision 500.6  2003/06/28 03:52:51  error
+* Don't tell browsers not to cache static documents
+
 Revision 500.5  2003/06/28 03:35:23  error
 * roomops.c: Display one less floor in the first column in romlist view
 
@@ -1507,4 +1510,3 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
-
index 62b3db45c1785bc88512e20061b835d2992390e9..a52c9a0573358e1b38080f1ed547154c962cd354 100644 (file)
@@ -911,7 +911,7 @@ void do_freebusy(char *req) {
        }
 
        fb = read_server_text();
-       http_transmit_thing(fb, strlen(fb), "text/calendar");
+       http_transmit_thing(fb, strlen(fb), "text/calendar", 0);
        free(fb);
 }
 
index d8182dba17f83dc394426e3f3ec1800f5f4a8112..b5b9e18ce302bf6af09d79e32407c6539572ca8e 100644 (file)
@@ -276,8 +276,9 @@ void urlescputs(char *strbuf)
  * 3 = HTTP and HTML headers, but no room banner
  *
  * Bit 2: Set to 1 to auto-refresh page every 30 seconds
- *
  * Bit 3: suppress check for express messages
+ * Bit 4: Allow browser to cache this document
+ *
  */
 void output_headers(int controlcode)
 {
@@ -285,11 +286,13 @@ void output_headers(int controlcode)
        int print_standard_html_head = 0;
        int refresh30 = 0;
        int suppress_check = 0;
+       int cache = 0;
        char httpnow[SIZ];
        static int pageseq = 0;
        print_standard_html_head        =       controlcode & 0x03;
        refresh30                       =       ((controlcode & 0x04) >> 2);
        suppress_check                  =       ((controlcode & 0x08) >> 3);
+       cache                           =       ((controlcode & 0x10) >> 4);
 
        wprintf("HTTP/1.0 200 OK\n");
 
@@ -299,10 +302,11 @@ void output_headers(int controlcode)
                wprintf("Content-type: text/html\n"
                        "Server: %s\n", SERVER
                );
-               wprintf("Connection: close\n"
-                       "Pragma: no-cache\n"
-                       "Cache-Control: no-store\n"
-               );
+               if (!cache)
+                       wprintf("Connection: close\n"
+                               "Pragma: no-cache\n"
+                               "Cache-Control: no-store\n"
+                       );
        }
 
        stuff_to_cookie(cookie, WC->wc_session, WC->wc_username,
@@ -396,8 +400,9 @@ void check_for_express_messages()
 /* 
  * Output a piece of content to the web browser
  */
-void http_transmit_thing(char *thing, size_t length, char *content_type) {
-       output_headers(0);
+void http_transmit_thing(char *thing, size_t length, char *content_type,
+                        int is_static) {
+       output_headers(is_static ? 0x10 : 0x00);
        wprintf("Content-type: %s\n"
                "Content-length: %ld\n"
                "Server: %s\n"
@@ -463,7 +468,7 @@ void output_static(char *what)
                fread(bigbuffer, bytes, 1, fp);
                fclose(fp);
 
-               http_transmit_thing(bigbuffer, (size_t)bytes, content_type);
+               http_transmit_thing(bigbuffer, (size_t)bytes, content_type, 1);
                free(bigbuffer);
        }
        if (!strcasecmp(bstr("force_close_session"), "yes")) {
@@ -494,7 +499,7 @@ void output_image()
                serv_gets(buf);
 
                /* Write it to the browser */
-               http_transmit_thing(xferbuf, (size_t)bytes, "image/gif");
+               http_transmit_thing(xferbuf, (size_t)bytes, "image/gif", 0);
                free(xferbuf);
 
        } else {
@@ -539,7 +544,7 @@ void output_mimepart()
                read_server_binary(content, bytes);
                serv_puts("CLOS");
                serv_gets(buf);
-               http_transmit_thing(content, bytes, content_type);
+               http_transmit_thing(content, bytes, content_type, 0);
                free(content);
        } else {
                wprintf("HTTP/1.0 404 %s\n", &buf[4]);
index 96e76a0debe9dbe1df1ce7c7aa49850a419d59ed..e722af7cf3685b66d34f388bf434aeb8a59688f6 100644 (file)
@@ -418,5 +418,6 @@ char *read_server_text(void);
 int goto_config_room(void);
 long locate_user_vcard(char *username, long usernum);
 void sleeeeeeeeeep(int);
-void http_transmit_thing(char *thing, size_t length, char *content_type);
+void http_transmit_thing(char *thing, size_t length, char *content_type,
+                        int is_static);
 void unescape_input(char *buf);