trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From osch...@apache.org
Subject trafficserver git commit: TS-3251 ats-pagespeed plugin upgrade to use PageSpeed 1.9.32.3
Date Fri, 15 May 2015 09:05:58 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 97ad57d88 -> 70a6c94dd


TS-3251 ats-pagespeed plugin upgrade to use PageSpeed 1.9.32.3

Upgrade to use PageSpeed 1.9.32.3.


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

Branch: refs/heads/master
Commit: 70a6c94ddeaf4a29b7c6d2fd78b310b2b57ca7ad
Parents: 97ad57d
Author: Otto van der Schaaf <oschaaf@we-amp.com>
Authored: Thu May 14 13:24:39 2015 +0200
Committer: Otto van der Schaaf <oschaaf@we-amp.com>
Committed: Thu May 14 18:25:32 2015 +0200

----------------------------------------------------------------------
 plugins/experimental/ats_pagespeed/Makefile     |   8 +-
 .../experimental/ats_pagespeed/ats_pagespeed.cc | 170 ++++++++++++-------
 .../experimental/ats_pagespeed/ats_pagespeed.h  |  18 +-
 .../ats_pagespeed/ats_process_context.cc        |   1 +
 .../ats_pagespeed/ats_resource_intercept.cc     |  59 ++++---
 plugins/experimental/ats_pagespeed/gzip/misc.h  |   6 +-
 6 files changed, 160 insertions(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70a6c94d/plugins/experimental/ats_pagespeed/Makefile
----------------------------------------------------------------------
diff --git a/plugins/experimental/ats_pagespeed/Makefile b/plugins/experimental/ats_pagespeed/Makefile
index 9177b44..b0b0e7d 100644
--- a/plugins/experimental/ats_pagespeed/Makefile
+++ b/plugins/experimental/ats_pagespeed/Makefile
@@ -61,11 +61,11 @@ PSOL_LIBS = $(PAGESPEED_OUT)pagespeed_automatic.a
 
 all: psol gzip/gzip.so ats_pagespeed.so
 
-1.8.31.4.tar.gz:
-	wget --no-check-certificate https://dl.google.com/dl/page-speed/psol/1.8.31.4.tar.gz
+1.9.32.3.tar.gz:
+	wget --no-check-certificate https://dl.google.com/dl/page-speed/psol/1.9.32.3.tar.gz
 
-psol/: 1.8.31.4.tar.gz
-	tar -xzvf 1.8.31.4.tar.gz
+psol/: 1.9.32.3.tar.gz
+	tar -xzvf 1.9.32.3.tar.gz
 
 gzip/gzip.so:
 	cd gzip && make

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70a6c94d/plugins/experimental/ats_pagespeed/ats_pagespeed.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/ats_pagespeed/ats_pagespeed.cc b/plugins/experimental/ats_pagespeed/ats_pagespeed.cc
index f0aad4e..81fdab2 100644
--- a/plugins/experimental/ats_pagespeed/ats_pagespeed.cc
+++ b/plugins/experimental/ats_pagespeed/ats_pagespeed.cc
@@ -205,40 +205,56 @@ ats_ctx_destroy(TransformCtx *ctx)
   TSfree(ctx);
 }
 
+// Wrapper around GetQueryOptions()
 RewriteOptions *
