1 #ifndef __HTTP_MISC_HPP__ 2 #define __HTTP_MISC_HPP__ 23 void clear() { _firstVal.clear(); _options.clear(); }
77 template <
typename _Ty > _Ty
getHeader(
winux::String const & name, _Ty
const & defval = _Ty() )
const {
return _headers.has(name) ? (_Ty)_headers[name] : defval; }
82 template <
typename _HeaderField >
85 if ( _headers.has(name) )
87 field->parse( *_headers[name]._pStr );
92 template <
typename _HeaderField >
96 f.parse( (*
this)[name] );
110 void delMultiHeader(
int index );
115 void setResponseLine(
winux::String const & responseLine,
bool setStatus =
true );
149 std::vector< std::pair< winux::String, winux::String > > _multiHeaders;
153 mutable int _curHeaderIndex;
154 mutable int _curMultiHeaderIndex;
155 mutable bool _isCompleteEnum;
165 bool empty()
const {
return _v.empty(); }
169 void operator = (
int v );
183 Cookie() : secure(false), httpOnly(false), wantSet(false) { }
191 bool httpOnly =
false 212 std::map< winux::String, http::Cookie > _cookies;
226 bool httpOnly = false
235 void loadCookies(
char const * cookiesStr );
248 bool has(
winux::String const & name )
const {
return _cookies.find(name) != _cookies.end(); }
267 Vars(
char const * varsData = NULL );
275 Vars & parse(
char const * varsData );
280 template <
typename _Ty >
283 return this->has(name) ? (_Ty)_vars[name] : defval;
292 #endif // __HTTP_MISC_HPP__
String StrLower(String const &str)
std::ostream & operator<<(std::ostream &o, Cookie const &cookie)
std::map< String, String > StringStringMap
bool isset(_MAP const &m, _KEY const &k)
检测map中是否有该键的值
bool has(winux::String const &name) const
检测是否有该cookie
用来使得String能够用operator<<来赋值
std::basic_string< tchar > String