? sslwrite-fix.patch
Index: lib/sendf.c
===================================================================
RCS file: /cvsroot/curl/lib/sendf.c,v
retrieving revision 1.18
diff -u -r1.18 sendf.c
--- lib/sendf.c	2001/01/31 13:54:13	1.18
+++ lib/sendf.c	2001/02/09 14:18:52
@@ -117,7 +117,30 @@
   if (data->ssl.use) {
     int loop=100; /* just a precaution to never loop endlessly */
     while(loop--) {
-      bytes_written = SSL_write(data->ssl.handle, mem, len);
+
+			/*
+			// Mod Cain: write in small chunks to avoid possible OpenSSL problems with large writes.
+			// Don't attempt to make the chunk size larger as 2048, 4096 and 8192 don't work.
+			*/
+			bytes_written = 0;
+			if (len >0) {		/* required so a negative value doesn't send us into infinte loop land */
+				void *pTrav = mem;
+				size_t chunk_written;
+				while (pTrav < mem+len){
+					chunk_written = SSL_write(data->ssl.handle, pTrav, 
+																		len-(pTrav-mem)<WRITE_CHUNK?len-(pTrav-mem):WRITE_CHUNK);
+					/* drop out if write error and set bytes_written to flag the error */
+					if (chunk_written==-1) {
+						bytes_written = -1;
+						break;
+					}
+					/* next chunk */
+					pTrav += WRITE_CHUNK;
+					bytes_written += chunk_written;
+				}
+			}
+			/* end mod */
+
       if((-1 != bytes_written) ||
          (SSL_ERROR_WANT_WRITE != SSL_get_error(data->ssl.handle,
                                                 bytes_written) ))

