* Discovered that Prototype makes it easy to auto-refresh, so I switched
authorArt Cancro <ajc@citadel.org>
Sun, 18 Sep 2005 16:00:15 +0000 (16:00 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 18 Sep 2005 16:00:15 +0000 (16:00 +0000)
  the wholist and summary refresh code to use that API instead of doing it
  myself.
* Switched all HTTP/1.0 HTTP/1.1.  I don't know if this is going to break
  anything (it shouldn't -- I'm not knowingly depending upon any features
  of HTTP/1.0), but it *fixes* the problem of Internet Exploder caching
  pages even when it's told not to.

webcit/ChangeLog
webcit/calendar.c
webcit/context_loop.c
webcit/groupdav_propfind.c
webcit/rss.c
webcit/summary.c
webcit/webcit.c
webcit/who.c

index 6d9cee370c9cff6172e7cd635c040f175ff64e9d..0535767cdfbfe776443e74b7f418258a0aa93542 100644 (file)
@@ -1,4 +1,13 @@
 $Log$
+Revision 625.14  2005/09/18 16:00:14  ajc
+* Discovered that Prototype makes it easy to auto-refresh, so I switched
+  the wholist and summary refresh code to use that API instead of doing it
+  myself.
+* Switched all HTTP/1.0 HTTP/1.1.  I don't know if this is going to break
+  anything (it shouldn't -- I'm not knowingly depending upon any features
+  of HTTP/1.0), but it *fixes* the problem of Internet Exploder caching
+  pages even when it's told not to.
+
 Revision 625.13  2005/09/18 15:02:29  ajc
 * summary.c: summary screen is now updated using ajax instead of refreshing
   the whole page.  Not only does this look cleaner, but it also has the
@@ -3014,4 +3023,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 effd9aea1b51c4586d9a452447774b699fcbf846..7016f54560f3765acaaae4a91b08a5e7282f3700 100644 (file)
@@ -924,7 +924,7 @@ void do_freebusy(char *req) {
        serv_getln(buf, sizeof buf);
 
        if (buf[0] != '1') {
-               wprintf("HTTP/1.0 404 %s\n", &buf[4]);
+               wprintf("HTTP/1.1 404 %s\n", &buf[4]);
                output_headers(0, 0, 0, 0, 0, 0);
                wprintf("Content-Type: text/plain\r\n");
                wprintf("\r\n");
index dec43c579753ab05158fba648d3ce1f736e0b8eb..a3541dd87cf56a15933d843e38ef4bb2bcbc19f1 100644 (file)
@@ -325,7 +325,7 @@ void context_loop(int sock)
         */
        if (!strncasecmp(buf, "/robots.txt", 11)) {
                strcpy(req->line, "GET /static/robots.txt"
-                               "?force_close_session=yes HTTP/1.0");
+                               "?force_close_session=yes HTTP/1.1");
        }
        else if (!strncasecmp(buf, "/favicon.ico", 12)) {
                strcpy(req->line, "GET /static/favicon.ico");
@@ -344,7 +344,7 @@ void context_loop(int sock)
                && (strncasecmp(buf, "/rss", 4))
                && (got_cookie == 0)) {
                strcpy(req->line, "GET /static/nocookies.html"
-                               "?force_close_session=yes HTTP/1.0");
+                               "?force_close_session=yes HTTP/1.1");
        }
 
        /*
index 382b5a411335b6280eb6c599367f116422012be2..80de45b8056e8bdc8515fc081391e116f19b56cd 100644 (file)
@@ -66,7 +66,7 @@ void groupdav_folder_list(void) {
         * Be rude.  Completely ignore the XML request and simply send them
         * everything we know about.  Let the client sort it out.
         */
-       wprintf("HTTP/1.0 207 Multi-Status\r\n");
+       wprintf("HTTP/1.1 207 Multi-Status\r\n");
        groupdav_common_headers();
        wprintf("Date: %s\r\n", datestring);
        wprintf("Content-type: text/xml\r\n");
@@ -217,7 +217,7 @@ void groupdav_propfind(char *dav_pathname) {
                 * everything we know about (which is going to simply be the ETag and
                 * nothing else).  Let the client-side parser sort it out.
                 */
-               wprintf("HTTP/1.0 207 Multi-Status\r\n");
+               wprintf("HTTP/1.1 207 Multi-Status\r\n");
                groupdav_common_headers();
                wprintf("Date: %s\r\n", datestring);
                wprintf("Content-type: text/xml\r\n");
@@ -262,7 +262,7 @@ void groupdav_propfind(char *dav_pathname) {
         * everything we know about (which is going to simply be the ETag and
         * nothing else).  Let the client-side parser sort it out.
         */
-       wprintf("HTTP/1.0 207 Multi-Status\r\n");
+       wprintf("HTTP/1.1 207 Multi-Status\r\n");
        groupdav_common_headers();
        wprintf("Date: %s\r\n", datestring);
        wprintf("Content-type: text/xml\r\n");
index 88bbec2b4fdeadbfd5388dcd2f3255dba53f6c22..2cf83c94e6720c05f293cb1c9aa259c8c661c88a 100644 (file)
@@ -63,7 +63,7 @@ void display_rss(const char *roomname)
 
        if (gotoroom(roomname)) {
                lprintf(3, "RSS: Can't goto requested room\n");
-               wprintf("HTTP/1.0 404 Not Found\r\n");
+               wprintf("HTTP/1.1 404 Not Found\r\n");
                wprintf("Content-Type: text/html\r\n");
                wprintf("\r\n");
                wprintf("Error retrieving RSS feed: couldn't find room\n");
@@ -73,7 +73,7 @@ void display_rss(const char *roomname)
        nummsgs = load_msg_ptrs("MSGS LAST|15", 0);
        if (nummsgs == 0) {
                lprintf(3, "RSS: No messages found\n");
-               wprintf("HTTP/1.0 404 Not Found\r\n");
+               wprintf("HTTP/1.1 404 Not Found\r\n");
                wprintf("Content-Type: text/html\r\n");
                wprintf("\r\n");
                wprintf(_("Error retrieving RSS feed: couldn't find messages\n"));
@@ -98,7 +98,7 @@ void display_rss(const char *roomname)
 
        if (if_modified_since > 0 && if_modified_since > now) {
                lprintf(3, "RSS: Feed not updated since the last time you looked\n");
-               wprintf("HTTP/1.0 304 Not Modified\r\n");
+               wprintf("HTTP/1.1 304 Not Modified\r\n");
                wprintf("Last-Modified: %s\r\n", date);
                now = time(NULL);
                gmtime_r(&now, &now_tm);
@@ -111,7 +111,7 @@ void display_rss(const char *roomname)
 
        /* Do RSS header */
        lprintf(3, "RSS: Yum yum! This feed is tasty!\n");
-       wprintf("HTTP/1.0 200 OK\r\n");
+       wprintf("HTTP/1.1 200 OK\r\n");
        wprintf("Last-Modified: %s\r\n", date);
 /*     if (*msgn) wprintf("ETag: %s\r\n\r\n", msgn); */
        wprintf("Content-Type: application/rss+xml\r\n");
index e22bfa1d928f4f7e80eec76e92f116677b3406a3..a8d97d283a45236b49801ced93f24375c84caa02 100644 (file)
@@ -297,10 +297,10 @@ void summary(void) {
        wprintf("</div>\n");
 
        wprintf(
-               "<script type=\"text/javascript\">                                                      \n"
-               " setInterval(\" new Ajax.Updater('content', '/summary_inner_div',                      "
-               "               {method: 'get', parameters: Math.random() });   \", 60000);             \n"
-               "</script>                                                                              \n"
+               "<script type=\"text/javascript\">                                      "
+               " new Ajax.PeriodicalUpdater('content', '/summary_inner_div',           "
+               "                            { method: 'get', frequency: 60 }  );       "
+               "</script>                                                              \n"
        );
 
        wDumpContent(1);
index 3b842d5a835ea1d7de1c377462e98d7649920570..82422c2c573fe8b8e2d5aec80c1baaf3c6cd201c 100644 (file)
@@ -342,7 +342,7 @@ void output_headers(        int do_httpheaders,     /* 1 = output HTTP headers
        char cookie[SIZ];
        char httpnow[SIZ];
 
-       wprintf("HTTP/1.0 200 OK\n");
+       wprintf("HTTP/1.1 200 OK\n");
        httpdate(httpnow, time(NULL));
 
        if (do_httpheaders) {
@@ -424,7 +424,7 @@ void output_headers(        int do_httpheaders,     /* 1 = output HTTP headers
  * Generic function to do an HTTP redirect.  Easy and fun.
  */
 void http_redirect(char *whichpage) {
-       wprintf("HTTP/1.0 302 Moved Temporarily\n");
+       wprintf("HTTP/1.1 302 Moved Temporarily\n");
        wprintf("Location: %s\r\n", whichpage);
        wprintf("URI: %s\r\n", whichpage);
        wprintf("Content-type: text/html; charset=utf-8\r\n\r\n");
@@ -509,7 +509,7 @@ void output_static(char *what)
        sprintf(buf, "static/%s", what);
        fp = fopen(buf, "rb");
        if (fp == NULL) {
-               wprintf("HTTP/1.0 404 %s\n", strerror(errno));
+               wprintf("HTTP/1.1 404 %s\n", strerror(errno));
                wprintf("Content-Type: text/plain\r\n");
                wprintf("\r\n");
                wprintf("Cannot open %s: %s\n", what, strerror(errno));
@@ -620,7 +620,7 @@ void output_mimepart()
                http_transmit_thing(content, bytes, content_type, 0);
                free(content);
        } else {
-               wprintf("HTTP/1.0 404 %s\n", &buf[4]);
+               wprintf("HTTP/1.1 404 %s\n", &buf[4]);
                output_headers(0, 0, 0, 0, 0, 0);
                wprintf("Content-Type: text/plain\r\n");
                wprintf("\r\n");
@@ -666,7 +666,7 @@ char *load_mimepart(long msgnum, char *partnum)
  */
 void convenience_page(char *titlebarcolor, char *titlebarmsg, char *messagetext)
 {
-       wprintf("HTTP/1.0 200 OK\n");
+       wprintf("HTTP/1.1 200 OK\n");
        output_headers(1, 1, 2, 0, 0, 0);
        wprintf("<div id=\"banner\">\n");
        wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#%s\"><TR><TD>", titlebarcolor);
@@ -748,7 +748,7 @@ void display_success(char *successmessage)
 /* This is probably temporary and should be revisited */
 void authorization_required(const char *message)
 {
-       wprintf("HTTP/1.0 401 Authorization Required\r\n");
+       wprintf("HTTP/1.1 401 Authorization Required\r\n");
        wprintf("WWW-Authenticate: Basic realm=\"\"\r\n", serv_info.serv_humannode);
        wprintf("Content-Type: text/html\r\n\r\n");
        wprintf("<h1>");
index 984fd4ac575fca185e016fff890386442351de1d..91fe3d5a01d90d4c2ac246ef2215105b361100d1 100644 (file)
@@ -168,22 +168,16 @@ void who(void)
        wprintf("</div>\n");
 
        /* JavaScript to make the ajax refresh happen:
-        * * See http://www.sergiopereira.com/articles/prototype.js.html for info on Ajax.Updater
-        * * It wants: 1. The div being updated
-        * *           2. The URL of the update source
-        * *           3. Other flags (such as the HTTP method)
-        *
-        * * setInterval() makes it auto-run this code every 30,000 milliseconds (30 seconds)
-        *
-        * The random number parameter forces b0rken MSIE to fetch a new page instead of going to
-        * its cache, even though it's been specifically told not to cache.
-        *
+        * See http://www.sergiopereira.com/articles/prototype.js.html for info on Ajax.PeriodicalUpdater
+        * It wants: 1. The div being updated
+        *           2. The URL of the update source
+        *           3. Other flags (such as the HTTP method and the refresh frequency)
         */
        wprintf(
-               "<script type=\"text/javascript\">                                                      \n"
-               " setInterval(\" new Ajax.Updater('fix_scrollbar_bug', '/who_inner_html',               "
-               "               {method: 'get', parameters: Math.random() });   \", 30000);             \n"
-               "</script>                                                                              \n"
+               "<script type=\"text/javascript\">                                      "
+               " new Ajax.PeriodicalUpdater('fix_scrollbar_bug', '/who_inner_html',    "
+               "                            { method: 'get', frequency: 30 }  );       "
+               "</script>                                                              \n"
        );
        wDumpContent(1);
 }