mirror of
https://github.com/stefanocasazza/ULib.git
synced 2025-09-28 19:05:55 +08:00
26 lines
612 B
C++
26 lines
612 B
C++
// test_https.cpp
|
|
|
|
#include <ulib/net/client/http.h>
|
|
#include <ulib/ssl/net/sslsocket.h>
|
|
|
|
int U_EXPORT main(int argc, char* argv[], char* env[])
|
|
{
|
|
U_ULIB_INIT(argv);
|
|
|
|
U_TRACE(5,"main(%d)",argc)
|
|
|
|
UString url(argv[1], strlen(argv[1]));
|
|
|
|
UHttpClient<USSLSocket> http(0);
|
|
http.setRequestPasswordAuthentication(U_STRING_FROM_CONSTANT("Aladdin"),
|
|
U_STRING_FROM_CONSTANT("open sesame"));
|
|
|
|
if (http.connectServer(url) &&
|
|
http.sendRequest())
|
|
{
|
|
UString content = http.getContent();
|
|
|
|
cout.write(content.data(), content.size());
|
|
}
|
|
}
|