]> code.citadel.org Git - citadel.git/blobdiff - webcit/webcit.h
* fix non cookie request blocking
[citadel.git] / webcit / webcit.h
index c9033cdf3f73ff7ba93e3d4135b1bc849cf2fb2a..36f763077cc8cfa195373093bb3350e2a812ae40 100644 (file)
@@ -346,8 +346,6 @@ typedef struct _addrbookent {
 } addrbookent;
 
 
-
-
 #define AJAX (1<<0)
 #define ANONYMOUS (1<<1)
 #define NEED_URL (1<<2)
@@ -368,12 +366,6 @@ typedef struct  _WebcitHandler{
 } WebcitHandler;
 void WebcitAddUrlHandler(const char * UrlString, long UrlSLen, WebcitHandlerFunc F, long Flags);
 
-
-
-
-
-
-
 typedef struct _headereval {
        ExamineMsgHeaderFunc evaluator;
        int Type;
@@ -406,41 +398,53 @@ enum {
 };
 const char *ReqStrs[eNONE];
 
+#define NO_AUTH 0
+#define AUTH_COOKIE 1
+#define AUTH_BASIC 2
 
 
-typedef struct _ParsedHttpHdrs {
-       int http_sock;                          /**< HTTP server socket */
-       const char *Pos;
-       StrBuf *ReadBuf;
 
+typedef struct _HdrRefs {
        long eReqType;                          /**< eGET, ePOST.... */
-       const WebcitHandler *Handler;
-       
+       int desired_session;
+       int SessionKey;
+
+       int got_auth;
        int DontNeedAuth;
-       int got_cookie;
        long ContentLength;
        time_t if_modified_since;
        int gzip_ok;                            /**< Nonzero if Accept-encoding: gzip */
 
-       StrBuf *c_username;
-       StrBuf *c_password;
-       StrBuf *c_roomname;
-       StrBuf *RawCookie;
-       int desired_session;
-
+       /* these are references into Hdr->HTTPHeaders, so we don't need to free them. */
        StrBuf *ContentType;
-
-       StrBuf *RawLine;/* TODO: freeme */
+       StrBuf *RawCookie;
        StrBuf *ReqLine;
        StrBuf *http_host;                      /**< HTTP Host: header */
        StrBuf *browser_host;
        StrBuf *user_agent;
+       StrBuf *plainauth;
+
+
+       const WebcitHandler *Handler;
+} HdrRefs;
+
+typedef struct _ParsedHttpHdrs {
+       int http_sock;                          /**< HTTP server socket */
+       const char *Pos;
+       StrBuf *ReadBuf;
 
+       StrBuf *c_username;
+       StrBuf *c_password;
+       StrBuf *c_roomname;
+       StrBuf *c_language;
        StrBuf *this_page;                      /**< URL of current page */
-       StrBuf *PlainArgs; /*TODO: freeme*/
+       StrBuf *PlainArgs; 
+
        HashList *urlstrings;                   /**< variables passed to webcit in a URL */
        HashList *HTTPHeaders;                  /**< the headers the client sent us */
        int nWildfireHeaders;                   /**< how many wildfire headers did we already send? */
+
+       HdrRefs HR;
 } ParsedHttpHdrs;
 
 
@@ -458,6 +462,7 @@ struct wcsession {
        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;
 
 /* Session local Members */
        int serv_sock;                          /**< Client socket to Citadel server */
@@ -483,7 +488,6 @@ struct wcsession {
 
 /* accounting */
        StrBuf *wc_username;                    /**< login name of current user */
-       StrBuf *httpauth_user;                  /**< only for GroupDAV sessions */
        StrBuf *wc_fullname;                    /**< Screen name of current user */
        StrBuf *wc_password;                    /**< Password of current user */
        StrBuf *httpauth_pass;                  /**< only for GroupDAV sessions */
@@ -566,6 +570,7 @@ typedef struct _HttpHeader {
        int HaveEvaluator;
 } OneHttpHeader;
 
+void RegisterHeaderHandler(const char *Name, long Len, Header_Evaluator F);
 
 
 /* values for WC->current_iconbar */
@@ -633,13 +638,20 @@ void InitialiseSemaphores(void);
 void begin_critical_section(int which_one);
 void end_critical_section(int which_one);
 
-
-void stuff_to_cookie(char *cookie, size_t clen, int session,
-                       StrBuf *user, StrBuf *pass, StrBuf *room);
-void cookie_to_stuff(StrBuf *cookie, int *session,
-                    StrBuf *user,
-                    StrBuf *pass,
-                    StrBuf *room);
+void stuff_to_cookie(char *cookie, size_t clen,
+               int session,
+               StrBuf *user,
+               StrBuf *pass,
+               StrBuf *room,
+               char *language
+);
+void cookie_to_stuff(StrBuf *cookie,
+               int *session,
+               StrBuf *user,
+               StrBuf *pass,
+               StrBuf *room,
+               StrBuf *language
+);
 void locate_host(StrBuf *TBuf, int);
 void become_logged_in(const StrBuf *user, const StrBuf *pass, StrBuf *serv_response);
 void openid_manual_create(void);
@@ -718,8 +730,8 @@ void text_to_server_qp(char *ptr);
 void confirm_delete_msg(void);
 void display_success(char *);
 void authorization_required(const char *message);
-int ReEstablish_Session(void);
-
+void CheckAuthBasic(ParsedHttpHdrs *hdr);
+void GetAuthBasic(ParsedHttpHdrs *hdr);
 void server_to_text(void);
 void save_edit(char *description, char *enter_cmd, int regoto);
 void display_edit(char *description, char *check_cmd,
@@ -837,7 +849,6 @@ void http_transmit_thing(const char *content_type, int is_static);
 long unescape_input(char *buf);
 void do_selected_iconbar(void);
 void spawn_another_worker_thread(void);
-void display_rss(const StrBuf *roomname);
 void StrEndTab(StrBuf *Target, int tabnum, int num_tabs);
 void StrBeginTab(StrBuf *Target, int tabnum, int num_tabs);
 void StrTabbedDialog(StrBuf *Target, int num_tabs, StrBuf *tabnames[]);