VirtualBox

Ignore:
Timestamp:
Jun 26, 2014 9:20:40 AM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 7418: Network Manager: Separate text/binary GET requests for UINetworkReply.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.cpp

    r51635 r51733  
    7373    static int applyCertificates(RTHTTP pHttp, const QString &strFullCertificateFileName);
    7474    static int applyRawHeaders(RTHTTP pHttp, const QList<QByteArray> &headers, const QNetworkRequest &request);
    75     static int performGetRequest(RTHTTP pHttp, const QNetworkRequest &request, QByteArray &reply);
     75    static int performGetRequestForText(RTHTTP pHttp, const QNetworkRequest &request, QByteArray &reply);
     76    static int performGetRequestForBinary(RTHTTP pHttp, const QNetworkRequest &request, QByteArray &reply);
    7677    static int checkCertificates(RTHTTP pHttp, const QString &strFullCertificateFileName);
    7778    static int downloadCertificates(RTHTTP pHttp, const QString &strFullCertificateFileName);
     
    158159{
    159160    /* Perform GET request: */
    160     return performGetRequest(m_pHttp, m_request, m_reply);
     161    return performGetRequestForText(m_pHttp, m_request, m_reply);
    161162}
    162163
     
    261262
    262263/* static */
    263 int UINetworkReplyPrivateThread::performGetRequest(RTHTTP pHttp, const QNetworkRequest &request, QByteArray &reply)
     264int UINetworkReplyPrivateThread::performGetRequestForText(RTHTTP pHttp, const QNetworkRequest &request, QByteArray &reply)
    264265{
    265266    /* Make sure HTTP is created: */
     
    268269
    269270    /* Perform blocking HTTP GET request: */
    270     char *pszBuf = 0;
     271    char *pszBuffer = 0;
    271272    int rc = RTHttpGetText(pHttp,
    272273                           request.url().toString().toAscii().constData(),
    273                            &pszBuf);
    274     reply = QByteArray(pszBuf);
    275     RTMemFree(pszBuf);
     274                           &pszBuffer);
     275    reply = QByteArray(pszBuffer);
     276    RTMemFree(pszBuffer);
     277    return rc;
     278}
     279
     280/* static */
     281int UINetworkReplyPrivateThread::performGetRequestForBinary(RTHTTP pHttp, const QNetworkRequest &request, QByteArray &reply)
     282{
     283    /* Make sure HTTP is created: */
     284    if (!pHttp)
     285        return VERR_INVALID_POINTER;
     286
     287    /* Perform blocking HTTP GET request: */
     288    void *pBuffer = 0;
     289    size_t size = 0;
     290    int rc = RTHttpGetBinary(pHttp,
     291                             request.url().toString().toAscii().constData(),
     292                             &pBuffer, &size);
     293    reply = QByteArray((const char*)pBuffer, (int)size);
     294    RTMemFree(pBuffer);
    276295    return rc;
    277296}
     
    363382    QByteArray certificate;
    364383    const QNetworkRequest address(QUrl("http://www.verisign.com/repository/roots/root-certificates/PCA-3G5.pem"));
    365     int rc = performGetRequest(pHttp, address, certificate);
     384    int rc = performGetRequestForText(pHttp, address, certificate);
    366385
    367386    /* Verify certificate: */
     
    383402    QByteArray certificate;
    384403    const QNetworkRequest address(QUrl("http://www.verisign.com/repository/roots/root-certificates/PCA-3.pem"));
    385     int rc = performGetRequest(pHttp, address, certificate);
     404    int rc = performGetRequestForText(pHttp, address, certificate);
    386405
    387406    /* Verify certificate: */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette