History log of /openbmc/bmcweb/http/verb.hpp (Results 1 – 7 of 7)
Revision Date Author Comments
# a3b9eb98 03-Jun-2024 Ed Tanous <ed@tanous.net>

Make SSE pass

Redfish protocol validator is failing SSE. This is due to a clause in
the Redfish specification that requires a "json" error to be returned
when the SSE URI is hit with a standard req

Make SSE pass

Redfish protocol validator is failing SSE. This is due to a clause in
the Redfish specification that requires a "json" error to be returned
when the SSE URI is hit with a standard request.

In what exists today, we return 4XX (method not allowed) but because
this is handled by the HTTP layer, it's not possible to return the
correct Redfish payloads for when that 4XX happens within the Redfish
tree, because there is in fact a route that matches, that route just
doesn't support the type that we need.

This commit rearranges the router such that there are now 4 classes of
rules.

1. "verb" rules. These are GET/POST/PATCH type, and they are stored
using the existing PerMethod array index.
2. "upgrade" rules. These are for websocket or SSE routes that we
expect to upgrade to another route
3. 404 routes. These are called in the case where no route exists with
that given URI pattern, and no routes exist in the table for any
verb.
4. 405 method not allowed. These are called in the case where routes
exist in the tree for some method, but not for the method the user
requested.

To accomplish this, some minor refactors are implemented to separate out
the 4xx handlers to be their own variables, rather than just existing at
an index at the end of the verb table. This in turn means that
getRouteByIndex now changes to allow getting the route by PerMethod
instance, rather than index.

Tested:
unit tests pass (okish coverage)
Redfish protocol validator passes (with the exception of #277, which
fails identically before and after). SSE tests now pass.
Redfish service validator passes.

Change-Id: I555c50f392cb12ecbc39fbadbae6a3d50f4d1b23
Signed-off-by: Ed Tanous <etanous@nvidia.com>

show more ...


# 17c47245 08-Apr-2024 Ed Tanous <ed@tanous.net>

Move logging args

Args captured by logging functions should be captured by rvalue, and use
std::forward to get perfect forwarding. In addition, separate out the
various std::out lines.

While we're

Move logging args

Args captured by logging functions should be captured by rvalue, and use
std::forward to get perfect forwarding. In addition, separate out the
various std::out lines.

While we're here, also try to optimize a little. We should ideally be
writing each log line to the output once, and ideally not use iostreams,
which induce a lot of overhead.

Similar to spdlog[1] (which at one point this codebase used), construct
the string, then call fwrite and fflush once, rather than calling
std::cout repeatedly.

Now that we don't have a dependency on iostreams anymore, we can remove
it from the places where it has snuck in.

Tested:
Logging still functions as before. Logs present.

[1] https://github.com/gabime/spdlog/blob/27cb4c76708608465c413f6d0e6b8d99a4d84302/include/spdlog/sinks/stdout_sinks-inl.h#L70C7-L70C13

Change-Id: I1dd4739e06eb506d68989a066d122109b71b92cd
Signed-off-by: Ed Tanous <ed@tanous.net>

show more ...


# 4da0490b 19-Mar-2024 Ed Tanous <ed@tanous.net>

Use no-switch-default on clang

clang-18 improves this check so that we can actually use it. Enable it
and fix all violations.

Change-Id: Ibe4ce19c423d447a4cbe593d1abba948362426af
Signed-off-by: Ed

Use no-switch-default on clang

clang-18 improves this check so that we can actually use it. Enable it
and fix all violations.

Change-Id: Ibe4ce19c423d447a4cbe593d1abba948362426af
Signed-off-by: Ed Tanous <ed@tanous.net>

show more ...


# 65a176cd 12-May-2023 Patrick Williams <patrick@stwcx.xyz>

fix clang-tidy warnings with unreachable returns

```
/data0/jenkins/workspace/ci-repository/openbmc/bmcweb/http/verb.hpp:51:12: error: 'return' will never be executed [clang-diagnostic-unreachable-c

fix clang-tidy warnings with unreachable returns

```
/data0/jenkins/workspace/ci-repository/openbmc/bmcweb/http/verb.hpp:51:12: error: 'return' will never be executed [clang-diagnostic-unreachable-code-return,-warnings-as-errors]
/data0/jenkins/workspace/ci-repository/openbmc/bmcweb/http/utility.hpp:99:12: error: 'return' will never be executed [clang-diagnostic-unreachable-code-return,-warnings-as-errors]
/data0/jenkins/workspace/ci-repository/openbmc/bmcweb/redfish-core/include/utils/query_param.hpp:272:13: error: 'break' will never be executed [clang-diagnostic-unreachable-code-break,-warnings-as-errors]
```

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ia74f4fb4f34875097d1ef04b26e40908cc175088

show more ...


# 6a04e0d2 16-Feb-2023 Ed Tanous <edtanous@google.com>

Fix missing include

This arguably isn't a missing include in boost::beast, but because beast
only includes iofwd (the forward declaration of iostreams) we need to
include the full header here, to su

Fix missing include

This arguably isn't a missing include in boost::beast, but because beast
only includes iofwd (the forward declaration of iostreams) we need to
include the full header here, to support converting the verb to and from
strings.

Tested: clang-tidy stops complaining.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I93a930e456617cead3ff3928d29c2bfea3163ba6

show more ...


# c0bdf223 11-Nov-2022 Edward Lee <edwarddl@google.com>

Code move to prevent circular dependency

While implementing https://gerrit.openbmc.org/c/openbmc/bmcweb/+/57932,
there has been an issue where there is a circular dependency between
routing.hpp and

Code move to prevent circular dependency

While implementing https://gerrit.openbmc.org/c/openbmc/bmcweb/+/57932,
there has been an issue where there is a circular dependency between
routing.hpp and privileges.hpp. This code move predates this change
to resolve it before implementing the heart of redfish authz.

Circular dependency will occur when we try to use the http verb
index variables in privilege.hpp. If this occurs routing.hpp
and privilege.hpp will co-depend on each other
and this code move prevents this from occuring.

Tested:
bitbake bmcweb
Code compiles (code move only)
Redfish Validator passed on next commit

Signed-off-by: Edward Lee <edwarddl@google.com>
Change-Id: I46551d9fe222e702d239ed3ea6d3d7e505d488c8

show more ...


# 2c9efc3c 01-Aug-2022 Ed Tanous <edtanous@google.com>

Make router take up less space for verbs

As is, the router designates routes for every possible boost verb, of
which there are 31. In bmcweb, we only make use of 6 of those verbs, so
that ends up b

Make router take up less space for verbs

As is, the router designates routes for every possible boost verb, of
which there are 31. In bmcweb, we only make use of 6 of those verbs, so
that ends up being quite a bit of wasted space and cache non-locality.

This commit invents a new enum class for declaring a subset of boost
verbs that we support, and a mapping between bmcweb verbs and boost
verbs.

Then it walks through and updates the router to support converting one
to another.

Tested:
Unit Tested
Redfish Service Validator performed on future commit

Signed-off-by: Ed Tanous <edtanous@google.com>
Signed-off-by: Edward Lee <edwarddl@google.com>
Change-Id: I3c89e896c632a5d4134dbd08a30b313c12a60de6

show more ...