ladybird/Libraries/LibRequests/ALPNHttpVersion.h
Luke Wilde 209b10e53e RequestServer: Retrieve timing info from curl and pipe it to LibWeb
This timing info will be used to create a PerformanceResourceTiming
entry.
2025-03-06 09:00:53 -07:00

43 lines
954 B
C++

/*
* Copyright (c) 2025, Luke Wilde <luke@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/FlyString.h>
namespace Requests {
// https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids
enum class ALPNHttpVersion {
None,
Http1_0,
Http1_1,
Http2_TLS,
Http2_TCP,
Http3,
};
inline FlyString alpn_http_version_to_fly_string(ALPNHttpVersion version)
{
switch (version) {
case ALPNHttpVersion::None:
return ""_fly_string;
case ALPNHttpVersion::Http1_0:
return "http/1.0"_fly_string;
case ALPNHttpVersion::Http1_1:
return "http/1.1"_fly_string;
case ALPNHttpVersion::Http2_TLS:
return "h2"_fly_string;
case ALPNHttpVersion::Http2_TCP:
return "h2c"_fly_string;
case ALPNHttpVersion::Http3:
return "h3"_fly_string;
default:
VERIFY_NOT_REACHED();
}
}
}