* read static/server files directly into the outbuffer
authorWilfried Göesgens <willi@citadel.org>
Mon, 28 Jul 2008 21:22:02 +0000 (21:22 +0000)
committerWilfried Göesgens <willi@citadel.org>
Mon, 28 Jul 2008 21:22:02 +0000 (21:22 +0000)
* resynced debian chagelog

webcit/availability.c
webcit/calendar.c
webcit/debian/changelog
webcit/downloads.c
webcit/messages.c
webcit/serv_func.c
webcit/webcit.c
webcit/webcit.h

index 097725523433ff9be9d7a1fa32158622f5af408c..156137b1b2e51a99f9a3a4fbaaac2b73a0d29526 100644 (file)
 icalcomponent *get_freebusy_for_user(char *who) {
        long nLines;
        char buf[SIZ];
-       StrBuf *serialized_fb = NULL;
+       StrBuf *serialized_fb = NewStrBuf();
        icalcomponent *fb = NULL;
 
        serv_printf("ICAL freebusy|%s", who);
        serv_getln(buf, sizeof buf);
        if (buf[0] == '1') {
-               serialized_fb = read_server_text(&nLines);
+               read_server_text(serialized_fb, &nLines);
        }
 
        if (serialized_fb == NULL) {
index 61d621993b99e8d9be63b12518f727adcd1d9398..7b6374eed97bf88d5b4a44a76633221868042f51 100644 (file)
@@ -1073,7 +1073,6 @@ void save_event(void) {
 void do_freebusy(char *req) {
        char who[SIZ];
        char buf[SIZ];
-       StrBuf *fb;
        int len;
        long lines;
 
@@ -1103,9 +1102,8 @@ void do_freebusy(char *req) {
                return;
        }
 
-       fb = read_server_text(&lines);
-       http_transmit_thing(fb, "text/calendar", 0);
-       FreeStrBuf(&fb);
+       read_server_text(WC->WBuf, &lines);
+       http_transmit_thing("text/calendar", 0);
 }
 
 
index 39c2751942325473098b8c478d99e24998ff91aa..e7940ce082076de4a2ee5b6ca03852f399e30695 100644 (file)
@@ -1,3 +1,68 @@
+webcit (7.37-36) stable; urgency=low
+
+  * fix tiny JS error anoying HTTP IM Users
+
+ -- Wilfried Goesgens <w.goesgens@outgesourced.org>  Wed, 16 Jul 2008 14:00:00 +0002
+
+webcit (7.37-35) stable; urgency=low
+
+  * tiny bugfix with i18n makefiles
+
+ -- Wilfried Goesgens <w.goesgens@outgesourced.org>  Sun, 22 Jun 2008 22:00:00 +0002
+
+webcit (7.37-34) stable; urgency=low
+
+  * new upstream version
+
+ -- Wilfried Goesgens <w.goesgens@outgesourced.org>  Thu, 19 Jun 2008 22:00:00 +0002
+
+webcit (7.36-33) stable; urgency=low
+
+  * new upstream version
+
+ -- Wilfried Goesgens <w.goesgens@outgesourced.org>  Fri, 30 May 2008 19:00:00 +0002
+
+webcit (7.35-32) stable; urgency=low
+
+  * fix prototype package integration
+  * updated brazillian translation
+
+ -- Wilfried Goesgens <w.goesgens@outgesourced.org>  Wed, 22 Apr 2008 8:00:00 +0001
+webcit (7.35-31) stable; urgency=low
+
+  * New citadel version
+
+ -- Wilfried Goesgens <w.goesgens@outgesourced.org>  Tue, 22 Apr 2008 19:00:00 +0002
+
+webcit (7.34-29) stable; urgency=high
+
+  * fix bug in addressbook popup
+
+ -- Wilfried Goesgens <w.goesgens@outgesourced.org>  Wed, 5 Mar 2008 22:00:00 +0001
+
+webcit (7.33-28) stable; urgency=high
+
+  * adjusted license; new sorting in lists
+
+ -- Wilfried Goesgens <w.goesgens@outgesourced.org>  Mo, 3 Mar 2008 22:00:00 +0001
+
+webcit (7.31-27) stable; urgency=high
+
+  * initial mime detection support
+  * don't nail the users to GIF
+
+ -- Wilfried Goesgens <w.goesgens@outgesourced.org>  Tue, 12 Feb 2008 0:00:00 +0001
+
+webcit (7.30-26) stable; urgency=high
+
+  * Fix room admin dialog
+
+ -- Wilfried Goesgens <w.goesgens@outgesourced.org>  Wed, 6 Feb 2008 20:00:00 +0001
+webcit (7.30-25) stable; urgency=high
+
+  * New citadel version.
+
+ -- Wilfried Goesgens <w.goesgens@outgesourced.org>  Fri, 1 Feb 2008 10:00:00 +0001
 webcit (7.24-24) stable; urgency=high
 
   * fixed missing locales and image calculation
index 600d89de0769cdf0c9196c02eb31293811725296..23bf5f801391e0b410fbd920e3005b4bae7e1ddd 100644 (file)
@@ -383,7 +383,6 @@ void display_mime_icon(void)
 
 void download_file(void)
 {
-       StrBuf *Buf;
        char buf[256];
        off_t bytes;
        char content_type[256];
@@ -406,10 +405,10 @@ void download_file(void)
                        extract_token(content_type, &buf[4], 3, '|', sizeof content_type);
                }
                output_headers(0, 0, 0, 0, 0, 0);
-               Buf = read_server_binary(bytes);
+               read_server_binary(WC->WBuf, bytes);
                serv_puts("CLOS");
                serv_getln(buf, sizeof buf);
-               http_transmit_thing(Buf, content_type, 0);
+               http_transmit_thing(content_type, 0);
                free(content);
        } else {
                hprintf("HTTP/1.1 404 %s\n", &buf[4]);
index 90340896472e3686b4485c4fbbe558f4a8594816..e7f007484a2fa66e3456c9903dd08c6dddbb6d8d 100644 (file)
@@ -1413,7 +1413,7 @@ void print_message(void) {
 
        hprintf("Content-type: text/html\r\n"
                "Server: %s\r\n"
-               "Connection: close\r\n"
+               "Connection: close\r\n",
                PACKAGE_STRING);
        begin_burst();
 
index a5604c2257fa1c93bf36b733a68ab3a804720b0c..50a7ab8b46db6e2a2f1679214721bee48e33df94 100644 (file)
@@ -341,24 +341,25 @@ void server_to_text()
  * server READ commands.
  * \return the read content as StrBuf
  */
-StrBuf *read_server_binary(size_t total_len) 
+int read_server_binary(StrBuf *Ret, size_t total_len) 
 {
        char buf[SIZ];
        size_t bytes = 0;
        size_t thisblock = 0;
        StrBuf *Buf;
-       StrBuf *Ret = NULL;
-
-       Buf = NewStrBuf();
        
+       Buf = NewStrBuf();
+       if (Ret == NULL)
+           return -1;
+
        while (bytes < total_len) {
                thisblock = 4095;
                if ((total_len - bytes) < thisblock) {
                        thisblock = total_len - bytes;
                        if (thisblock == 0) {
-                               FreeStrBuf(&Ret); 
+                               FlushStrBuf(Ret); 
                                FreeStrBuf(&Buf);
-                               return NULL
+                               return -1
                        }
                }
                serv_printf("READ %d|%d", (int)bytes, (int)thisblock);
@@ -369,22 +370,21 @@ StrBuf *read_server_binary(size_t total_len)
                            StrBufCutLeft(Buf, 4); //thisblock = (size_t)atoi(&buf[4]);
                            thisblock = StrTol(Buf);
                            if (!WC->connected) {
-                                   FreeStrBuf(&Ret);
+                                   FlushStrBuf(Ret); 
                                    FreeStrBuf(&Buf); 
-                                   return NULL
+                                   return -1
                            }
-                           if (Ret == NULL) Ret = NewStrBuf();
                            StrBuf_ServGetBLOB(Ret, thisblock);
                            bytes += thisblock;
                    }
                    else {
                            FreeStrBuf(&Buf);
                            lprintf(3, "Error: %s\n", &buf[4]);
-                           return NULL;
+                           return -1;
                    }
                }
        }
-       return Ret;
+       return StrLength(Ret);
 }
 
 
@@ -393,27 +393,27 @@ StrBuf *read_server_binary(size_t total_len)
  * usual 000 terminator is found.  Caller is responsible for freeing
  * the returned pointer.
  */
-StrBuf *read_server_text(long *nLines)
+int read_server_text(StrBuf *Buf, long *nLines)
 {
        struct wcsession *WCC = WC;
-       StrBuf *Buf;
        long nRead;
+       long nTotal = 0;
        long nlines;
-       const char *buf;
        
-       Buf = NewStrBuf();
-       buf = ChrPtr(Buf);
        nlines = 0;
        while ((WCC->serv_sock!=-1) &&
-              (nRead = StrBuf_ServGetln(Buf)), 
-              (nRead >= 0) && 
-              (buf += nRead), (strcmp(buf, "000") != 0)) {
-               
+              (nRead = StrBuf_ServGetln(Buf), (nRead >= 0) ))
+       {
+               if (strcmp(ChrPtr(Buf) + nTotal, "000") != 0) {
+                       StrBufCutRight(Buf, nRead);
+                       break;
+               }
+               nTotal += nRead;
                nlines ++;
        }
 
        *nLines = nlines;
-       return Buf;
+       return nTotal;
 }
 
 
index 27edb1a3d3aeef1d12fdfb511c7182cb5930f50d..7638cbf2084bda3530befceb6182d88b6de37d6a 100644 (file)
@@ -764,7 +764,7 @@ void http_redirect(const char *whichpage) {
 /*
  * Output a piece of content to the web browser using conformant HTTP and MIME semantics
  */
-void http_transmit_thing(StrBuf *thing, const char *content_type,
+void http_transmit_thing(const char *content_type,
                         int is_static) {
 
        output_headers(0, 0, 0, 0, 0, is_static);
@@ -775,9 +775,7 @@ void http_transmit_thing(StrBuf *thing, const char *content_type,
                content_type,
                PACKAGE_STRING);
 
-       WC->WBuf = thing;
        end_burst();
-       WC->WBuf = NULL;
 }
 
 /*
@@ -824,7 +822,6 @@ void output_static(char *what)
        struct stat statbuf;
        off_t bytes;
        off_t count = 0;
-       StrBuf *Buf;
        const char *content_type;
        int len;
        const char *Err;
@@ -851,17 +848,10 @@ void output_static(char *what)
 
                count = 0;
                bytes = statbuf.st_size;
-               Buf = NewStrBufPlain(NULL, bytes + 2);
-               if (Buf == NULL) {
-                       lprintf(9, "output_static('%s')  -- MALLOC FAILED (%s) --\n", what, strerror(errno));
-                       hprintf("HTTP/1.1 500 internal server error\r\n");
-                       hprintf("Content-Type: text/plain\r\n");
-                       end_burst();
-                       return;
-               }
-///            StrBufAppendBuf(Buf, WC->WBuf, 0);
-               if (StrBufReadBLOB(Buf, &fd, 1, bytes, &Err) < 0)
+
+               if (StrBufReadBLOB(WC->WBuf, &fd, 1, bytes, &Err) < 0)
                {
+                       if (fd > 0) close(fd);
                        lprintf(9, "output_static('%s')  -- FREAD FAILED (%s) --\n", what, strerror(errno));
                                hprintf("HTTP/1.1 500 internal server error \r\n");
                                hprintf("Content-Type: text/plain\r\n");
@@ -872,8 +862,7 @@ void output_static(char *what)
 
                close(fd);
                lprintf(9, "output_static('%s')  %s\n", what, content_type);
-               http_transmit_thing(Buf, content_type, 1);
-               FreeStrBuf(&Buf);
+               http_transmit_thing(content_type, 1);
        }
        if (yesbstr("force_close_session")) {
                end_webcit_session();
@@ -886,12 +875,12 @@ void output_static(char *what)
  */
 void output_image()
 {
+       struct wcsession *WCC = WC;
        char buf[SIZ];
        char *xferbuf = NULL;
        off_t bytes;
        const char *MimeType;
-       StrBuf *Buf;
-
+       
        serv_printf("OIMG %s|%s", bstr("name"), bstr("parm"));
        serv_getln(buf, sizeof buf);
        if (buf[0] == '2') {
@@ -900,19 +889,17 @@ void output_image()
 
                /** Read it from the server */
                
-               Buf = read_server_binary(bytes);
-               serv_puts("CLOS");
-               serv_getln(buf, sizeof buf);
-
-               MimeType = GuessMimeType (ChrPtr(Buf), StrLength(Buf));
-               /** Write it to the browser */
-               if (!IsEmptyStr(MimeType))
-               {
-                       http_transmit_thing(Buf, 
-                                           MimeType, 
-                                           0);
-                       FreeStrBuf(&Buf);
-                       return;
+               if (read_server_binary(WCC->WBuf, bytes) > 0) {
+                       serv_puts("CLOS");
+                       serv_getln(buf, sizeof buf);
+               
+                       MimeType = GuessMimeType (ChrPtr(WCC->WBuf), StrLength(WCC->WBuf));
+                       /** Write it to the browser */
+                       if (!IsEmptyStr(MimeType))
+                       {
+                               http_transmit_thing(MimeType, 0);
+                               return;
+                       }
                }
                /* hm... unknown mimetype? fallback to blank gif */
        } 
@@ -935,35 +922,32 @@ void display_vcard_photo_img(void)
        long msgnum = 0L;
        char *vcard;
        struct vCard *v;
-       char *xferbuf;
        char *photosrc;
-       int decoded;
        const char *contentType;
-       StrBuf *Buf;
+       struct wcsession *WCC = WC;
 
-       msgnum = StrTol(WC->UrlFragment1);
+       msgnum = StrTol(WCC->UrlFragment1);
        
        vcard = load_mimepart(msgnum,"1");
        v = vcard_load(vcard);
        
        photosrc = vcard_get_prop(v, "PHOTO", 1,0,0);
-       xferbuf = malloc(strlen(photosrc));
-       if (xferbuf == NULL) {
-               lprintf(5, "xferbuf malloc failed\n");
+       FlushStrBuf(WCC->WBuf);
+       StrBufAppendBufPlain(WCC->WBuf, photosrc, -1, 0);
+       if (StrBufDecodeBase64(WCC->WBuf) <= 0) {
+               FlushStrBuf(WCC->WBuf);
+               
+               hprintf("HTTP/1.1 500 %s\n","Unable to get photo");
+               output_headers(0, 0, 0, 0, 0, 0);
+               hprintf("Content-Type: text/plain\r\n");
+               wprintf(_("Could Not decode vcard photo\n"));
+               end_burst();
                return;
        }
-       memset(xferbuf, 1, SIZ);
-       decoded = CtdlDecodeBase64(
-               xferbuf,
-               photosrc,
-               strlen(photosrc));
-       contentType = GuessMimeType(xferbuf, decoded);
-       Buf = _NewConstStrBuf(xferbuf, decoded);
-       http_transmit_thing(Buf, contentType, 0);
+       contentType = GuessMimeType(ChrPtr(WCC->WBuf), StrLength(WCC->WBuf));
+       http_transmit_thing(contentType, 0);
        free(v);
        free(photosrc);
-       free(xferbuf);
-       FreeStrBuf(&Buf);
 }
 
 /*
@@ -984,7 +968,6 @@ void mimepart(const char *msgnum, const char *partnum, int force_download)
        serv_printf("OPNA %s|%s", msgnum, partnum);
        serv_getln(buf, sizeof buf);
        if (buf[0] == '2') {
-               StrBuf *Buf;
                bytes = extract_long(&buf[4], 0);
                content = malloc(bytes + 2);
                if (force_download) {
@@ -995,11 +978,10 @@ void mimepart(const char *msgnum, const char *partnum, int force_download)
                }
                output_headers(0, 0, 0, 0, 0, 0);
 
-               Buf = read_server_binary(bytes);
+               read_server_binary(WC->WBuf, bytes);
                serv_puts("CLOS");
                serv_getln(buf, sizeof buf);
-               http_transmit_thing(Buf, content_type, 0);
-               FreeStrBuf(&Buf);
+               http_transmit_thing(content_type, 0);
        } else {
                hprintf("HTTP/1.1 404 %s\n", &buf[4]);
                output_headers(0, 0, 0, 0, 0, 0);
@@ -1378,9 +1360,14 @@ void session_loop(struct httprequest *req)
        strcpy(browser_host, "");
 
        WCC= WC;
+       if (WCC->WBuf == NULL)
+               WCC->WBuf = NewStrBuf();
+       FlushStrBuf(WCC->WBuf);
+
        if (WCC->HBuf == NULL)
                WCC->HBuf = NewStrBuf();
        FlushStrBuf(WCC->HBuf);
+
        WCC->upload_length = 0;
        WCC->upload = NULL;
        WCC->is_mobile = 0;
index d57b838086793f059dfe913d33d458779b50a83f..572b42ff0af497072083840432aef548e20b4896 100644 (file)
@@ -703,13 +703,13 @@ void initialize_locales(void);
 
 extern char *months[];
 extern char *days[];
-StrBuf *read_server_binary(size_t total_len);
+int read_server_binary(StrBuf *Ret, size_t total_len);
 int StrBuf_ServGetBLOB(StrBuf *buf, long BlobSize);
-StrBuf *read_server_text(long *nLines);
+int read_server_text(StrBuf *Buf, long *nLines);;
 int goto_config_room(void);
 long locate_user_vcard(char *username, long usernum);
 void sleeeeeeeeeep(int);
-void http_transmit_thing(StrBuf *thing, const char *content_type, int is_static);
+void http_transmit_thing(const char *content_type, int is_static);
 long unescape_input(char *buf);
 void do_selected_iconbar(void);
 int CtdlDecodeQuotedPrintable(char *decoded, char *encoded, int sourcelen);