MCPcopy Create free account
hub / github.com/SaschaWillems/VulkanCapsViewer / httpGet

Method httpGet

vulkanDatabase.cpp:58–90  ·  view source on GitHub ↗

Execute http get request url for the http get request string of the http get request or empty string in case of failure

Source from the content-addressed store, hash-verified

56/// <param name="url">url for the http get request</param>
57/// <returns>string of the http get request or empty string in case of failure</returns>
58QString VulkanDatabase::httpGet(QString url)
59{
60 manager = new QNetworkAccessManager(NULL);
61
62 QUrl qurl(url);
63
64 if (username != "" && password != "")
65 {
66 qurl.setUserName(username);
67 qurl.setPassword(password);
68 }
69
70 QNetworkReply* reply = manager->get(QNetworkRequest(qurl));
71
72 QEventLoop loop;
73 connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
74 loop.exec(QEventLoop::ExcludeUserInputEvents);
75
76 if (reply->error() == QNetworkReply::NoError)
77 {
78 QByteArray bytes = reply->readAll();
79 QString replyStr(bytes);
80 delete(manager);
81 return replyStr;
82 }
83 else
84 {
85 QString err;
86 err = reply->errorString();
87 delete(manager);
88 return "";
89 }
90}
91
92/// <summary>
93/// Encodes an url (or string) to make it comply to RFC2396 by replacing

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected