ASF Bugzilla – Attachment 22453 Details for
Bug 45023
DEFLATE preventing 304 NOT MODIFIED response
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
A POC slightly better than the above conf lines,
patch (text/plain), 2.68 KB, created by
rahul
on 2008-08-19 06:41:51 UTC
(
hide
)
Description:
A POC slightly better than the above conf lines,
Filename:
MIME Type:
Creator:
rahul
Created:
2008-08-19 06:41:51 UTC
Size:
2.68 KB
patch
obsolete
>Index: modules/filters/mod_deflate.c >=================================================================== >--- modules/filters/mod_deflate.c (revision 687021) >+++ modules/filters/mod_deflate.c (working copy) >@@ -49,6 +49,7 @@ > #include "zlib.h" > > static const char deflateFilterName[] = "DEFLATE"; >+static const char etagFilterName[] = "ETAG"; > module AP_MODULE_DECLARE_DATA deflate_module; > > typedef struct deflate_filter_config_t >@@ -537,6 +538,9 @@ > /* For a 304 or 204 response there is no entity included in > * the response and hence nothing to deflate. */ > if (r->status == HTTP_NOT_MODIFIED || r->status == HTTP_NO_CONTENT) { >+ /* munge the etag only if we had done that when we came in.*/ >+ if(apr_table_get(r->notes, "If-None-Match") != NULL) >+ deflate_check_etag(r, "gzip"); > ap_remove_output_filter(f); > return ap_pass_brigade(f->next, bb); > } >@@ -735,6 +739,36 @@ > return APR_SUCCESS; > } > >+static apr_status_t etag_in_filter(ap_filter_t *f, >+ apr_bucket_brigade *bb, >+ ap_input_mode_t mode, >+ apr_read_type_e block, >+ apr_off_t readbytes) >+{ >+ request_rec *r = f->r; >+ /* Do not disturb clients who aren't interested in gzip >+ */ >+ const char* inm; >+ char* gz; >+ const char* accept = apr_table_get(r->headers_in, "Accept-Encoding"); >+ ap_remove_input_filter(f); /* go thru only once */ >+ if ((accept == NULL) || (ap_strstr_c(accept, "gzip") == NULL)) { >+ return ap_get_brigade(f->next, bb, mode, block, readbytes); >+ } >+ >+ /* Do they have a gzip version? >+ */ >+ inm = apr_table_get(r->headers_in, "If-None-Match"); >+ if ((inm == NULL) || ( (gz = ap_strstr_c(inm, "-gzip")) == NULL )) { >+ return ap_get_brigade(f->next, bb, mode, block, readbytes); >+ } >+ >+ *gz = '\0'; >+ apr_table_set(r->headers_in, "If-None-Match", apr_pstrdup(r->pool, inm)); >+ apr_table_setn(r->notes, "If-None-Match", "1"); >+ return ap_get_brigade(f->next, bb, mode, block, readbytes); >+} >+ > /* This is the deflate input filter (inflates). */ > static apr_status_t deflate_in_filter(ap_filter_t *f, > apr_bucket_brigade *bb, >@@ -1338,6 +1372,8 @@ > AP_FTYPE_RESOURCE-1); > ap_register_input_filter(deflateFilterName, deflate_in_filter, NULL, > AP_FTYPE_CONTENT_SET); >+ ap_register_input_filter(etagFilterName, etag_in_filter, NULL, >+ AP_FTYPE_CONTENT_SET); > } > > static const command_rec deflate_filter_cmds[] = {
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 45023
:
22453
|
22468
|
22605