]> code.citadel.org Git - citadel.git/blobdiff - webcit/webcit.c
* do linebuffered reading from server
[citadel.git] / webcit / webcit.c
index 6715fe4836a5d0537be72426a8b8b5ca631c663b..8647deec2b3fc7aefb5a8b24963b41b4b5462ebb 100644 (file)
@@ -608,7 +608,6 @@ void session_loop(HashList *HTTPHeaders, StrBuf *ReqLine, StrBuf *request_method
                index[a] = arg[a-1];
                sizes[a] = sizeof arg[a-1];
        }
-/*///  index[9] = &foo; todo */
        nBackDots = 0;
        nEmpty = 0;
        for ( a = 0; a < 9; ++a)
@@ -633,12 +632,9 @@ void session_loop(HashList *HTTPHeaders, StrBuf *ReqLine, StrBuf *request_method
        }
        if (GetHash(HTTPHeaders, HKEY("AUTHORIZATION"), &vLine) &&
            (vLine!=NULL)) {
-/* TODO: wrap base64 in strbuf */
-               CtdlDecodeBase64(c_httpauth_string, ChrPtr((StrBuf*)vLine), StrLength((StrBuf*)vLine));
-               FlushStrBuf(Buf);
-               StrBufAppendBufPlain(Buf, c_httpauth_string, -1, 0);
-               StrBufExtract_token(c_httpauth_user, Buf, 0, ':');
-               StrBufExtract_token(c_httpauth_pass, Buf, 1, ':');
+               StrBufDecodeBase64((StrBuf*)vLine);
+               StrBufExtract_token(c_httpauth_user, (StrBuf*)vLine, 0, ':');
+               StrBufExtract_token(c_httpauth_pass, (StrBuf*)vLine, 1, ':');
        }
        if (GetHash(HTTPHeaders, HKEY("CONTENT-LENGTH"), &vLine) &&
            (vLine!=NULL)) {
@@ -792,6 +788,7 @@ void session_loop(HashList *HTTPHeaders, StrBuf *ReqLine, StrBuf *request_method
         * connection now.
         */
        if (!WCC->connected) {
+               WCC->ReadBuf = NewStrBuf();
                if (!strcasecmp(ctdlhost, "uds")) {
                        /* unix domain socket */
                        snprintf(buf, SIZ, "%s/citadel.socket", ctdlport);
@@ -832,8 +829,8 @@ void session_loop(HashList *HTTPHeaders, StrBuf *ReqLine, StrBuf *request_method
                                }
                                locate_host(browser_host, WCC->http_sock);
                        }
-
-                       WCC->serv_info = get_serv_info(browser_host, user_agent);
+                       if (WCC->serv_info == NULL)
+                               WCC->serv_info = get_serv_info(browser_host, user_agent);
                        if (WCC->serv_info->serv_rev_level < MINIMUM_CIT_VERSION) {
                                begin_burst();
                                wprintf(_("You are connected to a Citadel "
@@ -852,7 +849,7 @@ void session_loop(HashList *HTTPHeaders, StrBuf *ReqLine, StrBuf *request_method
                        }
                }
        }
-/*///////todo: restore language in this case */
+
        /*
         * Functions which can be performed without logging in
         */
@@ -954,12 +951,7 @@ void session_loop(HashList *HTTPHeaders, StrBuf *ReqLine, StrBuf *request_method
                        serv_printf("PASS %s", ChrPtr(c_password));
                        StrBuf_ServGetln(Buf);
                        if (GetServerStatus(Buf, NULL) == 2) {
-                               StrBuf *Lang;
                                become_logged_in(c_username, c_password, Buf);
-                               if (get_preference("language", &Lang)) {
-                                       set_selected_language(ChrPtr(Lang));
-                                       go_selected_language();         /* set locale */
-                               }
                                get_preference("default_header_charset", &WCC->DefaultCharset);
                        }
                }