A brief file description. More...
#include "Prefetch.h"
#include "HdrUtils.h"
#include "HttpCompat.h"
#include <records/I_RecHttp.h>
#include <ts/IpMapConf.h>
Go to the source code of this file.
Data Structures | |
struct | PrefetchConfigCont |
struct | PrefetchConfigFreerCont |
Defines | |
#define | PrefetchEstablishStaticConfigStringAlloc(_ix, _n) |
#define | PrefetchEstablishStaticConfigLongLong(_ix, _n) |
#define | PrefetchEstablishStaticConfigFloat(_ix, _n) |
#define | PrefetchEstablishStaticConfigByte(_ix, _n) |
#define | IS_STATUS_REDIRECT(status) |
#define | IS_RECURSIVE_PREFETCH(req_ip) (prefetch_config->max_recursion > 0 && ats_is_ip_loopback(&req_ip)) |
#define | CONN_ARR_SIZE 256 |
Typedefs | |
typedef int(PrefetchConfigCont::* | PrefetchConfigContHandler )(int, void *) |
typedef int(PrefetchConfigFreerCont::* | PrefetchConfigFreerContHandler )(int, void *) |
Functions | |
static uint32_t | get_udp_seq_no () |
static void | setup_udp_header (char *header, uint32_t seq_no, uint32_t pkt_no, bool last_pkt) |
static void | setup_object_header (char *header, int64_t size, bool url_promise) |
const char * | findDomainFromHost (const char *host, int host_len, bool &no_dot) |
static int | normalize_url (char *url, int *len) |
static int | prefetch_config_cb (const char *, RecDataT, RecData, void *) |
static void | check_n_attach_prefetch_transform (HttpSM *sm, HTTPHdr *resp, bool from_cache) |
static int | PrefetchPlugin (TSCont, TSEvent event, void *edata) |
bool | isCookieUnique (HTTPHdr *req, const char *move_cookie, int move_cookie_len) |
void | cookie_debug (const char *level, const char *value, int value_len) |
static int | copy_header (MIOBuffer *buf, HTTPHdr *hdr, const char *hdr_tail) |
static int | config_read_proto (TSPrefetchBlastData &blast, const char *str) |
int | TSPrefetchHookSet (int hook_no, TSPrefetchHook hook) |
Variables | |
struct html_tag | prefetch_allowable_html_tags [] |
struct html_tag | prefetch_allowable_html_attrs [] |
static const char * | PREFETCH_FIELD_RECURSION |
static int | PREFETCH_FIELD_LEN_RECURSION |
PrefetchProcessor | prefetchProcessor |
KeepAliveConnTable * | g_conn_table |
static int | prefetch_udp_fd = 0 |
static int32_t | udp_seq_no |
TSPrefetchBlastData const | UDP_BLAST_DATA = { TS_PREFETCH_UDP_BLAST } |
TSPrefetchBlastData const | TCP_BLAST_DATA = { TS_PREFETCH_TCP_BLAST } |
static PrefetchConfiguration * | prefetch_config |
ClassAllocator< PrefetchUrlEntry > | prefetchUrlEntryAllocator ("prefetchUrlEntryAllocator") |
static Ptr< ProxyMutex > | prefetch_reconfig_mutex |
ClassAllocator< BlasterUrlList > | blasterUrlListAllocator ("blasterUrlList") |
ClassAllocator < PrefetchUrlBlaster > | prefetchUrlBlasterAllocator ("prefetchUrlBlaster") |
ClassAllocator< PrefetchBlaster > | prefetchBlasterAllocator ("PrefetchBlasterAllocator") |
ClassAllocator < KeepAliveLockHandler > | prefetchLockHandlerAllocator ("prefetchLockHandlerAllocator") |
A brief file description.
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.
Definition in file Prefetch.cc.
#define CONN_ARR_SIZE 256 |
Definition at line 2039 of file Prefetch.cc.
Referenced by KeepAliveConnTable::ip_hash().
#define IS_RECURSIVE_PREFETCH | ( | req_ip | ) | (prefetch_config->max_recursion > 0 && ats_is_ip_loopback(&req_ip)) |
Definition at line 655 of file Prefetch.cc.
Referenced by check_n_attach_prefetch_transform(), and PrefetchBlaster::init().
#define IS_STATUS_REDIRECT | ( | status | ) |
(prefetch_config->redirection > 0 &&\ (((status) == HTTP_STATUS_MOVED_PERMANENTLY) ||\ ((status) == HTTP_STATUS_MOVED_TEMPORARILY) ||\ ((status) == HTTP_STATUS_SEE_OTHER) ||\ (((status) == HTTP_STATUS_TEMPORARY_REDIRECT))))
Definition at line 298 of file Prefetch.cc.
Referenced by PrefetchTransform::redirect().
#define PrefetchEstablishStaticConfigByte | ( | _ix, | ||
_n | ||||
) |
REC_EstablishStaticConfigByte(_ix,_n); \ REC_RegisterConfigUpdateFunc(_n, prefetch_config_cb, NULL)
Definition at line 96 of file Prefetch.cc.
#define PrefetchEstablishStaticConfigFloat | ( | _ix, | ||
_n | ||||
) |
REC_EstablishStaticConfigFloat(_ix,_n); \ REC_RegisterConfigUpdateFunc(_n, prefetch_config_cb, NULL)
Definition at line 92 of file Prefetch.cc.
#define PrefetchEstablishStaticConfigLongLong | ( | _ix, | ||
_n | ||||
) |
REC_EstablishStaticConfigInteger(_ix,_n); \ REC_RegisterConfigUpdateFunc(_n, prefetch_config_cb, NULL)
Definition at line 88 of file Prefetch.cc.
#define PrefetchEstablishStaticConfigStringAlloc | ( | _ix, | ||
_n | ||||
) |
REC_EstablishStaticConfigStringAlloc(_ix,_n); \ REC_RegisterConfigUpdateFunc(_n, prefetch_config_cb, NULL)
Definition at line 84 of file Prefetch.cc.
typedef int(PrefetchConfigCont::* PrefetchConfigContHandler)(int, void *) |
Definition at line 305 of file Prefetch.cc.
typedef int(PrefetchConfigFreerCont::* PrefetchConfigFreerContHandler)(int, void *) |
Definition at line 321 of file Prefetch.cc.
static void check_n_attach_prefetch_transform | ( | HttpSM * | sm, | |
HTTPHdr * | resp, | |||
bool | from_cache | |||
) | [static] |
Definition at line 659 of file Prefetch.cc.
References ats_ip_copy(), ats_ip_ntop(), ats_ip_sa_cast(), HttpTransact::State::client_info, TSPrefetchInfo::client_ip, IpMap::contains(), Debug, DUMP_HEADER, TSPrefetchInfo::embedded_url, HttpTransact::State::hdr_info, PrefetchConfiguration::ip_map, IS_RECURSIVE_PREFETCH, HTTPHdr::m_http, PrefetchConfiguration::max_recursion, memcpy, MIME_FIELD_CONTENT_ENCODING, MIME_FIELD_CONTENT_TYPE, MIME_LEN_CONTENT_ENCODING, MIME_LEN_CONTENT_TYPE, TSPrefetchInfo::object_buf, TSPrefetchInfo::object_buf_reader, TSPrefetchInfo::object_buf_status, PrefetchConfiguration::pre_parse_hook, PREFETCH_FIELD_LEN_RECURSION, PREFETCH_FIELD_RECURSION, TSPrefetchInfo::present_in_cache, TSPrefetchInfo::request_buf, TSPrefetchInfo::request_loc, TSPrefetchInfo::response_buf, TSPrefetchInfo::response_loc, HttpSM::t_state, TS_HTTP_RESPONSE_TRANSFORM_HOOK, TS_PREFETCH_DISCONTINUE, TS_PREFETCH_PRE_PARSE_HOOK, TSHttpTxnHookAdd(), TSPrefetchInfo::url_blast, TSPrefetchInfo::url_response_blast, MIMEHdr::value_get(), MIMEHdr::value_get_int(), and MIMEHdr::value_set_int().
Referenced by PrefetchPlugin().
static int config_read_proto | ( | TSPrefetchBlastData & | blast, | |
const char * | str | |||
) | [static] |
Definition at line 1871 of file Prefetch.cc.
References ats_ip_ntop(), ats_ip_pton(), ats_ip_sa_cast(), Debug, Error, TSPrefetchBlastData::ip, and TSPrefetchBlastData::type.
Referenced by PrefetchConfiguration::readConfiguration().
void cookie_debug | ( | const char * | level, | |
const char * | value, | |||
int | value_len | |||
) | [inline] |
Definition at line 1184 of file Prefetch.cc.
References ats_free(), ats_malloc(), Debug, is_debug_tag_set, and memcpy.
Referenced by PrefetchBlaster::handleCookieHeaders().
Definition at line 1540 of file Prefetch.cc.
References MIOBuffer::add_block(), MIOBuffer::block_write_avail(), MIOBuffer::end(), MIOBuffer::fill(), ink_assert, HTTPHdr::print(), and MIOBuffer::write().
Referenced by PrefetchBlaster::bufferObject(), and PrefetchBlaster::httpClient().
const char* findDomainFromHost | ( | const char * | host, | |
int | host_len, | |||
bool & | no_dot | |||
) | [inline] |
Definition at line 126 of file Prefetch.cc.
Referenced by PrefetchTransform::PrefetchTransform().
static uint32_t get_udp_seq_no | ( | ) | [inline, static] |
Definition at line 101 of file Prefetch.cc.
References udp_seq_no.
Referenced by PrefetchBlaster::blastObject(), and PrefetchUrlBlaster::udpUrlBlaster().
bool isCookieUnique | ( | HTTPHdr * | req, | |
const char * | move_cookie, | |||
int | move_cookie_len | |||
) |
Definition at line 1136 of file Prefetch.cc.
References MIMEHdr::field_find(), StrList::head, Str::len, MIMEField::m_next_dup, MIME_FIELD_COOKIE, MIME_LEN_COOKIE, Str::next, HttpCompat::parse_tok_list(), Str::str, and MIMEField::value_get().
Referenced by PrefetchBlaster::handleCookieHeaders().
static int normalize_url | ( | char * | url, | |
int * | len | |||
) | [static] |
Definition at line 190 of file Prefetch.cc.
References ink_assert.
Referenced by PrefetchTransform::hash_add().
Definition at line 360 of file Prefetch.cc.
References ET_TASK, eventProcessor, HRTIME_SECONDS, and EventProcessor::schedule_in().
Referenced by PrefetchProcessor::start().
Definition at line 753 of file Prefetch.cc.
References check_n_attach_prefetch_transform(), Debug, HttpTransact::State::hdr_info, HttpSM::t_state, TS_CACHE_LOOKUP_HIT_FRESH, TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE, TS_EVENT_HTTP_CONTINUE, TS_EVENT_HTTP_READ_RESPONSE_HDR, TSHttpTxnCacheLookupStatusGet(), TSHttpTxnReenable(), and HTTPHdr::valid().
Referenced by PrefetchProcessor::start().
static void setup_object_header | ( | char * | header, | |
int64_t | size, | |||
bool | url_promise | |||
) | [inline, static] |
Definition at line 116 of file Prefetch.cc.
References PRELOAD_HDR_URL_PROMISE_FLAG.
Referenced by PrefetchBlaster::blastObject(), and PrefetchUrlBlaster::udpUrlBlaster().
static void setup_udp_header | ( | char * | header, | |
uint32_t | seq_no, | |||
uint32_t | pkt_no, | |||
bool | last_pkt | |||
) | [inline, static] |
Definition at line 107 of file Prefetch.cc.
References PRELOAD_UDP_LAST_PKT_FLAG, and PRELOAD_UDP_PKT_NUM_MASK.
Referenced by PrefetchBlaster::blastObject(), and PrefetchUrlBlaster::udpUrlBlaster().
int TSPrefetchHookSet | ( | int | hook_no, | |
TSPrefetchHook | hook | |||
) |
Definition at line 2248 of file Prefetch.cc.
References PrefetchConfiguration::embedded_obj_hook, PrefetchConfiguration::embedded_url_hook, PrefetchConfiguration::pre_parse_hook, TS_PREFETCH_EMBEDDED_OBJECT_HOOK, TS_PREFETCH_EMBEDDED_URL_HOOK, and TS_PREFETCH_PRE_PARSE_HOOK.
ClassAllocator<BlasterUrlList> blasterUrlListAllocator("blasterUrlList") |
Referenced by PrefetchTransform::PrefetchTransform().
Definition at line 76 of file Prefetch.cc.
struct html_tag prefetch_allowable_html_attrs[] |
{ {NULL, NULL}, {NULL, NULL}, {NULL, NULL}, {NULL, NULL}, {NULL, NULL}, {NULL, NULL}, {NULL, NULL}, {NULL, NULL}, {NULL, NULL}, {NULL, NULL}, {NULL, NULL}, {"rel", "stylesheet"}, {NULL, NULL} }
Definition at line 56 of file Prefetch.cc.
struct html_tag prefetch_allowable_html_tags[] |
{ {"img", "src"}, {"body", "background"}, {"frame", "src"}, {"fig", "src"}, {"applet", "code"}, {"script", "src"}, {"embed", "src"}, {"td", "background"}, {"base", "href"}, {"meta", "content"}, {"input", "src"}, {"link", "href"}, {NULL, NULL} }
Definition at line 34 of file Prefetch.cc.
PrefetchConfiguration* prefetch_config [static] |
Definition at line 295 of file Prefetch.cc.
int PREFETCH_FIELD_LEN_RECURSION [static] |
Definition at line 73 of file Prefetch.cc.
Referenced by check_n_attach_prefetch_transform(), PrefetchBlaster::httpClient(), and PrefetchProcessor::start().
const char* PREFETCH_FIELD_RECURSION [static] |
Definition at line 72 of file Prefetch.cc.
Referenced by check_n_attach_prefetch_transform(), PrefetchBlaster::httpClient(), and PrefetchProcessor::start().
Ptr<ProxyMutex> prefetch_reconfig_mutex [static] |
Definition at line 317 of file Prefetch.cc.
int prefetch_udp_fd = 0 [static] |
Definition at line 78 of file Prefetch.cc.
Referenced by PrefetchBlaster::blastObject(), PrefetchProcessor::start(), and PrefetchUrlBlaster::udpUrlBlaster().
ClassAllocator<PrefetchBlaster> prefetchBlasterAllocator("PrefetchBlasterAllocator") |
Referenced by PrefetchBlaster::free(), PrefetchTransform::parse_data(), and PrefetchTransform::redirect().
ClassAllocator<KeepAliveLockHandler> prefetchLockHandlerAllocator("prefetchLockHandlerAllocator") |
Referenced by KeepAliveConnTable::append(), and KeepAliveLockHandler::handleEvent().
Definition at line 75 of file Prefetch.cc.
Referenced by TransformProcessor::start().
ClassAllocator<PrefetchUrlBlaster> prefetchUrlBlasterAllocator("prefetchUrlBlaster") |
Referenced by PrefetchUrlBlaster::free().
ClassAllocator<PrefetchUrlEntry> prefetchUrlEntryAllocator("prefetchUrlEntryAllocator") |
Referenced by PrefetchTransform::hash_add().
TSPrefetchBlastData const TCP_BLAST_DATA = { TS_PREFETCH_TCP_BLAST } |
Definition at line 82 of file Prefetch.cc.
TSPrefetchBlastData const UDP_BLAST_DATA = { TS_PREFETCH_UDP_BLAST } |
Definition at line 81 of file Prefetch.cc.
int32_t udp_seq_no [static] |
Definition at line 79 of file Prefetch.cc.
Referenced by get_udp_seq_no(), and PrefetchProcessor::start().