/[resiprocate]/main/sip/resiprocate/dum/test/curlHttp/testCurlHttpProvider.cxx
ViewVC logotype

Contents of /main/sip/resiprocate/dum/test/curlHttp/testCurlHttpProvider.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4601 - (show annotations) (download)
Thu May 12 01:10:49 2005 UTC (14 years, 6 months ago) by derek
File size: 1338 byte(s)
merged identity branch(4598) into main--removing identity branch after this
1 #include "resiprocate/TransactionUser.hxx"
2 #include "CurlHttpProvider.hxx"
3 #include "resiprocate/os/Logger.hxx"
4 #include "resiprocate/external/HttpProvider.hxx"
5 #include "resiprocate/external/HttpGetMessage.hxx"
6
7 #define RESIPROCATE_SUBSYSTEM Subsystem::TEST
8
9 using namespace resip;
10
11 class TestCurlTransactionUser : public TransactionUser
12 {
13 public:
14 virtual const Data& name() const
15 {
16 static Data n("TestCurlTransactionUser");
17 return n;
18 }
19 TimeLimitFifo<Message>& getFifo() { return mFifo; }
20 private:
21 };
22
23 int
24 main(int argc, char* argv[])
25 {
26 Log::initialize(Log::Cout, Log::Debug, argv[0]);
27
28 HttpProvider::setFactory(std::auto_ptr<HttpProviderFactory>(new CurlHttpProviderFactory()));
29
30 GenericUri target;
31 if (argc == 2)
32 {
33 InfoLog ( << "Looking up: " << argv[1]);
34 target.uri() = argv[1];
35 }
36 else
37 {
38 target.uri() = "www.google.ca";
39 }
40 TestCurlTransactionUser testCurlTu;
41 HttpProvider::instance()->get(target, "aaa", testCurlTu);
42
43 Message* res = testCurlTu.getFifo().getNext(3000);
44 if (res)
45 {
46 HttpGetMessage* msg = dynamic_cast<HttpGetMessage*>(res);
47 assert(msg);
48 InfoLog( << "Received: " << *msg);
49 delete msg;
50 }
51 else
52 {
53 InfoLog( << "Reqeust timed out");
54 exit(-1);
55 }
56 return 0;
57 }

Properties

Name Value
svn:eol-style LF

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27