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.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
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
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
serv_getln(buf, sizeof buf);
if (buf[0] != '1') {
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");
output_headers(0, 0, 0, 0, 0, 0);
wprintf("Content-Type: text/plain\r\n");
wprintf("\r\n");
*/
if (!strncasecmp(buf, "/robots.txt", 11)) {
strcpy(req->line, "GET /static/robots.txt"
*/
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");
}
else if (!strncasecmp(buf, "/favicon.ico", 12)) {
strcpy(req->line, "GET /static/favicon.ico");
&& (strncasecmp(buf, "/rss", 4))
&& (got_cookie == 0)) {
strcpy(req->line, "GET /static/nocookies.html"
&& (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");
* Be rude. Completely ignore the XML request and simply send them
* everything we know about. Let the client sort it out.
*/
* 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");
groupdav_common_headers();
wprintf("Date: %s\r\n", datestring);
wprintf("Content-type: text/xml\r\n");
* everything we know about (which is going to simply be the ETag and
* nothing else). Let the client-side parser sort it out.
*/
* 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");
groupdav_common_headers();
wprintf("Date: %s\r\n", datestring);
wprintf("Content-type: text/xml\r\n");
* everything we know about (which is going to simply be the ETag and
* nothing else). Let the client-side parser sort it out.
*/
* 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");
groupdav_common_headers();
wprintf("Date: %s\r\n", datestring);
wprintf("Content-type: text/xml\r\n");
if (gotoroom(roomname)) {
lprintf(3, "RSS: Can't goto requested room\n");
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");
wprintf("Content-Type: text/html\r\n");
wprintf("\r\n");
wprintf("Error retrieving RSS feed: couldn't find room\n");
nummsgs = load_msg_ptrs("MSGS LAST|15", 0);
if (nummsgs == 0) {
lprintf(3, "RSS: No messages found\n");
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"));
wprintf("Content-Type: text/html\r\n");
wprintf("\r\n");
wprintf(_("Error retrieving RSS feed: couldn't find messages\n"));
if (if_modified_since > 0 && if_modified_since > now) {
lprintf(3, "RSS: Feed not updated since the last time you looked\n");
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);
wprintf("Last-Modified: %s\r\n", date);
now = time(NULL);
gmtime_r(&now, &now_tm);
/* Do RSS header */
lprintf(3, "RSS: Yum yum! This feed is tasty!\n");
/* 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");
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");
wprintf("</div>\n");
wprintf(
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"
char cookie[SIZ];
char httpnow[SIZ];
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) {
httpdate(httpnow, time(NULL));
if (do_httpheaders) {
* Generic function to do an HTTP redirect. Easy and fun.
*/
void http_redirect(char *whichpage) {
* 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");
wprintf("Location: %s\r\n", whichpage);
wprintf("URI: %s\r\n", whichpage);
wprintf("Content-type: text/html; charset=utf-8\r\n\r\n");
sprintf(buf, "static/%s", what);
fp = fopen(buf, "rb");
if (fp == NULL) {
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));
wprintf("Content-Type: text/plain\r\n");
wprintf("\r\n");
wprintf("Cannot open %s: %s\n", what, strerror(errno));
http_transmit_thing(content, bytes, content_type, 0);
free(content);
} else {
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");
output_headers(0, 0, 0, 0, 0, 0);
wprintf("Content-Type: text/plain\r\n");
wprintf("\r\n");
*/
void convenience_page(char *titlebarcolor, char *titlebarmsg, char *messagetext)
{
*/
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);
output_headers(1, 1, 2, 0, 0, 0);
wprintf("<div id=\"banner\">\n");
wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#%s\"><TR><TD>", titlebarcolor);
/* This is probably temporary and should be revisited */
void authorization_required(const char *message)
{
/* 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>");
wprintf("WWW-Authenticate: Basic realm=\"\"\r\n", serv_info.serv_humannode);
wprintf("Content-Type: text/html\r\n\r\n");
wprintf("<h1>");
wprintf("</div>\n");
/* JavaScript to make the ajax refresh happen:
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)
- "<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"