]> code.citadel.org Git - citadel.git/blobdiff - webcit/context_loop.c
* migrate http read logic to the strbuf controlled readbuffered internal fast mode
[citadel.git] / webcit / context_loop.c
index a11b930d2873c035084d5eb201b70d896a6db006..c844f65a74075df3f876029f66cd12ea26239dc2 100644 (file)
@@ -32,14 +32,17 @@ void DestroySession(wcsession **sessions_to_kill)
        if ((*sessions_to_kill)->cache_fold != NULL) {
                free((*sessions_to_kill)->cache_fold);
        }
+       DeleteServInfo(&((*sessions_to_kill)->serv_info));
        DeleteHash(&((*sessions_to_kill)->attachments));
        free_march_list((*sessions_to_kill));
        DeleteHash(&((*sessions_to_kill)->hash_prefs));
        DeleteHash(&((*sessions_to_kill)->IconBarSettings));
        DeleteHash(&((*sessions_to_kill)->ServCfg));
+       FreeStrBuf(&((*sessions_to_kill)->ReadBuf));
        FreeStrBuf(&((*sessions_to_kill)->UrlFragment1));
        FreeStrBuf(&((*sessions_to_kill)->UrlFragment2));
        FreeStrBuf(&((*sessions_to_kill)->UrlFragment3));
+       FreeStrBuf(&((*sessions_to_kill)->UrlFragment4));
        FreeStrBuf(&((*sessions_to_kill)->WBuf));
        FreeStrBuf(&((*sessions_to_kill)->HBuf));
        FreeStrBuf(&((*sessions_to_kill)->CLineBuf));
@@ -159,16 +162,6 @@ int GenerateSessionID(void)
        return ++seq;
 }
 
-/*
- * Collapse multiple cookies on one line
- */
-int ReqGetStrBuf(int *sock, StrBuf *Target, StrBuf *buf)
-{
-       
-       return ClientGetLine(sock, Target, buf);
-}
-
-
 
 /*
  * lingering_close() a`la Apache. see
@@ -257,6 +250,7 @@ const char *nix(void *vptr) {return ChrPtr( (StrBuf*)vptr);}
  */
 void context_loop(int *sock)
 {
+       const char *Pos = NULL;
        const char *buf;
        int desired_session = 0;
        int got_cookie = 0;
@@ -292,7 +286,9 @@ void context_loop(int *sock)
        do {
                nLine ++;
                Line = NewStrBuf();
-               if (ReqGetStrBuf(sock, Line, Buf) < 0) return;
+
+
+               if (ClientGetLine(sock, Line, Buf, &Pos) < 0) return;
 
                LineLen = StrLength(Line);
 
@@ -318,8 +314,8 @@ void context_loop(int *sock)
                        continue;
                }
 
+               StrBufSanitizeAscii(Line, 'ยง');
                StrBufExtract_token(HeaderName, Line, 0, ':');
-               /*/// TODO: filter bad chars! */
 
                pchs = ChrPtr(Line);
                pch = pchs + StrLength(HeaderName) + 1;
@@ -334,7 +330,7 @@ void context_loop(int *sock)
        } while (LineLen > 0);
        FreeStrBuf(&HeaderName);
 
-/*///  dbg_PrintHash(HTTPHeaders, nix, NULL); */
+/*     dbg_PrintHash(HTTPHeaders, nix, NULL);  */
 
 
        /*
@@ -552,7 +548,7 @@ void context_loop(int *sock)
        }
        go_selected_language();                                 /* set locale */
 #endif
-       session_loop(HTTPHeaders, ReqLine, ReqType, Buf);                               /* do transaction */
+       session_loop(HTTPHeaders, ReqLine, ReqType, Buf, &Pos);                         /* do transaction */
 #ifdef ENABLE_NLS
        stop_selected_language();                               /* unset locale */
 #endif