/* the following two values start at 1 because the initial parent thread counts as one. */
int num_threads_existing = 1; /* Number of worker threads which exist. */
int num_threads_executing = 1; /* Number of worker threads currently executing. */
+int verbose=0;
extern void session_loop(void);
void spawn_another_worker_thread(void);
&& (!strcasecmp(ChrPtr(Hdr->c_password), ChrPtr(sptr->wc_password)))
&& (sptr->killthis == 0)
) {
- syslog(LOG_DEBUG, "Matched a session with the same http-auth");
+ if (verbose)
+ syslog(LOG_DEBUG, "Matched a session with the same http-auth");
TheSession = sptr;
}
break;
if ( (Hdr->HR.desired_session != 0)
&& (sptr->wc_session == Hdr->HR.desired_session)
) {
- syslog(LOG_DEBUG, "Matched a session with the same cookie");
+ if (verbose)
+ syslog(LOG_DEBUG, "Matched a session with the same cookie");
TheSession = sptr;
}
break;
case NO_AUTH:
/* Any unbound session is a candidate */
if ( (sptr->wc_session == 0) && (sptr->inuse == 0) ) {
- syslog(LOG_DEBUG, "Reusing an unbound session");
+ if (verbose)
+ syslog(LOG_DEBUG, "Reusing an unbound session");
TheSession = sptr;
}
break;
StrBuf *NewLine = NewStrBuf();
Hdr->HR.DontNeedAuth = 1;
StrBufAppendPrintf(NewLine, "GET /landing?go=%s?failvisibly=1 HTTP/1.0", ChrPtr(Buf));
- syslog(LOG_DEBUG, "Replacing with: %s", ChrPtr(NewLine));
+ if (verbose) syslog(LOG_DEBUG, "Replacing with: %s", ChrPtr(NewLine));
return_value = ReadHttpSubject(Hdr, NewLine, Buf);
FreeStrBuf(&NewLine);
return return_value;
memset(pHdr, 0, sizeof(OneHttpHeader));
pHdr->Val = Line;
Put(Hdr->HTTPHeaders, HKEY("GET /"), pHdr, DestroyHttpHeaderHandler);
- syslog(LOG_DEBUG, "%s", ChrPtr(Line));
+ if (verbose || strstr(ChrPtr(Line), "sslg") == NULL)
+ syslog(LOG_DEBUG, "%s", ChrPtr(Line));
isbogus = ReadHttpSubject(Hdr, Line, HeaderName);
if (isbogus) break;
continue;
/* How long did this transaction take? */
gettimeofday(&tx_finish, NULL);
- syslog(LOG_DEBUG, "HTTP: 200 [%ld.%06ld] %s %s",
- ((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,
- ReqStrs[Hdr->HR.eReqType],
- ChrPtr(Hdr->this_page)
+ if (verbose)
+ syslog(LOG_DEBUG, "HTTP: 200 [%ld.%06ld] %s %s",
+ ((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,
+ ReqStrs[Hdr->HR.eReqType],
+ ChrPtr(Hdr->this_page)
);
session_detach_modules(Static);
session_destroy_modules(&Static);
* If a language was requested via a cookie, select that language now.
*/
if (StrLength(Hdr->c_language) > 0) {
- syslog(LOG_DEBUG, "Session cookie requests language '%s'", ChrPtr(Hdr->c_language));
+ if (verbose)
+ syslog(LOG_DEBUG, "Session cookie requests language '%s'", ChrPtr(Hdr->c_language));
set_selected_language(ChrPtr(Hdr->c_language));
go_selected_language();
}
/* How long did this transaction take? */
gettimeofday(&tx_finish, NULL);
- syslog(LOG_INFO, "HTTP: 200 [%ld.%06ld] %s %s",
- ((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,
- ReqStrs[Hdr->HR.eReqType],
- ChrPtr(Hdr->this_page)
- );
-
+ if (verbose || strstr(ChrPtr(Hdr->this_page), "sslg") == NULL) {
+ syslog(LOG_INFO, "HTTP: 200 [%ld.%06ld] %s %s",
+ ((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,
+ ReqStrs[Hdr->HR.eReqType],
+ ChrPtr(Hdr->this_page)
+ );
+ }
session_detach_modules(TheSession);
/* If *this* very transaction did not explicitly specify a session cookie,
void stuff_to_cookie(int unset_cookie);
extern int GetConnected(void);
-
+extern int verbose;
void PutRequestLocalMem(void *Data, DeleteHashDataFunc DeleteIt)
{
*/
void http_transmit_thing(const char *content_type, int is_static)
{
- syslog(LOG_DEBUG, "http_transmit_thing(%s)%s", content_type, ((is_static > 0) ? " (static)" : ""));
+ if (verbose)
+ syslog(LOG_DEBUG, "http_transmit_thing(%s)%s", content_type, ((is_static > 0) ? " (static)" : ""));
output_headers(0, 0, 0, 0, 0, is_static);
hprintf("Content-type: %s\r\n"
void http_transmit_headers(const char *content_type, int is_static, long is_chunked, int is_gzip)
{
wcsession *WCC = WC;
- syslog(LOG_DEBUG, "http_transmit_thing(%s)%s", content_type, ((is_static > 0) ? " (static)" : ""));
+ if (verbose)
+ syslog(LOG_DEBUG, "http_transmit_thing(%s)%s", content_type, ((is_static > 0) ? " (static)" : ""));
output_headers(0, 0, 0, 0, 0, is_static);
if (is_gzip)
char *junk;
size_t len;
- syslog(LOG_DEBUG, "ajax_servcmd() g_cmd=\"%s\"", bstr("g_cmd") );
+ if (verbose)
+ syslog(LOG_DEBUG, "ajax_servcmd() g_cmd=\"%s\"", bstr("g_cmd") );
begin_ajax_response();
Buf = NewStrBuf();
serv_puts(bstr("g_cmd"));
FreeStrBuf(&WCC->PushedDestination);
WCC->PushedDestination = NewStrBufDup(SBSTR("url"));
- syslog(LOG_DEBUG, "Push: %s", ChrPtr(WCC->PushedDestination));
+ if (verbose)
+ syslog(LOG_DEBUG, "Push: %s", ChrPtr(WCC->PushedDestination));
wc_printf("OK");
}
/*
* All righty then! We have a destination saved, so go there now.
*/
- syslog(LOG_DEBUG, "Pop: %s", ChrPtr(WCC->PushedDestination));
+ if (verbose)
+ syslog(LOG_DEBUG, "Pop: %s", ChrPtr(WCC->PushedDestination));
http_redirect(ChrPtr(WCC->PushedDestination));
}
/* If the client sent a nonce that is incorrect, kill the request. */
if (havebstr("nonce")) {
- syslog(LOG_DEBUG, "Comparing supplied nonce %s to session nonce %d",
- bstr("nonce"), WCC->nonce
- );
+ if (verbose)
+ syslog(LOG_DEBUG, "Comparing supplied nonce %s to session nonce %d",
+ bstr("nonce"), WCC->nonce
+ );
if (ibstr("nonce") != WCC->nonce) {
syslog(LOG_INFO, "Ignoring request with mismatched nonce.");
hprintf("HTTP/1.1 404 Security check failed\r\n");
*/
if (havebstr("go")) {
int ret;
- syslog(LOG_DEBUG, "Explicit room selection: %s", bstr("go"));
+ if (verbose)
+ syslog(LOG_DEBUG, "Explicit room selection: %s", bstr("go"));
ret = gotoroom(sbstr("go")); /* do quietly to avoid session output! */
if ((ret/100) != 2) {
- syslog(LOG_DEBUG, "Unable to change to [%s]; Reason: %d", bstr("go"), ret);
+ if (verbose)
+ syslog(LOG_DEBUG, "Unable to change to [%s]; Reason: %d", bstr("go"), ret);
}
}
else if (havebstr("gotofirst")) {
int ret;
- syslog(LOG_DEBUG, "Explicit room selection: %s", bstr("gotofirst"));
+ if (verbose)
+ syslog(LOG_DEBUG, "Explicit room selection: %s", bstr("gotofirst"));
ret = gotoroom(sbstr("gotofirst")); /* do quietly to avoid session output! */
if ((ret/100) != 2) {
syslog(LOG_INFO, "Unable to change to [%s]; Reason: %d", bstr("gotofirst"), ret);
else if ( (StrLength(WCC->CurRoom.name) == 0) && ( (StrLength(WCC->Hdr->c_roomname) > 0) )) {
int ret;
- syslog(LOG_DEBUG, "We are in '%s' but cookie indicates '%s', going there...",
- ChrPtr(WCC->CurRoom.name),
- ChrPtr(WCC->Hdr->c_roomname)
+ if (verbose)
+ syslog(LOG_DEBUG, "We are in '%s' but cookie indicates '%s', going there...",
+ ChrPtr(WCC->CurRoom.name),
+ ChrPtr(WCC->Hdr->c_roomname)
);
ret = gotoroom(WCC->Hdr->c_roomname); /* do quietly to avoid session output! */
if ((ret/100) != 2) {
- syslog(LOG_DEBUG, "COOKIEGOTO: Unable to change to [%s]; Reason: %d",
- ChrPtr(WCC->Hdr->c_roomname), ret);
+ if (verbose)
+ syslog(LOG_DEBUG, "COOKIEGOTO: Unable to change to [%s]; Reason: %d",
+ ChrPtr(WCC->Hdr->c_roomname), ret);
}
}
/* default action */
if (havebstr("go")) {
- syslog(LOG_DEBUG, "Explicit room selection: %s", bstr("go"));
+ if (verbose)
+ syslog(LOG_DEBUG, "Explicit room selection: %s", bstr("go"));
smart_goto(sbstr("go"));
}
else if (default_landing_page) {
const char foobuf[32];
const char *nix(void *vptr) {snprintf(foobuf, 32, "%0x", (long) vptr); return foobuf;}
#endif
+extern int verbose;
extern int dbg_analyze_msg;
extern int dbg_backtrace_template_errors;
extern int DumpTemplateI18NStrings;
/* Parse command line */
#ifdef HAVE_OPENSSL
- while ((a = getopt(argc, argv, "u:h:i:p:t:T:B:x:g:dD:G:cfsS:Z")) != EOF)
+ while ((a = getopt(argc, argv, "u:h:i:p:t:T:B:x:g:dD:G:cfsS:Z:v:")) != EOF)
#else
- while ((a = getopt(argc, argv, "u:h:i:p:t:T:B:x:g:dD:G:cfZ")) != EOF)
+ while ((a = getopt(argc, argv, "u:h:i:p:t:T:B:x:g:dD:G:cfZ:v:")) != EOF)
#endif
switch (a) {
case 'u':
I18nDump = NewStrBufPlain(HKEY("int templatestrings(void)\n{\n"));
I18nDumpFile = optarg;
break;
+ case 'v':
+ verbose=1;
+ break;
default:
fprintf(stderr, "usage: webcit "
"[-i ip_addr] [-p http_port] "