Changeset 74060 in vbox
- Timestamp:
- Sep 4, 2018 9:28:28 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
include/iprt/http.h (modified) (2 diffs)
-
src/VBox/Runtime/common/rest/RTCRestClientApiBaseOci.cpp (modified) (4 diffs)
-
src/VBox/Runtime/common/rest/RTCRestClientRequestBase.cpp (modified) (2 diffs)
-
src/VBox/Runtime/generic/http-curl.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/http.h
r74046 r74060 294 294 RTR3DECL(int) RTHttpSetHeaders(RTHTTP hHttp, size_t cHeaders, const char * const *papszHeaders); 295 295 296 /** 297 * Appends a raw header. 296 /** @name RTHTTPADDHDR_F_XXX - Flags for RTHttpAddRawHeader and RTHttpAddHeader 297 * @{ */ 298 #define RTHTTPADDHDR_F_BACK UINT32_C(0) /**< Append the header. */ 299 #define RTHTTPADDHDR_F_FRONT UINT32_C(1) /**< Prepend the header. */ 300 /** @} */ 301 302 /** 303 * Adds a raw header. 298 304 * 299 305 * @returns IPRT status code. 300 306 * @param hHttp The HTTP client handle. 301 307 * @param pszHeader Header string on the form "foo: bar". 302 */ 303 RTR3DECL(int) RTHttpAppendRawHeader(RTHTTP hHttp, const char *pszHeader); 304 305 /** 306 * Appends a header field and value. 308 * @param fFlags RTHTTPADDHDR_F_FRONT or RTHTTPADDHDR_F_BACK. 309 */ 310 RTR3DECL(int) RTHttpAddRawHeader(RTHTTP hHttp, const char *pszHeader, uint32_t fFlags); 311 312 /** 313 * Adds a header field and value. 307 314 * 308 315 * @returns IPRT status code. … … 310 317 * @param pszField The header field name. 311 318 * @param pszValue The header field value. 312 * @param fFlags Flags reserved for controlling encoding, MBZ. 313 */ 314 RTR3DECL(int) RTHttpAppendHeader(RTHTTP hHttp, const char *pszField, const char *pszValue, uint32_t fFlags); 319 * @param fFlags Only RTHTTPADDHDR_F_FRONT or RTHTTPADDHDR_F_BACK, 320 * may be extended with encoding controlling flags if 321 * needed later. 322 */ 323 RTR3DECL(int) RTHttpAddHeader(RTHTTP hHttp, const char *pszField, const char *pszValue, uint32_t fFlags); 315 324 316 325 /** -
trunk/src/VBox/Runtime/common/rest/RTCRestClientApiBaseOci.cpp
r74053 r74060 146 146 RTStrPrintf(szTmp, sizeof(szTmp), "%zu", a_rStrXmitBody.length()); 147 147 148 rc = RTHttpA ppendHeader(a_hHttp, s_szContentLength, szTmp, 0);148 rc = RTHttpAddHeader(a_hHttp, s_szContentLength, szTmp, RTHTTPADDHDR_F_BACK); 149 149 AssertRCReturn(rc, rc); 150 150 pszContentLength = RTHttpGetHeader(a_hHttp, RT_STR_TUPLE(s_szContentLength)); … … 177 177 rc = RTBase64EncodeEx(abHash, sizeof(abHash), RTBASE64_FLAGS_NO_LINE_BREAKS, szTmp, sizeof(szTmp), NULL); 178 178 179 rc = RTHttpA ppendHeader(a_hHttp, s_szXContentSha256, szTmp, 0);179 rc = RTHttpAddHeader(a_hHttp, s_szXContentSha256, szTmp, RTHTTPADDHDR_F_BACK); 180 180 AssertRCReturn(rc, rc); 181 181 pszValue = RTHttpGetHeader(a_hHttp, RT_STR_TUPLE(s_szXContentSha256)); … … 223 223 Time.u8Hour, Time.u8Minute, Time.u8Second); 224 224 225 rc = RTHttpA ppendHeader(a_hHttp, s_szXDate, szTmp, 0);225 rc = RTHttpAddHeader(a_hHttp, s_szXDate, szTmp, RTHTTPADDHDR_F_BACK); 226 226 AssertRCReturn(rc, rc); 227 227 pszXDate = RTHttpGetHeader(a_hHttp, RT_STR_TUPLE(s_szXDate)); … … 304 304 * Finally, add the authorization header. 305 305 */ 306 rc = RTHttpA ppendHeader(a_hHttp, "Authorization", strAuth.c_str(), 0);306 rc = RTHttpAddHeader(a_hHttp, "Authorization", strAuth.c_str(), RTHTTPADDHDR_F_FRONT); 307 307 AssertRC(rc); 308 308 } -
trunk/src/VBox/Runtime/common/rest/RTCRestClientRequestBase.cpp
r74025 r74060 193 193 AssertRCReturn(rc, rc); 194 194 195 rc = RTHttpA ppendHeader(a_hHttp, a_paHeaderParams[i].pszName, strTmpVal.c_str(), 0);195 rc = RTHttpAddHeader(a_hHttp, a_paHeaderParams[i].pszName, strTmpVal.c_str(), RTHTTPADDHDR_F_BACK); 196 196 AssertRCReturn(rc, rc); 197 197 } … … 217 217 AssertRCReturn(rc, rc); 218 218 219 rc = RTHttpA ppendHeader(a_hHttp, strTmpName.c_str(), strTmpVal.c_str(), 0);219 rc = RTHttpAddHeader(a_hHttp, strTmpName.c_str(), strTmpVal.c_str(), RTHTTPADDHDR_F_BACK); 220 220 AssertRCReturn(rc, rc); 221 221 } -
trunk/src/VBox/Runtime/generic/http-curl.cpp
r74050 r74060 1929 1929 1930 1930 /** 1931 * Helper for RTHttpSetHeaders and RTHttpA ppendHeader that unsets the user agent1931 * Helper for RTHttpSetHeaders and RTHttpAddRawHeader that unsets the user agent 1932 1932 * if it is now in one of the headers. 1933 1933 */ … … 1967 1967 1968 1968 /* 1969 * Convert the headers into a curl string list, checki g each string for User-Agent.1969 * Convert the headers into a curl string list, checking each string for User-Agent. 1970 1970 */ 1971 1971 struct curl_slist *pHeaders = NULL; … … 2000 2000 2001 2001 2002 RTR3DECL(int) RTHttpA ppendRawHeader(RTHTTP hHttp, const char *pszHeader)2002 RTR3DECL(int) RTHttpAddRawHeader(RTHTTP hHttp, const char *pszHeader, uint32_t fFlags) 2003 2003 { 2004 2004 PRTHTTPINTERNAL pThis = hHttp; 2005 2005 RTHTTP_VALID_RETURN(pThis); 2006 AssertReturn(!(fFlags & ~RTHTTPADDHDR_F_BACK), VERR_INVALID_FLAGS); 2007 /** @todo implement RTHTTPADDHDR_F_FRONT */ 2006 2008 2007 2009 /* … … 2040 2042 2041 2043 2042 RTR3DECL(int) RTHttpA ppendHeader(RTHTTP hHttp, const char *pszField, const char *pszValue, uint32_t fFlags)2044 RTR3DECL(int) RTHttpAddHeader(RTHTTP hHttp, const char *pszField, const char *pszValue, uint32_t fFlags) 2043 2045 { 2044 2046 … … 2062 2064 size_t const cchValue = strlen(pszValue); 2063 2065 2064 AssertReturn(! fFlags, VERR_INVALID_FLAGS);2066 AssertReturn(!(fFlags & ~RTHTTPADDHDR_F_BACK), VERR_INVALID_FLAGS); 2065 2067 2066 2068 /* … … 2084 2086 pszHeader[cbNeeded - 1] = '\0'; 2085 2087 2086 int rc = RTHttpA ppendRawHeader(hHttp, pszHeader);2088 int rc = RTHttpAddRawHeader(hHttp, pszHeader, fFlags & RTHTTPADDHDR_F_FRONT); 2087 2089 2088 2090 if (pszHeaderFree)
Note:
See TracChangeset
for help on using the changeset viewer.

