summaryrefslogtreecommitdiff
path: root/http/http_client.hpp
AgeCommit message (Collapse)AuthorFilesLines
2021-09-16EventService : Optimize event data buffersSunitha Harish1-5/+9
This commit enhances some of the parameters used at the http client 1. Added the buffer limit to requestDataQueue This is to control the message length of an event 2. Moved the flat_buffer to a flat_static_buffer This is to limit the maximum size to the requestDataQueue 3. Changed requestDataQueue from a queue to circular buffer This is to make the requestDataQueue space optimized Tested by: - Subscribe for the events at BMC using DMTF event listener - Generate an event and see the same is received at listener's console Signed-off-by: Sunitha Harish <sunharis@in.ibm.com> Change-Id: I563b7f8d24e5cd5e12db324b2e02974328ebd955
2021-03-08EventService : Support async_resolve for subscribersSunitha Harish1-24/+55
The http client at bmcweb does not resolve the client's hostname asynchronously This commit implements the async_resolve by using systemd resolved. The async dbus message to resolvd.service is sent when a subscriber successfully subscribes for events. The method ResolveHostname is used to resolve the subscriber's hostname Tested by: Subscribe for the events at BMC using DMTF event listener Generate an event and see the same is received at the listener's console Signed-off-by: Sunitha Harish <sunithaharish04@gmail.com> Change-Id: I3ab8206ac4764cfa025e94c06407524d6ba220e0
2021-02-24Fix the build on clang-11Ed Tanous1-0/+1
Clang tidy 11 got some really neat checks that do a much better job. Unfortunately, this, combined with the change in how std::executors has defined how callbacks should work differently in the past, which we picked up in 1.73, and now in theory we have recursion in a bunch of our IO loops that we have to break manually. In practice, this is unlikely to matter, as there's almost a 0% chance that we go through N thousand requests without ever starving the IO buffer. Other changes to make this build include: 1. Adding inline on the appropriate places where declared in a header. 2. Removing an Openssl call that did nothing, as the result was immediately overwritten. 3. Declaring the subproject dependencies as system dependencies, which silences the clang-tidy checks for those projects. Tested: Code builds again, clang-tidy passes Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ic11b1002408e8ac19a17a955e9477cac6e0d7504
2020-10-23Turn on ALL perf checksEd Tanous1-1/+1
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-09Write the clang-tidy file OpenBMC needsEd Tanous1-11/+5
Now that CI can handle clang-tidy, and a lot of the individual fixes have landed for the various static analysis checks, lets see how close we are. This includes bringing a bunch of the code up to par with the checks that require. Most of them fall into the category of extraneous else statements, const correctness problems, or extra copies. Tested: CI only. Unit tests pass. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I9fbd346560a75fdd3901fa40c57932486275e912
2020-10-06Fix includesEd Tanous1-3/+4
Lots of bad includes got put in recently, including big things, like boost/http and beast/core. These are lots of code to parse, and leads to files including things they didn't mean to. Tested: Code compiles Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I38de889fdfd9b23f66a2259bb30bf6584345e77f
2020-08-17Enable unused variable warnings and resolveEd Tanous1-5/+5
This commit enables the "unused variables" warning in clang. Throughout this, it did point out several issues that would've been functional bugs, so I think it was worthwhile. It also cleaned up several unused variable from old constructs that no longer exist. Tested: Built with clang. Code no longer emits warnings. Downloaded bmcweb to system and pulled up the webui, observed webui loads and logs in properly. Change-Id: I51505f4222cc147d6f2b87b14d7e2ac4a74cafa8 Signed-off-by: Ed Tanous <ed@tanous.net>
2020-08-17Enable clang warningsEd Tanous1-2/+0
This commit enables clang warnings, and fixes all warnings that were found. Most of these fall into a couple categories: Variable shadow issues were fixed by renaming variables unused parameter warnings were resolved by either checking error codes that had been ignored, or removing the name of the variable from the scope. Other various warnings were fixed in the best way I was able to come up with. Note, the redfish Node class is especially insidious, as it causes all imlementers to have variables for parameters, regardless of whether or not they are used. Deprecating the Node class is on my list of things to do, as it adds extra overhead, and in general isn't a useful abstraction. For now, I have simply fixed all the handlers. Tested: Added the current meta-clang meta layer into bblayers.conf, and added TOOLCHAIN_pn-bmcweb = "clang" to my local.conf Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Ia75b94010359170159c703e535d1c1af182fe700
2020-07-10Codespell spelling fixesGunnar Mills1-1/+1
These spelling errors were found using https://github.com/codespell-project/codespell Tested: Built and ran against validator. Signed-off-by: Gunnar Mills <gmills@us.ibm.com> Change-Id: I214fe102550295578cfdf0fc58305897d261ce55
2020-07-02EventService: Add retry configuration supportAyushi Smriti1-15/+67
This commit is to pass configuration parameters: retry attempts, retry interval secs and retry policy to http client and take required delivery retry policy action. Also, perform async wait for retryTimeoutInterval before each retry attempts. Tested: - Set and verified config properties by sending PATCH req on EventService and EventDestination uri. - Verified the appropriate delivery retry policy action block reached. - Verified the async_wait logic by triggering retry case depending failed state of connection. - could see a wait for timeout interval before next retry. Signed-off-by: Ayushi Smriti <smriti.ayushi@linux.intel.com> Change-Id: Id1366fca59dc9e6543c553bfe5df95a59f468bc7 Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-06-11clang-format: update to latest from docs repoGunnar Mills1-0/+1
This is from openbmc/docs/style/cpp/.clang-format Other OpenBMC repos are doing the same. Tested: Built and validator passed. Change-Id: Ief26c755c9ce012823e16a506342b0547a53517a Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-06-04fix for bmcweb CI build failureAppaRao Puli1-2/+4
CI builds are failing due to formatting issue. Below commit reverted the format to clang-6 from clang-10 and causing the failure. https://gerrit.openbmc-project.xyz/#/c/openbmc/bmcweb/+/32702/ Tested: Build success. Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> Change-Id: Ic75f7baeed9ff1013df37575dc180fb1c7d196fc
2020-06-03Fix duplicate NTP servers patchTony Lee1-4/+2
Duplicate NTP servers value should not be patch. Tested: 1. Patch duplicate NTP servers curl -k -H "X-Auth-Token: $bmc_token" -XPATCH https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol -d '{"NTP":{"NTPServers":["9.9.9.9","9.9.9.9","1.1.1.1","9.9.9.9"]}}' 2. GET NTP servers information curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol { "@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol", "@odata.type": "#ManagerNetworkProtocol.v1_5_0.ManagerNetworkProtocol", "Description": "Manager Network Service", "FQDN": "", "HTTP": { "Port": 0, "ProtocolEnabled": false }, "HTTPS": { "Certificates": { "@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates" }, "Port": 443, "ProtocolEnabled": true }, "HostName": "", "IPMI": { "Port": 623, "ProtocolEnabled": true }, "Id": "NetworkProtocol", "NTP": { "NTPServers": [ "1.1.1.1", "9.9.9.9" ], "ProtocolEnabled": false }, Signed-off-by: Tony Lee <tony.lee@quantatw.com> Change-Id: Idb63cf5e28d36a5df1aae9b0a7d53a1b7a9c8d91
2020-05-02EventService: Queuing the request data and retryAppaRao Puli1-55/+175
Add support to queue the request event data. Maintaining the proper state of connection and retry for appropriate action depending on state. If max retries are reached then suspend the retries. Need to add async timeout between retries and take action as configured 'DeliveryRetryPolicy' by user. Tested: - Using Telemetry reports, streamed data to validate the queue by stopping listener. - Verified the retry logic. - Verfiied the appropriate action depending failed state of connection. Change-Id: Idd562cd512897625bf7b0d9a376207db5cb8642f Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-04-21Http client supportAppaRao Puli1-0/+190
Add Http client support to asynchronously open the TCP connection with client and send data(POST only). This doesn't have support to keep open connection alive and also re-attempt send message during fail cases. Tested: - Able to push data to HTTP server successfully. Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> Change-Id: I2c1abf8ac4b002278377761d2dbc8b563808efcb