Support h2c upgrade
h2c upgrade is a mechanism for supporting http/2 on connections that
might not support alpn [1]. This is done by the client specifying
Connection: upgrade
Upgrade: h2c
This looks very similar to a websocket upgrade, which h2c replacing
websocket. Because of this, the existing upgrade code needs some
upgrades to avoid parsing twice.
Tested:
```
curl -u root:0penBmc --http2 -k http://192.168.7.2:443/redfish/v1/SessionService/Sessions
```
Succeeds and verbose logging shows that http upgrade succeeded
websocket_test.py in the scripts directory connects and reports events
[1] https://datatracker.ietf.org/doc/html/rfc7540#section-11.8
Change-Id: I8f76e355f99f21337d310ef2f345e6aaa253b48b
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/http/http2_connection.hpp b/http/http2_connection.hpp
index f0826d2..e982fb2 100644
--- a/http/http2_connection.hpp
+++ b/http/http2_connection.hpp
@@ -81,6 +81,26 @@
doRead();
}
+ void startFromSettings(std::string_view http2UpgradeSettings)
+ {
+ int ret = ngSession.sessionUpgrade2(http2UpgradeSettings,
+ false /*head_request*/);
+ if (ret != 0)
+ {
+ BMCWEB_LOG_ERROR("Failed to load upgrade header");
+ return;
+ }
+ // Create the control stream
+ streams[0];
+
+ if (sendServerConnectionHeader() != 0)
+ {
+ BMCWEB_LOG_ERROR("send_server_connection_header failed");
+ return;
+ }
+ doRead();
+ }
+
int sendServerConnectionHeader()
{
BMCWEB_LOG_DEBUG("send_server_connection_header()");