91act / curl-unity Goto Github PK
View Code? Open in Web Editor NEWThis is a C# wrapper for Unity to use libcurl with http/2 and openssl enabled.
This is a C# wrapper for Unity to use libcurl with http/2 and openssl enabled.
使用多线程的CurlMultiUpdater下载过程中调用CurlMulti的Abort有几率会崩溃,堆栈如下:
0x00007FFF0B714699 (curl) curl_mvsprintf
0x00007FFF0B71B812 (curl) curl_multi_wait
0x00007FFF0B71A1D6 (curl) curl_multi_perform
0x00000000BF64A6B6 (curl) CurlUnity.Lib.curl_multi_perform()
0x00000000BF649DBB (curl) CurlUnity.CurlMulti.Perform()
0x0000000002768CC3 (curl) CurlUnity.CurlMultiUpdater.Perform()
怀疑是主线程逻辑调用的CurlMulti的RemoveEasy和分线程下载时调用的Perform有多线程问题,华谊是不是curl_multi_remove_handle和curl_multi_perform在两个线程跑没加锁会有问题?
我把CurlMulti的AddEasy、RemoveEasy、CleanUp和Perform加了代码段锁保护后好像没有重现了,大佬帮忙看下?谢谢啦
I'm experiencing a crash similar to what is described in curl/curl#3463, especially on iOS. Apparently the fix has already made it into 7.64.1.
I'm using Curl Unity to connect to the HTTP/2 Alexa Voice Service directives endpoint. I've added the CurlMultiUpdater to a game object and I'm using the CurlMulti to create a downchannel connection like below (see AVS link for implementation details).
Unfortunately, no matter what I do, the OnPerformCallback (which creates a log entry and prints the inText output) is never called despite knowing that directives should be being sent to the application. It leads me to believe something must be wrong with the stream or connection that's created, or am I just missing something in the connection creation?
--- Part of function that creates Curl Connection ---
// Create Curl Easy Object
CurlEasy easy = new CurlEasy
{
method = request.Method,
debug = true,
uri = new Uri(request.Url),
contentType = request.ContentType,
timeout = request.Timeout,
lowSpeedTimeout = request.LowSpeedLimit,
lowSpeedLimit = request.LowSpeedLimit,
maxRetryCount = 0,
outData = request.OutData,
performCallback = OnPerformCallback
};
// Add Access Token
easy.SetHeader("Authorization", "Bearer " + authenticator.GetAccessToken());
if (request.AdditionalHeaders != null)
{
foreach (KeyValuePair<string, string> entry in request.AdditionalHeaders)
{
easy.SetHeader(entry.Key, entry.Value);
}
}
// Perform CurlMulti Action
Debug.Log("Connecting to " + request.Url);
easy.MultiPerform(curlMulti.DefaultMulti);
----
---- Downchannel callback ----
Debug.Log("In downchannel callback.");
// We're in downchannel callback, meaning we've either received a directive or a disconnect
if (result == CURLE.OK)
{
// A directive?
Debug.Log(easy.inText);
}
else
{
// Server disconnect. Make new downchannel
}
easy.Abort();
Failed to request: https://nghttp2.org/, reason: COULDNT_
log.txt
RESOLVE_HOST
SetOpt(CURLOPT.MAX_RECV_SPEED_LARGE, inSpeedLimit);该接口在真机上有效,但在Android模拟器上无效
old:
easy.rangeEnd = contentLength;
should:
easy.rangeEnd = contentLength-1; // or 0
'/Users/username/Documents/projectdir/iOS/ProjectName/Libraries/curl-unity/Plugins/ios/libcurl.a(libcurl_la-easy.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64
Xcode build失败 提示以上报错 ,好像可以通过关闭BitCode解决,后面这个第三方库会支持BitCode吗
Hello.
On the Android device of armeabi-v7a, thiz 'is null in HeaderFunction and
sizeand
nmemb` become negative values. Is there a workaround?
[AOT.MonoPInvokeCallback(typeof(Delegates.HeaderFunction))]
private static long HeaderFunction(IntPtr ptr, long size, long nmemb, IntPtr userdata)
{
size = size * nmemb;
var thiz = ((GCHandle)userdata).Target as CurlEasy;
....
First, thank you for being so responsive.
Somewhat related to a previous issue I submitted, I'm now trying to send a continuous audio stream--recorded from the microphone--to the Alexa Voice Service in 10ms chunks.
However, there doesn't seem to be a way to send a stream of bytes (or floats) of indeterminate size. The Curl Interface seems to have a form_add, READData, and ReadFunction options that seem relevant, but they're not implemented. I may be looking in the wrong place, though.
Any idea how I might add a binary audio stream to a multipart message and keep adding to it until a separate function tells me to stop (I'm receiving directives on a separate channel and can end the audio stream if there's a method to close the stream)?
Reference:
https://developer.amazon.com/docs/alexa-voice-service/speechrecognizer.html#recognize
int的话编辑器是好的,安卓真机是不对的,打的armv7的版本
EntryPointNotFoundException: curl_multi_init
CurlUnity.CurlMulti..ctor (System.IntPtr ptr) (at Assets/curl-unity/Scripts/CurlMulti.cs:38)
CurlTest.Start () (at Assets/curl-unity/CurlTest.cs:10)
您好 ,我在导入assets后直接运行,发现这个错误 ,检查了那个dll是存在的,是不是还有其他安装工作需要做 ?
easy.SetOpt(CURLOPT.MAX_RECV_SPEED_LARGE, speed);
我是这么直接设置的,编辑器上速度会变,安卓真机上不管用
请问一下,我仿照例子,创建了3个CurlEasy,调用MultiPerform加入一个创建的CurlMulti,但是总是在第一个CurlEasy的GET执行完之后,后面的GET才会被发送,这个可能是什么原因?三个CurlEasy的HEAD都正确同时执行过了。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.