#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 DontNeedAuth;
+ int desired_session;
+ int SessionKey;
+
int got_auth;
+ int DontNeedAuth;
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;
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 */
/* 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 */
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);
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,