mirror of
https://github.com/apache/httpd.git
synced 2025-08-13 14:40:20 +00:00
merged r1715023 as proposed by ylavic
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.17-protocols-changes@1715202 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@ -863,7 +863,8 @@ static void ssl_io_filter_disable(SSLConnRec *sslconn, ap_filter_t *f)
|
||||
|
||||
static apr_status_t ssl_io_filter_error(ap_filter_t *f,
|
||||
apr_bucket_brigade *bb,
|
||||
apr_status_t status)
|
||||
apr_status_t status,
|
||||
int is_init)
|
||||
{
|
||||
SSLConnRec *sslconn = myConnConfig(f->c);
|
||||
apr_bucket *bucket;
|
||||
@ -877,8 +878,13 @@ static apr_status_t ssl_io_filter_error(ap_filter_t *f,
|
||||
"trying to send HTML error page");
|
||||
ssl_log_ssl_error(SSLLOG_MARK, APLOG_INFO, sslconn->server);
|
||||
|
||||
sslconn->non_ssl_request = NON_SSL_SEND_HDR_SEP;
|
||||
ssl_io_filter_disable(sslconn, f);
|
||||
f->c->keepalive = AP_CONN_CLOSE;
|
||||
if (is_init) {
|
||||
sslconn->non_ssl_request = NON_SSL_SEND_REQLINE;
|
||||
return APR_EGENERAL;
|
||||
}
|
||||
sslconn->non_ssl_request = NON_SSL_SEND_HDR_SEP;
|
||||
|
||||
/* fake the request line */
|
||||
bucket = HTTP_ON_HTTPS_PORT_BUCKET(f->c->bucket_alloc);
|
||||
@ -1332,11 +1338,22 @@ static apr_status_t ssl_io_filter_input(ap_filter_t *f,
|
||||
}
|
||||
|
||||
if (!inctx->ssl) {
|
||||
apr_bucket *bucket;
|
||||
SSLConnRec *sslconn = myConnConfig(f->c);
|
||||
if (sslconn->non_ssl_request == NON_SSL_SEND_HDR_SEP) {
|
||||
apr_bucket *bucket = apr_bucket_immortal_create(CRLF, 2, f->c->bucket_alloc);
|
||||
if (sslconn->non_ssl_request == NON_SSL_SEND_REQLINE) {
|
||||
bucket = HTTP_ON_HTTPS_PORT_BUCKET(f->c->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(bb, bucket);
|
||||
sslconn->non_ssl_request = NON_SSL_SET_ERROR_MSG;
|
||||
if (mode != AP_MODE_SPECULATIVE) {
|
||||
sslconn->non_ssl_request = NON_SSL_SEND_HDR_SEP;
|
||||
}
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
if (sslconn->non_ssl_request == NON_SSL_SEND_HDR_SEP) {
|
||||
bucket = apr_bucket_immortal_create(CRLF, 2, f->c->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(bb, bucket);
|
||||
if (mode != AP_MODE_SPECULATIVE) {
|
||||
sslconn->non_ssl_request = NON_SSL_SET_ERROR_MSG;
|
||||
}
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
return ap_get_brigade(f->next, bb, mode, block, readbytes);
|
||||
@ -1357,7 +1374,7 @@ static apr_status_t ssl_io_filter_input(ap_filter_t *f,
|
||||
* rather than have SSLEngine On configured.
|
||||
*/
|
||||
if ((status = ssl_io_filter_handshake(inctx->filter_ctx)) != APR_SUCCESS) {
|
||||
return ssl_io_filter_error(f, bb, status);
|
||||
return ssl_io_filter_error(f, bb, status, is_init);
|
||||
}
|
||||
|
||||
if (is_init) {
|
||||
@ -1411,7 +1428,7 @@ static apr_status_t ssl_io_filter_input(ap_filter_t *f,
|
||||
|
||||
/* Handle custom errors. */
|
||||
if (status != APR_SUCCESS) {
|
||||
return ssl_io_filter_error(f, bb, status);
|
||||
return ssl_io_filter_error(f, bb, status, 0);
|
||||
}
|
||||
|
||||
/* Create a transient bucket out of the decrypted data. */
|
||||
@ -1597,7 +1614,7 @@ static apr_status_t ssl_io_filter_output(ap_filter_t *f,
|
||||
inctx->block = APR_BLOCK_READ;
|
||||
|
||||
if ((status = ssl_io_filter_handshake(filter_ctx)) != APR_SUCCESS) {
|
||||
return ssl_io_filter_error(f, bb, status);
|
||||
return ssl_io_filter_error(f, bb, status, 0);
|
||||
}
|
||||
|
||||
while (!APR_BRIGADE_EMPTY(bb) && status == APR_SUCCESS) {
|
||||
|
Reference in New Issue
Block a user