-ps_determine_request_options(ServerContext *server_context, RequestHeaders *request_headers,
ResponseHeaders *response_headers,
-                             GoogleUrl *url)
+ps_determine_request_options(const RewriteOptions *domain_options, /* may be null */
+                             RequestHeaders *request_headers, ResponseHeaders *response_headers,
RequestContextPtr request_context,
+                             ServerContext *server_context, GoogleUrl *url, GoogleString
*pagespeed_query_params,
+                             GoogleString *pagespeed_option_cookies)
 {
-  // Stripping ModPagespeed query params before the property cache lookup to
-  // make cache key consistent for both lookup and storing in cache.
-  //
   // Sets option from request headers and url.
   RewriteQuery rewrite_query;
-  if (!server_context->GetQueryOptions(url, request_headers, response_headers, &rewrite_query))
{
+  if (!server_context->GetQueryOptions(request_context, domain_options, url, request_headers,
response_headers, &rewrite_query)) {
     // Failed to parse query params or request headers.  Treat this as if there
     // were no query params given.
-    TSError("ps_route rerquest: parsing headers or query params failed.");
+    TSError("ps_route request: parsing headers or query params failed.");
     return NULL;
   }
 
+  *pagespeed_query_params = rewrite_query.pagespeed_query_params().ToEscapedString();
+  *pagespeed_option_cookies = rewrite_query.pagespeed_option_cookies().ToEscapedString();
+
   // Will be NULL if there aren't any options set with query params or in
   // headers.
   return rewrite_query.ReleaseOptions();
 }
 
+// There are many sources of options:
+//  - the request (query parameters, headers, and cookies)
+//  - location block
+//  - global server options
+//  - experiment framework
+// Consider them all, returning appropriate options for this request, of which
+// the caller takes ownership.  If the only applicable options are global,
+// set options to NULL so we can use server_context->global_options().
 bool
-ps_determine_options(ServerContext *server_context,
-                     // Directory-specific options, usually null.  They've already been rebased
off
-                     // of the global options as part of the configuration process.
-                     RewriteOptions *directory_options, RequestHeaders *request_headers,
ResponseHeaders *response_headers,
-                     RewriteOptions **options, GoogleUrl *url)
+ps_determine_options(ServerContext *server_context, RequestHeaders *request_headers, ResponseHeaders
*response_headers,
+                     RewriteOptions **options, RequestContextPtr request_context, GoogleUrl
*url,
+                     GoogleString *pagespeed_query_params, GoogleString *pagespeed_option_cookies,
bool html_rewrite)
 {
   // Global options for this server.  Never null.
   RewriteOptions *global_options = server_context->global_options();
 
+  // TODO(oschaaf): we don't have directory_options right now. But if we did,
+  // we'd need to take them into account here.
+  RewriteOptions *directory_options = NULL;
+
   // Request-specific options, nearly always null.  If set they need to be
   // rebased on the directory options or the global options.
-  RewriteOptions *request_options = ps_determine_request_options(server_context, request_headers,
response_headers, url);
+  // TODO(oschaaf): domain options..
+  RewriteOptions *request_options =
+    ps_determine_request_options(NULL /*domain options*/, request_headers, response_headers,
request_context, server_context, url,
+                                 pagespeed_query_params, pagespeed_option_cookies);
 
   // Because the caller takes ownership of any options we return, the only
   // situation in which we can avoid allocating a new RewriteOptions is if the
@@ -406,15 +422,16 @@ get_override_expiry(const StringPiece &host)
 }
 
 AtsRewriteOptions *
-get_host_options(const StringPiece &host)
+get_host_options(const StringPiece &host, ServerContext *server_context)
 {
   TSMutexLock(config_mutex);
-  AtsRewriteOptions *r = NULL;
+  AtsRewriteOptions *r = (AtsRewriteOptions *)server_context->global_options()->Clone();
   AtsHostConfig *hc = config->Find(host.data(), host.size());
   if (hc->options() != NULL) {
     // We return a clone here to avoid having to thing about
     // configuration reloads and outstanding options
-    r = hc->options()->Clone();
+    hc->options()->ClearSignatureWithCaution();
+    r->Merge(*hc->options());
   }
   TSMutexUnlock(config_mutex);
   return r;
@@ -475,32 +492,51 @@ ats_transform_init(TSCont contp, TransformCtx *ctx)
   // TODO(oschaaf): fix host/ip(?)
   SystemRequestContext *system_request_context =
     new SystemRequestContext(server_context->thread_system()->NewMutex(), server_context->timer(),
"www.foo.com", 80, "127.0.0.1");
+  RequestContextPtr rptr(system_request_context);
+  ctx->base_fetch = new AtsBaseFetch(server_context, rptr, ctx->downstream_vio, ctx->downstream_buffer,
false);
 
-  ctx->base_fetch =
-    new AtsBaseFetch(server_context, RequestContextPtr(system_request_context), ctx->downstream_vio,
ctx->downstream_buffer, false);
-
-
-  RewriteOptions *options = NULL;
+  ResponseHeaders response_headers;
   RequestHeaders *request_headers = new RequestHeaders();
   ctx->base_fetch->SetRequestHeadersTakingOwnership(request_headers);
   copy_request_headers_to_psol(reqp, req_hdr_loc, request_headers);
 
   TSHttpStatus status = TSHttpHdrStatusGet(bufp, hdr_loc);
-  // TODO(oschaaf): http version
-  ctx->base_fetch->response_headers()->set_status_code(status);
-  copy_response_headers_to_psol(bufp, hdr_loc, ctx->base_fetch->response_headers());
-  ctx->base_fetch->response_headers()->ComputeCaching();
-  const char *host = ctx->gurl->HostAndPort().as_string().c_str();
-  // request_headers->Lookup1(HttpAttributes::kHost);
-  if (host != NULL && strlen(host) > 0) {
-    ctx->options = get_host_options(host);
+  copy_response_headers_to_psol(bufp, hdr_loc, &response_headers);
+
+  std::string host = ctx->gurl->HostAndPort().as_string();
+  RewriteOptions *options = NULL;
+  if (host.size() > 0) {
+    options = get_host_options(host.c_str(), server_context);
+    if (options != NULL) {
+      server_context->message_handler()->Message(kInfo, "request options found \r\n");
+    }
+  }
+  if (options == NULL) {
+    options = server_context->global_options()->Clone();
   }
-  bool ok =
-    ps_determine_options(server_context, ctx->options, request_headers, ctx->base_fetch->response_headers(),
&options, ctx->gurl);
 
+  server_context->message_handler()->Message(kInfo, "request options:\r\n[%s]", options->OptionsToString().c_str());
+
+  /*
+  RewriteOptions* options = NULL;
+  GoogleString pagespeed_query_params;
+  GoogleString pagespeed_option_cookies;
+  bool ok = ps_determine_options(server_context,
+                                 ctx->base_fetch->request_headers(),
+                                 &response_headers,
+                                 &options,
+                                 rptr,
+                                 ctx->gurl,
+                                 &pagespeed_query_params,
+                                 &pagespeed_option_cookies,
+                                 true);
+  */
+
+
+  // TODO(oschaaf): use the determined option/query params
   // Take ownership of custom_options.
   scoped_ptr<RewriteOptions> custom_options(options);
-
+  /*
   if (!ok) {
     TSError("Failure while determining request options for psol");
     options = server_context->global_options();
@@ -508,7 +544,7 @@ ats_transform_init(TSCont contp, TransformCtx *ctx)
     // ps_determine_options modified url, removing any ModPagespeedFoo=Bar query
     // parameters.  Keep url_string in sync with url.
     ctx->gurl->Spec().CopyToString(ctx->url_string);
-  }
+    }*/
 
   RewriteDriver *driver;
   if (custom_options.get() == NULL) {
@@ -516,9 +552,16 @@ ats_transform_init(TSCont contp, TransformCtx *ctx)
   } else {
     driver = server_context->NewCustomRewriteDriver(custom_options.release(), ctx->base_fetch->request_context());
   }
+  rptr->set_options(driver->options()->ComputeHttpOptions());
+  // TODO(oschaaf): http version
+  ctx->base_fetch->response_headers()->set_status_code(status);
+  copy_response_headers_to_psol(bufp, hdr_loc, ctx->base_fetch->response_headers());
+  ctx->base_fetch->response_headers()->ComputeCaching();
 
   driver->SetUserAgent(ctx->user_agent->c_str());
   driver->SetRequestHeaders(*request_headers);
+  // driver->set_pagespeed_query_params(pagespeed_query_params);
+  // driver->set_pagespeed_option_cookies(pagespeed_option_cookies);
 
   bool page_callback_added = false;
   scoped_ptr<ProxyFetchPropertyCallbackCollector> property_callback(ProxyFetchFactory::InitiatePropertyCacheLookup(
@@ -787,12 +830,11 @@ handle_read_request_header(TSHttpTxn txnp)
           // TODO(oschaaf): fix host/ip(?)
           SystemRequestContext *system_request_context = new SystemRequestContext(
             server_context->thread_system()->NewMutex(), server_context->timer(),
"www.foo.com", 80, "127.0.0.1");
+          RequestContextPtr rptr(system_request_context);
 
-          ctx->base_fetch = new AtsBaseFetch(server_context, RequestContextPtr(system_request_context),
ctx->downstream_vio,
-                                             ctx->downstream_buffer, false);
+          ctx->base_fetch = new AtsBaseFetch(server_context, rptr, ctx->downstream_vio,
ctx->downstream_buffer, false);
 
 
-          RewriteOptions *options = NULL;
           RequestHeaders *request_headers = new RequestHeaders();
           ctx->base_fetch->SetRequestHeadersTakingOwnership(request_headers);
           copy_request_headers_to_psol(reqp, hdr_loc, request_headers);
@@ -802,26 +844,36 @@ handle_read_request_header(TSHttpTxn txnp)
           // ctx->base_fetch->response_headers()->set_status_code(status);
           // copy_response_headers_to_psol(bufp, hdr_loc, ctx->base_fetch->response_headers());
           // ctx->base_fetch->response_headers()->ComputeCaching();
-          const char *host = ctx->gurl->HostAndPort().as_string().c_str();
+          std::string host = ctx->gurl->HostAndPort().as_string();
           // request_headers->Lookup1(HttpAttributes::kHost);
-          if (host != NULL && strlen(host) > 0) {
-            ctx->options = get_host_options(host);
+          RewriteOptions *options = NULL;
+          if (host.size() > 0) {
+            options = get_host_options(host.c_str(), server_context);
           }
-          bool ok = ps_determine_options(server_context, ctx->options, request_headers,
ctx->base_fetch->response_headers(),
-                                         &options, ctx->gurl);
+          if (options == NULL) {
+            options = server_context->global_options()->Clone();
+          }
+
 
+          // GoogleString pagespeed_query_params;
+          // GoogleString pagespeed_option_cookies;
+          // bool ok = ps_determine_options(server_context,
+          //                               ctx->base_fetch->request_headers(),
+          //                               NULL /*ResponseHeaders* */,
+          //                               &options,
+          //                               rptr,
+          //                              ctx->gurl,
+          //                               &pagespeed_query_params,
+          //                               &pagespeed_option_cookies,
+          //                               false /*html rewrite*/);
           // Take ownership of custom_options.
           scoped_ptr<RewriteOptions> custom_options(options);
 
-          if (!ok) {
-            TSError("Failure while determining request options for psol");
-            options = server_context->global_options();
-          } else {
-            // ps_determine_options modified url, removing any ModPagespeedFoo=Bar query
-            // parameters.  Keep url_string in sync with url.
-            ctx->gurl->Spec().CopyToString(ctx->url_string);
-          }
+          // ps_determine_options modified url, removing any ModPagespeedFoo=Bar query
+          // parameters.  Keep url_string in sync with url.
+          // ctx->gurl->Spec().CopyToString(ctx->url_string);
 
+          rptr->set_options(options->ComputeHttpOptions());
           if (options->in_place_rewriting_enabled() && options->enabled() &&
options->IsAllowed(ctx->gurl->Spec())) {
             RewriteDriver *driver;
             if (custom_options.get() == NULL) {
@@ -834,6 +886,8 @@ handle_read_request_header(TSHttpTxn txnp)
               driver->SetUserAgent(ctx->user_agent->c_str());
             }
             driver->SetRequestHeaders(*ctx->base_fetch->request_headers());
+            // driver->set_pagespeed_query_params(pagespeed_query_params);
+            // driver->set_pagespeed_option_cookies(pagespeed_option_cookies);
             ctx->driver = driver;
             ctx->server_context->message_handler()->Message(kInfo, "Trying to serve
rewritten resource in-place: %s",
                                                             ctx->url_string->c_str());
@@ -841,6 +895,7 @@ handle_read_request_header(TSHttpTxn txnp)
             ctx->in_place = true;
             ctx->base_fetch->set_handle_error(false);
             ctx->base_fetch->set_is_ipro(true);
+
             // ctx->driver->FetchInPlaceResource(
             //    *ctx->gurl, false /* proxy_mode */, ctx->base_fetch);
           }
@@ -1036,14 +1091,15 @@ transform_plugin(TSCont contp, TSEvent event, void *edata)
       // (or at least a note that it cannot be cached stored there).
       // We do that using an Apache output filter.
       // TODO(oschaaf): fix host/ip(?)
-      SystemRequestContext *system_request_context = new SystemRequestContext(
-        ctx->server_context->thread_system()->NewMutex(), ctx->server_context->timer(),
"www.foo.com", 80, "127.0.0.1");
-
-      ctx->recorder = new InPlaceResourceRecorder(
-        RequestContextPtr(system_request_context), cache_url, ctx->driver->CacheFragment(),
request_headers.GetProperties(),
-        options->respect_vary(), options->ipro_max_response_bytes(), options->ipro_max_concurrent_recordings(),
-        options->implicit_cache_ttl_ms(), ctx->server_context->http_cache(), ctx->server_context->statistics(),
-        ctx->server_context->message_handler());
+      RequestContextPtr system_request_context(new SystemRequestContext(
+        ctx->server_context->thread_system()->NewMutex(), ctx->server_context->timer(),
"www.foo.com", 80, "127.0.0.1"));
+
+      system_request_context->set_options(options->ComputeHttpOptions());
+
+      ctx->recorder = new InPlaceResourceRecorder(system_request_context, cache_url, ctx->driver->CacheFragment(),
+                                                  request_headers.GetProperties(), options->ipro_max_response_bytes(),
+                                                  options->ipro_max_concurrent_recordings(),
ctx->server_context->http_cache(),
+                                                  ctx->server_context->statistics(),
ctx->server_context->message_handler());
       // TODO(oschaaf): does this make sense for ats? perhaps we don't need it.
       ctx->ipro_response_headers = new ResponseHeaders();
       ctx->ipro_response_headers->set_status_code(status);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70a6c94d/plugins/experimental/ats_pagespeed/ats_pagespeed.h
----------------------------------------------------------------------
diff --git a/plugins/experimental/ats_pagespeed/ats_pagespeed.h b/plugins/experimental/ats_pagespeed/ats_pagespeed.h
index ffdafd0..49906d5 100644
--- a/plugins/experimental/ats_pagespeed/ats_pagespeed.h
+++ b/plugins/experimental/ats_pagespeed/ats_pagespeed.h
@@ -32,6 +32,8 @@
 #include "net/instaweb/util/public/string.h"
 #include "net/instaweb/util/public/string_util.h"
 
+#include "net/instaweb/http/public/request_context.h"
+
 namespace net_instaweb
 {
 class AtsBaseFetch;
@@ -48,11 +50,7 @@ class ServerContext;
 
 } // namespace net_instaweb
 
-enum transform_state {
-  transform_state_initialized,
-  transform_state_output,
-  transform_state_finished,
-};
+enum transform_state { transform_state_initialized, transform_state_output, transform_state_finished
};
 
 typedef struct {
   TSHttpTxn txn;
@@ -94,15 +92,13 @@ TransformCtx *get_transaction_context(TSHttpTxn txnp);
 void ats_ctx_destroy(TransformCtx *ctx);
 bool cache_hit(TSHttpTxn txnp);
 
-bool ps_determine_options(net_instaweb::ServerContext *server_context,
-                          // Directory-specific options, usually null.  They've already been
rebased off
-                          // of the global options as part of the configuration process.
-                          net_instaweb::RewriteOptions *directory_options, net_instaweb::RequestHeaders
*request_headers,
+bool ps_determine_options(net_instaweb::ServerContext *server_context, net_instaweb::RequestHeaders
*request_headers,
                           net_instaweb::ResponseHeaders *response_headers, net_instaweb::RewriteOptions
**options,
-                          net_instaweb::GoogleUrl *url);
+                          net_instaweb::RequestContextPtr request_context, net_instaweb::GoogleUrl
*url,
+                          GoogleString *pagespeed_query_params, GoogleString *pagespeed_option_cookies,
bool html_rewrite);
 
 void copy_request_headers_to_psol(TSMBuffer bufp, TSMLoc hdr_loc, net_instaweb::RequestHeaders
*psol_headers);
 // You will own options returned by this:
-net_instaweb::AtsRewriteOptions *get_host_options(const StringPiece &host);
+net_instaweb::AtsRewriteOptions *get_host_options(const StringPiece &host, net_instaweb::ServerContext
*server_context);
 
 #endif /* ATS_PAGESPEED_H_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70a6c94d/plugins/experimental/ats_pagespeed/ats_process_context.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/ats_pagespeed/ats_process_context.cc b/plugins/experimental/ats_pagespeed/ats_process_context.cc
index ea0d3b7..1efd6d2 100644
--- a/plugins/experimental/ats_pagespeed/ats_process_context.cc
+++ b/plugins/experimental/ats_pagespeed/ats_process_context.cc
@@ -40,6 +40,7 @@ AtsProcessContext::AtsProcessContext() : ProcessContext()
   AtsThreadSystem *ts = new AtsThreadSystem();
   message_handler_.reset(new AtsMessageHandler(ts->NewMutex()));
   driver_factory_.reset(new AtsRewriteDriverFactory(*this, ts, "" /*hostname, not used*/,
-1 /*port, not used*/));
+  driver_factory_->Init();
   server_context_ = driver_factory()->MakeAtsServerContext();
 
   AtsRewriteOptions *root_options_ = (AtsRewriteOptions *)driver_factory_->default_options();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70a6c94d/plugins/experimental/ats_pagespeed/ats_resource_intercept.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/ats_pagespeed/ats_resource_intercept.cc b/plugins/experimental/ats_pagespeed/ats_resource_intercept.cc
index f6c7260..15b66e3 100644
--- a/plugins/experimental/ats_pagespeed/ats_resource_intercept.cc
+++ b/plugins/experimental/ats_pagespeed/ats_resource_intercept.cc
@@ -120,40 +120,49 @@ resource_intercept(TSCont cont, TSEvent event, void *edata)
       AtsServerContext *server_context = intercept_ctx->request_ctx->server_context;
 
       // TODO:(oschaaf) host/port
-      SystemRequestContext *system_request_context =
-        new SystemRequestContext(server_context->thread_system()->NewMutex(), server_context->timer(),
-                                 "www.foo.com", // TODO(oschaaf): compute these
-                                 80, "127.0.0.1");
+      RequestContextPtr system_request_context(new SystemRequestContext(server_context->thread_system()->NewMutex(),
+                                                                        server_context->timer(),
+                                                                        "www.foo.com", //
TODO(oschaaf): compute these
+                                                                        80, "127.0.0.1"));
 
-      intercept_ctx->request_ctx->base_fetch = new AtsBaseFetch(server_context, RequestContextPtr(system_request_context),
-                                                                downstream_vio, intercept_ctx->resp_buffer,
true);
+      intercept_ctx->request_ctx->base_fetch =
+        new AtsBaseFetch(server_context, system_request_context, downstream_vio, intercept_ctx->resp_buffer,
true);
       intercept_ctx->request_ctx->base_fetch->set_request_headers(intercept_ctx->request_headers);
 
+      std::string host = intercept_ctx->request_ctx->gurl->HostAndPort().as_string();
       RewriteOptions *options = NULL;
-
-      // const char* host = intercept_ctx->request_headers->Lookup1(HttpAttributes::kHost);
-      const char *host = intercept_ctx->request_ctx->gurl->HostAndPort().as_string().c_str();
-      if (host != NULL && strlen(host) > 0) {
-        intercept_ctx->request_ctx->options = get_host_options(host);
+      if (host.size() > 0) {
+        options = get_host_options(host.c_str(), server_context);
+      }
+      if (options == NULL) {
+        options = server_context->global_options()->Clone();
       }
 
-      // TODO(oschaaf): directory options should be coming from configuration!
-      bool ok = ps_determine_options(
-        server_context, intercept_ctx->request_ctx->options, intercept_ctx->request_ctx->base_fetch->request_headers(),
-        intercept_ctx->request_ctx->base_fetch->response_headers(), &options,
intercept_ctx->request_ctx->gurl);
-
-      // Take ownership of custom_options.
-      scoped_ptr<RewriteOptions> custom_options(options);
 
+      /*        GoogleString pagespeed_query_params;
+      GoogleString pagespeed_option_cookies;
+      bool ok = ps_determine_options(server_context,
+                                     intercept_ctx->request_ctx->base_fetch->request_headers(),
+                                     NULL //intercept_ctx->request_ctx->base_fetch->response_headers()//,
+                                     &options,
+                                     system_request_context,
+                                     intercept_ctx->request_ctx->gurl,
+                                     &pagespeed_query_params,
+                                     &pagespeed_option_cookies,
+                                     false );
       if (!ok) {
         TSError("Failure while determining request options for psol resource");
-        // options = server_context->global_options();
-      } else {
-        // ps_determine_options modified url, removing any ModPagespeedFoo=Bar query
-        // parameters.  Keep url_string in sync with url.
-        // TODO(oschaaf): we really should determine if we have to do the lookup
-        intercept_ctx->request_ctx->gurl->Spec().CopyToString(intercept_ctx->request_ctx->url_string);
+        options = server_context->global_options()->Clone();
+      } else if (options == NULL) {
+        options = server_context->global_options()->Clone();
       }
+    */
+      scoped_ptr<RewriteOptions> custom_options(options);
+
+
+      // TODO(oschaaf): directory options should be coming from configuration!
+      // TODO(oschaaf): do we need to sync the url?
+      system_request_context->set_options(options->ComputeHttpOptions());
 
       // The url we have here is already checked for IsWebValid()
       net_instaweb::ResourceFetch::Start(GoogleUrl(*intercept_ctx->request_ctx->url_string),
@@ -233,7 +242,7 @@ read_cache_header_callback(TSCont cont, TSEvent event, void *edata)
   // This is because I realised too late that the intercepts
   // are able to outlive the transaction, which I hacked
   // to work.
-  if (TSHttpTxnIsInternal(txn) == TS_SUCCESS) {
+  if (TSHttpIsInternalRequest(txn) == TS_SUCCESS) {
     ats_ctx_destroy(ctx);
     TSHttpTxnReenable(txn, TS_EVENT_HTTP_CONTINUE);
     return 0;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70a6c94d/plugins/experimental/ats_pagespeed/gzip/misc.h
----------------------------------------------------------------------
diff --git a/plugins/experimental/ats_pagespeed/gzip/misc.h b/plugins/experimental/ats_pagespeed/gzip/misc.h
index 52e7477..f3d49d4 100644
--- a/plugins/experimental/ats_pagespeed/gzip/misc.h
+++ b/plugins/experimental/ats_pagespeed/gzip/misc.h
@@ -48,11 +48,7 @@ static const int DICT_ENTRY_MAX = 2048;
 // to make it work, the name must be different then downstream proxies though
 // otherwise the downstream will restore the accept encoding header
 
-enum transform_state {
-  transform_state_initialized,
-  transform_state_output,
-  transform_state_finished,
-};
+enum transform_state { transform_state_initialized, transform_state_output, transform_state_finished
};
 
 typedef struct {
   TSHttpTxn txn;


Mime
View raw message