I am using Qt 4.1, the last version that compiles to Windows 98 (although I am running this on Windows XP because I have an AMD processor which cannot virtualize win98). I do not have access to more modern classes like QNetworkManager.
I'm trying to make a method that gets the contents of a url. The class is defined as so:
#ifndef __SONG_HPP
#define __SONG_HPP
#include <string>
#include <QWidget>
class Status : public QObject
{
Q_OBJECT
signals:
public slots:
void onRequestFinished(int id, bool error);
public:
Status();
virtual ~Status(){};
};
#endif
And the relevant function is:
Status::Status()
{
QHttp *http = new QHttp("plaza.one");
QHttpRequestHeader header("GET", "/status");
header.setValue("Host", "plaza.one");
http->request(header);
bool what = QObject::connect(http, SIGNAL(requestFinished(int, bool)), this, SLOT(onRequestFinished(int, bool)));
std::cout << what << std::endl;
}
void Status::onRequestFinished(int id, bool error)
{
std::cout << "called" << std::endl;
}
QObject::connect returns true, but the function never gets called.
My code (after realizing I'd changed it to
requestStartedat some point without thinking, when it should've beenrequestFinished) was working correctly.Opening up plaza.one in IE6 reveals that a connection is never actually made. It simply keeps hanging. As it turns out, plaza.one doesn't actually support http and Windows XP does not support the newer TLS/SSL protocols that Cloudflare uses over https.