当前位置: 首页>>代码示例>>C++>>正文


C++ HttpHeader::del方法代码示例

本文整理汇总了C++中HttpHeader::del方法的典型用法代码示例。如果您正苦于以下问题:C++ HttpHeader::del方法的具体用法?C++ HttpHeader::del怎么用?C++ HttpHeader::del使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HttpHeader的用法示例。


在下文中一共展示了HttpHeader::del方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int
U_EXPORT main (int argc, char* argv[])
{
   U_ULIB_INIT(argv);

   U_TRACE(5,"main(%d)",argc)

   UString value, path, domain, port, not_found;

   HttpCookie c1(U_CONSTANT_TO_PARAM("Cookie"), U_CONSTANT_TO_PARAM("Name=value")),
              c2(U_CONSTANT_TO_PARAM("Cookie"), U_CONSTANT_TO_PARAM(COOKIE_2)),
              c5(U_CONSTANT_TO_PARAM("Cookie"), U_CONSTANT_TO_PARAM(COOKIE_5));

   U_ASSERT( c5.find(U_STRING_FROM_CONSTANT("otptoken"), value, path, domain, port)  == true )
   U_ASSERT( value   == U_STRING_FROM_CONSTANT("pluto") )

   U_ASSERT( c1.count(U_STRING_FROM_CONSTANT("Name"))    == 1 )
   U_ASSERT( c2.count(U_STRING_FROM_CONSTANT("$Domain")) == 2 )

   U_ASSERT( c1.find(U_STRING_FROM_CONSTANT("Name"), value, path, domain, port)  == true )
   U_ASSERT( value   == U_STRING_FROM_CONSTANT("value") )
   U_ASSERT( path    == not_found )
   U_ASSERT( domain  == not_found )
   U_ASSERT( port    == not_found )

   U_ASSERT( c2.find(U_STRING_FROM_CONSTANT("NameB"), value, path, domain, port)  == true )
   U_ASSERT( value   == U_STRING_FROM_CONSTANT("ValueB") )
   U_ASSERT( domain  == U_STRING_FROM_CONSTANT("domain1") )
   U_ASSERT( port    == not_found )

#ifdef SERGIO
   U_ASSERT( path    == U_STRING_FROM_CONSTANT("/") )
#else
   U_ASSERT( path    == U_STRING_FROM_CONSTANT("\"/\"") )
#endif

   U_ASSERT( c2.del(U_STRING_FROM_CONSTANT("NameB")) == true )

   value = path = domain = port = not_found;

   U_ASSERT( c2.find(U_STRING_FROM_CONSTANT("Name"), value, path, domain, port)  == false )
   U_ASSERT( value   == not_found )
   U_ASSERT( path    == not_found )
   U_ASSERT( domain  == not_found )
   U_ASSERT( port    == not_found )

   U_ASSERT( c2.find(U_STRING_FROM_CONSTANT("NameC"), value, path, domain, port)  == true )
   U_ASSERT( value   == U_STRING_FROM_CONSTANT("ValueC") )
   U_ASSERT( path    == U_STRING_FROM_CONSTANT("domain1") )

#ifdef SERGIO
   U_ASSERT( port    == U_STRING_FROM_CONSTANT("123") )
   U_ASSERT( domain  == U_STRING_FROM_CONSTANT("/") )
#else
   U_ASSERT( port    == U_STRING_FROM_CONSTANT("\"123\"") )
   U_ASSERT( domain  == U_STRING_FROM_CONSTANT("\"/\"") )
#endif

   HttpSetCookie s1(U_CONSTANT_TO_PARAM("Set-Cookie"),  U_CONSTANT_TO_PARAM(SETCOOKIE_1)),
                 s2(U_CONSTANT_TO_PARAM("Set-Cookie2"), U_CONSTANT_TO_PARAM(SETCOOKIE_2));

   U_ASSERT( s1.count(U_STRING_FROM_CONSTANT("Domain"))  == 2 )
   U_ASSERT( s2.count(U_STRING_FROM_CONSTANT("Port"))    == 1 )

   HttpCookie c3(U_CONSTANT_TO_PARAM("Cookie"), U_CONSTANT_TO_PARAM(COOKIE_AUTH) );

   U_ASSERT( c3.count(U_STRING_FROM_CONSTANT("AUTHTOKEN")) == 1 )

   value = path = domain = port = not_found;

   U_ASSERT( c3.find(U_STRING_FROM_CONSTANT("AUTHTOKEN"), value, path, domain, port)  == true )

   U_ASSERT( path    == not_found )
   U_ASSERT( domain  == not_found )
   U_ASSERT( port    == not_found )

   value.erase(value.size()-1, 1);
   value.erase(0, 1);

#ifdef U_PROXY_UNIT
   DES3engine eng("pippo");
   OtpAuthToken a(&eng, value);
#else
   u_des3_key("pippo");
   OtpAuthToken a(0, value);
#endif

   U_ASSERT( a.tid     == U_STRING_FROM_CONSTANT("Current_Server_ID") )
   U_ASSERT( a.uid     == U_STRING_FROM_CONSTANT("User_ID") )
   U_ASSERT( a.sid     == U_STRING_FROM_CONSTANT("Session_ID") )
   U_ASSERT( a.ts      == U_STRING_FROM_CONSTANT("20031125131800") )
   U_ASSERT( a.cf      == U_STRING_FROM_CONSTANT("codicefiscale1") )
   U_ASSERT( a.migrate == true )

   HttpHeader h;
   HttpField* f = new HttpField(U_STRING_FROM_CONSTANT("Content-Type"), U_STRING_FROM_CONSTANT(" application/x-www-form-urlencoded"));
   HttpBaAuthorization* ba = new HttpBaAuthorization(U_CONSTANT_TO_PARAM("Authorization"),
                                                     U_CONSTANT_TO_PARAM(" Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="));
   HttpBaAuthorization* ba1 = new HttpBaAuthorization(U_CONSTANT_TO_PARAM("Authorization"),
                                                      U_CONSTANT_TO_PARAM(" Basic dXRlbnRlMTpzaWQx"));
//.........这里部分代码省略.........
开发者ID:alepharchives,项目名称:ULib,代码行数:101,代码来源:test_http_header.cpp


注:本文中的HttpHeader::del方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。