#include using namespace Upp; #define LLOG(x) RLOG(x) #define LDUMP(x) RDUMP(x) CONSOLE_APP_MAIN { StdLogSetup(LOG_COUT|LOG_FILE); HttpRequest::Trace(); const Tuple2 x[] = { { "https://www.servis24.cz", "" }, { "rcmania.cz", "" }, // { "http://www.facebook.com/pages/Upp", "" }, { "www.oexchange.org", "" }, { "http://pagead2.googlesyndication.com/pagead/show_ads.js", "" }, { "www.ultimatepp.org", "" }, { "www.idnes.cz", "" }, { "www.google.com", "" }, { "http://wattsupwiththat.com/", "" }, { "http://www.rcalbum.cz", "" }, { "www.cekas.cz", "")); } { HttpRequest r("http://httpbin.org/basic-auth/user/passw0rd"); r.User("user", "passw0rd"); String h = r.Execute(); DUMP(h); ASSERT(h.Find("\"authenticated\": true") >= 0); } { HttpRequest r("http://httpbin.org/digest-auth/auth/usr/pwd"); r.User("usr", "pwd"); String h = r.Execute(); DUMP(h); ASSERT(h.Find("\"authenticated\": true") >= 0); } { HttpRequest r("https://httpbin.org/bytes/0"); ASSERT(r.Execute().GetCount() == 0); ASSERT(r.IsSuccess()); } { HttpRequest h("https://journeyman.cz/"); String s = h.Execute(); DUMP(h.GetReasonPhrase()); DUMP(h.GetContent()); ASSERT(s.Find("") >= 0); } { HttpRequest h("https://journeyman.cz/"); h.Timeout(0); String s = h.Execute(); DUMP(h.GetReasonPhrase()); DUMP(h.GetContent()); ASSERT(s.Find("") >= 0); } LLOG("*********** Everything is OK"); }