cURL / Mailing Lists / curl-library / Single Mail

curl-library

handling ssl errors

From: Clarence Gardner <clarence_at_silcom.com>
Date: Thu, 28 Mar 2002 10:12:47 -0800

The following code appears in Curl_read() in sendf.c. As I recall from
my days of working with ssl, there are about 1000006 errors that can be
returned. I had a program get into an infinite loop in this code because
it was getting error 5 (whatever that is). I assume that, if these are
the only errors that can be handled, any other should cause an error
return from Curl_read.

307 if (conn->ssl.use) {
308 bool loop=TRUE;
309 int err;
310 do {
311 nread = SSL_read(conn->ssl.handle, buf, buffersize);
312
313 if(nread > 0)
314 /* successful read */
315 break;
316
317 err = SSL_get_error(conn->ssl.handle, nread);
318
319 switch(err) {
320 case SSL_ERROR_NONE: /* this is not an error */
321 case SSL_ERROR_ZERO_RETURN: /* no more data */
322 loop=0; /* get out of loop */
323 break;
324 case SSL_ERROR_WANT_READ:
325 case SSL_ERROR_WANT_WRITE:
326 /* if there's data pending, then we re-invoke SSL_read() */
327 break;
328 }
329 } while(loop);

-- 
Clarence Gardner
Software Engineer
NetLojix Communications
cgardner_at_netlojix.com
Received on 2002-03-28