提交 aea68b0d 编写于 作者: H Hugo Landau 提交者: Matt Caswell

s_server: Do not use SSL_sendfile when KTLS is not being used

Fix a bug in `openssl s_server -WWW` where it would attempt to invoke
`SSL_sendfile` if `-ktls -sendfile` was passed on the command line, even
if KTLS has not actually been enabled, for example because it is not
supported by the host. Since `SSL_sendfile` is only supported when KTLS
is actually being used, this resulted in a failure to serve requests.

Fixes #17503.
Reviewed-by: NTomas Mraz <tomas@openssl.org>
Reviewed-by: NMatt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17788)
上级 c1b364ce
......@@ -3010,6 +3010,9 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
int total_bytes = 0;
#endif
int width;
#ifndef OPENSSL_NO_KTLS
int use_sendfile_for_req = use_sendfile;
#endif
fd_set readfds;
const char *opmode;
#ifdef CHARSET_EBCDIC
......@@ -3340,7 +3343,11 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
}
/* send the file */
#ifndef OPENSSL_NO_KTLS
if (use_sendfile) {
if (use_sendfile_for_req && !BIO_get_ktls_send(SSL_get_wbio(con))) {
BIO_printf(bio_err, "Warning: sendfile requested but KTLS is not available\n");
use_sendfile_for_req = 0;
}
if (use_sendfile_for_req) {
FILE *fp = NULL;
int fd;
struct stat st;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册