X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=src%2Fgen_sslfunc.c;h=98e75a1dba6258d77b840a1b05b093aae79b3010;hp=4cbab6acc193a1f4fb12b1c8ba1a030eddf4c622;hb=d9fea91a0a319e348adb504bd3edff148ff3d8a0;hpb=0716c335a0d38c09ade6f05be17bffa0d586b3da diff --git a/src/gen_sslfunc.c b/src/gen_sslfunc.c index 4cbab6ac..98e75a1d 100644 --- a/src/gen_sslfunc.c +++ b/src/gen_sslfunc.c @@ -300,6 +300,19 @@ ssl_poll (int fd, double timeout, int wait_for, void *ctx) return select_fd (fd, timeout, wait_for); } +static int +ssl_peek (int fd, char *buf, int bufsize, void *ctx) +{ + int ret; + SSL *ssl = (SSL *) ctx; + do + ret = SSL_peek (ssl, buf, bufsize); + while (ret == -1 + && SSL_get_error (ssl, ret) == SSL_ERROR_SYSCALL + && errno == EINTR); + return ret; +} + static void ssl_close (int fd, void *ctx) { @@ -335,9 +348,10 @@ ssl_connect (int fd) /* Register FD with Wget's transport layer, i.e. arrange that SSL-enabled functions are used for reading, writing, and polling. - That way the rest of Wget can use fd_read, fd_write, and friends - and not care what happens underneath. */ - fd_register_transport (fd, ssl_read, ssl_write, ssl_poll, ssl_close, ssl); + That way the rest of Wget can keep using xread, xwrite, and + friends and not care what happens underneath. */ + fd_register_transport (fd, ssl_read, ssl_write, ssl_poll, ssl_peek, + ssl_close, ssl); DEBUGP (("Connected %d to SSL 0x%0lx\n", fd, (unsigned long) ssl)); return ssl;