)
{
StrBuf *Buf;
- StrBuf *Data;
+ StrBuf *Data = NULL;
const char *bptr;
int Done = 0;
char from[128] = "";
}
}
case 2:
- Data = NewStrBufPlain(NULL, msg4_content_length * 2);
+ if (Data == NULL)
+ Data = NewStrBufPlain(NULL, msg4_content_length * 2);
if (msg4_content_length > 0) {
StrBuf_ServGetBLOBBuffered(Data, msg4_content_length);
phase ++;
which_kind,
CallBack,
calv);
- FreeStrBuf (&Data);
}
+ FreeStrBuf (&Data);
icalmemory_free_ring();
}
if (Args == NULL) /* whe're not that picky about params... TODO: this will spoil '&' in filenames.*/
Args = strchr(ChrPtr(Hdr->ReqLine), '&');
if (Args != NULL) {
+ Args ++; /* skip the ? */
Hdr->PlainArgs = NewStrBufPlain(
Args,
StrLength(Hdr->ReqLine) -
pch ++;
StrBufCutLeft(Line, pch - pchs);
StrBufAppendBuf(LastLine, Line, 0);
+
FreeStrBuf(&Line);
continue;
}
session_attach_modules(TheSession);
session_loop(); /* do transaction */
+
+
+ /* How long did this transaction take? */
+ gettimeofday(&tx_finish, NULL);
+
+ lprintf(9, "Transaction [%s] completed in %ld.%06ld seconds.\n",
+ ChrPtr(Hdr.this_page),
+ ((tx_finish.tv_sec*1000000 + tx_finish.tv_usec) - (tx_start.tv_sec*1000000 + tx_start.tv_usec)) / 1000000,
+ ((tx_finish.tv_sec*1000000 + tx_finish.tv_usec) - (tx_start.tv_sec*1000000 + tx_start.tv_usec)) % 1000000
+ );
+
session_detach_modules(TheSession);
TheSession->Hdr = NULL;
pthread_mutex_unlock(&TheSession->SessionMutex); /* unbind */
+
+
+ http_destroy_modules(&Hdr);
/* TODO
FreeStrBuf(&c_username);
FreeStrBuf(&c_httpauth_pass);
*/
/* Free the request buffer */
- ///DeleteHash(&HTTPHeaders);
///FreeStrBuf(&ReqLine);
- /* How long did this transaction take? */
- gettimeofday(&tx_finish, NULL);
-
- lprintf(9, "Transaction completed in %ld.%06ld seconds.\n",
- ((tx_finish.tv_sec*1000000 + tx_finish.tv_usec) - (tx_start.tv_sec*1000000 + tx_start.tv_usec)) / 1000000,
- ((tx_finish.tv_sec*1000000 + tx_finish.tv_usec) - (tx_start.tv_sec*1000000 + tx_start.tv_usec)) % 1000000
- );
}
void tmplput_nonce(StrBuf *Target, WCTemplputParams *TP)
WebcitAddUrlHandler(HKEY("blank"), blank_page, ANONYMOUS|BOGUS);
- WebcitAddUrlHandler(HKEY("blank"), blank_page, URLNAMESPACE);
+ WebcitAddUrlHandler(HKEY("webcit"), blank_page, URLNAMESPACE);
}
-//FreeStrBuf(&WCC->this_page);
+
+
+void
+HttpDestroyModule_CONTEXT
+(ParsedHttpHdrs *httpreq)
+{
+ FreeStrBuf(&httpreq->ReqLine);
+ FreeStrBuf(&httpreq->ReadBuf);
+ FreeStrBuf(&httpreq->PlainArgs);
+ FreeStrBuf(&httpreq->this_page);
+ DeleteHash(&httpreq->HTTPHeaders);
+
+}
SESS_DETACH_FUNCS=`grep SessionDetachModule_ *.c |sed "s;.*:;;" |sort -u`
SESS_DESTROY_FUNCS=`grep SessionDestroyModule_ *.c |sed "s;.*:;;" |sort -u`
+HTTP_DESTROY_FUNCS=`grep HttpDestroyModule_ *.c |sed "s;.*:;;" |sort -u`
+
#SESS_NEW_FUNCS=`grep SessionNewModule_ *.c |sed "s;.*:;;" |sort -u`
void session_detach_modules (wcsession *sess);
void session_destroy_modules (wcsession **sess);
+void http_destroy_modules (ParsedHttpHdrs *httpreq);
+
/*
done
+cat <<EOF >>$C_FILE
+ free((*sess));
+ (*sess) = NULL;
+}
+
+
+EOF
+
+
+#********************************************************************************
+# DESTROY-Httprequest module logic.
+#********************************************************************************
+cat <<EOF >> $C_FILE
+
+void http_destroy_modules (ParsedHttpHdrs *httpreq)
+{
+EOF
+
+for HOOK in $HTTP_DESTROY_FUNCS; do
+HOOKNAME=`echo $HOOK |sed "s;HttpDestroyModule_;;"`
+# Add this entry point to the .c file
+cat <<EOF >> $C_FILE
+#ifdef DBG_PRINNT_HOOKS_AT_START
+ lprintf (CTDL_INFO, "Destructing $HOOKNAME\n");
+#endif
+ $HOOK(httpreq);
+EOF
+# Add this entry point to the .h file
+cat <<EOF >> $H_FILE
+extern void $HOOK(ParsedHttpHdrs *httpreq);
+EOF
+done
cat <<EOF >>$C_FILE
- free((*sess));
- (*sess) = NULL;
}
-
EOF
+
+
+
+
+
cat <<EOF >> $H_FILE
#endif /* MODULES_INIT_H */
wprintf(_("This server is already serving its maximum number of users and cannot accept any additional logins at this time. Please try again later or contact your system administrator."));
end_burst();
end_webcit_session();
+ FreeStrBuf(&Buf);
return 1;
}
hprintf("Content-type: text/plain; charset=utf-8\r\n");
end_burst();
end_webcit_session();
+ FreeStrBuf(&Buf);
return 1;
}
if (WCC->serv_info->serv_rev_level < MINIMUM_CIT_VERSION) {
hprintf("Content-type: text/plain; charset=utf-8\r\n");
end_burst();
end_webcit_session();
+ FreeStrBuf(&Buf);
return 1;
}
+ FreeStrBuf(&Buf);
}
return 0;
}
fd = open(what, O_RDONLY);
if (fd <= 0) {
- lprintf(9, "output_static('%s') -- NOT FOUND --\n", what);
+ lprintf(9, "output_static('%s') [%s] -- NOT FOUND --\n", what, ChrPtr(WC->Hdr->this_page));
hprintf("HTTP/1.1 404 %s\r\n", strerror(errno));
hprintf("Content-Type: text/plain\r\n");
wprintf("Cannot open %s: %s\r\n", what, strerror(errno));
{
char dirname[PATH_MAX];
char reldir[PATH_MAX];
- StrBuf *FileName;
- StrBuf *Tag;
- StrBuf *Dir;
- StrBuf *WebDir;
- StrBuf *OneWebName;
+ StrBuf *FileName = NULL;
+ StrBuf *Dir = NULL;
+ StrBuf *WebDir = NULL;
+ StrBuf *OneWebName = NULL;
DIR *filedir = NULL;
struct dirent d;
struct dirent *filedir_entry;
int d_namelen;
int d_without_ext;
- Dir = NewStrBufPlain(DirName, -1);
- WebDir = NewStrBufPlain(RelDir, -1);
- OneWebName = NewStrBuf();
filedir = opendir (DirName);
if (filedir == NULL) {
- FreeStrBuf(&Dir);
return 0;
}
- FileName = NewStrBuf();
- Tag = NewStrBuf();
- while ((readdir_r(filedir, &d, &filedir_entry) == 0) &&
+ Dir = NewStrBufPlain(DirName, -1);
+ WebDir = NewStrBufPlain(RelDir, -1);
+ OneWebName = NewStrBuf();
+
+ while ((readdir_r(filedir, &d, &filedir_entry) == 0) &&
(filedir_entry != NULL))
{
char *PStart;
StrBufAppendBufPlain(OneWebName, filedir_entry->d_name, d_namelen, 0);
Put(DirList, SKEY(OneWebName), FileName, HFreeStrBuf);
- printf("[%s | %s] \n", ChrPtr(OneWebName), ChrPtr(FileName));
+/* printf("[%s | %s] \n", ChrPtr(OneWebName), ChrPtr(FileName));*/
break;
default:
break;
}
closedir(filedir);
- FreeStrBuf(&FileName);
- FreeStrBuf(&Tag);
FreeStrBuf(&Dir);
+ FreeStrBuf(&WebDir);
FreeStrBuf(&OneWebName);
return 1;
}
Msg = (message_summary*) vMsg;
display_task(Msg, 0);
}
+ DeleteHashPos(&at);
}
if (calendar_summary_view() < 1) {
Msg = (message_summary*) vMsg;
load_calendar_item(Msg, 0, &c);
}
+ DeleteHashPos(&at);
}
if (calendar_summary_view() < 1) {
wprintf("<i>");