summaryrefslogtreecommitdiff
path: root/http/http_response.hpp
AgeCommit message (Collapse)AuthorFilesLines
2022-03-01Change the completionhandler to accept ResNan Zhou1-14/+40
These modifications are from WIP:Redfish:Query parameters:Only (https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/47474). It will be used in future CLs for Query Parameters. The code changed the completion handle to accept Res to be able to recall handle with a new Response object. AsyncResp owns a new res, so there is no need to pass in a res. Also fixed a self-move assignment bug. Context: Originally submitted: https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/480020 Reveted here: https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/48880 Because of failures here: https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/48864 Tested: 1. Romulus QEMU + Robot tests; all passed 2. Use scripts/websocket_test.py to test websockets. It is still work correctly. 3. Tested in real hardware; no new validator errors; tested both authless, session, and basic auth. 4. Hacked codes to return 500 errors on certain resource; response is expected; 5. Tested Eventing, the push style one (not SSE which is still under review), worked as expected. 6. Tested 404 errors; response is expected. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Signed-off-by: John Edward Broadbent <jebr@google.com> Change-Id: I52adb174476e0f6656335baa6657456752a031be
2022-01-12Enable cppcoreguidelines-special-member-functions checksEd Tanous1-0/+4
Part of enforcing cpp core guidelines involves explicitly including all constructors required on a non-trivial class. We were missing quite a few. In all cases, the copy/move/and operator= methods are simply deleted. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie8d6e8bf2bc311fa21a9ae48b0d61ee5c1940999
2021-11-16Revert "Change the completionhandler to accept Res"Gunnar Mills1-31/+13
This reverts commit 91995f3272010875e1559397e98ca93354066a0e. Seeing bumps fail. https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/48864 Please fix, test, and resubmit. Change-Id: Id539fe66d5a093caf8f22a393f7af7b58ead5247 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2021-11-16Change the completionhandler to accept Reszhanghch051-13/+31
These modifications are from WIP:Redfish:Query parameters:Only (https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/47474). And they will be used in Redfish:Query Parameters:Only. (https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38952) The code changed the completion handle to accept Res to be able to recall handle with a new Response object. AsyncResp owns a new res, so there is no need to pass in a res. Tested: 1.Basic and Token auth both still work. 2.Use scripts/websocket_test.py to test websockets. It is still work correctly. python3 websocket_test.py --host 127.0.0.1:2443 This modification is a public part, so you can use any URL to test this function. The response is the same as before. Signed-off-by: zhanghaicheng <zhanghch05@inspur.com> Change-Id: I570e32fb47a9a90fe111fcd1f4054060cd21def3
2021-08-23connection use setter for completeRequestHandlerJohn Edward Broadbent1-0/+5
The Connection object used to set the response object public member. However, it is cleaner when public interfaces are used. Change-Id: Ib16950f174106e5fd22aad874f09f31704283ad1 Signed-off-by: John Edward Broadbent <jebr@google.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2021-05-12Include what you use in http request and responseEd Tanous1-0/+2
https://jenkins.openbmc.org/job/ci-openbmc/3949/distro=ubuntu,label=docker-builder,target=tiogapass/consoleText This build seems to be failing with an error | ../git/http/http_response.hpp:23:10: error: 'optional' in namespace 'std' does not name a template type | 23 | std::optional<response_type> stringResponse; This should fix it by including the relevant headers. Tested: Code builds. CI error only. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ifba15559a73d823d791de1d508e136a3c44e6cd1
2021-04-26Fix infinite redirect when webui isn't installedEd Tanous1-1/+1
In the begining, bmcweb had its own webui checked in as source. Largely conceived of clay, and built by someone that doesn't understand UI development (me), it was eventually superceeded by phosphor-webui. When we did that, we created a bug where bmcweb was expecting a UI to always be installed, and when it wasn't resolved into an infinite recursive redirect as it tried to find the login page. This patchset fixes that, by adding a connection between the authorization class, and the webassets class, for bmcweb to detect at runtime whether or not the UI is installed, and change behavior in that case. Along the way, we got a circular #include, so some includes needed to be rearranged slightly. This patchset will change no behavior when the UI is installed. Login failures will continue to redirect to /, to hit the login page. If the UI is not installed, and there is no / route, BMCWEB will return the plaintext UNAUTHORIZED if you attempt to open the webui from the browser without having a webui installed and without having credentials. Tested: Launched in a build without webui-vue, and observed "UNAUTHORIZED" when I connected through chrome. Also launched in a build with webui-vue installed with: IMAGE_INSTALL_append = "webui-vue" And loaded the webui in chrome, and logged in successfully. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Iac9b83ba9e80d434479685b082d547847cdfe309
2020-12-18Fix .clang-tidyEd Tanous1-4/+4
camelLower is not a type, camelBack is. Changes were made automatically with clang-tidy --fix-errors To be able to apply changes automatically, the only way I've found that works was to build the version of clang/clang-tidy that yocto has, and run the fix script within bitbake -c devshell bmcweb. Unfortunately, yocto has clang-tidy 11, which can apparently find a couple extra errors in tests we already had enabled. As such, a couple of those are also included. Tested: Ran clang-tidy-11 and got a clean result. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I9d1080b67f0342229c2f267160849445c065ca51
2020-10-23Turn on ALL perf checksEd Tanous1-11/+0
1st, alphabetize the tidy-list for good housekeeping. Next, enable all the clang-tidy performance checks, and resolve all the issues. most of the issues boil down to: 1. Using std::move on const variables. This does nothing. 2. Passing big variables (like std::string) by value. 3. Using double quotes on a find call, which constructs an intermediate string, rather than using the character overload. Tested Loaded on system, logged in successfully and pulled down webui-vue. No new errors. Walked the Redfish tree a bit, and observed no new problems. Ran redfish service validator. Got no new failures (although there are a lot of log service deprecation warnings that we should look at). Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I2238958c4b22c1e554e09a0a1787c744bdbca43e
2020-10-23fix include namesEd Tanous1-0/+159
cppcheck isn't smart enough to recognize these are c++ headers, not c headers. Considering we're already inconsistent about our naming, it's easier to just be consistent, and move the last few files to use .hpp instead of .h. Tested: Code builds, no changes. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Ic348d695f8527fa4a0ded53f433e1558c319db40