/openbmc/bmcweb/include/ |
H A D | async_resp.hpp | 13548d85 Fri Jul 22 11:50:44 CDT 2022 Ed Tanous <edtanous@google.com> Preserve headers from the root object on expand
There is a bug where, when running an expand query, headers from the response object get dropped. These headers include OData.type, and the newly minted Link header, as well as possible others.
This was actually noted in a TODO, although the author of the TODO, didn't fully understand the consequences at the time, and thought there was no functional impact.
To resolve this, this commit resolves the TODO, and allows the Response object to be moved out, instead of having to create a new one, which preserves all the response state. To do this, it creates a move constructor on the Response object for this use. The move constructor is relatively benign, with one caveat, that we might be moving while in a completion handler (as is the most common use). So both the existing operator= and Response() move constructor are amended to handle this case, and simply null out the response object in the copied object, which would be correct behavior, given that each callback handler should only be called once per Response object.
Tested: curl --insecure --user root:0penBmc -vvvv https://192.168.7.2/redfish/v1\?\$expand\=\*\(\$levels\=2\)
returns the same body as previously, now with the included: OData-Version: 4.0 Allow: Get
headers in the response.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I221364dd4304903b37cacb1386f621b073a0a891
|
/openbmc/bmcweb/http/ |
H A D | http_response.hpp | 13548d85 Fri Jul 22 11:50:44 CDT 2022 Ed Tanous <edtanous@google.com> Preserve headers from the root object on expand
There is a bug where, when running an expand query, headers from the response object get dropped. These headers include OData.type, and the newly minted Link header, as well as possible others.
This was actually noted in a TODO, although the author of the TODO, didn't fully understand the consequences at the time, and thought there was no functional impact.
To resolve this, this commit resolves the TODO, and allows the Response object to be moved out, instead of having to create a new one, which preserves all the response state. To do this, it creates a move constructor on the Response object for this use. The move constructor is relatively benign, with one caveat, that we might be moving while in a completion handler (as is the most common use). So both the existing operator= and Response() move constructor are amended to handle this case, and simply null out the response object in the copied object, which would be correct behavior, given that each callback handler should only be called once per Response object.
Tested: curl --insecure --user root:0penBmc -vvvv https://192.168.7.2/redfish/v1\?\$expand\=\*\(\$levels\=2\)
returns the same body as previously, now with the included: OData-Version: 4.0 Allow: Get
headers in the response.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I221364dd4304903b37cacb1386f621b073a0a891
|
/openbmc/bmcweb/redfish-core/include/utils/ |
H A D | query_param.hpp | 13548d85 Fri Jul 22 11:50:44 CDT 2022 Ed Tanous <edtanous@google.com> Preserve headers from the root object on expand
There is a bug where, when running an expand query, headers from the response object get dropped. These headers include OData.type, and the newly minted Link header, as well as possible others.
This was actually noted in a TODO, although the author of the TODO, didn't fully understand the consequences at the time, and thought there was no functional impact.
To resolve this, this commit resolves the TODO, and allows the Response object to be moved out, instead of having to create a new one, which preserves all the response state. To do this, it creates a move constructor on the Response object for this use. The move constructor is relatively benign, with one caveat, that we might be moving while in a completion handler (as is the most common use). So both the existing operator= and Response() move constructor are amended to handle this case, and simply null out the response object in the copied object, which would be correct behavior, given that each callback handler should only be called once per Response object.
Tested: curl --insecure --user root:0penBmc -vvvv https://192.168.7.2/redfish/v1\?\$expand\=\*\(\$levels\=2\)
returns the same body as previously, now with the included: OData-Version: 4.0 Allow: Get
headers in the response.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I221364dd4304903b37cacb1386f621b073a0a891
|