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)
{
/* 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;