http new QHttp this buf new QBuffer this buf- open QBuffer ReadWrite Q

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
http = new QHttp(this);
buf = new QBuffer(this);
buf->open(QBuffer::ReadWrite);
QUrl url("http://localhost/index.php");
QByteArray path = QUrl::toPercentEncoding(url.path(), "!$&'()*+,;=:@/");
if (path.isEmpty())
path = "/";
QHttpRequestHeader header("GET", QUrl::toPercentEncoding(path));
header.addValue("Cache-Control", "no-cache");
http->setHost(url.host());
header.addValue("Host", url.host());
header.addValue("Accept","*/*");
QHttp::ConnectionMode mode = url.scheme().toLower() == "https" ? QHttp::ConnectionModeHttps : QHttp::ConnectionModeHttp;
http->setHost(url.host(), mode, url.port() == -1 ? 0 : url.port());
http->request(header, buf);