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


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

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


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

示例1: main


//.........这里部分代码省略.........
   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"));

   h.add(ba);
   h.add(f);
   h.add(ba1);

   HttpOtpPostLogin p(U_CONSTANT_TO_PARAM(POST_BODY), U_STRING_FROM_CONSTANT("user"),
                                                    U_STRING_FROM_CONSTANT("pin"),
                                                    U_STRING_FROM_CONSTANT("token"),
                                                    U_STRING_FROM_CONSTANT("password"),
                                                    U_STRING_FROM_CONSTANT("cf"), h);

   U_ASSERT( p.user  == U_STRING_FROM_CONSTANT("stefano casazza") )
   U_ASSERT( p.pin   == U_STRING_FROM_CONSTANT("12345") )
   U_ASSERT( p.token == U_STRING_FROM_CONSTANT("autorizzativo") )

   HttpField* p1 = h.del(U_STRING_FROM_CONSTANT("Content-Type"));

   U_ASSERT( p1 !=  0 )
   U_ASSERT( p1 == f )

   HttpBaAuthorization* p2 = (HttpBaAuthorization*) h.find(U_STRING_FROM_CONSTANT("Authorization"));

   U_ASSERT( p2 !=  0 )
   U_ASSERT( p2 == ba )

   U_ASSERT( p2->user   == U_STRING_FROM_CONSTANT("Aladdin") )
   U_ASSERT( p2->passwd == U_STRING_FROM_CONSTANT("open sesame") )

   HttpBaAuthorization* p3 = (HttpBaAuthorization*) h.find(U_STRING_FROM_CONSTANT("Authorization"), 1);

   U_ASSERT( p3 !=  0 )
   U_ASSERT( p3 == ba1 )

   U_ASSERT( p3->user   == U_STRING_FROM_CONSTANT("utente1") )
开发者ID:alepharchives,项目名称:ULib,代码行数:67,代码来源:test_http_header.cpp


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