diff --git a/src/connection.c b/src/connection.c index 503d379..128c629 100644 --- a/src/connection.c +++ b/src/connection.c @@ -832,11 +832,11 @@ static int ssl_negotiated(struct uh_connection_internal *conn) int ret; ret = ssl_accept(conn->ssl, on_ssl_verify_error, NULL); - if (ret == SSL_PENDING) + if (ret == SSL_WANT_READ || ret == SSL_WANT_WRITE) return 0; if (ret == SSL_ERROR) { - log_err("ssl connect error: %s\n", ssl_last_error_string(err_buf, sizeof(err_buf))); + log_err("ssl connect error: %s\n", ssl_last_error_string(conn->ssl, err_buf, sizeof(err_buf))); return -1; } @@ -853,11 +853,11 @@ static int conn_ssl_read(int fd, void *buf, size_t count, void *arg) ret = ssl_read(conn->ssl, buf, count); if (ret == SSL_ERROR) { - log_err("ssl_read: %s\n", ssl_last_error_string(err_buf, sizeof(err_buf))); + log_err("ssl_read: %s\n", ssl_last_error_string(conn->ssl, err_buf, sizeof(err_buf))); return P_FD_ERR; } - if (ret == SSL_PENDING) + if (ret == SSL_WANT_READ || ret == SSL_WANT_WRITE) return P_FD_PENDING; return ret; @@ -884,11 +884,11 @@ static void conn_write_cb(struct ev_loop *loop, struct ev_io *w, int revents) ret = ssl_write(conn->ssl, buffer_data(b), buffer_length(b)); if (ret == SSL_ERROR) { - log_err("ssl_write: %s\n", ssl_last_error_string(err_buf, sizeof(err_buf))); + log_err("ssl_write: %s\n", ssl_last_error_string(conn->ssl, err_buf, sizeof(err_buf))); goto err; } - if (ret == SSL_PENDING) + if (ret == SSL_WANT_READ || ret == SSL_WANT_WRITE) return; buffer_pull(b, NULL, ret); diff --git a/src/uhttpd.c b/src/uhttpd.c index 7460da1..3d3d1bf 100644 --- a/src/uhttpd.c +++ b/src/uhttpd.c @@ -170,7 +170,7 @@ static int uh_server_ssl_init(struct uh_server *srv, const char *cert, const cha return -1; } - if (ssl_load_crt_file(srvi->ssl_ctx, cert)) { + if (ssl_load_cert_file(srvi->ssl_ctx, cert)) { log_err("load certificate file fail\n"); return -1; }