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

HttpCompat.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 #ifndef __HTTP_COMPAT_H__
00025 #define __HTTP_COMPAT_H__
00026 
00027 #include "ink_string++.h"
00028 #include "MIME.h"
00029 #include "RawHashTable.h"
00030 #include "Diags.h"
00031 
00032 struct HttpBodySetRawData
00033 {
00034   unsigned int magic;
00035   char *set_name;
00036   char *content_language;
00037   char *content_charset;
00038   RawHashTable *table_of_pages;
00039 };
00040 
00041 
00042 class HttpCompat
00043 {
00044 public:
00045   static void parse_tok_list(StrList * list, int trim_quotes, const char *comma_list_str, int comma_list_len, char tok);
00046 
00047   static void parse_tok_list(StrList * list, int trim_quotes, const char *comma_list_str, char tok);
00048 
00049   static bool lookup_param_in_strlist(StrList * param_list, const char *param_name, char *param_val, int param_val_length);
00050 
00051   static bool lookup_param_in_semicolon_string(const char *semicolon_string, int semicolon_string_len,
00052                                                const char *param_name, char *param_val, int param_val_length);
00053 
00054   static void parse_mime_type(const char *mime_string, char *type, char *subtype, int type_len, int subtype_len);
00055 
00056   static void parse_mime_type_with_len(const char *mime_string, int mime_string_len, char *type, char *subtype,
00057                                        int type_len, int subtype_len);
00058 
00059   static bool do_header_values_rfc2068_14_43_match(MIMEField * hv1, MIMEField * hv2);
00060 
00061   static float find_Q_param_in_strlist(StrList * strlist);
00062 
00063   static float match_accept_language(const char *lang_str, int lang_len,
00064                                      StrList * acpt_lang_list,
00065                                      int *matching_length, int *matching_index, bool ignore_wildcards = false);
00066 
00067   static float match_accept_charset(const char *charset_str, int charset_len,
00068                                     StrList * acpt_charset_list, int *matching_index, bool ignore_wildcards = false);
00069 
00070   static const char *determine_set_by_language(RawHashTable * table_of_sets,
00071                                                StrList * acpt_language_list, StrList * acpt_charset_list,
00072                                                float *Q_best_ptr, int *La_best_ptr, int *Lc_best_ptr, int *I_best_ptr);
00073 
00074   static void parse_comma_list(StrList * list, const char *comma_list_str)
00075   {
00076     parse_tok_list(list, 1, comma_list_str, ',');
00077   }
00078 
00079   static void parse_comma_list(StrList * list, const char *comma_list_str, int comma_list_len)
00080   {
00081     parse_tok_list(list, 1, comma_list_str, comma_list_len, ',');
00082   }
00083 
00084   static void parse_semicolon_list(StrList * list, const char *comma_list_str)
00085   {
00086     parse_tok_list(list, 1, comma_list_str, ';');
00087   }
00088 
00089   static void parse_semicolon_list(StrList * list, const char *comma_list_str, int comma_list_len)
00090   {
00091     parse_tok_list(list, 1, comma_list_str, comma_list_len, ';');
00092   }
00093 
00094 };
00095 
00096 #endif /* __HTTP_COMPAT_H__ */

Generated by  doxygen 1.7.1