Skip to content

Commit

Permalink
chore: fix interface changes to ssl from Jan 2023
Browse files Browse the repository at this point in the history
  • Loading branch information
scratch authored and gstrauss committed Oct 25, 2024
1 parent 77da2c5 commit b16c286
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/uhttpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit b16c286

Please sign in to comment.