Bill Fenner <[EMAIL PROTECTED]> writes:
> Turns out my writev patch for fetch broke SSL, since it could create
> iov[0].iov_len = 0, which would cause SSL_write(..,0), which would
> return 0, which would look like a short write and cause an error, which
> then gets ignored by http.c .  Ignoring the bigger picture of the error
> checking, this fix at least gets https: working again by making sure
> that _fetch_putln doesn't construct an iov with iov_len == 0.  (Yes,
> this is against rev 1.40, post-brouhaha).

I'd rather fix it like this:

Index: common.c
===================================================================
RCS file: /home/ncvs/src/lib/libfetch/common.c,v
retrieving revision 1.41
diff -u -r1.41 common.c
--- common.c    30 Oct 2002 04:43:00 -0000      1.41
+++ common.c    30 Oct 2002 05:37:17 -0000
@@ -470,7 +470,7 @@
 {
        struct timeval now, timeout, wait;
        fd_set writefds;
-       ssize_t wlen, total;
+       ssize_t want, wlen, total;
        int r;

        if (fetchTimeout) {
@@ -507,11 +507,11 @@
 #ifdef WITH_SSL
                if (conn->ssl != NULL)
                        wlen = SSL_write(conn->ssl,
-                           iov->iov_base, iov->iov_len);
+                           iov->iov_base, want = iov->iov_len);
                else
 #endif
-                       wlen = writev(conn->sd, iov, iovcnt);
-               if (wlen == 0) {
+                       wlen = writev(conn->sd, iov, want = iovcnt);
+               if (wlen == 0 && want != 0) {
                        /* we consider a short write a failure */
                        errno = EPIPE;
                        _fetch_syserr();

DES
-- 
Dag-Erling Smorgrav - [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to