linux - Why does UnityWebRequest return unkown error when I do a GET request on Linux?
问题描述
This is my code:
public class DatabaseHandler : MonoBehaviour
{
string url = "https://fakeid.firebaseio.com/";
void Start()
{
StartCoroutine(GetLevelsCoroutine());
}
IEnumerator GetLevelsCoroutine()
{
using (UnityWebRequest www = UnityWebRequest.Get(url))
{
www.SetRequestHeader("X-Firebase-Decoding", "1");
yield return www.SendWebRequest();
if (www.isDone)
{
Debug.Log(www.error);
string result = www.downloadHandler.text;
Debug.Log(result);
}
}
}
}
The result variable is null and the www.error is "unknown error" I have been trying different things in order to fix this but, I just can't figure out what's causing this error, since it's just a generic error.
I have also read that this may be an unitywebrequest bug, if it is so, are there any alternatives?
解决方案
终于找到了解决问题的办法。(它只发生在某些 Linux 操作系统上)
Unity 仅正式支持 Ubuntu Linux,因此它正在寻找(但未能找到)它所期望的证书存储。您可以通过创建符号链接来解决 Fedora 问题:
mkdir -p /etc/ssl/certs && ln -s /etc/pki/tls/certs/ca-bundle.crt /etc/ssl/certs/ca-certificates.crt
这是我从中得到它的来源:https ://forum.unity.com/threads/ubuntu-headless-build-tls-handshake-fails.546704/
推荐阅读
- cryptography - ESP32/ESP8266 上的公钥/非对称加密
- flutter - 如何以编程方式清除 Flutter DropdownButton?
- geometry - 检查多边形是否被其他多边形完全填充
- django - 在 react django 项目中加载图像时遇到困难
- python-2.7 - 将字符串转换为 unicode pyton2.7
- wpf - WPF TextBox 在多个字符后换行
- flutter - 状态更改不提示 ondidchange
- javascript - 如何隐藏 CSS 网格区域名称显示
- c++ - 试图理解模板和名称查找
- google-sheets - 如何根据列中的重复值为每个值设置不同颜色的单元格颜色