Restore Qt 4.7 behaviour by adding a content type to POST requests that don't have one.

This commit is contained in:
John Maguire 2011-11-10 23:42:34 +01:00
parent 8e4ec35c61
commit 85ab8e260a
2 changed files with 7 additions and 0 deletions

View File

@ -91,6 +91,12 @@ QNetworkReply* NetworkAccessManager::createRequest(
QCoreApplication::applicationName(),
QCoreApplication::applicationVersion()).toUtf8());
if (op == QNetworkAccessManager::PostOperation &&
!new_request.header(QNetworkRequest::ContentTypeHeader).isValid()) {
new_request.setHeader(QNetworkRequest::ContentTypeHeader,
"application/x-www-form-urlencoded");
}
// Prefer the cache unless the caller has changed the setting already
if (request.attribute(QNetworkRequest::CacheLoadControlAttribute).toInt()
== QNetworkRequest::PreferNetwork) {

View File

@ -245,6 +245,7 @@ int main(int argc, char *argv[]) {
#ifdef HAVE_LIBLASTFM
lastfm::ws::ApiKey = LastFMService::kApiKey;
lastfm::ws::SharedSecret = LastFMService::kSecret;
lastfm::setNetworkAccessManager(new NetworkAccessManager);
#endif
CommandlineOptions options(argc, argv);