Skip to content

SoheilMV/MVNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MVNet Nuget

The library has been moved from Leaf.xNet to RuriLib.Http and RuriLib.Proxies.

Maybe the question is, how is it different from the main library?
I must say that I made some changes to make it easier to use and also fixed some minor bugs

Example

using MVNet;

CookieStorage cookies = new CookieStorage();
using (MVNet.HttpClient client = new MVNet.HttpClient())
{
    client.ReadWriteTimeOut = TimeSpan.FromSeconds(10);
    client.ConnectTimeout = TimeSpan.FromSeconds(10);
    client.Proxy = ProxyClient.Parse("http://127.0.0.1:8080");
    using (HttpRequest req = new HttpRequest("https://www.google.com/"))
    {
        req.Cookies = cookies;
        req.AddHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36");
        using (HttpResponse res = await client.SendAsync(req))
        {
            string source = await res.Content.ReadAsStringAsync();
        }
    }
}

How to add header?

using (HttpRequest req = new HttpRequest("https://www.example.com/"))
{
    req.AddHeader("name", "value");
}

How to add cookie?

using (HttpRequest req = new HttpRequest("https://www.example.com/"))
{
    req.AddCookie("name", "value");
}

How to change proxy?

using (MVNet.HttpClient client = new MVNet.HttpClient())
{
    client.Proxy = ProxyClient.Parse("http://127.0.0.1:8080"); //http
    //or
    client.Proxy = ProxyClient.Parse("socks4://127.0.0.1:1080"); //socks4
    //or
    client.Proxy = ProxyClient.Parse("socks4a://127.0.0.1:1080"); //socks4a
    //or
    client.Proxy = ProxyClient.Parse("socks5://127.0.0.1:1080"); //socks5
    //or
    client.Proxy = ProxyClient.Parse("ap://03000000093132372E302E302E3104393839380431323334"); //azadi
}

About

HTTP and HTTPS Library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages