Exemple #1
0
QUrl Context::uriFor(const QString &path, const QStringList &args, const ParamsMultiMap &queryValues) const
{
    Q_D(const Context);

    QUrl uri = d->request->uri();

    QString _path;
    if (path.isEmpty()) {
        // ns must NOT return a leading slash
        const QString controllerNS = d->action->controller()->ns();
        if (!controllerNS.isEmpty()) {
            _path.prepend(controllerNS);
        }
    } else {
        _path = path;
    }

    if (!args.isEmpty()) {
        if (_path == QLatin1String("/")) {
            _path += args.join(QLatin1Char('/'));
        } else {
            _path = _path + QLatin1Char('/') + args.join(QLatin1Char('/'));
        }
    }

    if (!_path.startsWith(QLatin1Char('/'))) {
        _path.prepend(QLatin1Char('/'));
    }
    uri.setPath(_path, QUrl::DecodedMode);

    QUrlQuery query;
    if (!queryValues.isEmpty()) {
        // Avoid a trailing '?'
        if (queryValues.size()) {
            auto it = queryValues.constEnd();
            while (it != queryValues.constBegin()) {
                --it;
                query.addQueryItem(it.key(), it.value());
            }
        }
    }
    uri.setQuery(query);

    return uri;
}
Exemple #2
0
void LoginDialog::OnLoginPageFinished() {
    QNetworkReply *reply = qobject_cast<QNetworkReply *>(QObject::sender());
    if (reply->error()) {
        DisplayError("Network error: " + reply->errorString() + "\nTry using another login method.");
        return;
    }

    QByteArray bytes = reply->readAll();
    std::string page(bytes.constData(), bytes.size());
    std::string hash = Util::GetCsrfToken(page, "hash");
    if (hash.empty()) {
        DisplayError("Failed to log in (can't extract form hash from page)");
        return;
    }

    QUrlQuery query;
    query.addQueryItem("login_email", EncodeSpecialCharacters(ui->emailLineEdit->text()));
    query.addQueryItem("login_password", EncodeSpecialCharacters(ui->passwordLineEdit->text()));
    query.addQueryItem("hash", QString(hash.c_str()));
    query.addQueryItem("login", "Login");
    query.addQueryItem("remember_me", "1");

    QUrl url(POE_LOGIN_URL);
    QByteArray data(query.query().toUtf8());
    QNetworkRequest request(url);
    request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
    QNetworkReply *logged_in = login_manager_->post(request, data);
    connect(logged_in, SIGNAL(finished()), this, SLOT(OnLoggedIn()));
}
void TelegramBot::editMessageText(QVariant chatId, QVariant messageId, QString text, TelegramFlags flags, TelegramKeyboardRequest keyboard, bool *response)
{
    // if we have a null messageId, and user don't request a response, call send Message
    if(!response && messageId.isNull()) {
        return this->sendMessage(chatId, text, 0, flags, keyboard);
    }

    // determine message id type
    bool isInlineMessageId = messageId.type() == QVariant::String;

    QUrlQuery params;
    if(!isInlineMessageId && !chatId.isNull()) params.addQueryItem("chat_id", chatId.toString());
    params.addQueryItem(isInlineMessageId ? "inline_message_id" : "message_id", messageId.toString());
    params.addQueryItem("text", text);
    if(flags && TelegramFlags::Markdown) params.addQueryItem("parse_mode", "Markdown");
    else if(flags && TelegramFlags::Html) params.addQueryItem("parse_mode", "HTML");
    if(flags && TelegramFlags::DisableWebPagePreview) params.addQueryItem("disable_web_page_preview", "true");

    // only build inline keyboard
    if(!(flags && TelegramFlags::ReplyKeyboardMarkup) && !(flags && TelegramFlags::ForceReply) && !(flags && TelegramFlags::ReplyKeyboardRemove)) {
        this->hanldeReplyMarkup(params, flags, keyboard);
    }

    // call api
    this->callApiTemplate("editMessageText", params, response);
}
Exemple #4
0
void Widget::wall_post()
{
    QString text = ui->WallTextPost->text();
    QUrl current("https://api.vk.com/method/wall.post");
    QUrlQuery Param;

    Param.addQueryItem("access_token",Setting::access_token);
    Param.addQueryItem("message",text);
    Param.addQueryItem("v","5.40");
    current.setQuery(Param);
    QByteArray answer = GET(current);
    if(answer.isEmpty())
    {
        qDebug() << "Нe zapostilo";
        exit(-1);
    }
    ui->WallTextPost->clear();
}
QNetworkRequest ItemsManagerWorker::MakeTabRequest(int tab_index, const ItemLocation &location, bool tabs) {
    QUrlQuery query;
    query.addQueryItem("league", league_.c_str());
    query.addQueryItem("tabs", tabs ? "1" : "0");
    query.addQueryItem("tabIndex", QString::number(tab_index));
    query.addQueryItem("accountName", account_name_.c_str());

    QUrl url(kStashItemsUrl);
    url.setQuery(query);

    TabCache::Flags flags;
    if (tabs) flags |= TabCache::Refresh;

    if (!location.IsValid() || bo_manager_.GetRefreshChecked(location))
        flags |= TabCache::Refresh;

    return Request(url, location, flags);
}
void ApiRequest::post(const QUrlQuery & data) const
{
    m_request->setUrl(url());
    m_request->setHeader(QNetworkRequest::ContentTypeHeader,
                         QStringLiteral("application/x-www-form-urlencoded"));
    QNetworkReply * reply =
        m_networkManager->post(*m_request, data.toString(QUrl::FullyEncoded).toUtf8());
    connect(reply, &QNetworkReply::finished, this, &ApiRequest::processReply);
}
Exemple #7
0
void AboutDialog::processSubscribe_()
{
    // Set query
    QUrlQuery urlQuery;
    urlQuery.addQueryItem("emailaddress", subscribeLineEdit_->text());
    QUrl url = QUrl("http://www.vpaint.org/subscribeext.php");
    QNetworkRequest networkRequest(url);
    networkRequest.setHeader(QNetworkRequest::ContentTypeHeader,
                             "application/x-www-form-urlencoded; charset=utf-8");

    // Send query
    QString urlQueryString = urlQuery.toString(QUrl::FullyEncoded);
    urlQueryString.replace('+', "%2B");
    reply_ = networkManager_->post(networkRequest, urlQueryString.toUtf8());

    // Connection to process reply
    connect(reply_, SIGNAL(finished()), this, SLOT(processFinished_()));
}
Exemple #8
0
int SM_QDropbox::authorize(QString email, QString pwd)
{
    QUrl dropbox_authorize;
    dropbox_authorize.setPath(QString("/%1/oauth/authorize")
                              .arg(_version.left(1)));
#ifdef SM_QTDROPBOX_DEBUG
    qDebug() << "oauthToken = " << oauthToken << endl;
#endif

    QUrlQuery query;
    query.addQueryItem("oauth_token", oauthToken);
    dropbox_authorize.setQuery(query);
    int reqnr = sendRequest(dropbox_authorize, "GET", 0, "www.dropbox.com");
    requestMap[reqnr].type = SM_DROPBOX_REQ_AULOGIN;
    mail     = email;
    password = pwd;
    return reqnr;
}
Exemple #9
0
void AppModel::refreshWeather()
{
    QUrl url("http://www.google.com/ig/api");
    QUrlQuery query;
    query.addQueryItem("hl", "en");
    query.addQueryItem("weather", d->city);
    url.setQuery(query);

    QNetworkReply *rep = d->nam->get(QNetworkRequest(url));
    // connect up the signal right away
    d->weatherReplyMapper->setMapping(rep, rep);
    connect(rep, SIGNAL(finished()),
            d->weatherReplyMapper, SLOT(map()));
    // it might have finished though while we were connecting it
    // if so, pass it straight on
    if (rep->isFinished())
        this->handleWeatherNetworkData(rep);
}
Exemple #10
0
bool Server::addComment(int issue_id, const QString & comment) {
	
	QUrlQuery params;
	params.addQueryItem("comment_visibility", "1");
	params.addQueryItem("comment_body", comment);
	params.addQueryItem("comment_save_changes", "1");
	
	QString format = "/comment/add/for/module/core/item/type/1/id/%1";
	QString url = format.arg(QString::number(issue_id));

	http::POSTRequest request(toUTF8(m_serverPrefix + url));
	request.setData(qUrlQueryToPostData(params));
	request.setFollowRedirects(false);
	
	boost::scoped_ptr<http::Response> response(post(request));
	
	return response->ok();
}
Exemple #11
0
void GeoNamesWeatherService::getAdditionalItems( const GeoDataLatLonAltBox& box,
                                            qint32 number )
{
    if (marbleModel()->planetId() != QLatin1String("earth")) {
        return;
    }

    QUrl geonamesUrl( "http://ws.geonames.org/weatherJSON" );
    QUrlQuery urlQuery;
    urlQuery.addQueryItem( "north", QString::number( box.north( GeoDataCoordinates::Degree ) ) );
    urlQuery.addQueryItem( "south", QString::number( box.south( GeoDataCoordinates::Degree ) ) );
    urlQuery.addQueryItem( "east", QString::number( box.east( GeoDataCoordinates::Degree ) ) );
    urlQuery.addQueryItem( "west", QString::number( box.west( GeoDataCoordinates::Degree ) ) );
    urlQuery.addQueryItem( "maxRows", QString::number( number ) );
    urlQuery.addQueryItem( "username", "marble" );
    geonamesUrl.setQuery( urlQuery );

    emit downloadDescriptionFileRequested( geonamesUrl );
}
Exemple #12
0
inline int KNAccount::loginWith(const QString &username,
                                const QString &password,
                                QByteArray &responseCache)
{
    //Generate the login request.
    QNetworkRequest loginRequest=generateKreogistRequest("login");
    //Construct the json struct.
    //Try to login with encrypted password first.
    QUrlQuery loginQuery;
    //Insert user name.
    loginQuery.addQueryItem("username", username);
    loginQuery.addQueryItem("password", password);
    //Insert login query to login url.
    QUrl loginUrl=loginRequest.url();
    loginUrl.setQuery(loginQuery);
    loginRequest.setUrl(loginUrl);
    //Get the login result.
    return get(loginRequest, responseCache, false);
}
Exemple #13
0
/*!
 * Преобразует канал в URL адрес.
 *
 * \param channel Указатель на канал.
 * \param action  Действие над каналом.
 */
QUrl ChatUrls::toUrl(ClientChannel channel, const QString &action)
{
  QUrl out(LS("chat://channel"));
  out.setPath(SimpleID::encode(channel->id()) + (action.isEmpty() ? QString() : "/" + action));

  QList<QPair<QString, QString> > queries;
  queries.append(QPair<QString, QString>(LS("name"),   ChatId::toBase32(channel->name().toUtf8())));
  queries.append(QPair<QString, QString>(LS("gender"), QString::number(channel->gender().raw())));

# if QT_VERSION >= 0x050000
  QUrlQuery query;
  query.setQueryItems(queries);
  out.setQuery(query);
# else
  out.setQueryItems(queries);
# endif

  return out;
}
void InstagramClient::discover(QString maxID, QJSValue callback)
{
    static QString sessionID;

    if (maxID.isEmpty() || sessionID.isEmpty())
        sessionID = createCleanedUuid();

    QUrlQuery q;
    q.addQueryItem("is_prefetch", "false");
    q.addQueryItem("session_id", sessionID);

    if (!maxID.isEmpty())
        q.addQueryItem("max_id", maxID);

    QUrl url("https://i.instagram.com/api/v1/discover/explore/");
    url.setQuery(q);

    executeGetRequest(url, callback);
}
Exemple #15
0
void View::google()
{
    QString queryString;
    QAction *action = qobject_cast<QAction *>(sender());
    if (action)
        queryString = action->data().toString();
    if (!queryString.isEmpty())
    {
        QUrl url("http://www.google.com/search");
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
        url.addEncodedQueryItem("q", QUrl::toPercentEncoding(queryString));
#else
        QUrlQuery query;
        query.addQueryItem("q", QUrl::toPercentEncoding(queryString));
        url.setQuery(query);
#endif
        QDesktopServices::openUrl(url);
    }
}
Exemple #16
0
/**
 *   Gets oauth tokens using XAuth method (starts authorization process)
 *   @param username username
 *   @param password password
 *   @remarks Async, emits authorizeXAuthFinished or authorizeXAuthError when there is error
 */
void OAuthTwitter::authorizeXAuth(const QString &username, const QString &password)
{
    Q_ASSERT(m_netManager != 0);

    QUrl url(TWITTER_ACCESS_TOKEN_XAUTH_URL);
	QUrlQuery query;
    query.addQueryItem("x_auth_username", username.toUtf8().toPercentEncoding());
    query.addQueryItem("x_auth_password", password.toUtf8().toPercentEncoding());
    query.addQueryItem("x_auth_mode", "client_auth");
	url.setQuery(query);

    QByteArray oauthHeader = generateAuthorizationHeader(url, OAuth::POST);

    QNetworkRequest req(url);
    req.setRawHeader(AUTH_HEADER, oauthHeader);

    QNetworkReply *reply = m_netManager->post(req, QByteArray());
    connect(reply, SIGNAL(finished()), this, SLOT(finishedAuthorization()));
}
Exemple #17
0
QList<Audio> VKAudio::getUserAudio() {
    QList<Audio> list;
    if(I_Am_Not_Null()) {
        qDebug() << "Getting user audios";

        QUrl url(main_url+method_userAudio);
        QUrlQuery query;
        // don't return audio owner info
        query.addQueryItem("uid", userId);
        query.addQueryItem("count", count);
        query.addQueryItem("offset","0");
        query.addQueryItem("access_token", accessToken);

        url.setQuery(query);

        list = getAudios(url);
    }
    return list;
}
QHash<QString, QString> HTTPConnection::parseUrlEncodedForm() {
    // make sure we have the correct MIME type
    QList<QByteArray> elements = _requestHeaders.value("Content-Type").split(';');

    QString contentType = elements.at(0).trimmed();
    if (contentType != "application/x-www-form-urlencoded") {
        return QHash<QString, QString>();
    }

    QUrlQuery form { _requestContent };
    QHash<QString, QString> pairs;
    for (auto pair : form.queryItems()) {
        auto key = QUrl::fromPercentEncoding(pair.first.toLatin1().replace('+', ' '));
        auto value = QUrl::fromPercentEncoding(pair.second.toLatin1().replace('+', ' '));
        pairs[key] = value;
    }

    return pairs;
}
Exemple #19
0
void XmlDataSource::executeQuery()
{
    m_waiting = true;
    const QList<QString> keys = m_queryItems.keys();

#if QT_VERSION >= 0x050000
    QUrlQuery query;
    foreach (QString key, keys)
        query.addQueryItem(key, m_queryItems.value(key));
    m_url.setQuery(query);
#else
    QList<QPair<QString, QString> > query;
    foreach (QString key, keys)
        query.append(QPair<QString,QString>(key, m_queryItems.value(key)));
    m_url.setQueryItems(query);
#endif

    m_receiver->request(m_url);
}
Exemple #20
0
void IBSFetcher::search() {
  m_started = true;
  m_matches.clear();

  QUrl u(QString::fromLatin1(IBS_BASE_URL));
  QUrlQuery q;

  switch(request().key) {
    case Title:
      q.addQueryItem(QLatin1String("Type"), QLatin1String("keyword"));
      q.addQueryItem(QLatin1String("T"), request().value);
      break;

    case Person:
      q.addQueryItem(QLatin1String("Type"), QLatin1String("keyword"));
      q.addQueryItem(QLatin1String("A"), request().value);
      break;

    case ISBN:
      {
        u = u.adjusted(QUrl::RemoveFilename);
        u.setPath(u.path() + QLatin1String("serdsp.asp"));

        QString s = request().value;
        s.remove(QLatin1Char('-'));
        // limit to first isbn
        s = s.section(QLatin1Char(';'), 0, 0);
        q.addQueryItem(QLatin1String("isbn"), s);
      }
      break;

    case Keyword:
      q.addQueryItem(QLatin1String("Type"), QLatin1String("keyword"));
      q.addQueryItem(QLatin1String("S"), request().value);
      break;

    default:
      myWarning() << "key not recognized: " << request().key;
      stop();
      return;
  }
  u.setQuery(q);
//  myDebug() << "url: " << u.url();

  m_job = KIO::storedGet(u, KIO::NoReload, KIO::HideProgressInfo);
  KJobWidgets::setWindow(m_job, GUI::Proxy::widget());
  if(request().key == ISBN) {
    connect(m_job, SIGNAL(result(KJob*)), SLOT(slotCompleteISBN(KJob*)));
  } else {
    connect(m_job, SIGNAL(result(KJob*)), SLOT(slotComplete(KJob*)));
  }
}
void GeoNamesWeatherService::getItem( const QString &id )
{
    if( marbleModel()->planetId() != "earth" ) {
        return;
    }

    if ( id.startsWith(QLatin1String("geonames_") ) ) {
        QUrl geonamesUrl( "http://ws.geonames.org/weatherIcaoJSON" );
#if QT_VERSION < 0x050000
        geonamesUrl.addQueryItem( "ICAO", id.mid( 9 ) );
        geonamesUrl.addQueryItem( "username", "marble" );
#else
        QUrlQuery urlQuery;
        urlQuery.addQueryItem( "ICAO", id.mid( 9 ) );
        urlQuery.addQueryItem( "username", "marble" );
        geonamesUrl.setQuery( urlQuery );
#endif
        emit downloadDescriptionFileRequested( geonamesUrl );
    }
}
Exemple #22
0
void AppModel::refreshWeather()
{
    if (d->city.isEmpty()) {
        qCDebug(requestsLog) << "refreshing weather skipped (no city)";
        return;
    }
    qCDebug(requestsLog) << "refreshing weather";
    QUrl url("http://api.openweathermap.org/data/2.5/weather");
    QUrlQuery query;

    query.addQueryItem("q", d->city);
    query.addQueryItem("mode", "json");
    url.setQuery(query);

    QNetworkReply *rep = d->nam->get(QNetworkRequest(url));
    // connect up the signal right away
    d->weatherReplyMapper->setMapping(rep, rep);
    connect(rep, SIGNAL(finished()),
            d->weatherReplyMapper, SLOT(map()));
}
void UpdateChecker::checkForUpdate() {
    QUrl url(QString(Constants::WEBSITE) + "-ws/release.xml");

    QUrlQuery q;
    q.addQueryItem("v", Constants::VERSION);

#ifdef APP_MAC
    q.addQueryItem("os", "mac");
#endif
#ifdef APP_WIN
    q.addQueryItem("os", "win");
#endif
#ifdef APP_MAC_STORE
    q.addQueryItem("store", "mac");
#endif
    url.setQuery(q);

    QObject *reply = Http::instance().get(url);
    connect(reply, SIGNAL(data(QByteArray)), SLOT(requestFinished(QByteArray)));
}
Exemple #24
0
void MainWindow::newTrack()
{
    QStringList files = QFileDialog::getOpenFileNames(
                            this,
                            "Select one or more files to add",
                            QDir::homePath());
    PlaylistTab *curTab = static_cast<PlaylistTab*>(playlistsTabWidget->currentWidget());
    QString curUuid = curTab->getUuid();
    QStringList::Iterator it = files.begin();
    while(it != files.end()) {
        QUrlQuery query;
        query.addQueryItem("path", *it);
        query.addQueryItem("playlist", curUuid);
        WarptenCli *cli = new WarptenCli(this);
        connect(cli, SIGNAL(onExecutionFinished(WarptenCli*)), this, SLOT(updateNewTrack(WarptenCli*)));
        cli->execute("POST", "/track/add", query);

        ++it;
    }
}
Exemple #25
0
void Api::post(QString url, QVariantMap parameters)
{
    DEBUG << Q_FUNC_INFO;
    m_future.cancel();
    QUrlQuery postData;
    QStringList keys = parameters.keys();
    for(int i = 0; i < keys.count(); i++)
    {
        QString key = keys.at(i);
        QString value = QVariant(parameters.value(key)).toString();

        postData.addQueryItem(key, value);
    }

    QNetworkRequest request(url);
    request.setHeader(QNetworkRequest::ContentTypeHeader,
                      "application/x-www-form-urlencoded");

    m_networkManager->post(request, postData.toString(QUrl::FullyEncoded).toUtf8());
}
Exemple #26
0
/**
 * @brief OwnCloudService::loadVersions
 */
