惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy & Cybersecurity Law Blog
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
B
Blog RSS Feed
罗磊的独立博客
V
V2EX
V
Visual Studio Blog
博客园 - 叶小钗
W
WeLiveSecurity
小众软件
小众软件
K
Kaspersky official blog
美团技术团队
雷峰网
雷峰网
阮一峰的网络日志
阮一峰的网络日志
Martin Fowler
Martin Fowler
Recorded Future
Recorded Future
Project Zero
Project Zero
Hugging Face - Blog
Hugging Face - Blog
Engineering at Meta
Engineering at Meta
Security Latest
Security Latest
Microsoft Azure Blog
Microsoft Azure Blog
V
Vulnerabilities – Threatpost
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
Help Net Security
Help Net Security
博客园 - Franky
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Fortinet All Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Forbes - Security
Forbes - Security
M
MIT News - Artificial intelligence
H
Hacker News: Front Page
大猫的无限游戏
大猫的无限游戏
Vercel News
Vercel News
Spread Privacy
Spread Privacy
The Register - Security
The Register - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
Google Online Security Blog
Google Online Security Blog
PCI Perspectives
PCI Perspectives
The Last Watchdog
The Last Watchdog
AI
AI
N
News | PayPal Newsroom
D
DataBreaches.Net
Cloudbric
Cloudbric
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog

博客园 - 威少小二orz

团结引擎抖音小游戏一定要手动填缓存资源域名 团结引擎+Addressable+Instant Game打包抖音小游戏 团结引擎发布抖音小游戏(十万个坑已踩完) 团结引擎发布小游戏区分不同平台 团结引擎发布小游戏与js版本SDK的互相调用 Unity发布京东小游戏 LayerMask的使用规范 Unity RectTransform中使用stretch模式时代码动态控制Left、Top、Right、Bottom 【MAUI开发】一、初识MAUI Android中使用GSON解析JSON数据 游戏软著渠道的用户协议和隐私协议方案(启动显示方案) C#文件夹复制 C#在Json序列化中动态忽略某些属性或字段 安卓多个Activity大退时自动重启的问题处理 C#中接收到的Json数据中key为数字的问题处理 对于UniWebView这种组件违规获取信息的处理 TapTap实名认证-Android Unity使用Get和Post传递json数据并转换成class对象 Unity获取手机本地应用以及调起apk安装、启动app、安装完成回调 Unity接入穿山甲GroMore广告——重构偏2(Banner广告)
Unity使用https请求握手失败的处理方案
威少小二orz · 2023-10-09 · via 博客园 - 威少小二orz

Unity使用https请求握手失败的处理方案

Handshake failed UNITYTLS_INTERNALS解决方案

        var handler = new HttpClientHandler();//需要加这句
        handler.ClientCertificateOptions = ClientCertificateOption.Manual;//需要加这句
        
        using (HttpClient httpClient = new HttpClient(handler))//httpClient里带handler参数
        {
            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);//这里调用的是下面那个方法
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;//这句也要加
            var content = new MultipartFormDataContent();
            //var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
            content.Headers.Add("ContentType", "multipart/form-data");//声明头部
            content.Add(new StringContent("1"), "a");

            httpClient.DefaultRequestHeaders.Add("Method", "Post");
            

            HttpResponseMessage response = await httpClient.PostAsync("https://127.0.0.1:5555/api/WeatherForecast/GameTest", content);//Debug.Log("状态码0:" + response.StatusCode);
            response.EnsureSuccessStatusCode();
            //Debug.Log("状态码1:" + response.StatusCode);
            string responseBody = await response.Content.ReadAsStringAsync();
            Debug.Log("这里是.net core web api测试:" + responseBody);

        }
    private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
    {
        return true; //总是接受     
    }