VirtualBox

Changeset 74351 in vbox


Ignore:
Timestamp:
Sep 18, 2018 8:01:28 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
125164
Message:

IPRT/rest: Redid the previous attempt at making sense of the basepath/host/url stuff. Tried to gear it a little in the direction of OpenAPI v3. bugref:9167

Location:
trunk
Files:
4 edited

Legend:

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

    r74348 r74351  
    638638     * @{ */
    639639    /**
    640      * Gets the default host (start of URL) as specified in the specs.
    641      *
     640     * Gets the server URL.
     641     */
     642    const char *getServerUrl(void) const;
     643
     644    /**
     645     * Sets the whole server URL.
     646     * @returns IPRT status code.
     647     * @param   a_pszUrl        The new server URL.  NULL/empty to reset to default.
     648     */
     649    int setServerUrl(const char *a_pszUrl);
     650
     651    /**
     652     * Sets the scheme part of the the server URL.
     653     * @returns IPRT status code.
     654     * @param   a_pszScheme     The new scheme.  Does not accept NULL or empty string.
     655     */
     656    int setServerScheme(const char *a_pszScheme);
     657
     658    /**
     659     * Sets the authority (hostname + port) part of the the server URL.
     660     * @returns IPRT status code.
     661     * @param   a_pszAuthority  The new authority.  Does not accept NULL or empty string.
     662     */
     663    int setServerAuthority(const char *a_pszAuthority);
     664
     665    /**
     666     * Sets the base path part of the the server URL.
     667     * @returns IPRT status code.
     668     * @param   a_pszBasePath   The new base path.  Does not accept NULL or empty string.
     669     */
     670    int setServerBasePath(const char *a_pszBasePath);
     671
     672    /**
     673     * Gets the default server URL as specified in the specs.
     674     * @returns Server URL.
     675     */
     676    virtual const char *getDefaultServerUrl() const = 0;
     677
     678    /**
     679     * Gets the default server base path as specified in the specs.
    642680     * @returns Host string (start of URL).
    643681     */
    644     virtual const char *getDefaultHost() const = 0;
    645 
    646     /**
    647      * Gets the host we're using.
    648      *
    649      * @returns Host URL string.
    650      */
    651     const char *getHost(void) const;
    652 
    653     /**
    654      * Sets the host (URL) to use when talking to the server.
    655      *
    656      * Setting the host is only required if there is a desire to use a
    657      * different server from the one specified in the API specification, like
    658      * for instance regional one.
    659      *
    660      * @returns IPRT status code.
    661      * @param   a_pszHost   The base path to use.
    662      */
    663     virtual int setHost(const char *a_pszHost);
    664 
    665     /**
    666      * Sets the base path (URL) to use when talking to the server.
    667      *
    668      * Setting the base path is only required if there is a desire to use a
    669      * different server from the one specified in the API specification, like
    670      * for instance regional one.
    671      *
    672      * @returns IPRT status code.
    673      * @param   a_strHost   The base path to use.
    674      * @note    Defers to the C-string variant.
    675      */
    676     int setHost(RTCString const &a_strHost);
    677 
    678 
    679     /**
    680      * Gets the default base path (relative to getHost()) as specified in the specs.
    681      *
    682      * @returns Base path string.
    683      */
    684     virtual const char *getDefaultBasePath() const = 0;
    685 
    686     /**
    687      * Gets the base path we're using (relative to getHost).
    688      *
    689      * @returns Base path string.
    690      */
    691     const char *getBasePath(void) const;
    692 
    693     /**
    694      * Sets the base path (relative to getHost()) to use when talking to the server.
    695      *
    696      * It is assumed that the base path is at the minimum a lone slash, so an
    697      * empty (or NULL) string is understood to mean reverting to the default
    698      * (see getDefaultBasePath()).
    699      *
    700      * @param   a_pszPath   The base path to use.
    701      */
    702     virtual int setBasePath(const char *a_pszPath);
    703 
    704     /**
    705      * Sets the base path (relative to getHost()) to use when talking to the server.
    706      *
    707      * @param   a_strPath   The base path to use.
    708      * @note    Defers to the C-string variant.
    709      */
    710     int setBasePath(RTCString const &a_strPath);
    711 
     682    virtual const char *getDefaultServerBasePath() const = 0;
    712683    /** @} */
    713684
     
    721692    /** Handle to the HTTP connection object. */
    722693    RTHTTP  m_hHttp;
    723     /** The host to use.  If empty use the default. */
    724     RTCString m_strHost;
    725     /** The base path to use.  If empty use the default. */
    726     RTCString m_strBasePath;
     694    /** The server URL to use.  If empty use the default. */
     695    RTCString m_strServerUrl;
    727696
    728697    /* Make non-copyable (RTCNonCopyable causes warnings): */
     
    782751    int ociSignRequest(RTHTTP a_hHttp, RTCString const &a_rStrFullUrl, RTHTTPMETHOD a_enmHttpMethod,
    783752                       RTCString const &a_rStrXmitBody, uint32_t a_fFlags, RTCRKEY a_hKey, RTCString const &a_rStrKeyId);
     753
     754    /**
     755     * Worker for the server URL modifiers.
     756     *
     757     * @returns IPRT status code.
     758     * @param   a_pszServerUrl  The current server URL (for comparing).
     759     * @param   a_offDst        The offset of the component in the current server URL.
     760     * @param   a_cchDst        The current component length.
     761     * @param   a_pszSrc        The new URL component value.
     762     * @param   a_cchSrc        The length of the new component.
     763     */
     764    int setServerUrlPart(const char *a_pszServerUrl, size_t a_offDst, size_t a_cchDst, const char *a_pszSrc, size_t a_cchSrc);
    784765};
    785766
  • trunk/src/VBox/Runtime/VBox/VBoxRTImp-vcc32.def

    r74347 r74351  
    4040    ??_7RTCRestClientRequestBase@@6B@ DATA                                      ; (const RTCRestClientRequestBase::`vftable')
    4141    ??_7RTCRestClientResponseBase@@6B@ DATA                                     ; (const RTCRestClientResponseBase::`vftable')
     42    ??_7RTCRestDataObject@@6B@ DATA                                             ; (const RTCRestDataObject::`vftable')
    4243    ??_7RTCRestDate@@6B@ DATA                                                   ; (const RTCRestDate::`vftable')
    4344    ??_7RTCRestDouble@@6B@ DATA                                                 ; (const RTCRestDouble::`vftable')
     
    7071    ??0RTCRestClientResponseBase@@QAE@ABV0@@Z                                   ; (public: __thiscall RTCRestClientResponseBase::RTCRestClientResponseBase(class RTCRestClientResponseBase const &))
    7172    ??0RTCRestClientResponseBase@@QAE@XZ                                        ; (public: __thiscall RTCRestClientResponseBase::RTCRestClientResponseBase(void))
     73    ??0RTCRestDataObject@@QAE@ABV0@@Z                                           ; (public: __thiscall RTCRestDataObject::RTCRestDataObject(class RTCRestDataObject const &))
     74    ??0RTCRestDataObject@@QAE@XZ                                                ; (public: __thiscall RTCRestDataObject::RTCRestDataObject(void))
    7275    ??0RTCRestDate@@QAE@ABV0@@Z                                                 ; (public: __thiscall RTCRestDate::RTCRestDate(class RTCRestDate const &))
    7376    ??0RTCRestDate@@QAE@XZ                                                      ; (public: __thiscall RTCRestDate::RTCRestDate(void))
     
    117120    ??1RTCRestClientRequestBase@@UAE@XZ                                         ; (public: virtual __thiscall RTCRestClientRequestBase::~RTCRestClientRequestBase(void))
    118121    ??1RTCRestClientResponseBase@@UAE@XZ                                        ; (public: virtual __thiscall RTCRestClientResponseBase::~RTCRestClientResponseBase(void))
     122    ??1RTCRestDataObject@@UAE@XZ                                                ; (public: virtual __thiscall RTCRestDataObject::~RTCRestDataObject(void))
    119123    ??1RTCRestDate@@UAE@XZ                                                      ; (public: virtual __thiscall RTCRestDate::~RTCRestDate(void))
    120124    ??1RTCRestDouble@@UAE@XZ                                                    ; (public: virtual __thiscall RTCRestDouble::~RTCRestDouble(void))
     
    136140    ??4RTCRestClientRequestBase@@QAEAAV0@ABV0@@Z                                ; (public: class RTCRestClientRequestBase & __thiscall RTCRestClientRequestBase::operator=(class RTCRestClientRequestBase const &))
    137141    ??4RTCRestClientResponseBase@@QAEAAV0@ABV0@@Z                               ; (public: class RTCRestClientResponseBase & __thiscall RTCRestClientResponseBase::operator=(class RTCRestClientResponseBase const &))
     142    ??4RTCRestDataObject@@IAEAAV0@ABV0@@Z                                       ; (protected: class RTCRestDataObject & __thiscall RTCRestDataObject::operator=(class RTCRestDataObject const &))
    138143    ??4RTCRestDate@@QAEAAV0@ABV0@@Z                                             ; (public: class RTCRestDate & __thiscall RTCRestDate::operator=(class RTCRestDate const &))
    139144    ??4RTCRestDouble@@QAEAAV0@ABV0@@Z                                           ; (public: class RTCRestDouble & __thiscall RTCRestDouble::operator=(class RTCRestDouble const &))
     
    215220    ?assignCopy@RTCRestBinaryResponse@@UAEHPBXI@Z                               ; (public: virtual int __thiscall RTCRestBinaryResponse::assignCopy(void const *,unsigned int))
    216221    ?assignCopy@RTCRestBool@@QAEHABV1@@Z                                        ; (public: int __thiscall RTCRestBool::assignCopy(class RTCRestBool const &))
     222    ?assignCopy@RTCRestDataObject@@UAEHABV1@@Z                                  ; (public: virtual int __thiscall RTCRestDataObject::assignCopy(class RTCRestDataObject const &))
    217223    ?assignCopy@RTCRestDate@@QAEHABV1@@Z                                        ; (public: int __thiscall RTCRestDate::assignCopy(class RTCRestDate const &))
    218224    ?assignCopy@RTCRestDouble@@QAEHABV1@@Z                                      ; (public: int __thiscall RTCRestDouble::assignCopy(class RTCRestDouble const &))
     
    301307    ?deserializeFromJson@RTCRestBinary@@UAEHABURTCRestJsonCursor@@@Z            ; (public: virtual int __thiscall RTCRestBinary::deserializeFromJson(struct RTCRestJsonCursor const &))
    302308    ?deserializeFromJson@RTCRestBool@@UAEHABURTCRestJsonCursor@@@Z              ; (public: virtual int __thiscall RTCRestBool::deserializeFromJson(struct RTCRestJsonCursor const &))
     309    ?deserializeFromJson@RTCRestDataObject@@UAEHABURTCRestJsonCursor@@@Z        ; (public: virtual int __thiscall RTCRestDataObject::deserializeFromJson(struct RTCRestJsonCursor const &))
    303310    ?deserializeFromJson@RTCRestDate@@UAEHABURTCRestJsonCursor@@@Z              ; (public: virtual int __thiscall RTCRestDate::deserializeFromJson(struct RTCRestJsonCursor const &))
    304311    ?deserializeFromJson@RTCRestDouble@@UAEHABURTCRestJsonCursor@@@Z            ; (public: virtual int __thiscall RTCRestDouble::deserializeFromJson(struct RTCRestJsonCursor const &))
     
    311318    ?deserializeHeader@RTCRestClientResponseBase@@IAEHPAVRTCRestObjectBase@@PBDII1@Z  ; (protected: int __thiscall RTCRestClientResponseBase::deserializeHeader(class RTCRestObjectBase *,char const *,unsigned int,unsigned int,char const *))
    312319    ?deserializeHeaderIntoMap@RTCRestClientResponseBase@@IAEHPAVRTCRestStringMapBase@@PBDI1II1@Z  ; (protected: int __thiscall RTCRestClientResponseBase::deserializeHeaderIntoMap(class RTCRestStringMapBase *,char const *,unsigned int,char const *,unsigned int,unsigned int,char const *))
     320    ?deserializeMemberFromJson@RTCRestDataObject@@UAEHABURTCRestJsonCursor@@I@Z  ; (public: virtual int __thiscall RTCRestDataObject::deserializeMemberFromJson(struct RTCRestJsonCursor const &,unsigned int))
    313321    ?doCall@RTCRestClientApiBase@@MAEHABVRTCRestClientRequestBase@@W4RTHTTPMETHOD@@PAVRTCRestClientResponseBase@@PBDI@Z  ; (protected: virtual int __thiscall RTCRestClientApiBase::doCall(class RTCRestClientRequestBase const &,enum RTHTTPMETHOD,class RTCRestClientResponseBase *,char const *,unsigned int))
    314322    ?doHeaderParameters@RTCRestClientRequestBase@@IBEHPAURTHTTPINTERNAL@@PBUHEADERPARAMDESC@1@PAPBVRTCRestObjectBase@@I@Z  ; (protected: int __thiscall RTCRestClientRequestBase::doHeaderParameters(struct RTHTTPINTERNAL *,struct RTCRestClientRequestBase::HEADERPARAMDESC const *,class RTCRestObjectBase const * *,unsigned int)const )
     
    349357    ?getAttributeValuePath@ElementNode@xml@@QBE_NPBDAAVRTCString@@0@Z           ; (public: bool __thiscall xml::ElementNode::getAttributeValuePath(char const *,class RTCString &,char const *)const )
    350358    ?getAttributeValuePath@ElementNode@xml@@QBE_NPBDPAVRTCString@@0@Z           ; (public: bool __thiscall xml::ElementNode::getAttributeValuePath(char const *,class RTCString *,char const *)const )
    351     ?getBasePath@RTCRestClientApiBase@@QBEABVRTCString@@XZ                      ; (public: class RTCString const & __thiscall RTCRestClientApiBase::getBasePath(void)const )
    352359    ?getCallbackData@RTCRestBinaryParameter@@QBEPAXXZ                           ; (public: void * __thiscall RTCRestBinaryParameter::getCallbackData(void)const )
    353360    ?getCallbackData@RTCRestBinaryResponse@@QBEPAXXZ                            ; (public: void * __thiscall RTCRestBinaryResponse::getCallbackData(void)const )
     
    365372    ?getPath@RTCRestJsonPrimaryCursor@@UBEPADABURTCRestJsonCursor@@PADI@Z       ; (public: virtual char * __thiscall RTCRestJsonPrimaryCursor::getPath(struct RTCRestJsonCursor const &,char *,unsigned int)const )
    366373    ?getPtr@RTCRestBinary@@QBEPBEXZ                                             ; (public: unsigned char const * __thiscall RTCRestBinary::getPtr(void)const )
     374    ?getServerUrl@RTCRestClientApiBase@@QBEPBDXZ                                ; (public: char const * __thiscall RTCRestClientApiBase::getServerUrl(void)const )
    367375    ?getSize@RTCRestBinary@@QBEIXZ                                              ; (public: unsigned int __thiscall RTCRestBinary::getSize(void)const )
    368376    ?getStatus@RTCRestClientResponseBase@@QAEHXZ                                ; (public: int __thiscall RTCRestClientResponseBase::getStatus(void))
     
    439447    ?resetToDefault@RTCRestBinaryResponse@@UAEHXZ                               ; (public: virtual int __thiscall RTCRestBinaryResponse::resetToDefault(void))
    440448    ?resetToDefault@RTCRestBool@@UAEHXZ                                         ; (public: virtual int __thiscall RTCRestBool::resetToDefault(void))
     449    ?resetToDefault@RTCRestDataObject@@UAEHXZ                                   ; (public: virtual int __thiscall RTCRestDataObject::resetToDefault(void))
    441450    ?resetToDefault@RTCRestDate@@UAEHXZ                                         ; (public: virtual int __thiscall RTCRestDate::resetToDefault(void))
    442451    ?resetToDefault@RTCRestDouble@@UAEHXZ                                       ; (public: virtual int __thiscall RTCRestDouble::resetToDefault(void))
     
    451460    ?serializeAsJson@RTCRestBinary@@UBEAAVRTCRestOutputBase@@AAV2@@Z            ; (public: virtual class RTCRestOutputBase & __thiscall RTCRestBinary::serializeAsJson(class RTCRestOutputBase &)const )
    452461    ?serializeAsJson@RTCRestBool@@UBEAAVRTCRestOutputBase@@AAV2@@Z              ; (public: virtual class RTCRestOutputBase & __thiscall RTCRestBool::serializeAsJson(class RTCRestOutputBase &)const )
     462    ?serializeAsJson@RTCRestDataObject@@UBEAAVRTCRestOutputBase@@AAV2@@Z        ; (public: virtual class RTCRestOutputBase & __thiscall RTCRestDataObject::serializeAsJson(class RTCRestOutputBase &)const )
    453463    ?serializeAsJson@RTCRestDate@@UBEAAVRTCRestOutputBase@@AAV2@@Z              ; (public: virtual class RTCRestOutputBase & __thiscall RTCRestDate::serializeAsJson(class RTCRestOutputBase &)const )
    454464    ?serializeAsJson@RTCRestDouble@@UBEAAVRTCRestOutputBase@@AAV2@@Z            ; (public: virtual class RTCRestOutputBase & __thiscall RTCRestDouble::serializeAsJson(class RTCRestOutputBase &)const )
     
    459469    ?serializeAsJson@RTCRestStringEnumBase@@UBEAAVRTCRestOutputBase@@AAV2@@Z    ; (public: virtual class RTCRestOutputBase & __thiscall RTCRestStringEnumBase::serializeAsJson(class RTCRestOutputBase &)const )
    460470    ?serializeAsJson@RTCRestStringMapBase@@UBEAAVRTCRestOutputBase@@AAV2@@Z     ; (public: virtual class RTCRestOutputBase & __thiscall RTCRestStringMapBase::serializeAsJson(class RTCRestOutputBase &)const )
     471    ?serializeMembersAsJson@RTCRestDataObject@@UBEPBDAAVRTCRestOutputBase@@PBD@Z  ; (public: virtual char const * __thiscall RTCRestDataObject::serializeMembersAsJson(class RTCRestOutputBase &,char const *)const )
    461472    ?setAttribute@ElementNode@xml@@QAEPAVAttributeNode@2@PBDABVRTCString@@@Z    ; (public: class xml::AttributeNode * __thiscall xml::ElementNode::setAttribute(char const *,class RTCString const &))
    462473    ?setAttributePath@ElementNode@xml@@QAEPAVAttributeNode@2@PBDABVRTCString@@@Z  ; (public: class xml::AttributeNode * __thiscall xml::ElementNode::setAttributePath(char const *,class RTCString const &))
    463     ?setBasePath@RTCRestClientApiBase@@QAEXABVRTCString@@@Z                     ; (public: void __thiscall RTCRestClientApiBase::setBasePath(class RTCString const &))
    464     ?setBasePath@RTCRestClientApiBase@@UAEXPBD@Z                                ; (public: virtual void __thiscall RTCRestClientApiBase::setBasePath(char const *))
    465474    ?setByString@RTCRestStringEnumBase@@QAEHABVRTCString@@@Z                    ; (public: int __thiscall RTCRestStringEnumBase::setByString(class RTCString const &))
    466475    ?setByString@RTCRestStringEnumBase@@QAEHPBDI@Z                              ; (public: int __thiscall RTCRestStringEnumBase::setByString(char const *,unsigned int))
     
    478487    ?setNull@RTCString@@QAEXXZ                                                  ; (public: void __thiscall RTCString::setNull(void))
    479488    ?setProducerCallback@RTCRestBinaryParameter@@QAEXP6AHPAV1@PAXI_KPAI@Z12@Z   ; (public: void __thiscall RTCRestBinaryParameter::setProducerCallback(int (__cdecl*)(class RTCRestBinaryParameter *,void *,unsigned int,unsigned __int64,unsigned int *),void *,unsigned __int64))
     489    ?setServerAuthority@RTCRestClientApiBase@@QAEHPBD@Z                         ; (public: int __thiscall RTCRestClientApiBase::setServerAuthority(char const *))
     490    ?setServerBasePath@RTCRestClientApiBase@@QAEHPBD@Z                          ; (public: int __thiscall RTCRestClientApiBase::setServerBasePath(char const *))
     491    ?setServerScheme@RTCRestClientApiBase@@QAEHPBD@Z                            ; (public: int __thiscall RTCRestClientApiBase::setServerScheme(char const *))
     492    ?setServerUrl@RTCRestClientApiBase@@QAEHPBD@Z                               ; (public: int __thiscall RTCRestClientApiBase::setServerUrl(char const *))
     493    ?setServerUrlPart@RTCRestClientApiBase@@IAEHPBDII0I@Z                       ; (protected: int __thiscall RTCRestClientApiBase::setServerUrlPart(char const *,unsigned int,unsigned int,char const *,unsigned int))
    480494    ?setWorker@RTCRestStringEnumBase@@IAE_NH@Z                                  ; (protected: bool __thiscall RTCRestStringEnumBase::setWorker(int))
    481495    ?size@RTCRestArrayBase@@QBEIXZ                                              ; (public: unsigned int __thiscall RTCRestArrayBase::size(void)const )
     
    520534    ?typeClass@RTCRestBinary@@UBE?AW4kTypeClass@RTCRestObjectBase@@XZ           ; (public: virtual enum RTCRestObjectBase::kTypeClass __thiscall RTCRestBinary::typeClass(void)const )
    521535    ?typeClass@RTCRestBool@@UBE?AW4kTypeClass@RTCRestObjectBase@@XZ             ; (public: virtual enum RTCRestObjectBase::kTypeClass __thiscall RTCRestBool::typeClass(void)const )
     536    ?typeClass@RTCRestDataObject@@UBE?AW4kTypeClass@RTCRestObjectBase@@XZ       ; (public: virtual enum RTCRestObjectBase::kTypeClass __thiscall RTCRestDataObject::typeClass(void)const )
    522537    ?typeClass@RTCRestDate@@UBE?AW4kTypeClass@RTCRestObjectBase@@XZ             ; (public: virtual enum RTCRestObjectBase::kTypeClass __thiscall RTCRestDate::typeClass(void)const )
    523538    ?typeClass@RTCRestDouble@@UBE?AW4kTypeClass@RTCRestObjectBase@@XZ           ; (public: virtual enum RTCRestObjectBase::kTypeClass __thiscall RTCRestDouble::typeClass(void)const )
     
    549564    ?xmitPrepare@RTCRestBinaryParameter@@UBEHPAURTHTTPINTERNAL@@@Z              ; (public: virtual int __thiscall RTCRestBinaryParameter::xmitPrepare(struct RTHTTPINTERNAL *)const )
    550565    ?xmitReady@RTCRestClientApiBase@@MAEHPAURTHTTPINTERNAL@@ABVRTCString@@W4RTHTTPMETHOD@@1I@Z  ; (protected: virtual int __thiscall RTCRestClientApiBase::xmitReady(struct RTHTTPINTERNAL *,class RTCString const &,enum RTHTTPMETHOD,class RTCString const &,unsigned int))
    551 
  • trunk/src/VBox/Runtime/VBox/VBoxRTImp-vcc64.def

    r74347 r74351  
    4040    ??_7RTCRestClientRequestBase@@6B@ DATA                                      ; (const RTCRestClientRequestBase::`vftable')
    4141    ??_7RTCRestClientResponseBase@@6B@ DATA                                     ; (const RTCRestClientResponseBase::`vftable')
     42    ??_7RTCRestDataObject@@6B@ DATA                                             ; (const RTCRestDataObject::`vftable')
    4243    ??_7RTCRestDate@@6B@ DATA                                                   ; (const RTCRestDate::`vftable')
    4344    ??_7RTCRestDouble@@6B@ DATA                                                 ; (const RTCRestDouble::`vftable')
     
    7071    ??0RTCRestClientResponseBase@@QEAA@AEBV0@@Z                                 ; (public: __cdecl RTCRestClientResponseBase::RTCRestClientResponseBase(class RTCRestClientResponseBase const &))
    7172    ??0RTCRestClientResponseBase@@QEAA@XZ                                       ; (public: __cdecl RTCRestClientResponseBase::RTCRestClientResponseBase(void))
     73    ??0RTCRestDataObject@@QEAA@AEBV0@@Z                                         ; (public: __cdecl RTCRestDataObject::RTCRestDataObject(class RTCRestDataObject const &))
     74    ??0RTCRestDataObject@@QEAA@XZ                                               ; (public: __cdecl RTCRestDataObject::RTCRestDataObject(void))
    7275    ??0RTCRestDate@@QEAA@AEBV0@@Z                                               ; (public: __cdecl RTCRestDate::RTCRestDate(class RTCRestDate const &))
    7376    ??0RTCRestDate@@QEAA@XZ                                                     ; (public: __cdecl RTCRestDate::RTCRestDate(void))
     
    117120    ??1RTCRestClientRequestBase@@UEAA@XZ                                        ; (public: virtual __cdecl RTCRestClientRequestBase::~RTCRestClientRequestBase(void))
    118121    ??1RTCRestClientResponseBase@@UEAA@XZ                                       ; (public: virtual __cdecl RTCRestClientResponseBase::~RTCRestClientResponseBase(void))
     122    ??1RTCRestDataObject@@UEAA@XZ                                               ; (public: virtual __cdecl RTCRestDataObject::~RTCRestDataObject(void))
    119123    ??1RTCRestDate@@UEAA@XZ                                                     ; (public: virtual __cdecl RTCRestDate::~RTCRestDate(void))
    120124    ??1RTCRestDouble@@UEAA@XZ                                                   ; (public: virtual __cdecl RTCRestDouble::~RTCRestDouble(void))
     
    136140    ??4RTCRestClientRequestBase@@QEAAAEAV0@AEBV0@@Z                             ; (public: class RTCRestClientRequestBase & __cdecl RTCRestClientRequestBase::operator=(class RTCRestClientRequestBase const &))
    137141    ??4RTCRestClientResponseBase@@QEAAAEAV0@AEBV0@@Z                            ; (public: class RTCRestClientResponseBase & __cdecl RTCRestClientResponseBase::operator=(class RTCRestClientResponseBase const &))
     142    ??4RTCRestDataObject@@IEAAAEAV0@AEBV0@@Z                                    ; (protected: class RTCRestDataObject & __cdecl RTCRestDataObject::operator=(class RTCRestDataObject const &))
    138143    ??4RTCRestDate@@QEAAAEAV0@AEBV0@@Z                                          ; (public: class RTCRestDate & __cdecl RTCRestDate::operator=(class RTCRestDate const &))
    139144    ??4RTCRestDouble@@QEAAAEAV0@AEBV0@@Z                                        ; (public: class RTCRestDouble & __cdecl RTCRestDouble::operator=(class RTCRestDouble const &))
     
    215220    ?assignCopy@RTCRestBinaryResponse@@UEAAHPEBX_K@Z                            ; (public: virtual int __cdecl RTCRestBinaryResponse::assignCopy(void const *,unsigned __int64))
    216221    ?assignCopy@RTCRestBool@@QEAAHAEBV1@@Z                                      ; (public: int __cdecl RTCRestBool::assignCopy(class RTCRestBool const &))
     222    ?assignCopy@RTCRestDataObject@@UEAAHAEBV1@@Z                                ; (public: virtual int __cdecl RTCRestDataObject::assignCopy(class RTCRestDataObject const &))
    217223    ?assignCopy@RTCRestDate@@QEAAHAEBV1@@Z                                      ; (public: int __cdecl RTCRestDate::assignCopy(class RTCRestDate const &))
    218224    ?assignCopy@RTCRestDouble@@QEAAHAEBV1@@Z                                    ; (public: int __cdecl RTCRestDouble::assignCopy(class RTCRestDouble const &))
     
    301307    ?deserializeFromJson@RTCRestBinary@@UEAAHAEBURTCRestJsonCursor@@@Z          ; (public: virtual int __cdecl RTCRestBinary::deserializeFromJson(struct RTCRestJsonCursor const &))
    302308    ?deserializeFromJson@RTCRestBool@@UEAAHAEBURTCRestJsonCursor@@@Z            ; (public: virtual int __cdecl RTCRestBool::deserializeFromJson(struct RTCRestJsonCursor const &))
     309    ?deserializeFromJson@RTCRestDataObject@@UEAAHAEBURTCRestJsonCursor@@@Z      ; (public: virtual int __cdecl RTCRestDataObject::deserializeFromJson(struct RTCRestJsonCursor const &))
    303310    ?deserializeFromJson@RTCRestDate@@UEAAHAEBURTCRestJsonCursor@@@Z            ; (public: virtual int __cdecl RTCRestDate::deserializeFromJson(struct RTCRestJsonCursor const &))
    304311    ?deserializeFromJson@RTCRestDouble@@UEAAHAEBURTCRestJsonCursor@@@Z          ; (public: virtual int __cdecl RTCRestDouble::deserializeFromJson(struct RTCRestJsonCursor const &))
     
    311318    ?deserializeHeader@RTCRestClientResponseBase@@IEAAHPEAVRTCRestObjectBase@@PEBD_KI1@Z  ; (protected: int __cdecl RTCRestClientResponseBase::deserializeHeader(class RTCRestObjectBase *,char const *,unsigned __int64,unsigned int,char const *))
    312319    ?deserializeHeaderIntoMap@RTCRestClientResponseBase@@IEAAHPEAVRTCRestStringMapBase@@PEBD_K12I1@Z  ; (protected: int __cdecl RTCRestClientResponseBase::deserializeHeaderIntoMap(class RTCRestStringMapBase *,char const *,unsigned __int64,char const *,unsigned __int64,unsigned int,char const *))
     320    ?deserializeMemberFromJson@RTCRestDataObject@@UEAAHAEBURTCRestJsonCursor@@_K@Z  ; (public: virtual int __cdecl RTCRestDataObject::deserializeMemberFromJson(struct RTCRestJsonCursor const &,unsigned __int64))
    313321    ?doCall@RTCRestClientApiBase@@MEAAHAEBVRTCRestClientRequestBase@@W4RTHTTPMETHOD@@PEAVRTCRestClientResponseBase@@PEBDI@Z  ; (protected: virtual int __cdecl RTCRestClientApiBase::doCall(class RTCRestClientRequestBase const &,enum RTHTTPMETHOD,class RTCRestClientResponseBase *,char const *,unsigned int))
    314322    ?doHeaderParameters@RTCRestClientRequestBase@@IEBAHPEAURTHTTPINTERNAL@@PEBUHEADERPARAMDESC@1@PEAPEBVRTCRestObjectBase@@_K@Z  ; (protected: int __cdecl RTCRestClientRequestBase::doHeaderParameters(struct RTHTTPINTERNAL *,struct RTCRestClientRequestBase::HEADERPARAMDESC const *,class RTCRestObjectBase const * *,unsigned __int64)const )
     
    349357    ?getAttributeValuePath@ElementNode@xml@@QEBA_NPEBDAEAVRTCString@@0@Z        ; (public: bool __cdecl xml::ElementNode::getAttributeValuePath(char const *,class RTCString &,char const *)const )
    350358    ?getAttributeValuePath@ElementNode@xml@@QEBA_NPEBDPEAVRTCString@@0@Z        ; (public: bool __cdecl xml::ElementNode::getAttributeValuePath(char const *,class RTCString *,char const *)const )
    351     ?getBasePath@RTCRestClientApiBase@@QEBAAEBVRTCString@@XZ                    ; (public: class RTCString const & __cdecl RTCRestClientApiBase::getBasePath(void)const )
    352359    ?getCallbackData@RTCRestBinaryParameter@@QEBAPEAXXZ                         ; (public: void * __cdecl RTCRestBinaryParameter::getCallbackData(void)const )
    353360    ?getCallbackData@RTCRestBinaryResponse@@QEBAPEAXXZ                          ; (public: void * __cdecl RTCRestBinaryResponse::getCallbackData(void)const )
     
    365372    ?getPath@RTCRestJsonPrimaryCursor@@UEBAPEADAEBURTCRestJsonCursor@@PEAD_K@Z  ; (public: virtual char * __cdecl RTCRestJsonPrimaryCursor::getPath(struct RTCRestJsonCursor const &,char *,unsigned __int64)const )
    366373    ?getPtr@RTCRestBinary@@QEBAPEBEXZ                                           ; (public: unsigned char const * __cdecl RTCRestBinary::getPtr(void)const )
     374    ?getServerUrl@RTCRestClientApiBase@@QEBAPEBDXZ                              ; (public: char const * __cdecl RTCRestClientApiBase::getServerUrl(void)const )
    367375    ?getSize@RTCRestBinary@@QEBA_KXZ                                            ; (public: unsigned __int64 __cdecl RTCRestBinary::getSize(void)const )
    368376    ?getStatus@RTCRestClientResponseBase@@QEAAHXZ                               ; (public: int __cdecl RTCRestClientResponseBase::getStatus(void))
     
    439447    ?resetToDefault@RTCRestBinaryResponse@@UEAAHXZ                              ; (public: virtual int __cdecl RTCRestBinaryResponse::resetToDefault(void))
    440448    ?resetToDefault@RTCRestBool@@UEAAHXZ                                        ; (public: virtual int __cdecl RTCRestBool::resetToDefault(void))
     449    ?resetToDefault@RTCRestDataObject@@UEAAHXZ                                  ; (public: virtual int __cdecl RTCRestDataObject::resetToDefault(void))
    441450    ?resetToDefault@RTCRestDate@@UEAAHXZ                                        ; (public: virtual int __cdecl RTCRestDate::resetToDefault(void))
    442451    ?resetToDefault@RTCRestDouble@@UEAAHXZ                                      ; (public: virtual int __cdecl RTCRestDouble::resetToDefault(void))
     
    451460    ?serializeAsJson@RTCRestBinary@@UEBAAEAVRTCRestOutputBase@@AEAV2@@Z         ; (public: virtual class RTCRestOutputBase & __cdecl RTCRestBinary::serializeAsJson(class RTCRestOutputBase &)const )
    452461    ?serializeAsJson@RTCRestBool@@UEBAAEAVRTCRestOutputBase@@AEAV2@@Z           ; (public: virtual class RTCRestOutputBase & __cdecl RTCRestBool::serializeAsJson(class RTCRestOutputBase &)const )
     462    ?serializeAsJson@RTCRestDataObject@@UEBAAEAVRTCRestOutputBase@@AEAV2@@Z     ; (public: virtual class RTCRestOutputBase & __cdecl RTCRestDataObject::serializeAsJson(class RTCRestOutputBase &)const )
    453463    ?serializeAsJson@RTCRestDate@@UEBAAEAVRTCRestOutputBase@@AEAV2@@Z           ; (public: virtual class RTCRestOutputBase & __cdecl RTCRestDate::serializeAsJson(class RTCRestOutputBase &)const )
    454464    ?serializeAsJson@RTCRestDouble@@UEBAAEAVRTCRestOutputBase@@AEAV2@@Z         ; (public: virtual class RTCRestOutputBase & __cdecl RTCRestDouble::serializeAsJson(class RTCRestOutputBase &)const )
     
    459469    ?serializeAsJson@RTCRestStringEnumBase@@UEBAAEAVRTCRestOutputBase@@AEAV2@@Z  ; (public: virtual class RTCRestOutputBase & __cdecl RTCRestStringEnumBase::serializeAsJson(class RTCRestOutputBase &)const )
    460470    ?serializeAsJson@RTCRestStringMapBase@@UEBAAEAVRTCRestOutputBase@@AEAV2@@Z  ; (public: virtual class RTCRestOutputBase & __cdecl RTCRestStringMapBase::serializeAsJson(class RTCRestOutputBase &)const )
     471    ?serializeMembersAsJson@RTCRestDataObject@@UEBAPEBDAEAVRTCRestOutputBase@@PEBD@Z  ; (public: virtual char const * __cdecl RTCRestDataObject::serializeMembersAsJson(class RTCRestOutputBase &,char const *)const )
    461472    ?setAttribute@ElementNode@xml@@QEAAPEAVAttributeNode@2@PEBDAEBVRTCString@@@Z  ; (public: class xml::AttributeNode * __cdecl xml::ElementNode::setAttribute(char const *,class RTCString const &))
    462473    ?setAttributePath@ElementNode@xml@@QEAAPEAVAttributeNode@2@PEBDAEBVRTCString@@@Z  ; (public: class xml::AttributeNode * __cdecl xml::ElementNode::setAttributePath(char const *,class RTCString const &))
    463     ?setBasePath@RTCRestClientApiBase@@QEAAXAEBVRTCString@@@Z                   ; (public: void __cdecl RTCRestClientApiBase::setBasePath(class RTCString const &))
    464     ?setBasePath@RTCRestClientApiBase@@UEAAXPEBD@Z                              ; (public: virtual void __cdecl RTCRestClientApiBase::setBasePath(char const *))
    465474    ?setByString@RTCRestStringEnumBase@@QEAAHAEBVRTCString@@@Z                  ; (public: int __cdecl RTCRestStringEnumBase::setByString(class RTCString const &))
    466475    ?setByString@RTCRestStringEnumBase@@QEAAHPEBD_K@Z                           ; (public: int __cdecl RTCRestStringEnumBase::setByString(char const *,unsigned __int64))
     
    478487    ?setNull@RTCString@@QEAAXXZ                                                 ; (public: void __cdecl RTCString::setNull(void))
    479488    ?setProducerCallback@RTCRestBinaryParameter@@QEAAXP6AHPEAV1@PEAX_K2PEA_K@Z12@Z  ; (public: void __cdecl RTCRestBinaryParameter::setProducerCallback(int (__cdecl*)(class RTCRestBinaryParameter *,void *,unsigned __int64,unsigned __int64,unsigned __int64 *),void *,unsigned __int64))
     489    ?setServerAuthority@RTCRestClientApiBase@@QEAAHPEBD@Z                       ; (public: int __cdecl RTCRestClientApiBase::setServerAuthority(char const *))
     490    ?setServerBasePath@RTCRestClientApiBase@@QEAAHPEBD@Z                        ; (public: int __cdecl RTCRestClientApiBase::setServerBasePath(char const *))
     491    ?setServerScheme@RTCRestClientApiBase@@QEAAHPEBD@Z                          ; (public: int __cdecl RTCRestClientApiBase::setServerScheme(char const *))
     492    ?setServerUrl@RTCRestClientApiBase@@QEAAHPEBD@Z                             ; (public: int __cdecl RTCRestClientApiBase::setServerUrl(char const *))
     493    ?setServerUrlPart@RTCRestClientApiBase@@IEAAHPEBD_K101@Z                    ; (protected: int __cdecl RTCRestClientApiBase::setServerUrlPart(char const *,unsigned __int64,unsigned __int64,char const *,unsigned __int64))
    480494    ?setWorker@RTCRestStringEnumBase@@IEAA_NH@Z                                 ; (protected: bool __cdecl RTCRestStringEnumBase::setWorker(int))
    481495    ?size@RTCRestArrayBase@@QEBA_KXZ                                            ; (public: unsigned __int64 __cdecl RTCRestArrayBase::size(void)const )
     
    520534    ?typeClass@RTCRestBinary@@UEBA?AW4kTypeClass@RTCRestObjectBase@@XZ          ; (public: virtual enum RTCRestObjectBase::kTypeClass __cdecl RTCRestBinary::typeClass(void)const )
    521535    ?typeClass@RTCRestBool@@UEBA?AW4kTypeClass@RTCRestObjectBase@@XZ            ; (public: virtual enum RTCRestObjectBase::kTypeClass __cdecl RTCRestBool::typeClass(void)const )
     536    ?typeClass@RTCRestDataObject@@UEBA?AW4kTypeClass@RTCRestObjectBase@@XZ      ; (public: virtual enum RTCRestObjectBase::kTypeClass __cdecl RTCRestDataObject::typeClass(void)const )
    522537    ?typeClass@RTCRestDate@@UEBA?AW4kTypeClass@RTCRestObjectBase@@XZ            ; (public: virtual enum RTCRestObjectBase::kTypeClass __cdecl RTCRestDate::typeClass(void)const )
    523538    ?typeClass@RTCRestDouble@@UEBA?AW4kTypeClass@RTCRestObjectBase@@XZ          ; (public: virtual enum RTCRestObjectBase::kTypeClass __cdecl RTCRestDouble::typeClass(void)const )
     
    549564    ?xmitPrepare@RTCRestBinaryParameter@@UEBAHPEAURTHTTPINTERNAL@@@Z            ; (public: virtual int __cdecl RTCRestBinaryParameter::xmitPrepare(struct RTHTTPINTERNAL *)const )
    550565    ?xmitReady@RTCRestClientApiBase@@MEAAHPEAURTHTTPINTERNAL@@AEBVRTCString@@W4RTHTTPMETHOD@@1I@Z  ; (protected: virtual int __cdecl RTCRestClientApiBase::xmitReady(struct RTHTTPINTERNAL *,class RTCString const &,enum RTHTTPMETHOD,class RTCString const &,unsigned int))
    551 
  • trunk/src/VBox/Runtime/common/rest/RTCRestClientApiBase.cpp

    r74348 r74351  
    3232#include <iprt/cpp/restclient.h>
    3333
     34#include <iprt/assert.h>
     35#include <iprt/ctype.h>
    3436#include <iprt/err.h>
    3537#include <iprt/http.h>
    3638#include <iprt/log.h>
     39#include <iprt/uri.h>
    3740
    3841
     
    6063
    6164
    62 const char *RTCRestClientApiBase::getHost() const
    63 {
    64     return m_strHost.isEmpty() ? getDefaultHost() : m_strHost.c_str();
    65 }
    66 
    67 int RTCRestClientApiBase::setHost(const char *a_pszHost)
    68 {
    69     return m_strHost.assignNoThrow(a_pszHost);
    70 }
    71 
    72 
    73 int RTCRestClientApiBase::setHost(RTCString const &a_strPath)
    74 {
    75     return setHost(a_strPath.c_str());
    76 }
    77 
    78 
    79 const char *RTCRestClientApiBase::getBasePath(void) const
    80 {
    81     return m_strBasePath.isEmpty() ? getDefaultBasePath() : m_strBasePath.c_str();
    82 }
    83 
    84 
    85 int RTCRestClientApiBase::setBasePath(const char *a_pszPath)
    86 {
    87     return m_strBasePath.assignNoThrow(a_pszPath);
    88 }
    89 
    90 
    91 int RTCRestClientApiBase::setBasePath(RTCString const &a_strPath)
    92 {
    93     return setBasePath(a_strPath.c_str());
     65const char *RTCRestClientApiBase::getServerUrl(void) const
     66{
     67    if (m_strServerUrl.isEmpty())
     68        return getDefaultServerUrl();
     69    return m_strServerUrl.c_str();
     70}
     71
     72
     73int RTCRestClientApiBase::setServerUrl(const char *a_pszUrl)
     74{
     75#ifdef RT_STRICT
     76    if (a_pszUrl)
     77    {
     78        RTURIPARSED Parsed;
     79        int rc = RTUriParse(a_pszUrl, &Parsed);
     80        AssertRC(rc);
     81    }
     82#endif
     83
     84    return m_strServerUrl.assignNoThrow(a_pszUrl);
     85}
     86
     87
     88int RTCRestClientApiBase::setServerUrlPart(const char *a_pszServerUrl, size_t a_offDst, size_t a_cchDst,
     89                                           const char *a_pszSrc, size_t a_cchSrc)
     90{
     91    if (   a_cchDst == a_cchSrc
     92        && memcmp(&a_pszServerUrl[0], a_pszSrc, a_cchSrc) == 0)
     93        return VINF_SUCCESS;
     94
     95    if (m_strServerUrl.isEmpty())
     96    {
     97        int rc = m_strServerUrl.assignNoThrow(a_pszServerUrl);
     98        AssertRCReturn(rc, rc);
     99    }
     100    return m_strServerUrl.replaceNoThrow(a_offDst, a_cchDst, a_pszSrc, a_cchSrc);
     101}
     102
     103
     104int RTCRestClientApiBase::setServerScheme(const char *a_pszScheme)
     105{
     106    /*
     107     * Validate.
     108     */
     109    AssertReturn(a_pszScheme, VERR_INVALID_POINTER);
     110    size_t const cchScheme = strlen(a_pszScheme);
     111    AssertReturn(cchScheme > 0, VERR_INVALID_PARAMETER);
     112    Assert(cchScheme < 16);
     113#ifdef RT_STRICT
     114    for (size_t i = 0; i < cchScheme; i++)
     115        Assert(RT_C_IS_ALNUM(a_pszScheme[i]));
     116#endif
     117
     118    /*
     119     * Parse, compare & replace.
     120     */
     121    RTURIPARSED Parsed;
     122    const char *pszUrl = getServerUrl();
     123    int rc = RTUriParse(pszUrl, &Parsed);
     124    AssertRCReturn(rc, rc);
     125    return setServerUrlPart(pszUrl, 0, Parsed.cchScheme, a_pszScheme, cchScheme);
     126}
     127
     128
     129int RTCRestClientApiBase::setServerAuthority(const char *a_pszAuthority)
     130{
     131    /*
     132     * Validate.
     133     */
     134    AssertReturn(a_pszAuthority, VERR_INVALID_POINTER);
     135    size_t const cchAuthority = strlen(a_pszAuthority);
     136    AssertReturn(cchAuthority > 0, VERR_INVALID_PARAMETER);
     137    Assert(memchr(a_pszAuthority, '/', cchAuthority) == NULL);
     138    Assert(memchr(a_pszAuthority, '\\', cchAuthority) == NULL);
     139    Assert(memchr(a_pszAuthority, '#', cchAuthority) == NULL);
     140    Assert(memchr(a_pszAuthority, '?', cchAuthority) == NULL);
     141
     142    /*
     143     * Parse, compare & replace.
     144     */
     145    RTURIPARSED Parsed;
     146    const char *pszUrl = getServerUrl();
     147    int rc = RTUriParse(pszUrl, &Parsed);
     148    AssertRCReturn(rc, rc);
     149    return setServerUrlPart(pszUrl, Parsed.offAuthority, Parsed.cchAuthority, a_pszAuthority, cchAuthority);
     150}
     151
     152
     153int RTCRestClientApiBase::setServerBasePath(const char *a_pszBasePath)
     154{
     155    /*
     156     * Validate.
     157     */
     158    AssertReturn(a_pszBasePath, VERR_INVALID_POINTER);
     159    size_t const cchBasePath = strlen(a_pszBasePath);
     160    AssertReturn(cchBasePath > 0, VERR_INVALID_PARAMETER);
     161    Assert(memchr(a_pszBasePath, '?', cchBasePath) == NULL);
     162    Assert(memchr(a_pszBasePath, '#', cchBasePath) == NULL);
     163
     164    /*
     165     * Parse, compare & replace.
     166     */
     167    RTURIPARSED Parsed;
     168    const char *pszUrl = getServerUrl();
     169    int rc = RTUriParse(pszUrl, &Parsed);
     170    AssertRCReturn(rc, rc);
     171    return setServerUrlPart(pszUrl, Parsed.offPath, Parsed.cchPath, a_pszBasePath, cchBasePath);
    94172}
    95173
     
    99177    if (m_hHttp != NIL_RTHTTP)
    100178    {
    101 #if 0
    102         /*
    103          * XXX: disable for now as it causes the RTHTTP handle state
    104          * and curl state to get out of sync.
    105          */
     179#if 0   /** @todo XXX: disable for now as it causes the RTHTTP handle state and curl state to get out of sync. */
    106180        return RTHttpReset(m_hHttp);
    107181#else
     
    170244                     */
    171245                    RTCString strFullUrl;
    172                     rc = strFullUrl.assignNoThrow(getHost());
    173                     if (RT_SUCCESS(rc))
    174                         rc = strFullUrl.appendNoThrow(getBasePath());
     246                    rc = strFullUrl.assignNoThrow(getServerUrl());
    175247                    if (strExtraPath.isNotEmpty())
    176248                    {
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