void OwnCloudService::loadVersions(QString fileName, MainWindow *mainWindow) {
    this->mainWindow = mainWindow;

    QUrl url(serverUrl + versionListPath);
    QString serverNotesPath = NoteFolder::currentRemotePath();

    url.setUserName(userName);
    url.setPassword(password);

    QUrlQuery q;
    q.addQueryItem("format", format);
    q.addQueryItem("file_name", serverNotesPath + fileName);
    url.setQuery(q);

    QNetworkRequest r(url);
    addAuthHeader(&r);

    QNetworkReply *reply = networkManager->get(r);
    ignoreSslErrorsIfAllowed(reply);
}
Exemple #27
0
void ScriptsModel::requestDefaultFiles(QString marker) {
    QUrl url(PathUtils::defaultScriptsLocation());

    // targets that don't have a scripts folder in the appropriate location will have an empty URL here
    if (!url.isEmpty()) {
        if (url.isLocalFile()) {
            // if the url indicates a local directory, use QDirIterator
            QString localDir = expandScriptUrl(url).toLocalFile();
            int localDirPartCount = localDir.split("/").size();
            if (localDir.endsWith("/")) {
                localDirPartCount--;
            }
#ifdef Q_OS_WIN
            localDirPartCount++; // one for the drive letter
#endif
            QDirIterator it(localDir, QStringList() << "*.js", QDir::Files, QDirIterator::Subdirectories);
            while (it.hasNext()) {
                QUrl jsFullPath = QUrl::fromLocalFile(it.next());
                QString jsPartialPath = jsFullPath.path().split("/").mid(localDirPartCount).join("/");
                jsFullPath = normalizeScriptURL(jsFullPath);
                _treeNodes.append(new TreeNodeScript(jsPartialPath, jsFullPath.toString(), SCRIPT_ORIGIN_DEFAULT));
            }
            _loadingScripts = false;
        } else {
            // the url indicates http(s), use QNetworkRequest
            QUrlQuery query;
            query.addQueryItem(PREFIX_PARAMETER_NAME, ".");
            if (!marker.isEmpty()) {
                query.addQueryItem(MARKER_PARAMETER_NAME, marker);
            }
            url.setQuery(query);

            QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
            QNetworkRequest request(url);
            request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
            request.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
            QNetworkReply* reply = networkAccessManager.get(request);
            connect(reply, SIGNAL(finished()), SLOT(downloadFinished()));
        }
    }
}
Exemple #28
0
Command *CommandManager::pushCommand(const QString &path, const QString &cmd, const QVariantMap &arguments)
{
	Q_ASSERT(nam != NULL);

	QString normPath(path);

	// ensure the path is normalized (with starting and ending slashes)
	if (normPath.length() > 0) {
		if (!normPath.startsWith('/'))
			normPath.prepend('/');
		if (!normPath.endsWith('/'))
			normPath.append('/');
	}

	QUrlQuery query;

	foreach (const QString &key, arguments.keys()) {
		query.addQueryItem(key, arguments[key].toString());
	}

	// add some application and authentication keys
	query.addQueryItem("key", apiKey);
	if (!authToken.isEmpty())
		query.addQueryItem("token", authToken);

	QUrl url(QString("%1%2%3.json").arg(websiteUrl).arg(normPath).arg(cmd));
	url.setQuery(query);

	QNetworkRequest request(url);
	request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);

	QNetworkReply *reply = nam->get(request);
	Command *command = new Command(this);
	commands.insert(reply, command);

	connect(reply, &QNetworkReply::finished, this, &CommandManager::httpFinished);
	connect(reply, &QNetworkReply::readyRead, this, &CommandManager::httpReadyRead);
	connect(reply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), this, &CommandManager::httpError);

	return command;
}
Exemple #29
0
/**
 * @internal
 *
 * @brief  Create an AWS Signature version 1 canonical query.
 *
 * This function returns a string containing all non-empty query parameters in
 * sorted order (case-insensitive), with no separators at all.
 *
 * For example, for the following SQS query string:
 *
 *     ?Action=CreateQueue&QueueName=queue2&AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE&SignatureVersion=1&Expires=2007-01-12T12:00:00Z&Version=2006-04-01
 *
 * this function will return the following canonical form:
 *
 *     ActionCreateQueueAWSAccessKeyIdAKIAIOSFODNN7EXAMPLEExpires2007-01-12T12:00:00ZQueueNamequeue2SignatureVersion1Version2006-04-01
 *
 * This function is very similar to AwsAbstractSignature::canonicalQuery(), except
 * that:
 *   1. this function sorts case-insensitively, whereas AwsAbstractSignature::canonicalQuery()
 *      use a byte sort (ie is case sensitive); and
 *   2. this function excludes parameters with empty values, where
 *      AwsAbstractSignature::canonicalQuery() includes all query parameters, regardless
 *      of content; and
 *   3. this function does not use any separators in the generated string, whereas
 *      AwsAbstractSignature::canonicalQuery() uses `&` and `=` separators just as
 *      you would expect to see them in a typical query string; and
 *   4. this function does not perform any URL encoding of the query parameters,
 *      whereas AwsAbstractSignature::canonicalQuery() URL encodes both parameter
 *      keys and values.
 *
 * The AwsAbstractSignature::canonicalQuery() function is used by the later signature
 * algorithms, such as AwsSignatureV2 and AwsSignatureV4, as required by Amazon. Instead
 * this function is specific to version 1 signatures.
 *
 * @param  query  Query to encode the HTTP query string from.
 *
 * @return An AWS Signature canonical query string.
 *
 * @see    http://docs.aws.amazon.com/AmazonDevPay/latest/DevPayDeveloperGuide/LSAPI_Auth_REST.html#CalculatingHMACSignature
 */
