dymokomi/luce-browser-engine
Source of release 0.6.1
0.6.1 / src / web / external / lib_requests / alpn_http_version.lucb
#==============================================================================================
#
# alpn_http_version - Requests::ALPNHttpVersion as the ALPN protocol id a connection timing
# info records
#
# DESCRIPTION:
# Port of Libraries/LibRequests/ALPNHttpVersion.h (lines 23-41): the inline function
# alpn_http_version_to_fly_string, which FetchTimingInfo::update_final_timings calls (the
# enum is in types_request_timing_info).
#
# Copyright (c) 2025, Luke Wilde <luke@ladybird.org>
# SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================
## Ported from Libraries/LibRequests/ALPNHttpVersion.h:23 Requests::alpn_http_version_to_fly_string.
pub func requests_alpn_http_version_to_fly_string(version: RequestsAlpnHttpVersion) -> ak.FlyString:
match version:
.none_: return ak.fly_string_from_str("")
.http1_0: return ak.fly_string_from_str("http/1.0")
.http1_1: return ak.fly_string_from_str("http/1.1")
.http2_tls: return ak.fly_string_from_str("h2")
.http2_tcp: return ak.fly_string_from_str("h2c")
.http3: return ak.fly_string_from_str("h3")
_: trap("VERIFY_NOT_REACHED")