trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject git commit: TS-2311: ESI: support responses that are of other text content type as well as non-200 status response
Date Wed, 06 Nov 2013 18:35:57 GMT
Updated Branches:
  refs/heads/master 44c7f5d1e -> b79a7ad99


TS-2311: ESI: support responses that are of other text content type as well as non-200 status
response

We want to enhance the ESI plugin so that we can support transformation
for other text content-type such as javascript.  We also want to
enable ESI transformation for non-200 response (e.g. 404)


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

Branch: refs/heads/master
Commit: b79a7ad99c17ec94f55f1299674ad09e2803e4b8
Parents: 44c7f5d
Author: Kit Chan <chanshukit@gmail.com>
Authored: Wed Nov 6 10:34:27 2013 -0800
Committer: James Peach <jpeach@apache.org>
Committed: Wed Nov 6 10:34:27 2013 -0800

----------------------------------------------------------------------
 CHANGES                         |  5 +++++
 plugins/experimental/esi/esi.cc | 16 +++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b79a7ad9/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index eef9793..0b848c1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.1.0
+
+
+  *) [TS-2311] ESI: Support responses that are of other text content type as well as non-200
status response.
+   Author: Kit Chan
+
   *) [TS-2321] C++ API: Clean up header code to not use STL containers and use structures
directly
 
   *) [TS-2323] Implement a .include directive for remap.config.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b79a7ad9/plugins/experimental/esi/esi.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/esi/esi.cc b/plugins/experimental/esi/esi.cc
index 994f5f0..d8665cb 100644
--- a/plugins/experimental/esi/esi.cc
+++ b/plugins/experimental/esi/esi.cc
@@ -1334,19 +1334,24 @@ isTxnTransformable(TSHttpTxn txnp, bool is_cache_txn, bool * intercept_header,
b
       break; // found internal header; no other detection required
     }
 
-    // allow response with specific status code to be transformable
+    // allow response with valid status code to be transformable
     resp_status = TSHttpHdrStatusGet(bufp, hdr_loc);
     if (static_cast<int>(resp_status) == static_cast<int>(TS_ERROR)) {
       TSError("[%s] Error while getting http status", __FUNCTION__);
       break;
     }
     if (resp_status != TS_HTTP_STATUS_OK) {
-      TSDebug(DEBUG_TAG, "[%s] Not handling non-OK response status %d", __FUNCTION__, resp_status);
-      break;
+      TSDebug(DEBUG_TAG, "[%s] non-OK response status %d", __FUNCTION__, resp_status);
     }
 
-    if (!checkHeaderValue(bufp, hdr_loc, TS_MIME_FIELD_CONTENT_TYPE, TS_MIME_LEN_CONTENT_TYPE,
-          "text/", 5, true)) {
+    if ((!checkHeaderValue(bufp, hdr_loc, TS_MIME_FIELD_CONTENT_TYPE, TS_MIME_LEN_CONTENT_TYPE,
+          "text/", 5, true)) &&
+        (!checkHeaderValue(bufp, hdr_loc, TS_MIME_FIELD_CONTENT_TYPE, TS_MIME_LEN_CONTENT_TYPE,
+          "application/javascript", 22, true)) &&
+        (!checkHeaderValue(bufp, hdr_loc, TS_MIME_FIELD_CONTENT_TYPE, TS_MIME_LEN_CONTENT_TYPE,
+          "application/x-javascript", 24, true)) &&
+        (!checkHeaderValue(bufp, hdr_loc, TS_MIME_FIELD_CONTENT_TYPE, TS_MIME_LEN_CONTENT_TYPE,
+          "multipart/mixed", 15, true))) {
       TSDebug(DEBUG_TAG, "[%s] Not text content", __FUNCTION__);
       break;
     }
@@ -1623,6 +1628,7 @@ static int esiPluginInit(int argc, const char *argv[], struct OptionInfo
*pOptio
   }
 
   memset(pOptionInfo, 0, sizeof(struct OptionInfo));
+
   if (argc > 1) {
     int c;
     static const struct option longopts[] = {


Mime
View raw message