From dfa90f81f16fb3ebb119228d04d76b92dfb8db8c Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sun, 18 Sep 2005 16:00:15 +0000 Subject: [PATCH] * 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. --- webcit/ChangeLog | 10 +++++++++- webcit/calendar.c | 2 +- webcit/context_loop.c | 4 ++-- webcit/groupdav_propfind.c | 6 +++--- webcit/rss.c | 8 ++++---- webcit/summary.c | 8 ++++---- webcit/webcit.c | 12 ++++++------ webcit/who.c | 22 ++++++++-------------- 8 files changed, 37 insertions(+), 35 deletions(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 6d9cee370..0535767cd 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -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 1998-12-03 Nathan Bryant * webserver.c: warning fix - diff --git a/webcit/calendar.c b/webcit/calendar.c index effd9aea1..7016f5456 100644 --- a/webcit/calendar.c +++ b/webcit/calendar.c @@ -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"); diff --git a/webcit/context_loop.c b/webcit/context_loop.c index dec43c579..a3541dd87 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -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"); } /* diff --git a/webcit/groupdav_propfind.c b/webcit/groupdav_propfind.c index 382b5a411..80de45b80 100644 --- a/webcit/groupdav_propfind.c +++ b/webcit/groupdav_propfind.c @@ -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"); diff --git a/webcit/rss.c b/webcit/rss.c index 88bbec2b4..2cf83c94e 100644 --- a/webcit/rss.c +++ b/webcit/rss.c @@ -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"); diff --git a/webcit/summary.c b/webcit/summary.c index e22bfa1d9..a8d97d283 100644 --- a/webcit/summary.c +++ b/webcit/summary.c @@ -297,10 +297,10 @@ void summary(void) { wprintf("\n"); wprintf( - " \n" + " \n" ); wDumpContent(1); diff --git a/webcit/webcit.c b/webcit/webcit.c index 3b842d5a8..82422c2c5 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -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("
\n"); wprintf("
", 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("

"); diff --git a/webcit/who.c b/webcit/who.c index 984fd4ac5..91fe3d5a0 100644 --- a/webcit/who.c +++ b/webcit/who.c @@ -168,22 +168,16 @@ void who(void) wprintf("\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( - " \n" + " \n" ); wDumpContent(1); } -- 2.30.2