VirtualBox

Changeset 88124 in vbox


Ignore:
Timestamp:
Mar 15, 2021 5:46:52 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
143269
Message:

OCI/PCA: bugref:9969 - Make it possible to specify the CA file for the
REST API calls. If "cert_bundle" profile parameter is not empty, use it.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/cpp/restclient.h

    r86681 r88124  
    719719    /** @} */
    720720
     721    /**
     722     * Sets the CA file to use for HTTPS.
     723     */
     724    int setCAFile(const char *pcszCAFile) RT_NOEXCEPT;
     725    /** @overload */
     726    int setCAFile(const RTCString &strCAFile) RT_NOEXCEPT;
     727
    721728    /** Flags to doCall. */
    722729    enum
     
    731738    /** The server URL to use.  If empty use the default. */
    732739    RTCString m_strServerUrl;
     740    /** The CA file to use.  If empty use the default. */
     741    RTCString m_strCAFile;
    733742
    734743    /* Make non-copyable (RTCNonCopyable causes warnings): */
  • trunk/src/VBox/Runtime/common/rest/RTCRestClientApiBase.cpp

    r87004 r88124  
    6363
    6464
     65int RTCRestClientApiBase::setCAFile(const char *pcszCAFile) RT_NOEXCEPT
     66{
     67    return m_strCAFile.assignNoThrow(pcszCAFile);
     68}
     69
     70
     71int RTCRestClientApiBase::setCAFile(const RTCString &strCAFile) RT_NOEXCEPT
     72{
     73    return m_strCAFile.assignNoThrow(strCAFile);
     74}
     75
     76
    6577const char *RTCRestClientApiBase::getServerUrl(void) const RT_NOEXCEPT
    6678{
     
    179191
    180192    int rc = RTHttpCreate(&m_hHttp);
    181     if (RT_FAILURE(rc))
     193    if (RT_SUCCESS(rc) && m_strCAFile.isNotEmpty())
     194        rc = RTHttpSetCAFile(m_hHttp, m_strCAFile.c_str());
     195
     196    if (RT_FAILURE(rc) && m_hHttp != NIL_RTHTTP)
     197    {
     198        RTHttpDestroy(m_hHttp);
    182199        m_hHttp = NIL_RTHTTP;
     200    }
    183201    return rc;
    184202}
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