From e121c5f3c425e5013f16d2b78ba45fc9ffd8f96e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Thu, 5 Nov 2009 22:22:19 +0000 Subject: [PATCH] * just calculate the language for non-static requests; else we will run this useless for every picture we deliver struct change -> make clean --- webcit/context_loop.c | 10 +++++----- webcit/gettext.c | 3 ++- webcit/webcit.h | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/webcit/context_loop.c b/webcit/context_loop.c index 4c322eb7c..43adf38dd 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -177,7 +177,7 @@ wcsession *FindSession(wcsession **wclist, ParsedHttpHdrs *Hdr, pthread_mutex_t return TheSession; } -wcsession *CreateSession(int Lockable, wcsession **wclist, ParsedHttpHdrs *Hdr, pthread_mutex_t *ListMutex) +wcsession *CreateSession(int Lockable, int Static, wcsession **wclist, ParsedHttpHdrs *Hdr, pthread_mutex_t *ListMutex) { wcsession *TheSession; lprintf(3, "Creating a new session\n"); @@ -203,7 +203,7 @@ wcsession *CreateSession(int Lockable, wcsession **wclist, ParsedHttpHdrs *Hdr, else { TheSession->wc_session = Hdr->HR.desired_session; } - + Hdr->HR.Static = Static; session_new_modules(TheSession); if (Lockable) { @@ -487,7 +487,7 @@ void context_loop(ParsedHttpHdrs *Hdr) { wcsession *Bogus; - Bogus = CreateSession(0, NULL, Hdr, NULL); + Bogus = CreateSession(0, 1, NULL, Hdr, NULL); do_404(); @@ -505,7 +505,7 @@ void context_loop(ParsedHttpHdrs *Hdr) if ((Hdr->HR.Handler != NULL) && ((Hdr->HR.Handler->Flags & ISSTATIC) != 0)) { wcsession *Static; - Static = CreateSession(0, NULL, Hdr, NULL); + Static = CreateSession(0, 1, NULL, Hdr, NULL); Hdr->HR.Handler->F(); @@ -540,7 +540,7 @@ void context_loop(ParsedHttpHdrs *Hdr) * Create a new session if we have to */ if (TheSession == NULL) { - TheSession = CreateSession(1, &SessionList, Hdr, &SessionListMutex); + TheSession = CreateSession(1, 0, &SessionList, Hdr, &SessionListMutex); if ((StrLength(Hdr->c_username) == 0) && (!Hdr->HR.DontNeedAuth)) { diff --git a/webcit/gettext.c b/webcit/gettext.c index 9d50582f1..e38d269ac 100644 --- a/webcit/gettext.c +++ b/webcit/gettext.c @@ -436,7 +436,8 @@ SessionNewModule_GETTEXT (wcsession *sess) { #ifdef ENABLE_NLS - if (sess->Hdr->HR.browser_language != NULL) { + if (!sess->Hdr->HR.Static && + (sess->Hdr->HR.browser_language != NULL)) { httplang_to_locale(sess->Hdr->HR.browser_language, sess); } #endif diff --git a/webcit/webcit.h b/webcit/webcit.h index 745b152a3..3dc49116f 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -379,6 +379,7 @@ typedef struct _HdrRefs { int gzip_ok; /* Nonzero if Accept-encoding: gzip */ int prohibit_caching; int dav_depth; + int Static; /* these are references into Hdr->HTTPHeaders, so we don't need to free them. */ StrBuf *ContentType; -- 2.30.2