• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

HttpTransactCache.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   A brief file description
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 /****************************************************************************
00025 
00026    HttpTransactCache.h --
00027    Created On      : Thu Mar 26 17:19:35 1998
00028 
00029 
00030  ****************************************************************************/
00031 #if !defined (_HttpTransactCache_h_)
00032 #define _HttpTransactCache_h_
00033 
00034 #include "libts.h"
00035 
00036 struct CacheHTTPInfoVector;
00037 
00038 class CacheLookupHttpConfig
00039 {
00040 public:
00041   bool cache_global_user_agent_header;  // 'global' user agent flag (don't need to marshal/unmarshal)
00042   bool cache_enable_default_vary_headers;
00043   unsigned ignore_accept_mismatch;
00044   unsigned ignore_accept_language_mismatch;
00045   unsigned ignore_accept_encoding_mismatch;
00046   unsigned ignore_accept_charset_mismatch;
00047   char *cache_vary_default_text;
00048   char *cache_vary_default_images;
00049   char *cache_vary_default_other;
00050 
00051   inkcoreapi int marshal_length();
00052   inkcoreapi int marshal(char *buf, int length);
00053   int unmarshal(Arena * arena, const char *buf, int length);
00054 
00055   CacheLookupHttpConfig():
00056     cache_global_user_agent_header(false),
00057     cache_enable_default_vary_headers(false),
00058     ignore_accept_mismatch(0),
00059     ignore_accept_language_mismatch(0),
00060     ignore_accept_encoding_mismatch(0),
00061     ignore_accept_charset_mismatch(0),
00062     cache_vary_default_text(NULL), cache_vary_default_images(NULL), cache_vary_default_other(NULL)
00063   { }
00064 
00065   void *operator new(size_t size, void *mem);
00066   void operator delete(void *mem);
00067 };
00068 
00069 extern ClassAllocator<CacheLookupHttpConfig> CacheLookupHttpConfigAllocator;
00070 // this is a global CacheLookupHttpConfig used to bypass SelectFromAlternates
00071 extern CacheLookupHttpConfig global_cache_lookup_config;
00072 
00073 inline void *
00074 CacheLookupHttpConfig::operator new(size_t size, void *mem)
00075 {
00076   (void) size;
00077   return mem;
00078 }
00079 
00080 inline void
00081 CacheLookupHttpConfig::operator delete(void *mem)
00082 {
00083   CacheLookupHttpConfigAllocator.free((CacheLookupHttpConfig *) mem);
00084 }
00085 
00086 enum Variability_t
00087 {
00088   VARIABILITY_NONE = 0,
00089   VARIABILITY_SOME,
00090   VARIABILITY_ALL
00091 };
00092 
00093 enum ContentEncoding
00094 {
00095   NO_GZIP = 0,
00096   GZIP
00097 };
00098 
00099 
00100 class HttpTransactCache
00101 {
00102 public:
00103 
00104   /////////////////////////////////
00105   // content negotiation support //
00106   /////////////////////////////////
00107 
00108   static int SelectFromAlternates(CacheHTTPInfoVector * cache_vector_data,
00109                                   HTTPHdr * client_request, CacheLookupHttpConfig * cache_lookup_http_config_params);
00110 
00111   static float calculate_quality_of_match(CacheLookupHttpConfig * http_config_params, HTTPHdr * client_request, // in
00112                                           HTTPHdr * obj_client_request, // in
00113                                           HTTPHdr * obj_origin_server_response);        // in
00114 
00115   static float calculate_quality_of_accept_match(MIMEField * accept_field, MIMEField * content_field);
00116 
00117   static float calculate_quality_of_accept_charset_match(MIMEField * accept_field,
00118                                                          MIMEField * content_field,
00119                                                          MIMEField * cached_accept_field = NULL);
00120 
00121   static float calculate_quality_of_accept_encoding_match(MIMEField * accept_field,
00122                                                           MIMEField * content_field,
00123                                                           MIMEField * cached_accept_field = NULL);
00124   static ContentEncoding match_gzip(MIMEField * accept_field);
00125 
00126   static float calculate_quality_of_accept_language_match(MIMEField * accept_field,
00127                                                           MIMEField * content_field,
00128                                                           MIMEField * cached_accept_field = NULL);
00129 
00130   ///////////////////////////////////////////////
00131   // variability & server negotiation routines //
00132   ///////////////////////////////////////////////
00133 
00134   static Variability_t CalcVariability(CacheLookupHttpConfig * http_config_params, HTTPHdr * client_request,    // in
00135                                        HTTPHdr * obj_client_request,    // in
00136                                        HTTPHdr * obj_origin_server_response     // in
00137     );
00138 
00139   static HTTPStatus match_response_to_request_conditionals(HTTPHdr * ua_request, HTTPHdr * c_response);
00140 
00141 };
00142 
00143 #endif

Generated by  doxygen 1.7.1