⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mod_gzip.c.diff

📁 look at this software its cool really cool
💻 DIFF
字号:
--- mod_gzip.c.orig	Sun Sep 16 04:50:34 2001+++ mod_gzip.c	Wed May 11 03:13:14 2005@@ -56,20 +56,30 @@  * University of Illinois, Urbana-Champaign.  */ -/* MOD_GZIP 2.0.26a */- /* NOTE: This modules is written for the Apache 2.x series only */ /* and will not compile correctly against the Apache 1.x series. */  #include "httpd.h" #include "http_config.h" #include "http_log.h"-#include "apr_strings.h"+#include "http_protocol.h"+#include "http_request.h"+#include "apr_buckets.h" #include "apr_general.h"+#include "apr_strings.h"+#include "apr_version.h" #include "util_filter.h"-#include "apr_buckets.h"-#include "http_request.h"-#include "http_protocol.h"++#if (MODULE_MAGIC_NUMBER < 20020628)+#error Apache 2.0.40 required+#endif+#if MODULE_MAGIC_NUMBER >= 20050127+#define regex_t ap_regex_t+#define regmatch_t ap_regmatch_t+#define REG_EXTENDED AP_REG_EXTENDED+#define REG_NOSUB AP_REG_NOSUB+#define REG_ICASE AP_REG_ICASE+#endif  /* NOTE: Since Apache 2.0 is using APRLIB then we now have to */ /* manually include certain system headers that would have been */@@ -79,8 +89,9 @@  /* Version information... */ -char mod_gzip_version[] = "2.0.26.1a";-#define MOD_GZIP_VERSION_INFO_STRING "mod_gzip/2.0.26.1a"+#define MOD_GZIP_VERSION_STRING "2.1.0"+#define MOD_GZIP_VERSION_INFO_STRING ("mod_gzip/" MOD_GZIP_VERSION_STRING)+char mod_gzip_version[] = MOD_GZIP_VERSION_STRING;  /* For now just use ZLIB... */ @@ -174,7 +185,9 @@  * VERY detailed and the log files will be HUGE.  */  +/* #define MOD_GZIP_DEBUG1+*/  /*  * Turn this 'define' on to send all DEBUG log output to@@ -620,7 +633,8 @@  /* such as 'r->headers_in' or 'r->headers_out' */   int i;- apr_table_entry_t *elts;+ const apr_array_header_t *elts_arr = apr_table_elts(t);+ const apr_table_entry_t *elts = (apr_table_entry_t *) elts_arr->elts;   #ifdef MOD_GZIP_DEBUG1  char cn[]="mod_gzip_dump_a_table()";@@ -628,14 +642,12 @@   /* Start... */ - elts = ( apr_table_entry_t * ) t->a.elts;-  #ifdef MOD_GZIP_DEBUG1  mod_gzip_printf( "%s: Entry...",cn);- mod_gzip_printf( "%s: t->a.nelts = %d",cn,(int)t->a.nelts);+ mod_gzip_printf( "%s: elts_arr->nelts = %d",cn,(int)elts_arr->nelts);  #endif - for ( i = 0; i < t->a.nelts; i++ )+ for (i = 0; i < elts_arr->nelts; ++i)     {      #ifdef MOD_GZIP_DEBUG1      mod_gzip_printf( "%s: %3.3d key=[%s] val=[%s]",@@ -1590,7 +1602,6 @@  /* Primary eligibility checks... */   int         i           = 0;- int         rc          = 0;  int         field_ok    = 0;  int         action_flag = 0;  const char *tablekey    = 0;@@ -1598,9 +1609,6 @@   int accept_encoding_gzip_seen = 0; - apr_table_t *t = 0;- apr_table_entry_t *elts = 0;-  #ifdef MOD_GZIP_DEBUG1  char cn[]="mod_gzip_echeck1()";  mod_gzip_conf *sconf = 0;@@ -1884,14 +1892,14 @@   if ( dconf->imap_total_isreqheader > 0 )    {+    const apr_array_header_t *elts_arr = apr_table_elts( ( apr_table_t * ) r->headers_in );+    const apr_table_entry_t *elts = (apr_table_entry_t *) elts_arr->elts;+     #ifdef MOD_GZIP_DEBUG1     mod_gzip_printf( "%s: Checking inbound REQUEST header fields...", cn );     #endif -    t    = ( apr_table_t       * ) r->headers_in;-    elts = ( apr_table_entry_t * ) t->a.elts;--    for ( i = 0; i < t->a.nelts; i++ )+    for (i = 0; i < elts_arr->nelts; ++i)        {         #ifdef MOD_GZIP_DEBUG1         mod_gzip_printf( "%s: %3.3d key=[%s] val=[%s]",@@ -2058,15 +2066,10 @@  /* examination... */   int         i           = 0;- int         rc          = 0;  int         field_ok    = 0;- int         action_flag = 0;  const char *tablekey    = 0;  const char *tablestring = 0; - apr_table_t *t = 0;- apr_table_entry_t *elts = 0;-  #ifdef MOD_GZIP_DEBUG1  char cn[]="mod_gzip_echeck2()";  mod_gzip_conf *sconf = 0;@@ -2290,14 +2293,14 @@   if ( dconf->imap_total_isrspheader > 0 )    {+    const apr_array_header_t *elts_arr = apr_table_elts( ( apr_table_t * ) r->headers_out );+    const apr_table_entry_t *elts = (apr_table_entry_t *) elts_arr->elts;+     #ifdef MOD_GZIP_DEBUG1     mod_gzip_printf( "%s: Checking RESPONSE header fields...", cn );     #endif -    t    = ( apr_table_t       * ) r->headers_out;-    elts = ( apr_table_entry_t * ) t->a.elts;--    for ( i = 0; i < t->a.nelts; i++ )+    for (i = 0; i < elts_arr->nelts; ++i)        {         #ifdef MOD_GZIP_DEBUG1         mod_gzip_printf( "%s: %3.3d key=[%s] val=[%s]",@@ -2411,9 +2414,11 @@     "mod_gzip is available...<br>\r\n"     "mod_gzip_version = %s<br>\r\n"     "mod_gzip_on = %s<br>\r\n"+    "zlib version = %s<br>\r\n"     "</body></html>",     mod_gzip_version, /* Global version string */-    s1+    s1,+    ZLIB_VERSION     );      #ifdef MOD_GZIP_DEBUG1@@ -2648,8 +2653,6 @@   request_rec *r = f->r; - char *token = NULL;-  /* ZLIB work variables... */   zlib_context *zlib_ctx;@@ -2667,7 +2670,6 @@   const char *idata;  /* Input data */  apr_size_t ilen;    /* Input length */- apr_size_t bcopied; /* Bytes copied */  int done = 0;       /* Completion flag */   /* Other scratch variables... */@@ -2772,7 +2774,7 @@  mod_gzip_printf( "%s: Call brigade_out = apr_brigade_create( f->r->pool )",cn);  #endif - brigade_out = apr_brigade_create( f->r->pool );+ brigade_out = apr_brigade_create( f->r->pool , f->c->bucket_alloc );   #ifdef MOD_GZIP_DEBUG1 @@ -2973,7 +2975,7 @@      bucket_out =     apr_bucket_pool_create(-    zlib_gzip_header, zlib_gzip_header_length, r->pool );+    zlib_gzip_header, zlib_gzip_header_length, r->pool , f->c->bucket_alloc );      #ifdef MOD_GZIP_DEBUG1     mod_gzip_printf( "%s: Back bucket_out = apr_bucket_pool_create( buf, zlib_gzip_header_length, r->pool )...",cn);@@ -3038,7 +3040,13 @@  mod_gzip_printf( "%s: Entering APR_BRIGADE_FOREACH() loop...",cn);  #endif +#if APR_MAJOR_VERSION+ for (bucket_in = APR_BRIGADE_FIRST(brigade_in);+         bucket_in != APR_BRIGADE_SENTINEL(brigade_in);+         bucket_in = APR_BUCKET_NEXT(bucket_in))+#else  APR_BRIGADE_FOREACH( bucket_in, brigade_in )+#endif     {      #ifdef MOD_GZIP_DEBUG1      mod_gzip_printf( "%s: APR_BRIGADE_FOREACH(): Processing next BUCKET",cn);@@ -3140,7 +3148,7 @@         mod_gzip_printf( "%s: Call bucket_eos = apr_bucket_eos_create()...",cn);         #endif -        bucket_eos = (apr_bucket *) apr_bucket_eos_create();+        bucket_eos = (apr_bucket *) apr_bucket_eos_create( f->c->bucket_alloc );          #ifdef MOD_GZIP_DEBUG1         mod_gzip_printf( "%s: Back bucket_eos = apr_bucket_eos_create()...",cn);@@ -3184,11 +3192,11 @@                #endif                 bucket_out =-               apr_bucket_heap_create( zlib_ctx->buffer, len, 1, &bcopied );+               apr_bucket_heap_create( zlib_ctx->buffer, len, NULL, f->c->bucket_alloc );                 #ifdef MOD_GZIP_DEBUG1                mod_gzip_printf( "%s: Back bucket_out = apr_bucket_heap_create( zlib_ctx->buffer, len=%ld, 1, &bcopied )...",cn,(long)len);-               mod_gzip_printf( "%s: bcopied = %ld",cn,(long)bcopied);+               mod_gzip_printf( "%s: bcopied = %ld",cn,bucket_out->length);                mod_gzip_printf( "%s: Call APR_BRIGADE_INSERT_TAIL( brigade_out, bucket_out )...",cn);                #endif @@ -3198,7 +3206,7 @@                mod_gzip_printf( "%s: Back APR_BRIGADE_INSERT_TAIL( brigade_out, bucket_out )...",cn);                #endif -               zlib_ctx->strm.next_out  = zlib_ctx->buffer;+               zlib_ctx->strm.next_out  = (unsigned char *) zlib_ctx->buffer;                zlib_ctx->strm.avail_out = MOD_GZIP_ZLIB_BSIZE;                 #ifdef MOD_GZIP_DEBUG1@@ -3324,7 +3332,7 @@          /* Make an 8 byte bucket out of it... */ -        bucket_out = apr_bucket_pool_create( zlib_gzip_footer, 8, r->pool );+        bucket_out = apr_bucket_pool_create( zlib_gzip_footer, 8, r->pool , f->c->bucket_alloc );          /* Add it to the end of the brigade... */ @@ -3354,7 +3362,7 @@          ap_log_rerror(         APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r,-        "mod_gzip: In: %ld Out: %ld Savings: %ld ( %d pct ): URL %s",+        "mod_gzip: In: %ld Out: %ld Savings: %ld ( %ld pct ): URL %s",         (long) total_bytes_read,         (long) total_bytes_written,         (long) total_bytes_saved,@@ -3504,9 +3512,9 @@         mod_gzip_printf( "%s: write: Writing bucket data now...",cn);         #endif -        zlib_ctx->strm.next_in   = (char *) idata;+        zlib_ctx->strm.next_in   = (unsigned char *) idata;         zlib_ctx->strm.avail_in  = ilen;-        zlib_ctx->strm.next_out  = zlib_ctx->buffer;+        zlib_ctx->strm.next_out  = (unsigned char *) zlib_ctx->buffer;         zlib_ctx->strm.avail_out = MOD_GZIP_ZLIB_BSIZE;          #ifdef MOD_GZIP_DEBUG1@@ -3525,7 +3533,7 @@             if ( zlib_ctx->strm.avail_out == 0 )              {-              zlib_ctx->strm.next_out = zlib_ctx->buffer;+              zlib_ctx->strm.next_out = (unsigned char *) zlib_ctx->buffer;                len = ( MOD_GZIP_ZLIB_BSIZE - zlib_ctx->strm.avail_out ); @@ -3536,11 +3544,11 @@               #endif                bucket_out =-              apr_bucket_heap_create( zlib_ctx->buffer, len, 1, &bcopied );+              apr_bucket_heap_create( zlib_ctx->buffer, len, NULL, f->c->bucket_alloc );                #ifdef MOD_GZIP_DEBUG1               mod_gzip_printf( "%s: write: Back bucket_out = apr_bucket_heap_create( zlib_ctx->buffer, len=%ld, 1, &bcopied )...",cn,(long)len);-              mod_gzip_printf( "%s: write: bcopied = %ld",cn,(long)bcopied);+              mod_gzip_printf( "%s: bcopied = %ld",cn,bucket_out->length);               mod_gzip_printf( "%s: write: Call APR_BRIGADE_INSERT_TAIL( brigade_out, bucket_out )...",cn);               #endif @@ -3605,7 +3613,7 @@  /* MODULE INITIALIZATION... */ -static void mod_gzip_init(+static int mod_gzip_init( apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp,@@ -3673,6 +3681,7 @@  mod_gzip_printf( "%s: Exit > return( void ) >", cn );  mod_gzip_printf( " " );  #endif+ return OK;  }/* End of mod_gzip_init() */ @@ -4148,7 +4157,7 @@  /* Apache 2.x output filter registration... */   ap_register_output_filter(- mod_gzip_filter_name, mod_gzip_output_filter, AP_FTYPE_CONTENT );+ mod_gzip_filter_name, mod_gzip_output_filter, NULL, AP_FTYPE_CONTENT_SET );   #ifdef MOD_GZIP_DEBUG1  mod_gzip_printf( "%s: Exit > return( void ) >",cn);@@ -5335,13 +5344,6 @@ cmd_parms *parms, void *cfg, const char *arg ) {  return mod_gzip_command_no_longer_supported;-}--static const char *-mod_gzip_command_not_available_in_20(-cmd_parms *parms, void *cfg, const char *arg )-{- return mod_gzip_command_not_available_for_20; }  /* Command table... */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -