trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iga...@apache.org
Subject [09/15] git commit: rename api
Date Thu, 08 Aug 2013 17:47:04 GMT
rename api


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/f12bd8c1
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/f12bd8c1
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/f12bd8c1

Branch: refs/heads/consistent-gzip-error-msgs
Commit: f12bd8c13eab772dc1667ac3eb0471b5d4f02b19
Parents: 872afee
Author: Igor Galić <i.galic@brainsware.org>
Authored: Thu Aug 8 17:22:53 2013 +0200
Committer: Igor Galić <i.galic@brainsware.org>
Committed: Thu Aug 8 19:39:03 2013 +0200

----------------------------------------------------------------------
 plugins/gzip/configuration.cc | 12 +++----
 plugins/gzip/gzip.cc          | 74 +++++++++++++++++++-------------------
 plugins/gzip/misc.cc          | 12 +++----
 3 files changed, 49 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f12bd8c1/plugins/gzip/configuration.cc
----------------------------------------------------------------------
diff --git a/plugins/gzip/configuration.cc b/plugins/gzip/configuration.cc
index f1ca18d..98fd91b 100644
--- a/plugins/gzip/configuration.cc
+++ b/plugins/gzip/configuration.cc
@@ -118,7 +118,7 @@ namespace Gzip {
 
     for (size_t i = 0; i < disallows_.size(); i++) {
       if ( fnmatch (disallows_[i].c_str(), surl.c_str(), 0) == 0 ) {
-        TSPluginInfo("URL [%s] disabled for compression, matched on pattern [%s]",
+        TSLogInfo("URL [%s] disabled for compression, matched on pattern [%s]",
             surl.c_str(), disallows_[i].c_str());
         return false;
       }
@@ -138,7 +138,7 @@ namespace Gzip {
         match_string++;//skip '!'
       }
       if ( fnmatch (match_string, scontent_type.c_str(), 0) == 0 ) {
-        TSPluginInfo("compressible content type [%s], matched on pattern [%s]",
+        TSLogInfo("compressible content type [%s], matched on pattern [%s]",
             scontent_type.c_str(), compressible_content_types_[i].c_str());
         is_match = !exclude;
       }
@@ -169,7 +169,7 @@ namespace Gzip {
     }
 
     path = pathstring.c_str();
-    TSPluginInfo("Parsing file \"%s\"", path);
+    TSLogInfo("Parsing file \"%s\"", path);
     std::ifstream f;
 
     size_t lineno = 0;
@@ -177,7 +177,7 @@ namespace Gzip {
     f.open(path, std::ios::in);
 
     if (!f.is_open()) {
-      TSPluginWarning("could not open file [%s], skip",path);
+      TSLogWarning("could not open file [%s], skip",path);
       return c;
     }
 
@@ -223,7 +223,7 @@ namespace Gzip {
             state = kParseDisallow;
           }
           else {
-            TSPluginWarning("failed to interpret \"%s\" at line %zu", token.c_str(), lineno);
+            TSLogWarning("failed to interpret \"%s\" at line %zu", token.c_str(), lineno);
           }
           break;
         case kParseCompressibleContentType:
@@ -251,7 +251,7 @@ namespace Gzip {
     }
 
     if (state != kParseStart) {
-      TSPluginWarning("the parser state indicates that data was expected when it reached
the end of the file (%d)", state);
+      TSLogWarning("the parser state indicates that data was expected when it reached the
end of the file (%d)", state);
     }
 
     return c;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f12bd8c1/plugins/gzip/gzip.cc
----------------------------------------------------------------------
diff --git a/plugins/gzip/gzip.cc b/plugins/gzip/gzip.cc
index 68d1351..c0d0c28 100644
--- a/plugins/gzip/gzip.cc
+++ b/plugins/gzip/gzip.cc
@@ -87,13 +87,13 @@ gzip_data_alloc(int compression_type)
   err = deflateInit2(&data->zstrm, ZLIB_COMPRESSION_LEVEL, Z_DEFLATED, window_bits,
ZLIB_MEMLEVEL, Z_DEFAULT_STRATEGY);
 
   if (err != Z_OK) {
-    TSPluginFatal("gzip-transform: deflateInit (%d)!", err);
+    TSLogFatal("gzip-transform: deflateInit (%d)!", err);
   }
 
   if (dictionary) {
     err = deflateSetDictionary(&data->zstrm, (const Bytef *) dictionary, strlen(dictionary));
     if (err != Z_OK) {
-      TSPluginFatal("gzip-transform: deflateSetDictionary (%d)!", err);
+      TSLogFatal("gzip-transform: deflateSetDictionary (%d)!", err);
     }
   }
 
@@ -138,7 +138,7 @@ gzip_content_encoding_header(TSMBuffer bufp, TSMLoc hdr_loc, const int
compressi
   }
 
   if (ret != TS_SUCCESS) {
-    TSPluginError("cannot add the Content-Encoding header");
+    TSLogError("cannot add the Content-Encoding header");
   }
 
   return ret;
@@ -179,7 +179,7 @@ gzip_vary_header(TSMBuffer bufp, TSMLoc hdr_loc)
   }
 
   if (ret != TS_SUCCESS) {
-    TSPluginError("cannot add/update the Vary header");
+    TSLogError("cannot add/update the Vary header");
   }
 
   return ret;
@@ -213,7 +213,7 @@ gzip_etag_header(TSMBuffer bufp, TSMLoc hdr_loc)
   }
 
   if (ret != TS_SUCCESS) {
-    TSPluginError("cannot handle the %s header", TS_MIME_FIELD_ETAG);
+    TSLogError("cannot handle the %s header", TS_MIME_FIELD_ETAG);
   }
 
   return ret;
@@ -233,7 +233,7 @@ gzip_transform_init(TSCont contp, GzipData * data)
   data->state = transform_state_output;
 
   if (TSHttpTxnTransformRespGet(data->txn, &bufp, &hdr_loc) != TS_SUCCESS) {
-    TSPluginError("TSHttpTxnTransformRespGet");
+    TSLogError("TSHttpTxnTransformRespGet");
     return;
   }
 
@@ -263,13 +263,13 @@ gzip_transform_one(GzipData * data, TSIOBufferReader upstream_reader,
int amount
   while (amount > 0) {
     downstream_blkp = TSIOBufferReaderStart(upstream_reader);
     if (!downstream_blkp) {
-      TSPluginError("could not get from IOBufferBlock");
+      TSLogError("could not get from IOBufferBlock");
       return;
     }
 
     upstream_buffer = TSIOBufferBlockReadStart(downstream_blkp, upstream_reader, &upstream_length);
     if (!upstream_buffer) {
-      TSPluginError("could not get from TSIOBufferBlockReadStart");
+      TSLogError("could not get from TSIOBufferBlockReadStart");
       return;
     }
 
@@ -290,7 +290,7 @@ gzip_transform_one(GzipData * data, TSIOBufferReader upstream_reader,
int amount
       err = deflate(&data->zstrm, Z_NO_FLUSH);
 
       if (err != Z_OK)
-        TSPluginWarning("deflate() call failed: %d", err);
+        TSLogWarning("deflate() call failed: %d", err);
 
       if (downstream_length > data->zstrm.avail_out) {
         TSIOBufferProduce(data->downstream_buffer, downstream_length - data->zstrm.avail_out);
@@ -299,7 +299,7 @@ gzip_transform_one(GzipData * data, TSIOBufferReader upstream_reader,
int amount
 
       if (data->zstrm.avail_out > 0) {
         if (data->zstrm.avail_in != 0) {
-          TSPluginError("gzip-transform: ERROR: avail_in is (%d): should be 0", data->zstrm.avail_in);
+          TSLogError("gzip-transform: ERROR: avail_in is (%d): should be 0", data->zstrm.avail_in);
         }
       }
     }
@@ -339,13 +339,13 @@ gzip_transform_finish(GzipData * data)
       }
 
       if (err != Z_STREAM_END) {
-        TSPluginWarning("deflate should report Z_STREAM_END");
+        TSLogWarning("deflate should report Z_STREAM_END");
       }
       break;
     }
 
     if (data->downstream_length != (int64_t) (data->zstrm.total_out)) {
-      TSPluginError("gzip-transform: output lengths don't match (%d, %ld)", data->downstream_length,
+      TSLogError("gzip-transform: output lengths don't match (%d, %ld)", data->downstream_length,
             data->zstrm.total_out);
     }
 
@@ -427,7 +427,7 @@ gzip_transform(TSCont contp, TSEvent event, void * /* edata ATS_UNUSED
*/)
   } else {
     switch (event) {
     case TS_EVENT_ERROR:{
-        TSPluginDebug("gzip_transform: TS_EVENT_ERROR starts");
+        TSLogDebug("gzip_transform: TS_EVENT_ERROR starts");
         TSVIO upstream_vio = TSVConnWriteVIOGet(contp);
         TSContCall(TSVIOContGet(upstream_vio), TS_EVENT_ERROR, upstream_vio);
       }
@@ -442,7 +442,7 @@ gzip_transform(TSCont contp, TSEvent event, void * /* edata ATS_UNUSED
*/)
       gzip_transform_do(contp);
       break;
     default:
-      TSPluginWarning("unknown event [%d]", event);
+      TSLogWarning("unknown event [%d]", event);
       gzip_transform_do(contp);
       break;
     }
@@ -480,7 +480,7 @@ gzip_transformable(TSHttpTxn txnp, int server, HostConfiguration * host_configur
 
   //conservatively pick some statusses to compress
   if (!(resp_status == 200 || resp_status == 404 || resp_status == 500)) {
-    TSPluginInfo("http response status [%d] is not compressible", resp_status);
+    TSLogInfo("http response status [%d] is not compressible", resp_status);
     return 0;
   }
 
@@ -490,7 +490,7 @@ gzip_transformable(TSHttpTxn txnp, int server, HostConfiguration * host_configur
   int method_length;
   const char *method = TSHttpHdrMethodGet(cbuf, chdr, &method_length);
   if (!(method_length == TS_HTTP_LEN_GET && memcmp(method, TS_HTTP_METHOD_GET, TS_HTTP_LEN_GET)
== 0)) {
-    TSPluginDebug("method is not GET, not compressible");
+    TSLogDebug("method is not GET, not compressible");
     TSHandleMLocRelease(cbuf, TS_NULL_MLOC, chdr);
     return 0;
   }
@@ -520,11 +520,11 @@ gzip_transformable(TSHttpTxn txnp, int server, HostConfiguration * host_configur
     TSHandleMLocRelease(cbuf, TS_NULL_MLOC, chdr);
 
     if (!compression_acceptable) {
-      TSPluginInfo("no acceptable encoding found in request header, not compressible");
+      TSLogInfo("no acceptable encoding found in request header, not compressible");
       return 0;
     }
   } else {
-    TSPluginInfo("no acceptable encoding found in request header, not compressible");
+    TSLogInfo("no acceptable encoding found in request header, not compressible");
     TSHandleMLocRelease(cbuf, chdr, cfield);
     TSHandleMLocRelease(cbuf, TS_NULL_MLOC, chdr);
     return 0;
@@ -540,7 +540,7 @@ gzip_transformable(TSHttpTxn txnp, int server, HostConfiguration * host_configur
      to do anything. */
   field_loc = TSMimeHdrFieldFind(bufp, hdr_loc, TS_MIME_FIELD_CONTENT_ENCODING, -1);
   if (field_loc) {
-    TSPluginInfo("response is already content encoded, not compressible");
+    TSLogInfo("response is already content encoded, not compressible");
     TSHandleMLocRelease(bufp, hdr_loc, field_loc);
     TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
     return 0;
@@ -550,7 +550,7 @@ gzip_transformable(TSHttpTxn txnp, int server, HostConfiguration * host_configur
      content type of "text/" or "application/x-javascript". */
   field_loc = TSMimeHdrFieldFind(bufp, hdr_loc, TS_MIME_FIELD_CONTENT_TYPE, -1);
   if (!field_loc) {
-    TSPluginInfo("no content type header found, not compressible");
+    TSLogInfo("no content type header found, not compressible");
     TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
     return 0;
   }
@@ -559,7 +559,7 @@ gzip_transformable(TSHttpTxn txnp, int server, HostConfiguration * host_configur
 
   int rv = host_configuration->ContentTypeIsCompressible(value, len);
   if (!rv) { 
-    TSPluginInfo("content-type [%.*s] not compressible", len, value);
+    TSLogInfo("content-type [%.*s] not compressible", len, value);
   }
   TSHandleMLocRelease(bufp, hdr_loc, field_loc);
   TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
@@ -573,11 +573,11 @@ gzip_transform_add(TSHttpTxn txnp, int /* server ATS_UNUSED */, HostConfiguratio
   int *tmp = (int *) TSHttpTxnArgGet(txnp, arg_idx_hooked);
   if (tmp) {
     //happens on cache_stale_hit
-    TSPluginDebug("transform hook already set, bail");
+    TSLogDebug("transform hook already set, bail");
     return;
   } else {
     TSHttpTxnArgSet(txnp, arg_idx_hooked, (void *) &GZIP_ONE);
-    TSPluginInfo("adding compression transform");
+    TSLogInfo("adding compression transform");
   }
 
   TSHttpTxnUntransformedRespCache(txnp, 1);
@@ -605,15 +605,15 @@ cache_transformable(TSHttpTxn txnp)
   int obj_status;
 
   if (TSHttpTxnCacheLookupStatusGet(txnp, &obj_status) == TS_ERROR) {
-    TSPluginWarning("Couldn't get cache status of object");
+    TSLogWarning("Couldn't get cache status of object");
     return 0;
   }
   if (obj_status == TS_CACHE_LOOKUP_HIT_STALE) {
-    TSPluginInfo("stale cache hit");
+    TSLogInfo("stale cache hit");
     return 0;
   }
   if (obj_status == TS_CACHE_LOOKUP_HIT_FRESH) {
-    TSPluginInfo("fresh cache hit");
+    TSLogInfo("fresh cache hit");
     return 1;
   }
 
@@ -659,7 +659,7 @@ transform_plugin(TSCont /* contp ATS_UNUSED */, TSEvent event, void *edata)
           if (!hc->enabled() || !hc->IsUrlAllowed(url, url_len)) {
             //FIXME: no double negatives
             TSHttpTxnArgSet(txnp, arg_idx_url_disallowed, (void *) &GZIP_ONE);
-            TSPluginInfo("url [%.*s] not allowed", url_len, url);
+            TSLogInfo("url [%.*s] not allowed", url_len, url);
           } else {
             normalize_accept_encoding(txnp, req_buf, req_loc);	
           }
@@ -725,7 +725,7 @@ transform_plugin(TSCont /* contp ATS_UNUSED */, TSEvent event, void *edata)
       break;
 
     default:
-      TSPluginFatal("gzip transform unknown event");
+      TSLogFatal("gzip transform unknown event");
   }
 
   return 0;
@@ -738,7 +738,7 @@ read_configuration(TSCont contp) {
   Configuration * newconfig = Configuration::Parse(path);
 
   Configuration * oldconfig =__sync_lock_test_and_set(&config, newconfig);
-  TSPluginDebug("config swapped,old config %p", oldconfig);
+  TSLogDebug("config swapped,old config %p", oldconfig);
 
   //FIXME: we have leaked.
   //consider cloning or refcounting the configuration passed to the txn
@@ -751,7 +751,7 @@ static int
 management_update(TSCont contp, TSEvent event, void * /* edata ATS_UNUSED */)
 {
   TSReleaseAssert(event == TS_EVENT_MGMT_UPDATE);
-  TSPluginInfo("management update event received");
+  TSLogInfo("management update event received");
   read_configuration(contp);
   return 0;
 }
@@ -763,15 +763,15 @@ TSPluginInit(int argc, const char *argv[])
   string config_path;
 
   if (argc > 2)  {
-    TSPluginFatal("the gzip plugin does not accept more than 1 plugin argument");
+    TSLogFatal("the gzip plugin does not accept more than 1 plugin argument");
   } else if (argc == 2) { 
     config_path = std::string(argv[1]);
   }
 
-  TSPluginInfo("TSPluginInit %s", argv[0]);
+  TSLogInfo("TSPluginInit %s", argv[0]);
 
   if (!register_plugin()) {
-    TSPluginFatal("The gzip plugin failed to register");
+    TSLogFatal("The gzip plugin failed to register");
   }
 
   //if (argc == 2) {
@@ -779,13 +779,13 @@ TSPluginInit(int argc, const char *argv[])
   //}
 
   if (TSHttpArgIndexReserve("gzip", "for remembering if the hook was set", &arg_idx_hooked)
!= TS_SUCCESS) {
-    TSPluginFatal("failed to reserve an argument index");
+    TSLogFatal("failed to reserve an argument index");
   }
   if (TSHttpArgIndexReserve("gzip", "for storing if compression is applicable", &arg_idx_host_configuration)
!= TS_SUCCESS) {
-    TSPluginFatal("failed to reserve an argument index");
+    TSLogFatal("failed to reserve an argument index");
   }
   if (TSHttpArgIndexReserve("gzip", "for storing if compression is disallowed for this txn",
&arg_idx_url_disallowed) != TS_SUCCESS) {
-    TSPluginFatal("failed to reserve an argument index");
+    TSLogFatal("failed to reserve an argument index");
   }
 
   global_hidden_header_name = init_hidden_header_name();
@@ -804,5 +804,5 @@ TSPluginInit(int argc, const char *argv[])
   TSHttpHookAdd(TS_HTTP_SEND_REQUEST_HDR_HOOK, transform_contp);
   TSHttpHookAdd(TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK, transform_contp);
 
-  TSPluginInfo("loaded");
+  TSLogInfo("loaded");
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f12bd8c1/plugins/gzip/misc.cc
----------------------------------------------------------------------
diff --git a/plugins/gzip/misc.cc b/plugins/gzip/misc.cc
index e3dd4d3..63b42a7 100644
--- a/plugins/gzip/misc.cc
+++ b/plugins/gzip/misc.cc
@@ -83,10 +83,10 @@ normalize_accept_encoding(TSHttpTxn /* txnp ATS_UNUSED */, TSMBuffer reqp,
TSMLo
 
     if (gzip) {
       TSMimeHdrFieldValueStringInsert(reqp, hdr_loc, field, -1, "gzip", strlen("gzip"));
-      TSPluginInfo("normalized accept encoding to gzip");
+      TSLogInfo("normalized accept encoding to gzip");
     } else if (deflate) {
       TSMimeHdrFieldValueStringInsert(reqp, hdr_loc, field, -1, "deflate", strlen("deflate"));
-      TSPluginInfo("normalized accept encoding to deflate");
+      TSLogInfo("normalized accept encoding to deflate");
     }
 
     TSMimeHdrFieldAppend(reqp, hdr_loc, field);
@@ -129,7 +129,7 @@ init_hidden_header_name()
   TSMgmtString result;
 
   if (TSMgmtStringGet(var_name, &result) != TS_SUCCESS) {
-    TSPluginFatal("failed to get server name");
+    TSLogFatal("failed to get server name");
   } else {
     int hidden_header_name_len = strlen("x-accept-encoding-") + strlen(result);
     hidden_header_name = (char *) TSmalloc(hidden_header_name_len + 1);
@@ -166,7 +166,7 @@ load_dictionary(const char *preload_file)
 
   fp = fopen(preload_file, "r");
   if (!fp) {
-    TSPluginFatal("gzip-transform: Unable to open dict file %s", preload_file);
+    TSLogFatal("gzip-transform: Unable to open dict file %s", preload_file);
   }
 
   /* dict = (char *) calloc(8000, sizeof(char)); */
@@ -190,8 +190,8 @@ void
 gzip_log_ratio(int64_t in, int64_t out)
 {
   if (in) {
-    TSPluginInfo("Compressed size %" PRId64" (bytes), Original size %" PRId64", ratio: %f",
out, in, ((float) (in - out) / in));
+    TSLogInfo("Compressed size %" PRId64" (bytes), Original size %" PRId64", ratio: %f",
out, in, ((float) (in - out) / in));
   } else {
-    TSPluginDebug("Compressed size %" PRId64" (bytes), Original size %" PRId64", ratio: %f",
out, in, 0.0F);
+    TSLogDebug("Compressed size %" PRId64" (bytes), Original size %" PRId64", ratio: %f",
out, in, 0.0F);
   }
 }


Mime
View raw message