示例#1
0
        static async Task <int> HttpInvoke(Uri uri, TokenCacheInfo cacheInfo, string verb, bool verbose, HttpContent content, Dictionary <string, List <string> > headers, bool http2)
        {
            var winhttp = http2 ? new WinHttpHandler() : null;

            if (Utils.GetSkipSslVerify() && winhttp != null)
            {
                winhttp.ServerCertificateValidationCallback = delegate { return(true); };
            }

            var handler = new HttpLoggingHandler((HttpMessageHandler)winhttp ?? new HttpClientHandler(), verbose);

            return(await Utils.HttpInvoke(uri, cacheInfo, verb, handler, content, headers));
        }
示例#2
0
        static async Task<int> HttpInvoke(Uri uri, TokenCacheInfo cacheInfo, string verb, bool verbose, HttpContent content, Dictionary<string, List<string>> headers)
        {
            var primaryHandler = new WebRequestHandler();
            if (Utils.IsCustom(uri))
            {
                var certSubjectName = Environment.GetEnvironmentVariable("ARMCLIENT_CERT");
                if (string.IsNullOrWhiteSpace(certSubjectName))
                {
                    throw new Exception("ARMCLIENT_CERT environment variable is required when invoking a custom url.");
                }
                
                primaryHandler.ClientCertificates.Add(FindCertificate(certSubjectName));
            }

            var logginerHandler = new HttpLoggingHandler(primaryHandler, verbose);
            return await Utils.HttpInvoke(uri, cacheInfo, verb, logginerHandler, content, headers);
        }
示例#3
0
        static async Task <int> HttpInvoke(Uri uri, TokenCacheInfo cacheInfo, string verb, bool verbose, HttpContent content, Dictionary <string, List <string> > headers)
        {
            var logginerHandler = new HttpLoggingHandler(new HttpClientHandler(), verbose);

            return(await Utils.HttpInvoke(uri, cacheInfo, verb, logginerHandler, content, headers));
        }
示例#4
0
 static async Task<int> HttpInvoke(Uri uri, TokenCacheInfo cacheInfo, string verb, bool verbose, HttpContent content)
 {
     var logginerHandler = new HttpLoggingHandler(new HttpClientHandler(), verbose);
     return await Utils.HttpInvoke(uri, cacheInfo, verb, logginerHandler, content);
 }