cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: PATCH: A fix to allow OpenVMS to (HTTP) POST data larger than 64K...

From: Tim Sneddon, Systems Programmer, BSD, Infomedia Ltd <tsneddon_at_bsd.infomedia.com.au>
Date: Thu, 10 Jun 2004 10:41:41 +0800

I just realised I had not removed the use of send(). I have fixed this
and the correct patch is attached :-)

Regards, Tim.

-- 
Tim Sneddon                                tsneddon[at]infomedia.com.au
Systems Programmer                  Infomedia Business Systems Division
                         Level 3, 823 Wellington St, West Perth WA 6005
                          Phone: +61 8 9217 5000   Fax: +61 8 9217 5055

diff -u3r ../curl/lib/sendf.c ./lib/sendf.c
--- ../curl/lib/sendf.c Wed Jun 9 10:47:35 2004
+++ ./lib/sendf.c Thu Jun 10 10:37:17 2004
@@ -231,7 +231,7 @@
                     size_t len,
                     ssize_t *written)
 {
- ssize_t bytes_written;
+ ssize_t bytes_written = 0;
   CURLcode retcode;
 
 #ifdef USE_SSLEAY
@@ -288,7 +288,39 @@
     else
 #endif /* HAVE_KRB4 */
     {
+#ifdef HAVE_VMS_64K_LIMIT
+ /* This code allows data buffers larger than 64K to be sent on OpenVMS
+ systems by breaking them up into manageable pieces of 64K and less.
+ For some reason the sockets interface does not attempt to handle
+ large buffers and restricts the caller to the $QIO maximum
+ buffer size. This is not a problem for OpenVMS V7.3-2 with TCP/IP
+ V5.5 and above. */
+ int offset = 0;
+ char *memptr = 0;
+ int memptrlen = 0;
+ ssize_t swrite_result = 0;
+
+ while (offset < len) {
+ memptr = (char *)mem+offset;
+
+ memptrlen = len - offset;
+ if (memptrlen > USHRT_MAX) {
+ memptrlen = USHRT_MAX;
+ }
+
+ swrite_result = (ssize_t)swrite(sockfd, memptr, memptrlen);
+ if (swrite_result < 0) {
+ bytes_written = swrite_result;
+ break;
+ }
+
+ bytes_written += swrite_result;
+
+ offset += memptrlen;
+ }
+#else
       bytes_written = (ssize_t)swrite(sockfd, mem, len);
+#endif /* HAVE_VMS_64K_LIMIT */
     }
     if(-1 == bytes_written) {
       int err = Curl_ourerrno();
diff -u3r ../curl/packages/vms/config-vms.h_with_ssl ./packages/vms/config-vms.h_with_ssl
--- ../curl/packages/vms/config-vms.h_with_ssl Wed Jun 9 10:48:27 2004
+++ ./packages/vms/config-vms.h_with_ssl Thu Jun 10 08:19:26 2004
@@ -262,3 +262,9 @@
 
 /* Somewhere around 7.12.0 HAVE_INET_NTOP was introduced. */
 #define HAVE_INET_NTOP 1
+
+/* Define if you have OpenVMS V7.3-1 and below and TCP/IP V5.5 and below.
+ This handles an issue where the sockets interface cannot handle buffers
+ larger than 64K. This may also be necessary for TCPware, Multinet and other
+ third-party IP stacks. */
+#define HAVE_VMS_64K_LIMIT 1
diff -u3r ../curl/packages/vms/config-vms.h_without_ssl ./packages/vms/config-vms.h_without_ssl
--- ../curl/packages/vms/config-vms.h_without_ssl Wed Jun 9 10:48:27 2004
+++ ./packages/vms/config-vms.h_without_ssl Thu Jun 10 08:19:26 2004
@@ -262,3 +262,9 @@
 
 /* Somewhere around 7.12.0 HAVE_INET_NTOP was introduced. */
 #define HAVE_INET_NTOP 1
+
+/* Define if you have OpenVMS V7.3-1 and below and TCP/IP V5.5 and below.
+ This handles an issue where the sockets interface cannot handle buffers
+ larger than 64K. This may also be necessary for TCPware, Multinet and other
+ third-party IP stacks. */
+#define HAVE_VMS_64K_LIMIT 1
diff -u3r ../curl/src/getpass.c ./src/getpass.c
--- ../curl/src/getpass.c Wed Jun 9 10:49:00 2004
+++ ./src/getpass.c Thu Jun 10 08:18:34 2004
@@ -50,7 +50,6 @@
 {
   long sts;
   short chan;
- struct _iosb iosb;
   /* MSK, 23-JAN-2004, iosbdef.h wasn't in VAX V7.2 or CC 6.4 */
   /* distribution so I created this. May revert back later to */
   /* struct _iosb iosb; */
Received on 2004-06-10