Data Structures | Public Types | Public Member Functions | Data Fields | Static Public Attributes

UrlRewrite Class Reference

#include <UrlRewrite.h>

Collaboration diagram for UrlRewrite:
Collaboration graph
[legend]

Data Structures

struct  MappingsStore
struct  RegexMapping

Public Types

typedef Queue< RegexMappingRegexMappingList

Public Member Functions

 UrlRewrite ()
 ~UrlRewrite ()
int BuildTable (const char *path)
 Reads the configuration file and creates a new hash table.
mapping_type Remap_redirect (HTTPHdr *request_header, URL *redirect_url)
 Determines if a redirect is to occur and if so, figures out what the redirect is.
bool ReverseMap (HTTPHdr *response_header)
void SetReverseFlag (int flag)
 Sets the reverse proxy flag.
void Print ()
 Debugging Method.
bool is_valid () const
void PerformACLFiltering (HttpTransact::State *s, url_mapping *mapping)
 Perform fast ACL filtering.
url_mappingSetupPacMapping ()
 Allocaites via new, and setups the default mapping to the PAC generator port which is used to serve the PAC (proxy autoconfig) file.
url_mappingSetupBackdoorMapping ()
 Allocaites via new, and adds a mapping like this map /ink/rh http://{backdoor}/ink/rh.
void PrintStore (MappingsStore &store)
 Debugging method.
void DestroyStore (MappingsStore &store)
bool InsertForwardMapping (mapping_type maptype, url_mapping *mapping, const char *src_host)
bool InsertMapping (mapping_type maptype, url_mapping *new_mapping, RegexMapping *reg_map, const char *src_host, bool is_cur_mapping_regex)
bool TableInsert (InkHashTable *h_table, url_mapping *mapping, const char *src_host)
 Inserts arg mapping in h_table with key src_host chaining the mapping of existing entries bound to src_host if necessary.
bool forwardMappingLookup (URL *request_url, int request_port, const char *request_host, int request_host_len, UrlMappingContainer &mapping_container)
bool reverseMappingLookup (URL *request_url, int request_port, const char *request_host, int request_host_len, UrlMappingContainer &mapping_container)
bool permanentRedirectLookup (URL *request_url, int request_port, const char *request_host, int request_host_len, UrlMappingContainer &mapping_container)
bool temporaryRedirectLookup (URL *request_url, int request_port, const char *request_host, int request_host_len, UrlMappingContainer &mapping_container)
bool forwardMappingWithRecvPortLookup (URL *request_url, int recv_port, const char *request_host, int request_host_len, UrlMappingContainer &mapping_container)

Data Fields

MappingsStore forward_mappings
MappingsStore reverse_mappings
MappingsStore permanent_redirects
MappingsStore temporary_redirects
MappingsStore forward_mappings_with_recv_port
int nohost_rules
int reverse_proxy
int backdoor_enabled
int mgmt_autoconf_port
int default_to_pac
int default_to_pac_port
char * ts_name
char * http_default_redirect_url
int num_rules_forward
int num_rules_reverse
int num_rules_redirect_permanent
int num_rules_redirect_temporary
int num_rules_forward_with_recv_port

Static Public Attributes

static const int MAX_REGEX_SUBS = 10

Detailed Description

Definition at line 52 of file UrlRewrite.h.


Member Typedef Documentation

Definition at line 92 of file UrlRewrite.h.


Constructor & Destructor Documentation

UrlRewrite::UrlRewrite (  ) 
UrlRewrite::~UrlRewrite (  ) 

Member Function Documentation

int UrlRewrite::BuildTable ( const char *  path  ) 
void UrlRewrite::DestroyStore ( MappingsStore store  )  [inline]
bool UrlRewrite::forwardMappingLookup ( URL request_url,
int  request_port,
const char *  request_host,
int  request_host_len,
UrlMappingContainer mapping_container 
) [inline]

Definition at line 124 of file UrlRewrite.h.

References forward_mappings.

Referenced by RemapProcessor::setup_for_remap().

bool UrlRewrite::forwardMappingWithRecvPortLookup ( URL request_url,
int  recv_port,
const char *  request_host,
int  request_host_len,
UrlMappingContainer mapping_container 
) [inline]

Definition at line 148 of file UrlRewrite.h.

References forward_mappings_with_recv_port.

Referenced by RemapProcessor::setup_for_remap().

bool UrlRewrite::InsertForwardMapping ( mapping_type  maptype,
url_mapping mapping,
const char *  src_host 
)
bool UrlRewrite::InsertMapping ( mapping_type  maptype,
url_mapping new_mapping,
RegexMapping reg_map,
const char *  src_host,
bool  is_cur_mapping_regex 
)
bool UrlRewrite::is_valid (  )  const [inline]

Definition at line 63 of file UrlRewrite.h.

Referenced by init_reverse_proxy(), and reloadUrlRewrite().

void UrlRewrite::PerformACLFiltering ( HttpTransact::State s,
url_mapping map 
)
bool UrlRewrite::permanentRedirectLookup ( URL request_url,
int  request_port,
const char *  request_host,
int  request_host_len,
UrlMappingContainer mapping_container 
) [inline]

