stil / curlthin Goto Github PK
View Code? Open in Web Editor NEWLightweight cURL wrapper for C# with support for curl_multi polling interface through libuv
License: Other
Lightweight cURL wrapper for C# with support for curl_multi polling interface through libuv
License: Other
When using CurlThin, I encounter difficulties posting raw JSON data, and I do not receive any response. However, when utilizing the standard HttpClient, I can successfully post JSON data and receive responses without any issues.
Hi
I dont get a response other than "SSL_CACERT" when I try to make an https call. What am I doing wrong? TY!
CurlNative.Easy.SetOpt(easy, CURLoption.URL, "https://www.cloudflare.com");
//CurlNative.Easy.SetOpt(easy, CURLoption.HTTP_VERSION, 2);
var stream = new MemoryStream();
CurlNative.Easy.SetOpt(easy, CURLoption.WRITEFUNCTION, (data, size, nmemb, user) =>
{
var length = (int)size * (int)nmemb;
var buffer = new byte[length];
Marshal.Copy(data, buffer, 0, length);
stream.Write(buffer, 0, length);
return (UIntPtr)length;
});
var result = CurlNative.Easy.Perform(easy);
Using the same libcurl build as the library was built on (libcurl 7.70.0-x86), it causes an exception at curl_easy_perform in the example code (AccessViolation). This occurs even if the CurlThin architecture matches that of the libcurl build (x86).
Builds for 64 bit versions work as expected.
I'm trying to build the latest version of your CurlThin library for a project I'm maintaining. Could you give me an example of a build command using build.py or explain the steps you use to build the project?
Thanks.
Hello,
SafeEasyHandler is defined as
private SafeEasyHandle() : base(IntPtr.Zero, false)
So handle isnt owed by SafeHandle and ReleaseHandle will be not called.
Then CurlNative.Easy.Cleanup(handle); missed in all examples (for multi is the same ).
Or just change to
private SafeEasyHandle() : base(IntPtr.Zero, true)
Hi,
I noticed that in https://github.com/stil/CurlThin/blob/89c94a1358365bdf6b4c722dd48734ca8e4c71f6/CurlThin.Samples/Easy/HttpHeadersSample.cs line 36 you called CurlNative.Slist.FreeAll(headers);
. However the SafeSlistHandle
itself will call this function in ReleaseHandle()
method. Will that cause a double-free?
Hi! I ve tried to make a post request using the sample post code, but add the Content-Type header and specifying "application/json", but it didn't work, and returns a Bad Request, can you do a sample for Json Data Post?
Hi, i love this lib. Thank you for working on it.
Could anyone please share a short example how to make a HTTP PUT request?
CurlThin is a good package.
I am using CurlThin for my project.
I want to apply UnitTest to my code developed with CurlThin.
how to code for UnitTest?
I apologize if this is not the correct place for this question, but I did not find a better alternative.
I would like to use curl from a C# application. I see I can use CurlThin, which is great, but I was wondering if there might be a different interface that I am missing.
It would be amazing to be able to something like
var x = await curlthin.cmd("curl -O ftp://speedtest.tele2.net/1MB.zip");
It would be even more amazing to be able to get back the stream instead of having the result always written to a file
var stream = await curlthin.cmd("curl -O ftp://speedtest.tele2.net/1MB.zip", getBackStream=true);
I am actually asking for a few different things, and then really asking if something like this is possible without rewriting a lot of code.
The whole key to what I am suggesting/asking is whether there is a way to leverage the command line syntax of curl without having to recreate all of it. Then, if that is possible, is there a way to do so that is async and can provide easy access to the resultant stream. That would really be like curl is in my C# application as opposed to libcurl. The value of the curl command line cannot be overstated. It is a widely used an accepted syntax. To be able to drop it directly into a function call would be huge. To be able to have that function either write to a file, or to yield back a stream, would make integration a snap. That way, when I want to grab a file from an ftp and write it to my local filesystem, it's simple. And, when I want to make an HTTP POST and get back the response stream, it's equally simple. Plus, I don't have to rewrite the command line parser that curl has already written and perfected.
Thank you for any advice or thoughts on whether this can be done or how I might approach it. It would be fantastic if I just missed this in the API docs for curlthin or if there is some other project that works along with curlthin to support this.
Kind Regards
I've explicitly set executable to x64 and referenced CurlThin.Native.
In result, x86 libcurl DLLs were copied to output directory instead of x64. It means RuntimeInformation.OSArchitecture is not reliable method of checking if process is run in x64
Hi. Congrats, your implementation is still the best on github. However, I have to ask the question- why did you go with using LibUV and netstandard2? As far as I can tell, LIBUv just completely bloated this project- I removed it and your implementation of Multi but other than that.. its great. Im busy rewriting your multi implementation in pure .net.
Thanks!
The URL to curl in https://github.com/stil/CurlThin/blob/master/CurlThin.Native/PackCurlNative.ps1 is no longer working, so it is not possible to create Resources.zip
in CurlThin.Native.
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.