This library uses Rebex, because Rebex did not support cookies before this project was created. To use the new MVNet library, click here.
- tls 1.0
- tls 1.1
- tls 1.2
- tls 1.3
- SSL 3.0
- Http/s
- Socks4
- Socks4a
- Socks5
- Basic Authentication
- Digest Authentication
- Windows NT Challenge/Response authentication (ntlm)
- GET
- HEAD
- OPTIONS
- DELETE
- POST
- PUT
- PATCH
using MVNet;
try
{
var hr = new HttpRequest();
var res = hr.Get("https://api.ipify.org?format=json");
if (res.IsOk)
{
Console.WriteLine(res.Content);
}
else
{
Console.WriteLine(res.StatusCode);
}
}
catch (HttpException ex)
{
Console.WriteLine(ex.Message);
}
StringContent content = new StringContent();
content.ContentType = "contenttype"; //Default is application/x-www-form-urlencoded
content["name1"] = "value1";
content["name2"] = "value2";
//Or
StringContent content = new StringContent("queryparams", "contenttype", encode);
MultipartContent content = new MultipartContent(); //Generate random boundary
//Or
MultipartContent content = new MultipartContent("boundary");
content.AddParam("name", "value");
content.AddParam("name", "filename", "contenttype");
StreamContent content = new StreamContent(stream); //Default ContentType is application/x-www-form-urlencoded
//Or
StreamContent content = new StreamContent(stream, contentType);
//Or
StreamContent content = new StreamContent(stream, contentType, size);
//ON
var hr = new HttpRequest()
{
AcceptAllCert = true
};
//OFF
var hr = new HttpRequest()
{
AcceptAllCert = false
};
ProxyClient pc = new ProxyClient(type, "host:port");
//Or
ProxyClient pc = new ProxyClient(type, "host", port);
//Or
ProxyClient pc = new ProxyClient(type, "host", port, "user", "pass");
var hr = new HttpRequest()
{
Proxy = pc
};
//Or
var hr = new HttpRequest()
{
Proxy = ProxyClient.Parse(type, "host:port");
};
ProxyClient pc = new ProxyClient(type, "host:port");
pc.ProxyAuthentication = ProxyAuthentication.Basic;
//Or
pc.ProxyAuthentication = ProxyAuthentication.Digest;
//Or
pc.ProxyAuthentication = ProxyAuthentication.Ntlm;
CookieDictionary cookie = new CookieDictionary();
cookie.Add("name1", "value1");
cookie.Add("name2", "value2");
var hr = new HttpRequest()
{
Cookies = cookie
};
//Or
var hr = new HttpRequest();
hr.Cookies.Add("name1", "value1");
hr.Cookies.Add("name2", "value2");
HeaderDictionary header = new HeaderDictionary();
header.Add("name1", "value1");
header.Add("name2", "value2");
var hr = new HttpRequest()
{
Headers = header
};
//Or
var hr = new HttpRequest();
hr.Headers.Add("name1", "value1");
hr.Headers.Add("name2", "value2");
string cookie = res.GetCookie("name");
string header = res.GetHeader("name");
Bitcoin : 124NBhKiPTvunTwbYk47w8Zfi47UDrc6hM