Definition at line 136 of file UrlRewrite.h.

References permanent_redirects.

Referenced by Remap_redirect().

void UrlRewrite::Print (  ) 
void UrlRewrite::PrintStore ( MappingsStore store  ) 
mapping_type UrlRewrite::Remap_redirect ( HTTPHdr request_header,
URL redirect_url 
)

Determines if a redirect is to occur and if so, figures out what the redirect is.

This was plaguiarized from UrlRewrite::Remap. redirect_url ought to point to the new, mapped URL when the function exits.

Definition at line 481 of file UrlRewrite.cc.

References URL::copy(), URL::create(), Debug, URL::host_get(), ink_assert, ink_atoi(), HdrHeapSDKHandle::m_heap, MIME_FIELD_HOST, MIME_LEN_HOST, NONE, num_rules_redirect_permanent, num_rules_redirect_temporary, PERMANENT_REDIRECT, permanentRedirectLookup(), URL::port_get(), reverse_proxy, TEMPORARY_REDIRECT, temporaryRedirectLookup(), HTTPHdr::url_get(), url_rewrite_remap_request(), URL::valid(), and MIMEHdr::value_get().

Referenced by request_url_remap_redirect().

bool UrlRewrite::ReverseMap ( HTTPHdr response_header  ) 
bool UrlRewrite::reverseMappingLookup ( URL request_url,
int  request_port,
const char *  request_host,
int  request_host_len,
UrlMappingContainer mapping_container 
) [inline]

Definition at line 130 of file UrlRewrite.h.

References reverse_mappings.

Referenced by ReverseMap().

void UrlRewrite::SetReverseFlag ( int  flag  ) 

Sets the reverse proxy flag.

Definition at line 129 of file UrlRewrite.cc.

References is_debug_tag_set, Print(), and reverse_proxy.

Referenced by url_rewrite_CB().

url_mapping * UrlRewrite::SetupBackdoorMapping (  ) 

Allocaites via new, and adds a mapping like this map /ink/rh http://{backdoor}/ink/rh.

These {backdoor} things are then rewritten in a request-hdr hook. (In the future it might make sense to move the rewriting into HttpSM directly.)

Definition at line 174 of file UrlRewrite.cc.

References URL::create(), url_mapping::fromURL, URL::parse(), URL::scheme_set(), url_mapping::toUrl, URL_LEN_HTTP, and URL_SCHEME_HTTP.

Referenced by BuildTable().

url_mapping * UrlRewrite::SetupPacMapping (  ) 

Allocaites via new, and setups the default mapping to the PAC generator port which is used to serve the PAC (proxy autoconfig) file.

Definition at line 142 of file UrlRewrite.cc.

References URL::create(), default_to_pac_port, url_mapping::fromURL, mgmt_autoconf_port, URL::parse(), URL::port_set(), and url_mapping::toUrl.

Referenced by BuildTable().

bool UrlRewrite::TableInsert ( InkHashTable h_table,
url_mapping mapping,
const char *  src_host 
)

Inserts arg mapping in h_table with key src_host chaining the mapping of existing entries bound to src_host if necessary.

Definition at line 760 of file UrlRewrite.cc.

References ink_hash_table_insert(), ink_hash_table_lookup(), and Warning.

Referenced by BuildTable(), and InsertForwardMapping().

bool UrlRewrite::temporaryRedirectLookup ( URL request_url,
int  request_port,
const char *  request_host,
int  request_host_len,
UrlMappingContainer mapping_container 
) [inline]

Definition at line 142 of file UrlRewrite.h.

References temporary_redirects.

Referenced by Remap_redirect().


Field Documentation

Definition at line 157 of file UrlRewrite.h.

Referenced by BuildTable(), and UrlRewrite().

Definition at line 161 of file UrlRewrite.h.

Referenced by BuildTable(), and UrlRewrite().

Definition at line 162 of file UrlRewrite.h.

Referenced by SetupPacMapping(), and UrlRewrite().

Definition at line 166 of file UrlRewrite.h.

Referenced by RemapProcessor::finish_remap(), Print(), UrlRewrite(), and ~UrlRewrite().

const int UrlRewrite::MAX_REGEX_SUBS = 10 [static]

Definition at line 66 of file UrlRewrite.h.

Referenced by process_regex_mapping_config().

Definition at line 160 of file UrlRewrite.h.

Referenced by SetupPacMapping(), and UrlRewrite().

Definition at line 155 of file UrlRewrite.h.

Referenced by BuildTable(), and RemapProcessor::setup_for_remap().

Definition at line 169 of file UrlRewrite.h.

Referenced by BuildTable(), InsertMapping(), Print(), and Remap_redirect().

Definition at line 170 of file UrlRewrite.h.

Referenced by BuildTable(), InsertMapping(), Print(), and Remap_redirect().

Definition at line 168 of file UrlRewrite.h.

Referenced by BuildTable(), InsertMapping(), Print(), and ReverseMap().

Definition at line 164 of file UrlRewrite.h.

Referenced by UrlRewrite(), and ~UrlRewrite().


The documentation for this class was generated from the following files: