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

推荐订阅源

B
Blog
I
InfoQ
Y
Y Combinator Blog
The Last Watchdog
The Last Watchdog
博客园_首页
The Cloudflare Blog
博客园 - 【当耐特】
Engineering at Meta
Engineering at Meta
罗磊的独立博客
月光博客
月光博客
V
V2EX
大猫的无限游戏
大猫的无限游戏
腾讯CDC
GbyAI
GbyAI
云风的 BLOG
云风的 BLOG
Stack Overflow Blog
Stack Overflow Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Attack and Defense Labs
Attack and Defense Labs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
B
Blog RSS Feed
Webroot Blog
Webroot Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
Netflix TechBlog - Medium
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Vercel News
Vercel News
C
CERT Recently Published Vulnerability Notes
人人都是产品经理
人人都是产品经理
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Recent Announcements
Recent Announcements
Cyberwarzone
Cyberwarzone
G
Google Developers Blog
H
Heimdal Security Blog
MyScale Blog
MyScale Blog
The Register - Security
The Register - Security
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
T
Tenable Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
O
OpenAI News
C
Check Point Blog
Forbes - Security
Forbes - Security
SecWiki News
SecWiki News
K
Kaspersky official blog
The GitHub Blog
The GitHub Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
F
Full Disclosure
阮一峰的网络日志
阮一峰的网络日志

博客园 - 威少小二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; //总是接受     
    }