]> code.citadel.org Git - citadel.git/blobdiff - webcit/tcp_sockets.c
* set an application specific prefered Buffer size in places where debugging shows...
[citadel.git] / webcit / tcp_sockets.c
index 058f7c821f1588299c94a73d1e6e6641800a8c8e..00f7a273ce9cf29517ff758ef3481f731307782a 100644 (file)
@@ -236,18 +236,22 @@ int StrBuf_ServGetBLOB(StrBuf *buf, long BlobSize)
  */
 void serv_write(const char *buf, int nbytes)
 {
+       wcsession *WCC = WC;
        int bytes_written = 0;
        int retval;
+
+       FlushStrBuf(WCC->ReadBuf);
+       WCC->ReadPos = NULL;
        while (bytes_written < nbytes) {
-               retval = write(WC->serv_sock, &buf[bytes_written],
+               retval = write(WCC->serv_sock, &buf[bytes_written],
                               nbytes - bytes_written);
                if (retval < 1) {
                        lprintf(1, "Server connection broken: %s\n",
                                strerror(errno));
-                       close(WC->serv_sock);
-                       WC->serv_sock = (-1);
-                       WC->connected = 0;
-                       WC->logged_in = 0;
+                       close(WCC->serv_sock);
+                       WCC->serv_sock = (-1);
+                       WCC->connected = 0;
+                       WCC->logged_in = 0;
                        return;
                }
                bytes_written = bytes_written + retval;
@@ -591,6 +595,8 @@ long end_burst(void)
                hprintf("Content-encoding: gzip\r\n");
        }
 
+       if (WCC->Hdr->HR.prohibit_caching)
+               hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
        hprintf("Content-length: %d\r\n\r\n", StrLength(WCC->WBuf));
 
        ptr = ChrPtr(WCC->HBuf);
@@ -707,6 +713,31 @@ int lingering_close(int fd)
        return close(fd);
 }
 
+void
+HttpNewModule_TCPSOCKETS
+(ParsedHttpHdrs *httpreq)
+{
+
+       httpreq->ReadBuf = NewStrBufPlain(NULL, SIZ * 4);
+}
+
+void
+HttpDetachModule_TCPSOCKETS
+(ParsedHttpHdrs *httpreq)
+{
+
+       FlushStrBuf(httpreq->ReadBuf);
+       ReAdjustEmptyBuf(httpreq->ReadBuf, 4 * SIZ, SIZ);
+}
+
+void
+HttpDestroyModule_TCPSOCKETS
+(ParsedHttpHdrs *httpreq)
+{
+
+       FreeStrBuf(&httpreq->ReadBuf);
+}
+
 
 void
 SessionNewModule_TCPSOCKETS