* move serv_func.c:read_server_binary() to tcp_sockets.c: serv_read_binary()
[citadel.git] / webcit / serv_func.c
index 3a648717291b31da8736bd4011d5c6bef6a4a927..654cb4f2dc0bad384290a9c36ab013eddefc02ec 100644 (file)
@@ -533,53 +533,6 @@ void server_to_text()
 
 
 
-/**
- * Read binary data from server into memory using a series of
- * server READ commands.
- * \return the read content as StrBuf
- */
-int read_server_binary(StrBuf *Ret, size_t total_len, StrBuf *Buf) 
-{
-       wcsession *WCC = WC;
-       size_t bytes = 0;
-       size_t thisblock = 0;
-       
-       if (Ret == NULL)
-           return -1;
-
-       while ((WCC->serv_sock!=-1) &&
-              (bytes < total_len)) {
-               thisblock = 4095;
-               if ((total_len - bytes) < thisblock) {
-                       thisblock = total_len - bytes;
-                       if (thisblock == 0) {
-                               FlushStrBuf(Ret); 
-                               return -1; 
-                       }
-               }
-               serv_printf("READ %d|%d", (int)bytes, (int)thisblock);
-               if (StrBuf_ServGetln(Buf) > 0)
-               {
-                       if (GetServerStatus(Buf, NULL) == 6)
-                       {
-                           StrBufCutLeft(Buf, 4);
-                           thisblock = StrTol(Buf);
-                           if (WCC->serv_sock==-1) {
-                                   FlushStrBuf(Ret); 
-                                   return -1; 
-                           }
-                           StrBuf_ServGetBLOBBuffered(Ret, thisblock);
-                           bytes += thisblock;
-                   }
-                   else {
-                           lprintf(3, "Error: %s\n", ChrPtr(Buf) + 4);
-                           return -1;
-                   }
-               }
-       }
-       return StrLength(Ret);
-}
-
 
 /**
  *  Read text from server, appending to a string buffer until the