From owner-freebsd-current Tue Oct 29 21:43:20 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1D94C37B401 for ; Tue, 29 Oct 2002 21:43:19 -0800 (PST) Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id ED30843E75 for ; Tue, 29 Oct 2002 21:43:17 -0800 (PST) (envelope-from des@ofug.org) Received: by flood.ping.uio.no (Postfix, from userid 2602) id E6090534E; Wed, 30 Oct 2002 06:43:15 +0100 (CET) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: Bill Fenner Cc: freebsd-current@freebsd.org Subject: Re: libfetch(3) patch for SSL References: <200210300312.g9U3CPZs021756@stash.attlabs.att.com> From: Dag-Erling Smorgrav Date: Wed, 30 Oct 2002 06:43:14 +0100 In-Reply-To: <200210300312.g9U3CPZs021756@stash.attlabs.att.com> (Bill Fenner's message of "Tue, 29 Oct 2002 19:12:25 -0800 (PST)") Message-ID: Lines: 46 User-Agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i386--freebsd) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Bill Fenner 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 - des@ofug.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message