QByteArray AwsSignatureV1Private::canonicalQuery(const QUrlQuery &query) const
{
    QList<QStringPair> list = query.queryItems(QUrl::FullyDecoded);
    qSort(list.begin(), list.end(), AwsSignatureV1Private::caseInsensitiveLessThan);
    QString result;
    foreach (const QStringPair &pair, list) {
        if (!pair.second.isEmpty()) {
            result += pair.first + pair.second;
        }
    }
    return result.toUtf8();
}
  void writeGetFeatureInfo( QgsServerInterface *serverIface, const QgsProject *project,
                            const QString &version, const QgsServerRequest &request,
                            QgsServerResponse &response )
  {
    Q_UNUSED( version );
    const QgsWmtsParameters params( QUrlQuery( request.url() ) );

    // WMS query
    QUrlQuery query = translateWmtsParamToWmsQueryItem( QStringLiteral( "GetFeatureInfo" ), params, project, serverIface );

    // GetFeatureInfo query items
    query.addQueryItem( QgsWmsParameterForWmts::name( QgsWmsParameterForWmts::QUERY_LAYERS ), params.layer() );
    query.addQueryItem( QgsWmsParameterForWmts::name( QgsWmsParameterForWmts::I ), params.i() );
    query.addQueryItem( QgsWmsParameterForWmts::name( QgsWmsParameterForWmts::J ), params.j() );
    query.addQueryItem( QgsWmsParameterForWmts::name( QgsWmsParameterForWmts::INFO_FORMAT ), params.infoFormatAsString() );

    QgsServerParameters wmsParams( query );
    QgsServerRequest wmsRequest( "?" + query.query( QUrl::FullyDecoded ) );
    QgsService *service = serverIface->serviceRegistry()->getService( wmsParams.service(), wmsParams.version() );
    service->executeRequest( wmsRequest, response, project );
  }