VirtualBox

Changeset 78066 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Apr 9, 2019 4:02:32 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129919
Message:

IPRT,GUI: Workaround for certificate downloads getting redirected to https.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/net
Files:
2 edited

Legend:

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

    r76606 r78066  
    777777    NOREF(pStaticErrInfo);
    778778    int rc;
     779
     780    /*
     781     * Must disable SSL certification verification here as we cannot use the
     782     * SSL certificates before we've downloaded them.   We must also enable
     783     * redirections in case the certificates moves around.
     784     */
     785    bool const     fSavedVerifyPeer   = RTHttpGetVerifyPeer(hHttp);
     786    uint32_t const cSavedMaxRedirects = RTHttpGetFollowRedirects(hHttp);
     787    RTHttpSetVerifyPeer(hHttp, false);
     788    RTHttpSetFollowRedirects(hHttp, 8);
    779789
    780790    /*
     
    810820                                {
    811821                                    RTHttpFreeResponse(pvRootsZip);
     822                                    RTHttpSetVerifyPeer(hHttp, fSavedVerifyPeer);
     823                                    RTHttpSetFollowRedirects(hHttp, cSavedMaxRedirects);
    812824                                    return;
    813825                                }
     
    845857                }
    846858        }
     859
     860    RTHttpSetVerifyPeer(hHttp, fSavedVerifyPeer);
     861    RTHttpSetFollowRedirects(hHttp, cSavedMaxRedirects);
    847862}
    848863
  • trunk/src/VBox/Frontends/VirtualBox/src/net/tstSSLCertDownloads.cpp

    r76553 r78066  
    5757    int rc;
    5858
     59    bool const     fSavedVerifyPeer   = RTHttpGetVerifyPeer(TestObj.m_hHttp);
     60    uint32_t const cSavedMaxRedirects = RTHttpGetFollowRedirects(TestObj.m_hHttp);
     61    RTTESTI_CHECK_RC(RTHttpSetVerifyPeer(TestObj.m_hHttp, false), VINF_SUCCESS);
     62    RTTESTI_CHECK_RC(RTHttpSetFollowRedirects(TestObj.m_hHttp, 8), VINF_SUCCESS);
     63    RTTESTI_CHECK(RTHttpGetVerifyPeer(TestObj.m_hHttp) == false);
     64    RTTESTI_CHECK(RTHttpGetFollowRedirects(TestObj.m_hHttp) == 8);
     65
    5966    /* ZIP files: */
    6067    for (uint32_t iUrl = 0; iUrl < RT_ELEMENTS(s_apszRootsZipUrls); iUrl++)
     
    113120    RTTESTI_CHECK(RTCrStoreRelease(hStore) == 0);
    114121
     122    RTTESTI_CHECK_RC(RTHttpSetVerifyPeer(TestObj.m_hHttp, fSavedVerifyPeer), VINF_SUCCESS);
     123    RTTESTI_CHECK_RC(RTHttpSetFollowRedirects(TestObj.m_hHttp, cSavedMaxRedirects), VINF_SUCCESS);
     124
    115125    /*
    116126     * Now check the gathering of certificates on the system doesn't crash.
Note: See TracChangeset for help on using the changeset viewer.

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