$Log$
+Revision 528.43 2005/02/05 08:36:13 ajc
+* Added an everything-buffering thingi so we can do Content-length:
+
Revision 528.42 2005/02/05 04:16:01 ajc
* Cleanup of new message range view-o-matic
* GroupDAV GET operations now only send the Content-type: and Date:
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
char httpauth_pass[SIZ];
strcpy(httpauth_string, "");
- strcpy(httpauth_user, "");
- strcpy(httpauth_pass, "");
+ strcpy(httpauth_user, DEFAULT_HTTPAUTH_USER);
+ strcpy(httpauth_pass, DEFAULT_HTTPAUTH_PASS);
/*
* Find out what it is that the web browser is asking for
*/
wprintf("HTTP/1.0 207 Multi-Status\n");
groupdav_common_headers();
- wprintf("Content-type: text/xml\n"
- "\n"
- "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
+ wprintf("Content-type: text/xml\n");
+
+ begin_burst();
+
+ wprintf("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<D:multistatus xmlns:D=\"DAV:\">\n"
);
wprintf(" </D:response>\n");
}
}
- wprintf("</D:multistatus>\n");
+ wprintf("</D:multistatus>\n\n\n");
+
+ end_burst();
}
*/
wprintf("HTTP/1.0 207 Multi-Status\n");
groupdav_common_headers();
- wprintf("Content-type: text/xml\n"
- "\n"
- "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
+ wprintf("Content-type: text/xml\n");
+
+ begin_burst();
+
+ wprintf("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<D:multistatus xmlns:D=\"DAV:\">\n"
);
}
}
- wprintf("</D:multistatus>\n");
+ wprintf("</D:multistatus>\n\n\n");
+ end_burst();
+
if (msgs != NULL) {
free(msgs);
}
strcpy(c_password, "");
strcpy(c_roomname, "");
strcpy(c_httpauth_string, "");
- strcpy(c_httpauth_user, "");
- strcpy(c_httpauth_pass, "");
+ strcpy(c_httpauth_user, DEFAULT_HTTPAUTH_USER);
+ strcpy(c_httpauth_pass, DEFAULT_HTTPAUTH_PASS);
WC->upload_length = 0;
WC->upload = NULL;
int ctdl_pid; /* Session ID on the Citadel server */
char httpauth_user[SIZ]; /* only for GroupDAV sessions */
char httpauth_pass[SIZ]; /* only for GroupDAV sessions */
+
+ size_t burst_len;
+ char *burst;
};
#define extract(dest,source,parmnum) extract_token(dest,source,parmnum,'|')
void client_write_ssl(char *buf, int nbytes);
#endif
+void begin_burst(void);
+void end_burst(void);
+
extern char *ascmonths[];
#define VIEW_TASKS 4 /* Tasks view */
#define VIEW_NOTES 5 /* Notes view */
+
+/* These should be empty, but we have them for testing */
+#define DEFAULT_HTTPAUTH_USER ""
+#define DEFAULT_HTTPAUTH_PASS ""
}
len = len + rlen;
}
- /* write(2, buf, bytes); FIXME */
+ write(2, buf, bytes); /* FIXME */
return (1);
}
ssize_t client_write(const void *buf, size_t count) {
+
+ if (WC->burst != NULL) {
+ WC->burst = realloc(WC->burst, (WC->burst_len + count + 2));
+ memcpy(&WC->burst[WC->burst_len], buf, count);
+ WC->burst_len += count;
+ return(count);
+ }
+
#ifdef HAVE_OPENSSL
if (is_https) {
client_write_ssl((char *)buf, count);
return(count);
}
#endif
- /* write(2, buf, count); FIXME */
+ write(2, buf, count); /* FIXME */
return(write(WC->http_sock, buf, count));
}
+void begin_burst(void) {
+ if (WC->burst != NULL) {
+ free(WC->burst);
+ WC->burst = NULL;
+ }
+ WC->burst_len = 0;
+ WC->burst = malloc(SIZ);
+}
+
+void end_burst(void) {
+ size_t the_len;
+ char *the_data;
+
+ the_len = WC->burst_len;
+ the_data = WC->burst;
+
+ WC->burst_len = 0;
+ WC->burst = NULL;
+
+ wprintf("Content-length: %d\n\n", the_len);
+ client_write(the_data, the_len);
+ free(the_data);
+}
+
+
+
/*
* Read data from the client socket with default timeout.
* (This is implemented in terms of client_read_to() and could be