All Projects → masroore → Curlsharp

masroore / Curlsharp

Licence: bsd-3-clause
CurlSharp - .Net binding and object-oriented wrapper for libcurl.

Projects that are alternatives of or similar to Curlsharp

Node Libcurl
libcurl bindings for Node.js
Stars: ✭ 447 (+192.16%)
Mutual labels:  http-client, http2, curl, libcurl
Katipo
HTTP2 client for Erlang based on libcurl and libevent
Stars: ✭ 90 (-41.18%)
Mutual labels:  http-client, http2, curl, libcurl
request-extra
⚡️ Extremely stable HTTP request module built on top of libcurl with retries, timeouts and callback API
Stars: ✭ 14 (-90.85%)
Mutual labels:  curl, http-client, libcurl
Libhv
🔥 比libevent、libuv更易用的国产网络库。A c/c++ network library for developing TCP/UDP/SSL/HTTP/WebSocket client/server.
Stars: ✭ 3,355 (+2092.81%)
Mutual labels:  network, http-client, curl
curly.hpp
Simple cURL C++17 wrapper
Stars: ✭ 48 (-68.63%)
Mutual labels:  curl, http-client, libcurl
Fast Android Networking
🚀 A Complete Fast Android Networking Library that also supports HTTP/2 🚀
Stars: ✭ 5,346 (+3394.12%)
Mutual labels:  network, http-client, http2
1c http
Подсистема 1С для работы с HTTP
Stars: ✭ 48 (-68.63%)
Mutual labels:  curl, cookie, http-client
Kurly
kurly is an alternative to the widely popular curl program, written in Golang.
Stars: ✭ 319 (+108.5%)
Mutual labels:  http-client, http2, curl
Guzzle
Guzzle, an extensible PHP HTTP client
Stars: ✭ 21,384 (+13876.47%)
Mutual labels:  http-client, curl, httpclient
Urllib
Request HTTP(s) URLs in a complex world
Stars: ✭ 600 (+292.16%)
Mutual labels:  http-client, curl, httpclient
Lush Http
Smart Http Client for PHP
Stars: ✭ 60 (-60.78%)
Mutual labels:  http-client, curl
Hreq
A type dependent highlevel HTTP client library inspired by servant-client.
Stars: ✭ 53 (-65.36%)
Mutual labels:  network, http-client
Oh My Request
🔮 simple request library by java8
Stars: ✭ 44 (-71.24%)
Mutual labels:  network, http-client
Easygo
基于Kotlin、OkHttp的声明式网络框架,像写HTML界面一样写网络调用代码
Stars: ✭ 40 (-73.86%)
Mutual labels:  network, http-client
Cashew
A simple and elegant yet powerful HTTP client cache for .NET
Stars: ✭ 70 (-54.25%)
Mutual labels:  http-client, httpclient
Akka Http
The Streaming-first HTTP server/module of Akka
Stars: ✭ 1,163 (+660.13%)
Mutual labels:  http-client, http2
Rest Client
A tool for automated testing REST API, generating exquisite testing report and REST API documentation.
Stars: ✭ 1,181 (+671.9%)
Mutual labels:  http-client, httpclient
Restclient Cpp
C++ client for making HTTP/REST requests
Stars: ✭ 1,206 (+688.24%)
Mutual labels:  http-client, libcurl
Okurl
OkHttp Kotlin command line
Stars: ✭ 77 (-49.67%)
Mutual labels:  http2, curl
Gmod Chttp
A HTTP()-compatible wrapper for curl in Garry's Mod.
Stars: ✭ 39 (-74.51%)
Mutual labels:  curl, libcurl

CurlSharp

CurlSharp is a .Net binding and object-oriented wrapper for libcurl.

libcurl is a web-client library that can provide cross-platform .Net applications with an easy way to implement such things as:

  • HTTP ( GET / HEAD / PUT / POST / multi-part / form-data )
  • FTP ( upload / download / list / 3rd-party )
  • HTTPS, FTPS, SSL, TLS ( via OpenSSL or GnuTLS )
  • Proxies, proxy tunneling, cookies, user+password authentication.
  • File transfer resume, byte ranges, multiple asynchronous transfers.
  • and much more...

CurlSharp provides simple get/set properties for libcurl's options and information functions, event-based hooks to libcurl's I/O, status, and progress callbacks, and wraps the c-style file I/O behind simple filename properties. The CurlEasy class contains has more than 100 different properties and methods to handle a wide variety of URL transfer requirements. While this may seem overwhelming at first glance, the good news is you will probably need only a tiny subset of these for most situations.

The CurlSharp library consists of these parts:

  • Pure C# P/Invoke bindings to the libcurl API.
  • Optional libcurlshim helper DLL [WIN32].
  • The CurlEasy class which provides a wrapper around a curl_easy session.
  • The CurlMulti class, which serves as a container for multiple CurlEasy objects, and provides a wrapper around a curl_multi session.
  • The CurlShare class which provides an infrastructure for serializing access to data shared by multiple CurlEasy objects, including cookie data and DNS hosts. It implements the curl_share_xxx API.
  • The CurlHttpMultiPartForm to easily construct multi-part forms.
  • The CurlSlist class which wraps a linked list of strings used in cURL.

CurlSharp is available for these platforms:

  • [Stable] Windows 32-bit
  • [Experimental] Win64 port
  • [Experimental] Mono Linux & OS X support

Examples

A simple HTTP download program...

using System;
using CurlSharp;

internal class EasyGet
{
  public static void Main(String[] args)
  {
    Curl.GlobalInit(CurlInitFlag.All);

    try
    {
      using (var easy = new CurlEasy())
      {
        easy.Url = "http://www.google.com/";
        easy.WriteFunction = OnWriteData;
        easy.Perform();
      }
    }
    finally
    {
      Curl.GlobalCleanup();
    }	
  }

  public static Int32 OnWriteData(byte[] buf, Int32 size, Int32 nmemb, object data)
  {
      Console.Write(Encoding.UTF8.GetString(buf));
      return size*nmemb;
  }
}

Simple HTTP Post example:

using (var easy = new CurlEasy())
{
    easy.Url = "http://hostname/testpost.php";
    easy.Post = true;
    var postData = "parm1=12345&parm2=Hello+world%21";
    easy.PostFields = postData;
    easy.PostFieldSize = postData.Length;
    easy.Perform();
}

HTTP/2.0 download:

using (var easy = new CurlEasy())
{
    easy.Url = "https://google.com/";
    easy.WriteFunction = OnWriteData;

    // HTTP/2 please
    easy.HttpVersion = CurlHttpVersion.Http2_0;

    // skip SSL verification during debugging
    easy.SslVerifyPeer = false;
    easy.SslVerifyhost = false;

    easy.Perform();
}

More samples are included in the Samples folder.

Credits

CurlSharp Written by Dr. Masroor Ehsan.

CurlSharp is based on original code by Jeff Phillips libcurl.NET. Original code has been modified and greatly enhanced.


CurlSharp Copyright © 2013-17 Dr. Masroor Ehsan

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].