pthread_key_t MyConKey; /* TSD key for MySession() */
+
+void free_attachments(struct wcsession *sess) {
+ struct wc_attachment *att;
+
+ while (sess->first_attachment != NULL) {
+ att = sess->first_attachment;
+ sess->first_attachment = sess->first_attachment->next;
+ free(att->data);
+ free(att);
+ }
+}
+
+
void do_housekeeping(void)
{
struct wcsession *sptr, *ss, *session_to_kill;
/* Remove sessions flagged for kill */
if (sptr->killthis) {
+ lprintf(3, "Destroying session %d\n",
+ sptr->wc_session);
+
/* remove session from linked list */
if (sptr == SessionList) {
SessionList = SessionList->next;
if (session_to_kill->preferences != NULL) {
free(session_to_kill->preferences);
}
+ free_attachments(session_to_kill);
pthread_mutex_unlock(&session_to_kill->SessionMutex);
free(session_to_kill);
}
void housekeeping_loop(void)
{
while (1) {
- sleep(HOUSEKEEPING);
+ sleeeeeeeeeep(HOUSEKEEPING);
do_housekeeping();
}
}
* Generate a unique WebCit session ID (which is not the same thing as the
* Citadel session ID).
*
- * FIX ... ensure that session number is truly unique
+ * FIXME ... ensure that session number is truly unique
*
*/
int GenerateSessionID(void)
return(0);
}
}
+
return(0);
}
memset(hold, 0, sizeof(hold));
do {
if (req_gets(sock, buf, hold) < 0) return;
+
if (!strncasecmp(buf, "Cookie: webcit=", 15)) {
cookie_to_stuff(&buf[15], &desired_session,
NULL, NULL, NULL);
*/
if (!strncasecmp(buf, "GET ", 4)) strcpy(buf, &buf[4]);
else if (!strncasecmp(buf, "HEAD ", 5)) strcpy(buf, &buf[5]);
+ else if (!strncasecmp(buf, "POST ", 5)) strcpy(buf, &buf[5]);
if (buf[1]==' ') buf[1]=0;
/*