~unity-api-team/unity-scopes-api/child-scopes-option

« back to all changes in this revision

Viewing changes to src/scopes/internal/smartscopes/HttpClientQtThread.cpp

  • Committer: Marcus Tomlinson
  • Date: 2014-10-08 10:58:57 UTC
  • mfrom: (497.1.3 devel)
  • mto: (497.1.5 devel)
  • mto: This revision was merged to the branch mainline in revision 505.
  • Revision ID: marcus.tomlinson@canonical.com-20141008105857-gf4ilb9ywfeaeroi
Merged devel

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
namespace smartscopes
39
39
{
40
40
 
41
 
HttpClientQtThread::HttpClientQtThread(const QUrl& url, uint timeout, std::function<void(std::string const&)> const& lineData)
 
41
HttpClientQtThread::HttpClientQtThread(const QUrl& url, uint timeout, std::function<void(std::string const&)> const& lineData, HttpHeaders const& headers)
42
42
    : QThread()
43
43
    , url_(url)
44
44
    , lineDataCallback_(lineData)
 
45
    , headers_(headers)
45
46
    , timeout_(timeout)
46
47
    , success_(false)
47
48
{
67
68
    QNetworkAccessManager* manager = new QNetworkAccessManager();
68
69
 
69
70
    QNetworkRequest request(url_);
 
71
    for (auto const& hdr: headers_)
 
72
    {
 
73
        request.setRawHeader(QString::fromStdString(hdr.first).toUtf8(), QString::fromStdString(hdr.second).toUtf8());
 
74
    }
70
75
 
71
76
    QNetworkReply* reply = manager->get(request);
72
77
    reply->setReadBufferSize(0); // unlimited buffer