VirtualBox

Changeset 87303 in vbox


Ignore:
Timestamp:
Jan 18, 2021 6:39:18 PM (4 years ago)
Author:
vboxsync
Message:

IPRT/rest: for POST and PUT OCI wants even an empty body signed. May
be the caller should use kDoCall_RequireBody, but it's not immediately
obvious that's the right thing to do and doing it right requires some
rearrangements. (This should logically be in the request, but the
flag comes from the doCall in the api template, so the same logic
would end up duplicated in different files). For now just tweak the
local logic in a well isolated fix. bugref:9167.

File:
1 edited

Legend:

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

    r87302 r87303  
    144144    if (RT_SUCCESS(rc))
    145145    {
    146         bool fHasBody = a_rStrXmitBody.isNotEmpty() || (a_fFlags & kDoCall_RequireBody);
     146        bool fHasBody
     147            =  a_rStrXmitBody.isNotEmpty()
     148               /* but sometimes we need an empty body signed too */
     149            || (a_fFlags & kDoCall_RequireBody)
     150            || a_enmHttpMethod == RTHTTPMETHOD_POST
     151            || a_enmHttpMethod == RTHTTPMETHOD_PUT;
    147152
    148         if (   fHasBody
    149             || a_enmHttpMethod == RTHTTPMETHOD_POST
    150             || a_enmHttpMethod == RTHTTPMETHOD_PUT)
     153        if (fHasBody)
     154        {
    151155            rc = ociSignRequestEnsureContentLength(a_hHttp, a_rStrXmitBody.length());
    152         if (   RT_SUCCESS(rc)
    153             && fHasBody)
    154             rc = ociSignRequestEnsureXContentSha256(a_hHttp, a_rStrXmitBody.c_str(), a_rStrXmitBody.length());
     156            if (RT_SUCCESS(rc))
     157                rc = ociSignRequestEnsureXContentSha256(a_hHttp, a_rStrXmitBody.c_str(), a_rStrXmitBody.length());
     158        }
    155159        if (RT_SUCCESS(rc))
    156160            rc = ociSignRequestEnsureDateOrXDate(a_hHttp);
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