Filter::createConnPool(Upstream::ThreadLocalCluster& thread_local_cluster) {
  GenericConnPoolFactory* factory = nullptr;
  if (cluster_->upstreamConfig().has_value()) {
    factory = Envoy::Config::Utility::getFactory<GenericConnPoolFactory>(
        cluster_->upstreamConfig().value());
    ENVOY_BUG(factory != nullptr,
              fmt::format("invalid factory type '{}', failing over to default upstream",
                          cluster_->upstreamConfig().value().DebugString()));
  }
  if (!factory) {
    factory = &Envoy::Config::Utility::getAndCheckFactoryByName<GenericConnPoolFactory>(
        "envoy.filters.connection_pools.http.generic");
  }

  bool should_tcp_proxy = false;

  if (route_entry_->connectConfig().has_value()) {
    auto method = downstream_headers_->getMethodValue();
    should_tcp_proxy = (method == Http::Headers::get().MethodValues.Connect);

    // Allow POST for proxying raw TCP if it is configured.
    if (!should_tcp_proxy && route_entry_->connectConfig().value().allow_post()) {
      should_tcp_proxy = (method == Http::Headers::get().MethodValues.Post);
    }
  }
  return factory->createGenericConnPool(thread_local_cluster, should_tcp_proxy, *route_entry_,
                                        callbacks_->streamInfo().protocol(), this);
}
Filter::createConnPool(Upstream::ThreadLocalCluster& thread_local_cluster) {
  GenericConnPoolFactory* factory = nullptr;
  if (cluster_->upstreamConfig().has_value()) {
    factory = Envoy::Config::Utility::getFactory<GenericConnPoolFactory>(
        cluster_->upstreamConfig().value());
    ENVOY_BUG(factory != nullptr,
              fmt::format("invalid factory type '{}', failing over to default upstream",
                          cluster_->upstreamConfig().value().DebugString()));
  }
  if (!factory) {
    factory = &Envoy::Config::Utility::getAndCheckFactoryByName<GenericConnPoolFactory>(
        "envoy.filters.connection_pools.http.generic");
  }

  bool should_tcp_proxy = false;

  if (route_entry_->connectConfig().has_value()) {
    auto method = downstream_headers_->getMethodValue();
    should_tcp_proxy = (method == Http::Headers::get().MethodValues.Connect);

     
    if (!should_tcp_proxy && route_entry_->connectConfig().value().allow_post()) {
      should_tcp_proxy = (method == Http::Headers::get().MethodValues.Post);
    }
  }
  return factory->createGenericConnPool(thread_local_cluster, should_tcp_proxy, *route_entry_,
                                        callbacks_->streamInfo().protocol(), this);
}