ASF Bugzilla – Attachment 30974 Details for
Bug 55666
Not able to inflate, when enabled with SSL from backend to reverse proxy, if receiving bytes are less than 10
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
inflate input filter header buffering (trunk 2/6)
httpd-trunk-mod_deflate_inflate_in_header.patch2 (text/plain), 3.92 KB, created by
Yann Ylavic
on 2013-10-27 23:47:42 UTC
(
hide
)
Description:
inflate input filter header buffering (trunk 2/6)
Filename:
MIME Type:
Creator:
Yann Ylavic
Created:
2013-10-27 23:47:42 UTC
Size:
3.92 KB
patch
obsolete
>Index: modules/filters/mod_deflate.c >=================================================================== >--- modules/filters/mod_deflate.c (revision 1534970) >+++ modules/filters/mod_deflate.c (working copy) >@@ -905,10 +905,10 @@ static apr_status_t deflate_in_filter(ap_filter_t > > c = ap_get_module_config(r->server->module_config, &deflate_module); > >- if (!ctx) { >- char deflate_hdr[10]; >+ if (!ctx || ctx->header_len < sizeof(ctx->header)) { > apr_size_t len; > >+ if (!ctx) { > /* only work on main request/no subrequests */ > if (!ap_is_initial_req(r)) { > ap_remove_input_filter(f); >@@ -937,40 +937,66 @@ static apr_status_t deflate_in_filter(ap_filter_t > ctx->bb = apr_brigade_create(r->pool, f->c->bucket_alloc); > ctx->proc_bb = apr_brigade_create(r->pool, f->c->bucket_alloc); > ctx->buffer = apr_palloc(r->pool, c->bufferSize); >+ } > >- rv = ap_get_brigade(f->next, ctx->bb, AP_MODE_READBYTES, block, 10); >- if (rv != APR_SUCCESS) { >+ do { >+ apr_brigade_cleanup(ctx->bb); >+ >+ len = sizeof(ctx->header) - ctx->header_len; >+ rv = ap_get_brigade(f->next, ctx->bb, AP_MODE_READBYTES, block, >+ len); >+ >+ /* ap_get_brigade may return success with an empty brigade for >+ * a non-blocking read which would block (an empty brigade for >+ * a blocking read is an issue which is simply forwarded here). >+ */ >+ if (rv != APR_SUCCESS || APR_BRIGADE_EMPTY(ctx->bb)) { > return rv; > } > > /* zero length body? step aside */ > bkt = APR_BRIGADE_FIRST(ctx->bb); > if (APR_BUCKET_IS_EOS(bkt)) { >+ if (ctx->header_len) { >+ /* If the header was (partially) read it's an error, this >+ * is not a gzip Content-Encoding, as claimed. >+ */ >+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO() >+ "Encountered premature end-of-stream while " >+ "reading inflate header"); >+ return APR_EGENERAL; >+ } >+ APR_BUCKET_REMOVE(bkt); >+ APR_BRIGADE_INSERT_TAIL(bb, bkt); > ap_remove_input_filter(f); >- return ap_get_brigade(f->next, bb, mode, block, readbytes); >+ return APR_SUCCESS; > } > >- apr_table_unset(r->headers_in, "Content-Length"); >- apr_table_unset(r->headers_in, "Content-MD5"); >- >- len = 10; >- rv = apr_brigade_flatten(ctx->bb, deflate_hdr, &len); >+ rv = apr_brigade_flatten(ctx->bb, >+ ctx->header + ctx->header_len, &len); > if (rv != APR_SUCCESS) { > return rv; > } >+ if (len && !ctx->header_len) { >+ apr_table_unset(r->headers_in, "Content-Length"); >+ apr_table_unset(r->headers_in, "Content-MD5"); >+ } >+ ctx->header_len += len; > >+ } while (ctx->header_len < sizeof(ctx->header)); >+ > /* We didn't get the magic bytes. */ >- if (len != 10 || >- deflate_hdr[0] != deflate_magic[0] || >- deflate_hdr[1] != deflate_magic[1]) { >- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(01387) "Zlib: Invalid header"); >+ if (ctx->header[0] != deflate_magic[0] || >+ ctx->header[1] != deflate_magic[1]) { >+ ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(01387) >+ "Zlib: Invalid header"); > return APR_EGENERAL; > } > > /* We can't handle flags for now. */ >- if (deflate_hdr[3] != 0) { >+ if (ctx->header[3] != 0) { > ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(01388) >- "Zlib: Unsupported flags %02x", (int)deflate_hdr[3]); >+ "Zlib: Unsupported flags %02x", (int)ctx->header[3]); > return APR_EGENERAL; > } > >
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 55666
:
30936
|
30937
|
30938
|
30939
|
30959
|
30960
|
30961
|
30962
|
30973
| 30974 |
30975
|
30976
|
30977
|
30978
|
30979
|
30983