std::shared_ptr HttpProxyStrategy::CreateAdaptiveHttpProxyStrategy()

in source/http/HttpProxyStrategy.cpp [151:193]


            std::shared_ptr<HttpProxyStrategy> HttpProxyStrategy::CreateAdaptiveHttpProxyStrategy(
                const HttpProxyStrategyAdaptiveConfig &config,
                Allocator *allocator)
            {
                std::shared_ptr<AdaptiveHttpProxyStrategy> adaptiveStrategy =
                    Aws::Crt::MakeShared<AdaptiveHttpProxyStrategy>(
                        allocator, allocator, config.KerberosGetToken, config.NtlmGetCredential, config.NtlmGetToken);

                struct aws_http_proxy_strategy_tunneling_kerberos_options kerberosConfig;
                AWS_ZERO_STRUCT(kerberosConfig);
                kerberosConfig.get_token = AdaptiveHttpProxyStrategy::KerberosGetToken;
                kerberosConfig.get_token_user_data = adaptiveStrategy.get();

                struct aws_http_proxy_strategy_tunneling_ntlm_options ntlmConfig;
                AWS_ZERO_STRUCT(ntlmConfig);
                ntlmConfig.get_challenge_token = AdaptiveHttpProxyStrategy::NtlmGetToken;
                ntlmConfig.get_token = AdaptiveHttpProxyStrategy::NtlmGetCredential;
                ntlmConfig.get_challenge_token_user_data = adaptiveStrategy.get();

                struct aws_http_proxy_strategy_tunneling_adaptive_options adaptiveConfig;
                AWS_ZERO_STRUCT(adaptiveConfig);

                if (config.KerberosGetToken)
                {
                    adaptiveConfig.kerberos_options = &kerberosConfig;
                }

                if (config.NtlmGetToken)
                {
                    adaptiveConfig.ntlm_options = &ntlmConfig;
                }

                struct aws_http_proxy_strategy *strategy =
                    aws_http_proxy_strategy_new_tunneling_adaptive(allocator, &adaptiveConfig);
                if (strategy == NULL)
                {
                    return NULL;
                }

                adaptiveStrategy->SetStrategy(strategy);

                return adaptiveStrategy;
            }