openbullet / OpenBullet2

OpenBullet reinvented
https://docs.openbullet.dev/
MIT License
1.65k stars 455 forks source link

[REQUEST] HTTP/2.0 Implementation #88

Open fairy-root opened 3 years ago

fairy-root commented 3 years ago

Is your feature request related to a problem? Please describe. HTTP/2 attempts to solve many of the shortcomings and inflexibilities of HTTP/1.1

Describe the solution you'd like As much as it may seem hard to implement, sooner or later, Implementing the HTTP/2.0 shall be a must for more of the internet is turning to it.

Describe alternatives you've considered no alternatives whatsoever...

Additional context Thank you in Advance Ruri Chan.

Capture

openbullet commented 3 years ago

As a workaround for this situation, until it's implemented in the RLHttpClient, you can use the following snippet in your LoliCode, which uses the built-in HttpClient of .NET that supports HTTP/2.0 and HTTP/3.0. You do need to know C# in order to configure your HttpRequestMessage properly

var httpClientHandler = new System.Net.Http.HttpClientHandler();
if (data.Proxy != null)
{
    var webProxy = new System.Net.WebProxy(data.Proxy.Host, data.Proxy.Port);
    if (data.Proxy.NeedsAuthentication)
    {
        webProxy.Credentials = new System.Net.NetworkCredential(data.Proxy.Username, data.Proxy.Password);
    }
    httpClientHandler.Proxy = webProxy;
}

var httpClient = new System.Net.Http.HttpClient(httpClientHandler);
var httpRequest = new System.Net.Http.HttpRequestMessage();
httpRequest.RequestUri = new Uri("https://http2.golang.org/reqinfo");
httpRequest.Version = new Version(2, 0);
var response = await httpClient.SendAsync(httpRequest);
data.SOURCE = await response.Content.ReadAsStringAsync();

LOG ""
LOG "HTTP/2.0 Request Sample"
CLOG ForestGreen "Received Payload"
CLOG GreenYellow data.SOURCE

httpClientHandler.Dispose();
httpClient.Dispose();
httpRequest.Dispose();
response.Dispose();

// Rest of your blocks here

NOTE: This only works with HTTP(S) proxies as you can clearly see from the code

openbullet commented 2 years ago

A follow up on this: HTTP/2.0 is now supported via the System.Net library since OB2 version 0.2.0. In your Http Request block, select SystemNet instead of RuriLibHttp as a value for the Http Library parameter. You will then be able to perform HTTP/2.0 requests by writing 2.0 in the Http Version field. Both HTTP and SOCKS proxies are supported, and custom Cipher Suites are supported on Linux if you have the latest openssl installed.

I will leave this issue open because one day I would like to write my own implementation of HTTP/2.0 for the RuriLib.Http library as well.

mastercho commented 7 months ago

And now we need HTTP/3.0 already

pitagoras530 commented 7 months ago

And now we need HTTP/3.0 already

what site has http3 chrome has not enabled it by default 🤔

mastercho commented 7 months ago

And now we need HTTP/3.0 already

what site has http3 chrome has not enabled it by default 🤔

Cloudflare forced sites, Chrome has enabled it by default you just didn't notice, here you can check https://cloudflare-quic.com/