TS-3167 Eliminate the prefetch feature, although leave the code ifdefed out
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/5f204944 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/5f204944 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/5f204944 Branch: refs/heads/master Commit: 5f20494465f71f5315eee36186f4a5f0b8d369c3 Parents: c7b2e7d Author: Leif Hedstrom <[email protected]> Authored: Mon Jun 8 15:51:41 2015 -0600 Committer: Leif Hedstrom <[email protected]> Committed: Tue Jun 9 08:16:18 2015 -0600 ---------------------------------------------------------------------- cmd/traffic_manager/AddConfigFilesHere.cc | 1 - cmd/traffic_manager/traffic_manager.cc | 2 - example/Makefile.am | 1 - example/prefetch/prefetch-plugin-eg1.c | 85 --------- example/prefetch/readme.txt | 26 --- example/prefetch/test-hns-plugin.c | 245 ------------------------- lib/perl/lib/Apache/TS/AdminClient.pm | 12 -- mgmt/RecordsConfig.cc | 25 --- proxy/Makefile.am | 3 - proxy/api/ts/experimental.h | 117 ------------ proxy/config/Makefile.am | 1 - proxy/config/prefetch.config.default | 58 ------ 12 files changed, 576 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5f204944/cmd/traffic_manager/AddConfigFilesHere.cc ---------------------------------------------------------------------- diff --git a/cmd/traffic_manager/AddConfigFilesHere.cc b/cmd/traffic_manager/AddConfigFilesHere.cc index 6482d26..ea9066b 100644 --- a/cmd/traffic_manager/AddConfigFilesHere.cc +++ b/cmd/traffic_manager/AddConfigFilesHere.cc @@ -85,6 +85,5 @@ initializeRegistry() configFiles->addFile("splitdns.config", false); configFiles->addFile("ssl_multicert.config", false); configFiles->addFile("stats.config.xml", false); - configFiles->addFile("prefetch.config", false); configFiles->registerCallback(testcall); } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5f204944/cmd/traffic_manager/traffic_manager.cc ---------------------------------------------------------------------- diff --git a/cmd/traffic_manager/traffic_manager.cc b/cmd/traffic_manager/traffic_manager.cc index 974a00b..5516a42 100644 --- a/cmd/traffic_manager/traffic_manager.cc +++ b/cmd/traffic_manager/traffic_manager.cc @@ -928,8 +928,6 @@ fileUpdated(char *fname, bool incVersion) mgmt_log(stderr, "[fileUpdated] stats.config.xml file has been modified\n"); } else if (strcmp(fname, "congestion.config") == 0) { lmgmt->signalFileChange("proxy.config.http.congestion_control.filename"); - } else if (strcmp(fname, "prefetch.config") == 0) { - lmgmt->signalFileChange("proxy.config.prefetch.config_file"); } else { mgmt_elog(stderr, 0, "[fileUpdated] Unknown config file updated '%s'\n", fname); } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5f204944/example/Makefile.am ---------------------------------------------------------------------- diff --git a/example/Makefile.am b/example/Makefile.am index db09497..835f218 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -83,6 +83,5 @@ ssl_sni_whitelist_la_SOURCES = ssl-sni-whitelist/ssl-sni-whitelist.cc # The following examples do not build: # -# prefetch_eg1_la_SOURCES = prefetch/prefetch-plugin-eg1.c # redirect_1_la_SOURCES = redirect-1/redirect-1.c # session_1_la_SOURCES = session-1/session-1.c http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5f204944/example/prefetch/prefetch-plugin-eg1.c ---------------------------------------------------------------------- diff --git a/example/prefetch/prefetch-plugin-eg1.c b/example/prefetch/prefetch-plugin-eg1.c deleted file mode 100644 index 61d7a21..0000000 --- a/example/prefetch/prefetch-plugin-eg1.c +++ /dev/null @@ -1,85 +0,0 @@ -/** @file - - A brief file description - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -/* - prefetch-plugin-eg1.c : an example plugin which interacts with - Traffic Server's prefetch feature - -*/ - -#include <stdio.h> -#include <string.h> -#include <ts/ts.h> -#include <ts/experimental.h> - -TSPrefetchReturnCode -my_preparse_hook(TSPrefetchHookID hook, TSPrefetchInfo *info) -{ - unsigned char *ip = (unsigned char *)&info->client_ip; - - printf("preparse hook (%d): request from child %u.%u.%u.%u\n", hook, ip[0], ip[1], ip[2], ip[3]); - - - /* we will let TS parse the page */ - return TS_PREFETCH_CONTINUE; -} - -TSPrefetchReturnCode -my_embedded_url_hook(TSPrefetchHookID hook, TSPrefetchInfo *info) -{ - unsigned char *ip = (unsigned char *)&info->client_ip; - - printf("url hook (%d): url: %s %s child: %u.%u.%u.%u\n", hook, info->embedded_url, - (info->present_in_cache) ? "(present in cache)" : "", ip[0], ip[1], ip[2], ip[3]); - - /* - We will select UDP for sending url and TCP for sending object - */ - - info->url_proto = TS_PREFETCH_PROTO_UDP; - info->url_response_proto = TS_PREFETCH_PROTO_TCP; - - /* we can return TS_PREFETCH_DISCONTINUE if we dont want TS to prefetch - this url */ - - return TS_PREFETCH_CONTINUE; -} - - -void -TSPluginInit(int argc, const char *argv[]) -{ - TSPluginRegistrationInfo info; - - info.plugin_name = "prefetch_plugin_eg1"; - info.vendor_name = "MyCompany"; - info.support_email = "[email protected]"; - - if (TSPluginRegister(TS_SDK_VERSION_3_0, &info) != TS_SUCCESS) { - TSError("Plugin registration failed.\n"); - } - - /* register our hooks */ - TSPrefetchHookSet(TS_PREFETCH_PRE_PARSE_HOOK, &my_preparse_hook); - TSPrefetchHookSet(TS_PREFETCH_EMBEDDED_URL_HOOK, &my_embedded_url_hook); -} http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5f204944/example/prefetch/readme.txt ---------------------------------------------------------------------- diff --git a/example/prefetch/readme.txt b/example/prefetch/readme.txt deleted file mode 100644 index f7d1d8a..0000000 --- a/example/prefetch/readme.txt +++ /dev/null @@ -1,26 +0,0 @@ -The test-hns-plugin tests the Parent Traffic Server handling of parse/prefetch -rules. It prints information to 'stdout' at various stages to verify the -correctness of the parse/prefetch module. It has the following options: - --p. If 0, the plugin returns INK_PREFETCH_DISCONTINUE when called at the - INK_PREFETCH_PRE_PARSE_HOOK. If 1, the plugin returns - INK_PREFETCH_CONTINUE. - --u. If 0, the plugin returns INK_PREFETCH_DISCONTINUE when called at the - INK_PREFETCH_EMBEDDED_URL_HOOK. If 1, the plugin returns - INK_PREFETCH_CONTINUE. - --o. If 1, the plugin sets 'object_buf_status' field in the INKPrefetchInfo to - INK_PREFETCH_OBJ_BUF_NEEDED and expects to be called back with the object. - --i. If 0, the plugin sets the 'url_response_proto' field in the - INKPrefetchInfo to INK_PREFETCH_PROTO_UDP. If 1, it sets the - 'url_response_proto' field to INK_PREFETCH_PROTO_TCP. - --d. Specifies the directory where the plugin will store all the prefetched - objects. All prefetched objects are stored in the PkgPreload format in - the 'prefetched.objects' file in this directory. - - - - http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5f204944/example/prefetch/test-hns-plugin.c ---------------------------------------------------------------------- diff --git a/example/prefetch/test-hns-plugin.c b/example/prefetch/test-hns-plugin.c deleted file mode 100644 index 7d33b44..0000000 --- a/example/prefetch/test-hns-plugin.c +++ /dev/null @@ -1,245 +0,0 @@ -/** @file - - A brief file description - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -/* - prefetch-plugin-eg1.c : an example plugin which interacts with - Traffic Server's prefetch feature - -*/ - -/* -This plugin tests the Parent Traffic Server handling of parse/prefetch -rules. It prints information to 'stdout' at various stages to verify the -correctness of the parse/prefetch module. It has the following options: - --p. If 0, the plugin returns TS_PREFETCH_DISCONTINUE when called at the - TS_PREFETCH_PRE_PARSE_HOOK. If 1, the plugin returns - TS_PREFETCH_CONTINUE. - --u. If 0, the plugin returns TS_PREFETCH_DISCONTINUE when called at the - TS_PREFETCH_EMBEDDED_URL_HOOK. If 1, the plugin returns - TS_PREFETCH_CONTINUE. - --o. If 1, the plugin sets 'object_buf_status' field in the TSPrefetchInfo to - TS_PREFETCH_OBJ_BUF_NEEDED and expects to be called back with the object. - If 2, this field is set to TS_PREFETCH_OBJ_BUF_NEEDED_N_TRANSMITTED - which implies the object is transmitted to the child as well. - --i. If 0, the plugin sets the 'url_response_proto' field in the - TSPrefetchInfo to TS_PREFETCH_PROTO_UDP. If 1, it sets the - 'url_response_proto' field to TS_PREFETCH_PROTO_TCP. - --d. Specifies the directory where the plugin will store all the prefetched - objects. All prefetched objects are stored in the PkgPreload format in - the 'prefetched.objects' file in this directory. - -*/ - -#include <stdio.h> -#include <string.h> -#include <fcntl.h> -#include <getopt.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <ts/ts.h> -#include <ts/experimental.h> - -/* We will register the following two hooks */ - -#define TAG "test-hns-plugin" - -TSFile filep1 = NULL; -static int pre_parse_cont = 0; -static int embedded_url_cont = 0; -static int url_proto = 0; -static int embedded_object = 0; - -static TSMutex file_write_mutex; - - -TSPrefetchReturnCode -embedded_object_hook(TSPrefetchHookID hook, TSPrefetchInfo *info) -{ - TSIOBufferBlock block; - const char *block_start; - int64_t block_avail, total_avail; - - TSMutexLock(file_write_mutex); - - printf("(%s) >>> TS_PREFETCH_EMBEDDED_OBJECT_HOOK (%d)\n", TAG, hook); - - printf("(%s) \tobject size for: %s is %lld\n", TAG, info->embedded_url, - (long long)TSIOBufferReaderAvail(info->object_buf_reader)); - - /* Get the embedded objects here */ - total_avail = TSIOBufferReaderAvail(info->object_buf_reader); - - printf("(%s) >>> TSIOBufferReaderAvail returns %lld\n", TAG, (long long)total_avail); - - block = TSIOBufferReaderStart(info->object_buf_reader); - while (block) { - block_start = TSIOBufferBlockReadStart(block, info->object_buf_reader, &block_avail); - - if (block_avail == 0) { - break; - } - - /* Put the object fragment into the file */ - TSfwrite(filep1, block_start, block_avail); - TSfflush(filep1); - TSIOBufferReaderConsume(info->object_buf_reader, block_avail); - block = TSIOBufferReaderStart(info->object_buf_reader); - } - - - TSIOBufferDestroy(info->object_buf); - - TSMutexUnlock(file_write_mutex); - - return 0; -} - -TSPrefetchReturnCode -embedded_url_hook(TSPrefetchHookID hook, TSPrefetchInfo *info) -{ - unsigned char *ip = (unsigned char *)&info->client_ip; - - printf("(%s) >>> TS_PREFETCH_EMBEDDED_URL_HOOK (%d)\n", TAG, hook); - - printf("(%s) \tURL: %s %s Child IP: %u.%u.%u.%u\n", TAG, info->embedded_url, (info->present_in_cache) ? "(present in cache)" : "", - ip[0], ip[1], ip[2], ip[3]); - - /* We will select UDP for sending url and TCP for sending object */ - if (embedded_object) - info->object_buf_status = (embedded_object == 1) ? TS_PREFETCH_OBJ_BUF_NEEDED : TS_PREFETCH_OBJ_BUF_NEEDED_N_TRANSMITTED; - if (url_proto) - info->url_response_proto = TS_PREFETCH_PROTO_TCP; - else - info->url_response_proto = TS_PREFETCH_PROTO_UDP; - - - if (!embedded_url_cont) { - /* This will cause parent TS not to parse the HTML page */ - printf("(%s) \tPlugin returns - TS_PREFETCH_DISCONTINUE\n", TAG); - return TS_PREFETCH_DISCONTINUE; - - } else { - /* This will cause TS (MDE plugin) to prefetch the URL */ - printf("(%s) \tURL Response Protocol: %s\n", TAG, - (info->url_response_proto == TS_PREFETCH_PROTO_TCP) ? "TS_PREFETCH_PROTO_TCP" : "TS_PREFETCH_PROTO_UDP"); - printf("(%s) \tPlugin returns - TS_PREFETCH_CONTINUE\n", TAG); - return TS_PREFETCH_CONTINUE; - } -} - - -TSPrefetchReturnCode -pre_parse_hook(TSPrefetchHookID hook, TSPrefetchInfo *info) -{ - unsigned char *ip = (unsigned char *)&info->client_ip; - - printf("(%s) >>> TS_PREFETCH_PRE_PARSE_HOOK (%d)\n", TAG, hook); - - printf("(%s) \tChild IP : %u.%u.%u.%u\n", TAG, ip[0], ip[1], ip[2], ip[3]); - - if (!pre_parse_cont) { - /* This will cause parent TS not to parse the HTML page */ - printf("(%s) \tPlugin returns - TS_PREFETCH_DISCONTINUE\n", TAG); - return TS_PREFETCH_DISCONTINUE; - - } else { - /* we will let TS parse the page */ - printf("(%s) \tPlugin returns - TS_PREFETCH_CONTINUE\n", TAG); - return TS_PREFETCH_CONTINUE; - } -} - - -void -TSPluginInit(int argc, const char *argv[]) -{ - int c, arg; - extern char *optarg; - TSPluginRegistrationInfo plugin_info; - char file_name[512] = {0}; - plugin_info.plugin_name = "test-prefetch"; - plugin_info.vendor_name = "MyCompany"; - plugin_info.support_email = "[email protected]"; - - if (TSPluginRegister(TS_SDK_VERSION_3_0, &plugin_info) != TS_SUCCESS) { - TSError("Plugin registration failed.\n"); - return; - } - - while ((c = getopt(argc, (char *const *)argv, "p:u:i:o:d:")) != EOF) { - switch (c) { - case 'p': - case 'u': - case 'i': - case 'o': - if (!strcmp(optarg, "0")) - arg = 0; - else if (!strcmp(optarg, "1")) - arg = 1; - else if (!strcmp(optarg, "2")) - arg = 2; - else { - TSError("Invalid argument specified for option: %c\n", c); - return; - } - if (c == 'p') - pre_parse_cont = arg; - else if (c == 'u') - embedded_url_cont = arg; - else if (c == 'i') - url_proto = arg; - else - embedded_object = arg; - break; - - case 'd': - sprintf(file_name, "%s/prefetched.objects", optarg); - break; - case '?': - TSError("Invalid argument specified\n"); - return; - } - } - - if (embedded_object) { - filep1 = TSfopen(file_name, "w"); - if (!filep1) { - TSError("Cannot open file %s for writing\n", file_name); - return; - } - TSfwrite(filep1, "", 1); - TSfflush(filep1); - - file_write_mutex = TSMutexCreate(); - } - - /* register our hooks */ - TSPrefetchHookSet(TS_PREFETCH_PRE_PARSE_HOOK, &pre_parse_hook); - TSPrefetchHookSet(TS_PREFETCH_EMBEDDED_URL_HOOK, &embedded_url_hook); - TSPrefetchHookSet(TS_PREFETCH_EMBEDDED_OBJECT_HOOK, &embedded_object_hook); -} http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5f204944/lib/perl/lib/Apache/TS/AdminClient.pm ---------------------------------------------------------------------- diff --git a/lib/perl/lib/Apache/TS/AdminClient.pm b/lib/perl/lib/Apache/TS/AdminClient.pm index 226268f..3984627 100644 --- a/lib/perl/lib/Apache/TS/AdminClient.pm +++ b/lib/perl/lib/Apache/TS/AdminClient.pm @@ -645,18 +645,6 @@ The Apache Traffic Server Administration Manual will explain what these strings proxy.config.ping.npacks_to_trans proxy.config.ping.timeout_sec proxy.config.plugin.plugin_dir - proxy.config.prefetch.child_port - proxy.config.prefetch.config_file - proxy.config.prefetch.default_data_proto - proxy.config.prefetch.default_url_proto - proxy.config.prefetch.keepalive_timeout - proxy.config.prefetch.max_object_size - proxy.config.prefetch.max_recursion - proxy.config.prefetch.prefetch_enabled - proxy.config.prefetch.push_cached_objects - proxy.config.prefetch.redirection - proxy.config.prefetch.url_buffer_size - proxy.config.prefetch.url_buffer_timeout proxy.config.process_manager.enable_mgmt_port proxy.config.process_manager.mgmt_port proxy.config.process_manager.timeout http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5f204944/mgmt/RecordsConfig.cc ---------------------------------------------------------------------- diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc index 51dfa0f..9377fbd 100644 --- a/mgmt/RecordsConfig.cc +++ b/mgmt/RecordsConfig.cc @@ -2017,31 +2017,6 @@ static const RecordElement RecordsConfig[] = {RECT_LOCAL, "proxy.local.log.collation_mode", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-4]", RECA_NULL} , - //#Prefetch configuration - {RECT_CONFIG, "proxy.config.prefetch.prefetch_enabled", RECD_INT, "0", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL} - , - {RECT_CONFIG, "proxy.config.prefetch.child_port", RECD_INT, "39679", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL} - , - {RECT_CONFIG, "proxy.config.prefetch.config_file", RECD_STRING, "prefetch.config", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL} - , - {RECT_CONFIG, "proxy.config.prefetch.url_buffer_size", RECD_INT, "0", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL} - , - {RECT_CONFIG, "proxy.config.prefetch.url_buffer_timeout", RECD_INT, "0", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL} - , - {RECT_CONFIG, "proxy.config.prefetch.keepalive_timeout", RECD_INT, "900", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL} - , - {RECT_CONFIG, "proxy.config.prefetch.push_cached_objects", RECD_INT, "1", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL} - , - {RECT_CONFIG, "proxy.config.prefetch.default_url_proto", RECD_STRING, "tcp", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL} - , - {RECT_CONFIG, "proxy.config.prefetch.default_data_proto", RECD_STRING, "tcp", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL} - , - {RECT_CONFIG, "proxy.config.prefetch.max_object_size", RECD_INT, "1000000000", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL} - , - {RECT_CONFIG, "proxy.config.prefetch.max_recursion", RECD_INT, "0", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL} - , - {RECT_CONFIG, "proxy.config.prefetch.redirection", RECD_INT, "0", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL} - , //# Librecords based stats system (new as of v2.1.3) {RECT_CONFIG, "proxy.config.stat_api.max_stats_allowed", RECD_INT, "256", RECU_RESTART_TS, RR_NULL, RECC_INT, "[256-1000]", RECA_NULL} , http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5f204944/proxy/Makefile.am ---------------------------------------------------------------------- diff --git a/proxy/Makefile.am b/proxy/Makefile.am index 4fdc49f..50fd902 100644 --- a/proxy/Makefile.am +++ b/proxy/Makefile.am @@ -170,8 +170,6 @@ traffic_server_SOURCES = \ Plugin.h \ PluginVC.cc \ PluginVC.h \ - Prefetch.cc \ - Prefetch.h \ ProtocolProbeSessionAccept.cc \ ProtocolProbeSessionAccept.h \ ProxyClientSession.cc \ @@ -292,7 +290,6 @@ traffic_sac_SOURCES = \ PluginVC.cc \ AbstractBuffer.cc \ Transform.cc \ - Prefetch.cc \ ProtocolProbeSessionAccept.cc \ ProtocolProbeSessionAccept.h \ ProxyClientSession.cc \ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5f204944/proxy/api/ts/experimental.h ---------------------------------------------------------------------- diff --git a/proxy/api/ts/experimental.h b/proxy/api/ts/experimental.h index 4d1d6c9..15f0f6e 100644 --- a/proxy/api/ts/experimental.h +++ b/proxy/api/ts/experimental.h @@ -489,123 +489,6 @@ tsapi TSClusterRPCMsg_t *TSAllocClusterRPCMsg(TSClusterRPCHandle_t *h, int data_ tsapi int TSSendClusterRPC(TSNodeHandle_t *nh, TSClusterRPCMsg_t *msg); -/* - This is for the prefetch APIs, this really has to be cleaned out. This is - some pretty seriously broken stuff, and we should decide whether it should - die and be redone properly. A few of the issues include: - - * The hooks are not normal ATS continuations, just plain callbacks. - * The hooks are therefore not registered the normal way either... - * And thusly, there can only be one callback for each of the three - Prefetch "hooks". - * The example plugins don't compile, there are old / missing pieces. -*/ - -typedef enum { - TS_PREFETCH_UDP_BLAST = 0, - TS_PREFETCH_TCP_BLAST, - TS_PREFETCH_MULTICAST_BLAST, -} TSPrefetchBlastType; - -typedef struct { - TSPrefetchBlastType type; - struct sockaddr_storage ip; -} TSPrefetchBlastData; - -typedef enum { - TS_PREFETCH_OBJ_BUF_NOT_NEEDED = 0, - TS_PREFETCH_OBJ_BUF_NEEDED, /* The user wants the buffer but does not - want it to be transmitted to the child */ - TS_PREFETCH_OBJ_BUF_NEEDED_N_TRANSMITTED /* The object should - be transmitted as well */ -} TSPrefetchStatus; - -/* return type for TSPrefetchHook */ -typedef enum { - TS_PREFETCH_CONTINUE, - TS_PREFETCH_DISCONTINUE, -} TSPrefetchReturnCode; - - -/* prefetch hooks, which are *not* normal hooks (no continuations) */ -typedef enum { - TS_PREFETCH_PRE_PARSE_HOOK, - /* This hook is invoked just before we begin to parse a document - request and response headers are available. - Return value: TS_PREFETCH_CONTINUE :continue parsing - TS_PREFETCH_DISCONTIUE: don't bother parser - */ - - TS_PREFETCH_EMBEDDED_URL_HOOK, - /* This hook is invoked when a URL is extracted. - url_proto and url_response_proto contain the default protocols used - for sending the url and actual url object respectively to the child. - The hook can change thes to one of the 3 methods mentioned above. - Return value: TS_PREFETCH_CONTINUE : prefetch this url. - TS_PREFETCH_DISCONTIUE: don't bother prefetching this - url - */ - - TS_PREFETCH_EMBEDDED_OBJECT_HOOK - /* This hook is invoked when the user wants to have access to the buffer - of the embedded object we prefetched. We pass in the buffer reader. - The reader contains the data in the format specified in the Prefetch - document (with 12 byte header etc). - It is the users responsibility to free the reader. - The only valid field in the PrefetchInfo structure object_buf_reader. - embedded_url, object_buf, object_buf_reader, and object_buf_status are - set in TSPrefetchInfo passed as arguments - */ -} TSPrefetchHookID; - - -/* This holds the main Prefetch information as used by the hook callbacks. */ -typedef struct { - /*request header */ - TSMBuffer request_buf; - TSMLoc request_loc; - - /*response header */ - TSMBuffer response_buf; - TSMLoc response_loc; - - /*child ip addr in network order */ - struct sockaddr_storage client_ip; - - /*the embedded url parsed by the parser */ - const char *embedded_url; - - /* flag which says if a perticular embedded url is present in the cache */ - int present_in_cache; - - /* Reader for the buffer which contains the prefetched object */ - TSIOBuffer object_buf; - TSIOBufferReader object_buf_reader; - - /* This specifies if we need to invoke the OBJECT_HOOK and whether we - need to send the buffer to child as well - This should set inside EMBEDDED_URL_HOOK by the user - */ - int object_buf_status; - - /** Method of sending data to child. - - If set to @c MULTICAST_BLAST then the corresponding address - value must be set to a multicast address to use. - */ - TSPrefetchBlastData url_blast; - TSPrefetchBlastData url_response_blast; - -} TSPrefetchInfo; - -typedef TSPrefetchReturnCode (*TSPrefetchHook)(TSPrefetchHookID hook, TSPrefetchInfo *prefetch_info); - -/* Registers a hook for the given hook_no. - A hook is already present, it is replace by hook_fn - return value 0 indicates success */ -tsapi int TSPrefetchHookSet(int hook_no, TSPrefetchHook hook_fn); - - /** * Extended FetchSM's AIPs */ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5f204944/proxy/config/Makefile.am ---------------------------------------------------------------------- diff --git a/proxy/config/Makefile.am b/proxy/config/Makefile.am index 4266dae..9e654d7 100644 --- a/proxy/config/Makefile.am +++ b/proxy/config/Makefile.am @@ -38,7 +38,6 @@ dist_sysconf_DATA = \ parent.config.default \ volume.config.default \ plugin.config.default \ - prefetch.config.default \ remap.config.default \ socks.config.default \ splitdns.config.default \ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5f204944/proxy/config/prefetch.config.default ---------------------------------------------------------------------- diff --git a/proxy/config/prefetch.config.default b/proxy/config/prefetch.config.default deleted file mode 100644 index 75f8df9..0000000 --- a/proxy/config/prefetch.config.default +++ /dev/null @@ -1,58 +0,0 @@ -#prefetch.config -#example configuration file for prefetch. -# -# You need to have following line in records.config file to enable Prefetch -# feature -# CONFIG proxy.config.prefetch.prefetch_enabled INT 1 -# -#In this file we need to specify Traffic Server child node ip addresses. -#Prefetch will be applied to requests from those ip addresses: -# -# eg: -# prefetch_children 10.0.0.0 - 10.255.255.255, 216.1.2.3 - -#Providing separate set of html tags for parsing: -# -#There is already a default set of tags which is used by the Prefetch parser. -#If you don't provide any tags, these default tags will be used. If you provide -#even one html tag pair, only the html tag pairs provided here will be used. None -#of the tags in the default set is used: -# Format: -# each line should of the form: -# -# html_tag tag attr -# -# or -# -# html_tag tag attr filter_attr filter_value -# -# where 'tag' represents the HTML tag and 'attr' represents the name of the attribute -# whose value gives the embedded object. -# -# The second form allows to specify the name of a filter attribute 'filter_attr' and -# the value 'filter_value' that it must match for the embedded object to be prefetched. -# -# eg: <img height=10 width=10 src="http://www.example.com/images/1.gif"> -# here, tag is "img" and attr is "src" -# so the line would be: -# html_tag img src -# -# eg: <link rel="stylesheet" type="text/css" href="example.css"> -# here, tag is "link" and attr is "href" -# an specifying filter_tag as "rel" and filter_value as "stylesheet" enables to -# prefetch only cascading style sheet links. -# so the line would be: -# html_tag link href rel stylesheet - -#the following pairs are part of default set of tags used. You could uncomment these and -#add more if necessary: - -# html_tag img src -# html_tag body background -# html_tag frame src -# html_tag fig src -# html_tag applet code -# html_tag script src -# html_tag embed src -# html_tag td background -
