Use h2o_httpclient_ctx_t::protocol_selector.ratio to signal h2 prior knowledge
@@ -123,9 +123,13 @@ static void on_pool_connect(h2o_socket_t *sock, const char *errstr, void *data,
h2o_iovec_t alpn_proto;
if (sock->ssl == NULL || (alpn_proto = h2o_socket_ssl_get_selected_protocol(sock)).len == 0) {
+ /* 100% means prior knowledge connect, force h2 */
+ if (client->ctx->protocol_selector.ratio.http2 == 100)
+ goto ForceH2;
h2o_httpclient__h1_on_connect(client, sock, origin);
} else {
if (h2o_memis(alpn_proto.base, alpn_proto.len, H2O_STRLIT("h2"))) {
+ ForceH2:
/* detach this socket from the socketpool to count the number of h1 connections correctly */
h2o_socketpool_detach(client->connpool->socketpool, sock);
h2o_httpclient__h2_on_connect(client, sock, origin);
