VirtualBox

Changeset 74060 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Sep 4, 2018 9:28:28 AM (6 years ago)
Author:
vboxsync
Message:

IPRT/http: s/RTHttpAppend/RTHttpAdd/[Raw]Header, defining FRONT and BACK flags. bugref:9167

Location:
trunk/src/VBox/Runtime
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/rest/RTCRestClientApiBaseOci.cpp

    r74053 r74060  
    146146        RTStrPrintf(szTmp, sizeof(szTmp), "%zu", a_rStrXmitBody.length());
    147147
    148         rc = RTHttpAppendHeader(a_hHttp, s_szContentLength, szTmp, 0);
     148        rc = RTHttpAddHeader(a_hHttp, s_szContentLength, szTmp, RTHTTPADDHDR_F_BACK);
    149149        AssertRCReturn(rc, rc);
    150150        pszContentLength = RTHttpGetHeader(a_hHttp, RT_STR_TUPLE(s_szContentLength));
     
    177177        rc = RTBase64EncodeEx(abHash, sizeof(abHash), RTBASE64_FLAGS_NO_LINE_BREAKS, szTmp, sizeof(szTmp), NULL);
    178178
    179         rc = RTHttpAppendHeader(a_hHttp, s_szXContentSha256, szTmp, 0);
     179        rc = RTHttpAddHeader(a_hHttp, s_szXContentSha256, szTmp, RTHTTPADDHDR_F_BACK);
    180180        AssertRCReturn(rc, rc);
    181181        pszValue = RTHttpGetHeader(a_hHttp, RT_STR_TUPLE(s_szXContentSha256));
     
    223223                    Time.u8Hour, Time.u8Minute, Time.u8Second);
    224224
    225         rc = RTHttpAppendHeader(a_hHttp, s_szXDate, szTmp, 0);
     225        rc = RTHttpAddHeader(a_hHttp, s_szXDate, szTmp, RTHTTPADDHDR_F_BACK);
    226226        AssertRCReturn(rc, rc);
    227227        pszXDate = RTHttpGetHeader(a_hHttp, RT_STR_TUPLE(s_szXDate));
     
    304304                                     * Finally, add the authorization header.
    305305                                     */
    306                                     rc = RTHttpAppendHeader(a_hHttp, "Authorization", strAuth.c_str(), 0);
     306                                    rc = RTHttpAddHeader(a_hHttp, "Authorization", strAuth.c_str(), RTHTTPADDHDR_F_FRONT);
    307307                                    AssertRC(rc);
    308308                                }
  • trunk/src/VBox/Runtime/common/rest/RTCRestClientRequestBase.cpp

    r74025 r74060  
    193193                AssertRCReturn(rc, rc);
    194194
    195                 rc = RTHttpAppendHeader(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);
    196196                AssertRCReturn(rc, rc);
    197197            }
     
    217217                    AssertRCReturn(rc, rc);
    218218
    219                     rc = RTHttpAppendHeader(a_hHttp, strTmpName.c_str(), strTmpVal.c_str(), 0);
     219                    rc = RTHttpAddHeader(a_hHttp, strTmpName.c_str(), strTmpVal.c_str(), RTHTTPADDHDR_F_BACK);
    220220                    AssertRCReturn(rc, rc);
    221221                }
  • trunk/src/VBox/Runtime/generic/http-curl.cpp

    r74050 r74060  
    19291929
    19301930/**
    1931  * Helper for RTHttpSetHeaders and RTHttpAppendHeader that unsets the user agent
     1931 * Helper for RTHttpSetHeaders and RTHttpAddRawHeader that unsets the user agent
    19321932 * if it is now in one of the headers.
    19331933 */
     
    19671967
    19681968    /*
    1969      * Convert the headers into a curl string list, checkig each string for User-Agent.
     1969     * Convert the headers into a curl string list, checking each string for User-Agent.
    19701970     */
    19711971    struct curl_slist *pHeaders = NULL;
     
    20002000
    20012001
    2002 RTR3DECL(int) RTHttpAppendRawHeader(RTHTTP hHttp, const char *pszHeader)
     2002RTR3DECL(int) RTHttpAddRawHeader(RTHTTP hHttp, const char *pszHeader, uint32_t fFlags)
    20032003{
    20042004    PRTHTTPINTERNAL pThis = hHttp;
    20052005    RTHTTP_VALID_RETURN(pThis);
     2006    AssertReturn(!(fFlags & ~RTHTTPADDHDR_F_BACK), VERR_INVALID_FLAGS);
     2007/** @todo implement RTHTTPADDHDR_F_FRONT */
    20062008
    20072009    /*
     
    20402042
    20412043
    2042 RTR3DECL(int) RTHttpAppendHeader(RTHTTP hHttp, const char *pszField, const char *pszValue, uint32_t fFlags)
     2044RTR3DECL(int) RTHttpAddHeader(RTHTTP hHttp, const char *pszField, const char *pszValue, uint32_t fFlags)
    20432045{
    20442046
     
    20622064    size_t const cchValue = strlen(pszValue);
    20632065
    2064     AssertReturn(!fFlags, VERR_INVALID_FLAGS);
     2066    AssertReturn(!(fFlags & ~RTHTTPADDHDR_F_BACK), VERR_INVALID_FLAGS);
    20652067
    20662068    /*
     
    20842086    pszHeader[cbNeeded - 1] = '\0';
    20852087
    2086     int rc = RTHttpAppendRawHeader(hHttp, pszHeader);
     2088    int rc = RTHttpAddRawHeader(hHttp, pszHeader, fFlags & RTHTTPADDHDR_F_FRONT);
    20872089
    20882090    if (pszHeaderFree)
Note: See TracChangeset for help on using the changeset viewer.

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