ASF Bugzilla – Attachment 38003 Details for
Bug 65519
mod_proxy_http hangs after HTTP upgrade to jboss-remoting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Update data_in_input_filters in the core and ssl input filters
data_in_input_filters.diff (text/plain), 8.70 KB, created by
Yann Ylavic
on 2021-08-30 14:15:09 UTC
(
hide
)
Description:
Update data_in_input_filters in the core and ssl input filters
Filename:
MIME Type:
Creator:
Yann Ylavic
Created:
2021-08-30 14:15:09 UTC
Size:
8.70 KB
patch
obsolete
>Index: modules/ssl/ssl_engine_io.c >=================================================================== >--- modules/ssl/ssl_engine_io.c (revision 1892572) >+++ modules/ssl/ssl_engine_io.c (working copy) >@@ -1473,7 +1473,7 @@ static apr_status_t ssl_io_filter_input(ap_filter_ > apr_read_type_e block, > apr_off_t readbytes) > { >- apr_status_t status; >+ apr_status_t status = APR_SUCCESS; > bio_filter_in_ctx_t *inctx = f->ctx; > const char *start = inctx->buffer; /* start of block to return */ > apr_size_t len = sizeof(inctx->buffer); /* length of block to return */ >@@ -1520,6 +1520,8 @@ static apr_status_t ssl_io_filter_input(ap_filter_ > inctx->mode = mode; > inctx->block = block; > >+ f->c->data_in_input_filters &= ~2; /* until further notice */ >+ > /* XXX: we could actually move ssl_io_filter_handshake to an > * ap_hook_process_connection but would still need to call it for > * AP_MODE_INIT for protocols that may upgrade the connection >@@ -1526,7 +1528,8 @@ static apr_status_t ssl_io_filter_input(ap_filter_ > * rather than have SSLEngine On configured. > */ > if ((status = ssl_io_filter_handshake(inctx->filter_ctx)) != APR_SUCCESS) { >- return ssl_io_filter_error(inctx, bb, status, is_init); >+ status = ssl_io_filter_error(inctx, bb, status, is_init); >+ goto cleanup; > } > > if (is_init) { >@@ -1533,7 +1536,7 @@ static apr_status_t ssl_io_filter_input(ap_filter_ > /* protocol module needs to handshake before sending > * data to client (e.g. NNTP or FTP) > */ >- return APR_SUCCESS; >+ goto cleanup; > } > > if (inctx->mode == AP_MODE_READBYTES || >@@ -1580,17 +1583,20 @@ static apr_status_t ssl_io_filter_input(ap_filter_ > > /* Handle custom errors. */ > if (status != APR_SUCCESS) { >- return ssl_io_filter_error(inctx, bb, status, 0); >+ status = ssl_io_filter_error(inctx, bb, status, 0); > } >- >- /* Create a transient bucket out of the decrypted data. */ >- if (len > 0) { >- bucket = >- apr_bucket_transient_create(start, len, f->c->bucket_alloc); >+ else if (len > 0) { >+ /* Create a transient bucket out of the decrypted data. */ >+ bucket = apr_bucket_transient_create(start, len, f->c->bucket_alloc); > APR_BRIGADE_INSERT_TAIL(bb, bucket); > } > >- return APR_SUCCESS; >+cleanup: >+ if (inctx->cbuf.length > 0 >+ || (inctx->bb && !APR_BRIGADE_EMPTY(inctx->bb))) { >+ f->c->data_in_input_filters |= 2; >+ } >+ return status; > } > > >Index: server/core_filters.c >=================================================================== >--- server/core_filters.c (revision 1892572) >+++ server/core_filters.c (working copy) >@@ -90,11 +90,12 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, > ap_input_mode_t mode, apr_read_type_e block, > apr_off_t readbytes) > { >- apr_status_t rv; >+ apr_status_t rv = APR_SUCCESS; > core_net_rec *net = f->ctx; > core_ctx_t *ctx = net->in_ctx; > const char *str; > apr_size_t len; >+ apr_bucket *e; > > if (mode == AP_MODE_INIT) { > /* >@@ -110,6 +111,8 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, > return APR_SUCCESS; > } > >+ f->c->data_in_input_filters &= ~1; /* until further notice */ >+ > if (!ctx) > { > net->in_ctx = ctx = apr_palloc(f->c->pool, sizeof(*ctx)); >@@ -147,7 +150,7 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, > if (APR_STATUS_IS_EAGAIN(rv) && block == APR_NONBLOCK_READ) { > rv = APR_SUCCESS; > } >- return rv; >+ goto cleanup; > } > > /* ### AP_MODE_PEEK is a horrific name for this mode because we also >@@ -154,7 +157,6 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, > * eat any CRLFs that we see. That's not the obvious intention of > * this mode. Determine whether anyone actually uses this or not. */ > if (mode == AP_MODE_EATCRLF) { >- apr_bucket *e; > const char *c; > > /* The purpose of this loop is to ignore any CRLF (or LF) at the end >@@ -167,16 +169,17 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, > * mean that there is another request, just a blank line. > */ > while (1) { >- if (APR_BRIGADE_EMPTY(ctx->b)) >- return APR_EOF; >+ if (APR_BRIGADE_EMPTY(ctx->b)) { >+ rv = APR_EOF; >+ goto cleanup; >+ } > > e = APR_BRIGADE_FIRST(ctx->b); >- > rv = apr_bucket_read(e, &str, &len, APR_NONBLOCK_READ); >+ if (rv != APR_SUCCESS) { >+ goto cleanup; >+ } > >- if (rv != APR_SUCCESS) >- return rv; >- > c = str; > while (c < str + len) { > if (*c == APR_ASCII_LF) >@@ -184,7 +187,7 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, > else if (*c == APR_ASCII_CR && *(c + 1) == APR_ASCII_LF) > c += 2; > else >- return APR_SUCCESS; >+ goto cleanup; > } > > /* If we reach here, we were a bucket just full of CRLFs, so >@@ -192,7 +195,7 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, > /* FIXME: Is this the right thing to do in the core? */ > apr_bucket_delete(e); > } >- return APR_SUCCESS; >+ goto cleanup; > } > > /* If mode is EXHAUSTIVE, we want to just read everything until the end >@@ -206,8 +209,6 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, > * read, which means that it can pass it to the correct child process. > */ > if (mode == AP_MODE_EXHAUSTIVE) { >- apr_bucket *e; >- > /* Tack on any buckets that were set aside. */ > APR_BRIGADE_CONCAT(b, ctx->b); > >@@ -218,27 +219,26 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, > * must be EOS. */ > e = apr_bucket_eos_create(f->c->bucket_alloc); > APR_BRIGADE_INSERT_TAIL(b, e); >- return APR_SUCCESS; >+ goto cleanup; > } > > /* read up to the amount they specified. */ > if (mode == AP_MODE_READBYTES || mode == AP_MODE_SPECULATIVE) { >- apr_bucket *e; >- > AP_DEBUG_ASSERT(readbytes > 0); > > e = APR_BRIGADE_FIRST(ctx->b); > rv = apr_bucket_read(e, &str, &len, block); > >- if (APR_STATUS_IS_EAGAIN(rv) && block == APR_NONBLOCK_READ) { >- /* getting EAGAIN for a blocking read is an error; for a >- * non-blocking read, return an empty brigade. */ >- return APR_SUCCESS; >+ if (rv != APR_SUCCESS) { >+ if (APR_STATUS_IS_EAGAIN(rv) && block == APR_NONBLOCK_READ) { >+ /* getting EAGAIN for a blocking read is an error; for a >+ * non-blocking read, return an empty brigade. */ >+ rv = APR_SUCCESS; >+ } >+ goto cleanup; > } >- else if (rv != APR_SUCCESS) { >- return rv; >- } >- else if (block == APR_BLOCK_READ && len == 0) { >+ >+ if (block == APR_BLOCK_READ && len == 0) { > /* We wanted to read some bytes in blocking mode. We read > * 0 bytes. Hence, we now assume we are EOS. > * >@@ -253,7 +253,7 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, > e = apr_bucket_eos_create(f->c->bucket_alloc); > APR_BRIGADE_INSERT_TAIL(b, e); > } >- return APR_SUCCESS; >+ goto cleanup; > } > > /* Have we read as much data as we wanted (be greedy)? */ >@@ -294,7 +294,7 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, > > rv = apr_brigade_partition(ctx->b, readbytes, &e); > if (rv != APR_SUCCESS) { >- return rv; >+ goto cleanup; > } > > /* Must do move before CONCAT */ >@@ -312,7 +312,8 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, > { > rv = apr_bucket_copy(e, ©_bucket); > if (rv != APR_SUCCESS) { >- return rv; >+ APR_BRIGADE_CONCAT(ctx->b, ctx->tmpbb); >+ goto cleanup; > } > APR_BRIGADE_INSERT_TAIL(b, copy_bucket); > } >@@ -321,7 +322,13 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, > /* Take what was originally there and place it back on ctx->b */ > APR_BRIGADE_CONCAT(ctx->b, ctx->tmpbb); > } >- return APR_SUCCESS; >+ >+cleanup: >+ e = APR_BRIGADE_FIRST(ctx->b); >+ if (e != APR_BRIGADE_SENTINEL(ctx->b) && e->length != (apr_size_t)-1) { >+ f->c->data_in_input_filters |= 1; >+ } >+ return rv; > } > > static void setaside_remaining_output(ap_filter_t *f,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 65519
:
37988
|
38003
|
38004
|
38005