Host header is now stored per-request instead of globally.
[citadel.git] / webcit / webcit.h
index 5a901d8dd68f83b73f9392c349200acc2be8ef39..5417fe0213c96e2055ca6fc40ca69dac7f6bd8a8 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * Copyright (c) 1987-2011 by the citadel.org team
  *
- * This program is open source software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
+ * This program is open source software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #include "sysdep.h"
@@ -261,9 +261,10 @@ extern char *ssl_cipher_list;
 #define NO_SUCH_SYSTEM                         73      
 #define ALREADY_EXISTS                         74      
 #define MESSAGE_NOT_FOUND              75
+
 /*
  * NLI is the string that shows up in a who's online listing for sessions
- * that are active, but for which no user has yet authenticated.
+ * that are active but do not (yet) have a user logged in.
  */
 #define NLI    "(not logged in)"
 
@@ -453,6 +454,7 @@ typedef struct _ParsedHttpHdrs {
        StrBuf *c_language;
        StrBuf *this_page;                      /* URL of current page */
        StrBuf *PlainArgs; 
+       StrBuf *HostHeader;
 
        HashList *urlstrings;                   /* variables passed to webcit in a URL */
        HashList *HTTPHeaders;                  /* the headers the client sent us */
@@ -473,7 +475,6 @@ struct wcsession {
        pthread_mutex_t SessionMutex;           /* mutex for exclusive access */
        int wc_session;                         /* WebCit session ID */
        int killthis;                           /* Nonzero == purge this session */
-       int is_mobile;                          /* Client is a handheld browser */
        int ctdl_pid;                           /* Session ID on the Citadel server */
        int nonce;                              /* session nonce (to prevent session riding) */
        int SessionKey;
@@ -595,6 +596,8 @@ enum {
 #define num_parms(source)              num_tokens(source, '|') 
 #endif
 
+#define site_prefix    (WC ? (WC->Hdr->HostHeader) : NULL)
+
 /* Per-session data */
 #define WC ((struct wcsession *)pthread_getspecific(MyConKey))
 extern pthread_key_t MyConKey;
@@ -620,7 +623,6 @@ extern char wizard_filename[];
 extern int follow_xff;
 extern int num_threads_existing;
 extern int num_threads_executing;
-extern StrBuf *site_prefix;
 
 void InitialiseSemaphores(void);
 void begin_critical_section(int which_one);
@@ -829,8 +831,6 @@ HashList *GetRoomListHashLKRA(StrBuf *Target, WCTemplputParams *TP);
 void webcit_fmt_date(char *buf, size_t siz, time_t thetime, int Format);
 void summary(void);
 
-int is_mobile_ua(char *user_agent);
-
 /* actual supported locales */
 void TmplGettext(StrBuf *Target, WCTemplputParams *TP);
 void offer_languages(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType);