--- /dev/null
+ *) ab: Fix the detection for when the server performed a legitimate
+ connection close as per RFC7230 6.3.1. We must check whedther the
+ connection was previously kept alive, and not whether the current
+ closed request is keepalive. [Graham Leggett]
+
beginread, /* First byte of input */
done; /* Connection closed */
+ apr_uint64_t keptalive; /* subsequent keepalive requests */
int socknum;
#ifdef USE_SSL
SSL *ssl;
while (do_next) {
int ret, ecode;
+ apr_status_t status;
ret = SSL_do_handshake(c->ssl);
ecode = SSL_get_error(c->ssl, ret);
case SSL_ERROR_SSL:
case SSL_ERROR_SYSCALL:
/* Unexpected result */
- BIO_printf(bio_err, "SSL handshake failed (%d).\n", ecode);
+ status = apr_get_netos_error();
+ BIO_printf(bio_err, "SSL handshake failed (%d): %s\n", ecode,
+ apr_psprintf(c->ctx, "%pm", &status));
ERR_print_errors(bio_err);
close_connection(c);
do_next = 0;
c->cbx = 0;
c->gotheader = 0;
c->rwrite = 0;
+ c->keptalive = 0;
if (c->ctx) {
apr_pool_clear(c->ctx);
}
static void close_connection(struct connection * c)
{
- if (c->read == 0 && c->keepalive) {
+ if (c->read == 0 && c->keptalive) {
/*
* server has legitimately shut down an idle keep alive request
+ * as per RFC7230 6.3.1.
*/
if (good)
good--; /* connection never happened */
/* zero connect time with keep-alive */
c->start = c->connect = lasttime = apr_time_now();
+ c->keptalive++;
+
write_request(c);
}
}