summaryrefslogtreecommitdiff
path: root/http
AgeCommit message (Collapse)AuthorFilesLines
2022-02-15Move validateAndSplitUri to common utility headerEd Tanous2-0/+87
This function in practice looks like it has another use where the code is essentially the same. Move it to a header so it can be used by other things. And add unit tests to ensure it stays reliable. Tested: Unit tests pass. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I3343ba1aa9c0dd542fbb98628b7628cb0704fb3b
2022-02-15Enable readability-uppercase-literal-suffixEd Tanous1-1/+1
We only had a few violations of this; Fix them and enable the check. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I159e774fd0169a91a092218ec8dc896ba9edebf4
2022-02-15Enable readability-implicit-bool-conversion checksEd Tanous1-17/+18
These checks ensure that we're not implicitly converting ints or pointers into bools, which makes the code easier to read. Tested: Ran series through redfish service validator. No changes observed. UUID failing in Qemu both before and after. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I1ca0be980d136bd4e5474341f4fd62f2f6bbdbae
2022-02-11Add readability-redundant-* checksEd Tanous3-4/+3
There's a number of redundancies in our code that clang can sanitize out. Fix the existing problems, and enable the checks. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie63d7b7f0777b702fbf1b23a24e1bed7b4f5183b
2022-02-09Enable readability-avoid-const-params-in-declsEd Tanous4-6/+7
This check involves explicitly declaring variables const when they're declared auto, which helps in readability, and makes it more clear that the variables are const. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I71198ea03850384a389a56ad26f2c4a48c75b148
2022-02-08Add UrlFromPieces helper functionEd Tanous2-0/+37
This commit attempts to improve our ability to encode URIs from pieces of a string. In the past, we've used std::string::operator+= for this, which has problems in that bad characters are not encoded correctly into a URI. As an example, if we got a dbus path with _2F (ascii /) in it, our current code would push that directly into the uri and break the redfish tree. Examples of use are provided in the unit tests. Tested: Unit tests pass, no functional changes yet. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I5801d2146a5c948396d4766ac96f1f2b25205a0f
2022-02-07Enable readability-redundant-control-flow checksEd Tanous1-3/+0
These checks are a nice addition to our static analysis, as they simplify code quite a bit, as can be seen by this diff being negative lines. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I60ede4ad23d7e5337e811d70ddcab24bf8986891
2022-02-07Enable readability-named-parameter checksEd Tanous1-20/+23
We don't have too many violations here, probably because we don't have many optional parameters. Fix the existing instances, and enable the check. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I4d512f0ec90b060fb60a42fe3cd6ba72fb6c6bcb
2022-02-04Remove NEW_BOOST_URL macroEd Tanous1-20/+1
Now that the subtree update is done, this define is no longer needed. Tested: Code compiles. Noop. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Idc5d7ef69c009982a2476fadc1d95e3280bfff48
2022-02-04Remove getTimestampEd Tanous1-10/+0
The aforementioned function is only used in the log services, and is used incorrectly in that context. This commit replaces it with the correct (and unit tested) getDateTimeUintMs, which is what we should be using for dbus->time conversions in all cases, to avoid time_t overflows when static casting. Tested: Before "Created": "2022-01-31T19:39:58+00:00", "Modified": "2022-01-31T19:39:58+00:00", With change: "Created": "2022-01-31T19:39:58.101000+00:00", "Modified": "2022-01-31T19:39:58.101000+00:00", The Redfish validator is okay with this *** /redfish/v1/Systems/system/LogServices/EventLog/Entries/1000 Type (LogEntry.v1_8_0.LogEntry), GET SUCCESS (time: 0) PASS Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie8a2243230ee080d9e8785ae918fad1b1b6ab145
2022-02-02Next round of boost-uri updatesEd Tanous1-0/+19
Boost url has changed some APIs again. This commit updates our URIs to handle it. As part of this work, it also removes some of the debug prints that were put in early on. These aren't really needed these days. This commit invents a temporary #define of NEW_BOOST_URL, so we can get through the subtree update without a hard dependency on this specific version of bmcweb. Ideally boost-url would have some version field, but unfortunately, it is thusfar unversioned, as the long term intent of the author is to be included in boost, and would be versioned there. All the code within the else of the NEW_BOOST_URL flag will be removed once the subtree update is landed. Tested: Added CXXFLAGS:append = " -DNEW_BOOST_URL" to the recipe and checked out on top of the subtree update, and build succeeded. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie2064e45efbc4331bdc5a5ddf44d877cde5e13cb
2022-01-28Enable readability-container-size-empty testsEd Tanous1-1/+1
This one is a little trivial, but it does help in readability. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I5366d4eec8af2f781b3bad804131ae2eb806e3aa
2022-01-27getDateTimeStdtime: fix building warnings in 32bitsNan Zhou1-7/+12
Also made std::min their own lines to be more readable. Tested: unit test passes and it builds via bitbake. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: Ic32b886cca7c2901d77b4baffd4d4a6d655e0b14
2022-01-25Fix Boost exceptions in GetDateTime seriesEd Tanous2-32/+45
In cases when the input time is too large, we return the maximum supported date in the ISO Extended format. Tested: Unit tests pass Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I0dcd60d10d4357bd8700f0dbc1ef86d94bcc82bb
2022-01-25Update unit tests for getDateTimeEd Tanous1-7/+40
the GetDateTime series needs more unit tests to ensure that we don't get bad behavior when we hit the extremes. This commit does include one tests, for getDateTimeUint that currently throws an exception that shouldn't, which is currently commented out. This needs looked at by someone. Tested: Unit tests pass Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I7f45e5d84d644780832112dca14bdb9c768903ff
2022-01-19Include what you useEd Tanous1-3/+6
Do a partial update from the include what you use tool. While ideally we'd be able to do this as part of CI, there's still quite a bit of noise in the output that requires manual intervention. Tested: Code compiles Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Iaaeb7a9199f64b5d6913c3abab4779b252768ed8
2022-01-12Enable pro-type-cstyle-cast checksEd Tanous1-2/+3
We actually do a pretty good job of this, and only have one C style cast, that's part of an openssl macro, so ignore the one, and enable the checks. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie0462ee947c8310457365ba2aeea78caedb93da1
2022-01-12Enable pointer devolution checksEd Tanous1-0/+4
Enable cpp core guidelines checks for pointer deevolution. For the moment, simply ignore the uses, although ideally these should be cleaned up at some point. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I9a8aae94cc7a59529eab89225a37e89628c17597
2022-01-12Enable cpp core guidelines macro checksEd Tanous2-0/+14
We only use a couple macros. Ignore them in the checks. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I38feb10f76f6aaea8899617f081c9be68c88b3eb
2022-01-12Enable checks for pointer arithmeticEd Tanous1-2/+4
Quite a few places we've disobeyed this rule, so simply ignore them for now to avoid new issues popping up. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I3e518a8e8742279afb3ad1a9dad54006ed109fb1
2022-01-12Enable reinterpre_cast checksEd Tanous1-2/+4
We seem to use reinterpret cast in a few cases unfortunately. For the moment, simply ignore most of them, and make it so we don't get more. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ic860cf922576b18cdc8d51d6132f5a9cbcc1d9dc
2022-01-12Enable cppcoreguidelines-special-member-functions checksEd Tanous7-0/+32
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
2022-01-12Enable init checkerEd Tanous2-7/+7
clang-tidy added cppcoreguidelines-init-variables as a check, which is something we already enforce to some extent, but getting CI to enforce it will help reviews move faster. Tested: Code compiles. Noop changes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I7e10950de617b1d3262265572b1703f2e60b69d0
2022-01-12Enable bugprone widening checks in clangEd Tanous1-2/+2
Most of the errors we hit are simply places we need to explicitly increase the width of the integer. Luckily, these are few and far between. Tested: Code compiles, unit tests pass. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I617d87f3970ae773e0767bb2f20118fca2e71daa
2022-01-12Enable clang-tidy forward reference checksEd Tanous2-6/+7
Clang-13 adds new checks we can turn on, which find quite a few errors. Tested: Code compiles Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I74b780760014c898cc440b37aea640b33e91c439
2022-01-11Fixed timestamp in telemetry serviceKrzysztof Grobelny1-11/+17
Telemetry service is using timestamp with milliseconds accuracy. Bmcweb code assumed that timestamp is in seconds which produced a bad result. This patchset updates the APIs, and adds a getDateTimeUintMs method, which can be used to convert a millisecond timestamp into a string. In the future, this can be used to get more precision out of the API. Reference: '9.4.3. Date-Time values' https://www.dmtf.org/sites/default/files/standards/documents/DSP0266_1.8.0.pdf Tested: - Telemetry service timestamp show correct timestamp with milliseconds precission. Example: 2022-01-11T13:06:58.648000+00:00 - Other timestamps in bmcweb did not change - All unit tests are passing Reference: Properties.Readings https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Telemetry/Report.interface.yaml Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I5b40ef6889b5af8c045ec0d35a758967e53dbed2
2021-12-29http_connection: Fix loggedIn check and timeoutLei YU1-1/+1
The code was using `req && req->session` to check if the session is logged in. It is not working anymore and should use `userSession` to check as other places. This impacts the timeout value on uploading the tarball, where a logged in user should have a connection timeout value of 60, but actually it is 15, and thus the upload will fail if it takes more than 15 seconds. Tested: Without the change, it fails to upload a tarball with 64M and times out at 15 seconds. With the fix, the upload is successful. Signed-off-by: Lei YU <yulei.sh@bytedance.com> Change-Id: I5e7c9e5d1f4c48ec604afb574ceda9ecc3f1cbc3
2021-12-28Move to common variantEd Tanous1-6/+5
This saves approximately 34kB in the compressed binary size of bmcweb due to reduced template instantiations. This amounts to a 2.5% reduction in the overall size. Note, there were a few places where we broke const-correctness in the form of pulling a non-const reference out of a const variant. This new variant now requires const correctness, so some consts are added where required. Tested: Code compiles. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I6a60c8881c1268627eedb4ffddf16689dc5f6ed2
2021-12-22Make routing capture by const referenceEd Tanous1-4/+5
Where possible, we should avoid doing async_method_calls that capture by mutable value. Tested: Ran redfish/v1 and webui. Both appear to function. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I3065a230568ac13f63ce030b6f19eabba1ece5fe
2021-12-21Skip contentLength check in insecure-disable-authJunLin Chen1-1/+1
If we update image via POST /redfish/v1/UpdateService. Because there is no need to establish session in insecure-disable-auth, This restricts unauthenticated users upload sizes cause POST image fail. (image always greater than limit). According to https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/30994 it should not be checked this when disable-auth condition is enabled. Test: curl -k -X POST -T <image_path> "https://<bmcip>/redfish/v1/UpdateService" Return { "@odata.id": "/redfish/v1/TaskService/Tasks/1", "@odata.type": "#Task.v1_4_3.Task", "Id": "1", "TaskState": "Running", "TaskStatus": "OK" } Signed-off-by: JunLin Chen <Jun-Lin.Chen@quantatw.com> Change-Id: Iecb1cdc0213958e7d6191801043010b0ae10433d
2021-12-15Implement connection limitEd Tanous1-7/+9
Now that we rely on normal steady_timer, bmcweb doesn't limit http connections. This commit moves the connectionCount variable out of the debug ifdefs, and into the "normal" build. Then additionally, add a check to ensure that less than 100 connections are started at a time. This count is intended to match the code in timer_queue.hpp that limited this to 100 timers at a given time. Tested: /redfish/v1 returns properly. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I93ceaf8319d09d911b36cb7b21bba0cf64a9f7b8
2021-12-15Deduplicate doAccept codeEd Tanous1-28/+15
doAccept does essentially the same code in two ways. boost::beast::lowest_layer is used elsewhere to deduplicate this code. Use it here as well. Tested: curl -vvvv --insecure -u root:0penBmc "https://192.168.7.2:443/redfish/v1" succeeds. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Idfb0cd8f62ffbc09d6e248c677c24ea1abcb7a5b
2021-12-15Make timer system use boostEd Tanous4-227/+56
The original crow timeout system had a timer queue setup for handling many thousands of connections at a time efficiently. The most common use cases for the bmc involve a handful of connections, so this code doesn't help us much. These days, boost asio also implements a very similar timer queue https://www.boost.org/doc/libs/1_72_0/boost/asio/detail/timer_queue.hpp internally, so the only thing we're loosing here is the "fuzzy" coalescing of timeout actions, for which it's tough to say if anyone will even notice. This commit implements a timer system that's self contained within each connection, using steady_timer. This is much more "normal" and how most of the beast examples implement timers. Tested: Minimal touch testing to ensure that things work, but more testing is required, probably using sloworis to ensure that our timeouts are no longer issues. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I19156411ce46adff6c88ad97ee8f6af8c858fe3c
2021-12-15Change DateOffset from Z to +00:00Nan Zhou2-6/+6
I missed that getDateTimeOffsetNow is extracting the last 5 chars for DateTimeOffset. So this patch changes the offset to the original "+00:00" one. Tested: 1. unit tests 2. Redfish Validator Tests: no errors found on DateTime or DateTimeLocalOffset. ``` DateTime 1970-01-01T00:13:27+00:00 date Yes PASS DateTimeLocalOffset +00:00 string Yes PASS ``` All other errors are not related. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I24977c476f18c88515d759e278ec56e5cbb73b3a
2021-12-11fix the year 2038 problem in getDateTimeNan Zhou2-16/+38
The existing codes cast uint64_t into time_t which is int32_t in most 32-bit systems. It results overflow if the timestamp is larger than INT_MAX. time_t will be 64 bits in future releases of glibc. See https://sourceware.org/bugzilla/show_bug.cgi?id=28182. This change workarounds the year 2038 problem via boost's ptime. std::chrono doesn't help since it is still 32 bits. Tested on QEMU. Example output for certificate: { "Name": "HTTPS Certificate", "Subject": null, "ValidNotAfter": "2106-01-28T20:40:31Z", "ValidNotBefore": "2106-02-06T18:28:16Z" } Previously, the format is like "1969-12-31T12:00:00+00:00". Note that the ending "+00:00" is the time zone, not ms. Tested the schema on QEMU. No new Redfish Service Validator errors. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8ef0bee3d724184d96253c23f3919447828d3f82
2021-12-10Convert IPv4-mapped IPv6 ClientIP back to IPv4Jiaqing Zhao1-2/+1
Current HTTP server creates an IPv6 acceptor to accept both IPv4 and IPv6 connections. In this way, IPv4 address will be presented as IPv6 address in IPv4-mapped format. This patch converts it back to IPv4. Tested: Verified the ClientOriginIP in Session is shown in native IPv4 format instead of IPv4-mapped IPv6 format. Change-Id: Icd51260b2d4572d52f5c670128b7f07f6b5e6912 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2021-12-09Fix bmcweb core-dump caused by Split up authenticatezhanghaicheng1-11/+0
Ed changed the code from req.emplace(parser->release()) to req.reset() in line 728 of the http/http_connection.hpp file in this patch https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/47122. So req cannot be used in doReadHeaders(). These codes are not necessary, so I choose to delete them. Tested: 1. Keep these codes and set bmcweb-logging=enabled, then log in to bmcweb using webui. Bmcweb will core-dump. 2. Delete these codes, bmcweb works normally. Signed-off-by: zhanghaicheng <zhanghch05@inspur.com> Change-Id: I1875a3fe4fa1d03656631435508b3876d8a42e54
2021-12-07fixed errors in EventServiceKrzysztof Grobelny1-4/+2
- Initialized boost::circular_buffer_space_optimized<std::string> which was not initialized. It prevented any event from being send. - Removed line 'parser->skip(true)' which cause all received responses to be interpreted as errors. It was triggering retry which resulted in sensing same event multiple times. Tested: POST redfish/v1/EventService/Subscriptions, body: { "Destination": "https://127.0.0.1:4042/", "Protocol": "Redfish", "EventFormatType": "MetricReport" } { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The resource has been created successfully", "MessageArgs": [], "MessageId": "Base.1.8.1.Created", "MessageSeverity": "OK", "Resolution": "None" } ] } POST redfish/v1/TelemetryService/MetricReportDefinitions, body: { "Id": "TestReport", "Metrics": [ { "MetricId": "TestMetric", "MetricProperties": [ "/redfish/v1/Chassis/chassis/Thermal#/Temperatures/7/ReadingCelsius" ] } ], "MetricReportDefinitionType": "OnRequest", "ReportActions": [ "RedfishEvent", "LogToMetricReportsCollection" ] } { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The resource has been created successfully", "MessageArgs": [], "MessageId": "Base.1.8.1.Created", "MessageSeverity": "OK", "Resolution": "None" } ] } GET redfish/v1/TelemetryService/MetricReports/TestReport { "@odata.id": "/redfish/v1/TelemetryService/MetricReports/TestReport", "@odata.type": "#MetricReport.v1_3_0.MetricReport", "Id": "TestReport", "MetricReportDefinition": { "@odata.id": "/redfish/v1/TelemetryService/MetricReportDefinitions/TestReport" }, "MetricValues": [ { "MetricId": "TestMetric", "MetricProperty": "/redfish/v1/Chassis/chassis/Thermal#/Temperatures/7/ReadingCelsius", "MetricValue": "-8388608000.000000", "Timestamp": "1970-04-12T02:28:53+00:00" } ], "Name": "TestReport", "Timestamp": "1970-04-12T06:08:17+00:00" } EVENT RECEIVED { "@odata.id": "/redfish/v1/TelemetryService/MetricReports/TestReport", "@odata.type": "#MetricReport.v1_3_0.MetricReport", "Id": "TestReport", "MetricReportDefinition": { "@odata.id": "/redfish/v1/TelemetryService/MetricReportDefinitions/TestReport" }, "MetricValues": [ { "MetricId": "TestMetric", "MetricProperty": "/redfish/v1/Chassis/chassis/Thermal#/Temperatures/7/ReadingCelsius", "MetricValue": "-8388608000.000000", "Timestamp": "1970-04-12T02:28:53+00:00" } ], "Name": "TestReport", "Timestamp": "1970-04-12T06:08:17+00:00" } Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: I4912853c3b59593e7032424d0b48aca7a36889b3
2021-12-07Delete the copy constructor on the Request objectEd Tanous1-0/+3
This code was in the codebase previously, and at some point got removed to make copies. Considering the previous commits to this one, making copies of the request object is a bad idea, and should be avoided. Therefore, this commit deletes the copy constructor for the Request object, making request copies fail to compile. It should be noted, it does leave the move constructor, which I don't think it's really used, but as a rule isn't an anti-pattern. Tested: Code compiles. No functional change. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ib38ed79a7c60340fb00f922f29265a3c3c7beca8
2021-11-18meson_options: implement disable-auth; delete pamNan Zhou1-3/+5
Implemented the disable-auth option. This patch also removed the pam option which never worked. Tested: With disable-auth, ``` ~# wget -qO- http://localhost/redfish/v1/Systems/ { "@odata.id": "/redfish/v1/Systems", "@odata.type": "#ComputerSystemCollection.ComputerSystemCollection", "Members": [ { "@odata.id": "/redfish/v1/Systems/system" } ], "Members@odata.count": 1, "Name": "Computer System Collection" } ``` Without disable-auth, ``` ~# wget -qO- http://localhost/redfish/ { "v1": "/redfish/v1/" } ~# wget -qO- http://localhost/redfish/v1/Systems/system wget: server returned error: HTTP/1.1 401 Unauthorized ``` Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I88e4e6fa6ed71096bc866b42b9af283645a65988
2021-11-18EventService: Pass httpHeaders to subscriberSunitha Harish1-2/+4
Custom http headers provided by the subscriber was not passed on to the http client request header This commit passes the http headers to the Subscriber constructor Tested by: Subscribe to events with custom headers Verify the event request packet sending the custom header to the subscriber Verified persistency of the subscription Signed-off-by: Sunitha Harish <sunharis@in.ibm.com> Change-Id: I9a4f59b6e9477fae96b380565885f4ac51e2a628
2021-11-16reduce error traces in connection and auth codeAndrew Geissler1-3/+11
These logs are reported in good paths (at least web interfaces are working fine when they are logged). Convert them to warnings so they do not show up as false errors when debugging bmcweb. Here's the log we were getting: Oct 08 19:20:48 p10bmc bmcweb[15348]: (2021-10-08 19:20:48) [ERROR "http_connection.hpp":537] 0x14bd360 Error while reading: end of stream Oct 08 19:20:48 p10bmc bmcweb[15348]: (2021-10-08 19:20:48) [ERROR "http_connection.hpp":531] 0x14910b0 async_read_header 308 Bytes Oct 08 19:20:48 p10bmc bmcweb[15348]: (2021-10-08 19:20:48) [ERROR "authorization.hpp":292] authHeader= These code paths, and why they are not real errors, is not totally clear to me. Hoping for some discussion on it in this review. Tested: - Verified these no longer show up when doing basic system management with just error traces enabled in bmcweb Change-Id: If357aeb93ff28ef02e135a888524e057cb188871 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
2021-11-16Revert "Change the completionhandler to accept Res"Gunnar Mills3-51/+33
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-16Revert "Remove AsyncResp from openHandler"Gunnar Mills2-4/+11
This reverts commit 0f3d3a01aed4040ef73a977a958ecdf4f68111f6. Seeing bumps fail. Change-Id: Ida7b1bae48abbed2e00a5259e8f94b64168d4788 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2021-11-16Remove AsyncResp from openHandlerzhanghch052-11/+4
This change, moving the openHandler back to only supporting websocket disconnects and not 404s.Because AsyncResp is removed from openHandler. Tested: Opened KVM in webui-vue and it works. Signed-off-by: zhanghaicheng <zhanghch05@inspur.com> Change-Id: I90811f4ab91ad41cb298877f76252dce80932b2b
2021-11-16Change the completionhandler to accept Reszhanghch053-33/+51
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-10-27Make code build in clangEd Tanous1-2/+0
The newest version of clang correctly recognizes that all values of this enumeration are already covered by distinct cases, and that this is unneeded. Considering the default case does nothing, it can just be removed entirely. Tested: Code compiles in clang. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I15333be16affda91d1a733e5d97aaa028a424efd
2021-10-19Cleanup HttpClient to use inline initializationEd Tanous1-10/+8
For variables that aren't sent through the constructor, it's less code and cleaner to initialize them inline as part of the struct. Tested: Per Appu: "Did basic check and its initialized to default as before." Per Sunitha: "Tested the basic event notification scenario with this commit. Works fine" Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I60e096686eb328edba51b26f27c3c879dae25a84
2021-10-19Only generate headers once in EventServiceEd Tanous1-18/+8
This patchset builds on https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/45761 and moves the header generation into the constructor, rather than attempting to repurpose addHeaders(). Tested: Per Appu: "Did basic check and its initialized to default as before." Per Sunitha: "Tested the basic event notification scenario with this commit. Works fine" https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/46703/2 Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ia9e8b89574c7e0137f0d93f08378e45c2fcf5376
2021-10-18Rename method to isOnAllowlistEd Tanous1-1/+1
While we're here testing things anyway, it seems like a good time to do a simple method rename following the projects new naming guidelines. This seems like an easy thing to do while we're here anyway and might short circuit a harder discussion later. Tested: Code compiles. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie5ed1c38d7dec13f875efae4acc22f4fd582f9b9