Changeset 73922 in vbox for trunk/src/VBox/Runtime/common/rest
- Timestamp:
- Aug 28, 2018 7:30:28 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 124647
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/rest/RTCRestClientResponseBase.cpp
r73921 r73922 40 40 RTCRestClientResponseBase::RTCRestClientResponseBase() 41 41 : m_rcStatus(VERR_WRONG_ORDER) 42 , m_rcHttp(VERR_NOT_AVAILABLE) 43 , m_pErrInfo(NULL) 42 44 { 43 45 } … … 49 51 RTCRestClientResponseBase::~RTCRestClientResponseBase() 50 52 { 51 /* nothing to do here */53 deleteErrInfo(); 52 54 } 53 55 … … 58 60 RTCRestClientResponseBase::RTCRestClientResponseBase(RTCRestClientResponseBase const &a_rThat) 59 61 : m_rcStatus(a_rThat.m_rcStatus) 60 { 62 , m_rcHttp(a_rThat.m_rcHttp) 63 , m_strContentType(a_rThat.m_strContentType) 64 , m_pErrInfo(NULL) 65 { 66 if (m_pErrInfo) 67 copyErrInfo(m_pErrInfo); 61 68 } 62 69 … … 67 74 RTCRestClientResponseBase &RTCRestClientResponseBase::operator=(RTCRestClientResponseBase const &a_rThat) 68 75 { 69 m_rcStatus = a_rThat.m_rcStatus; 76 m_rcStatus = a_rThat.m_rcStatus; 77 m_rcHttp = a_rThat.m_rcHttp; 78 m_strContentType = a_rThat.m_strContentType; 79 if (a_rThat.m_pErrInfo) 80 copyErrInfo(a_rThat.m_pErrInfo); 81 else if (m_pErrInfo) 82 deleteErrInfo(); 83 70 84 return *this; 71 85 } … … 83 97 RT_NOREF_PV(a_hHttp); 84 98 m_rcStatus = a_rcStatus; 99 if (a_rcStatus >= 0) 100 m_rcHttp = a_rcStatus; 85 101 } 86 102 … … 88 104 void RTCRestClientResponseBase::consumeHeaders(const char *a_pchData, size_t a_cbData) 89 105 { 106 /* 107 * Get the the content type. 108 */ 109 int rc = extractHeaderFromBlob(RT_STR_TUPLE("Content-Type"), a_pchData, a_cbData, &m_strContentType); 110 if (rc == VERR_NOT_FOUND) 111 rc = VINF_SUCCESS; 112 AssertRCReturnVoidStmt(rc, m_rcStatus = rc); 113 } 114 115 116 void RTCRestClientResponseBase::consumeBody(const char *a_pchData, size_t a_cbData) 117 { 90 118 RT_NOREF(a_pchData, a_cbData); 91 119 } 92 120 93 121 94 void RTCRestClientResponseBase::consumeBody(const char *a_pchData, size_t a_cbData)95 {96 RT_NOREF(a_pchData, a_cbData);97 }98 99 100 122 void RTCRestClientResponseBase::receiveFinal() 101 123 { 124 } 125 126 127 PRTERRINFO RTCRestClientResponseBase::allocErrInfo(void) 128 { 129 size_t cbMsg = _4K; 130 m_pErrInfo = (PRTERRINFO)RTMemAllocZ(sizeof(*m_pErrInfo) + cbMsg); 131 if (m_pErrInfo) 132 return RTErrInfoInit(m_pErrInfo, (char *)(m_pErrInfo + 1), cbMsg); 133 return NULL; 134 } 135 136 137 void RTCRestClientResponseBase::deleteErrInfo(void) 138 { 139 if (m_pErrInfo) 140 { 141 RTMemFree(m_pErrInfo); 142 m_pErrInfo = NULL; 143 } 144 } 145 146 147 void RTCRestClientResponseBase::copyErrInfo(PCRTERRINFO pErrInfo) 148 { 149 deleteErrInfo(); 150 m_pErrInfo = (PRTERRINFO)RTMemDup(pErrInfo, pErrInfo->cbMsg + sizeof(*pErrInfo)); 151 if (m_pErrInfo) 152 { 153 m_pErrInfo->pszMsg = (char *)(m_pErrInfo + 1); 154 m_pErrInfo->apvReserved[0] = NULL; 155 m_pErrInfo->apvReserved[1] = NULL; 156 } 102 157 } 103 158
Note:
See TracChangeset
for help on using the changeset viewer.