Use AlpnForVersion() instead of ParseQuicVersionString() in TlsClientHandshaker::SetAlpn(). This avoids a potential
(but I don't think actually reachable) confusion between,
say, a QuicVersionLabel and an alpn string.

PiperOrigin-RevId: 427268120
diff --git a/quic/core/tls_client_handshaker.cc b/quic/core/tls_client_handshaker.cc
index f70bc1c..886edb7 100644
--- a/quic/core/tls_client_handshaker.cc
+++ b/quic/core/tls_client_handshaker.cc
@@ -209,15 +209,17 @@
 
   // Enable ALPS only for versions that use HTTP/3 frames.
   for (const std::string& alpn_string : alpns) {
-    ParsedQuicVersion version = ParseQuicVersionString(alpn_string);
-    if (!version.IsKnown() || !version.UsesHttp3()) {
-      continue;
-    }
-    if (SSL_add_application_settings(
-            ssl(), reinterpret_cast<const uint8_t*>(alpn_string.data()),
-            alpn_string.size(), nullptr, /* settings_len = */ 0) != 1) {
-      QUIC_BUG(quic_bug_10576_7) << "Failed to enable ALPS.";
-      return false;
+    for (const ParsedQuicVersion& version : session()->supported_versions()) {
+      if (!version.UsesHttp3() || AlpnForVersion(version) != alpn_string) {
+        continue;
+      }
+      if (SSL_add_application_settings(
+              ssl(), reinterpret_cast<const uint8_t*>(alpn_string.data()),
+              alpn_string.size(), nullptr, /* settings_len = */ 0) != 1) {
+        QUIC_BUG(quic_bug_10576_7) << "Failed to enable ALPS.";
+        return false;
+      }
+      break;
     }
   }