OpenBullet2 icon indicating copy to clipboard operation
OpenBullet2 copied to clipboard

[REQUEST] HTTP/2.0 Implementation

Open fairy-root opened this issue 3 years ago • 5 comments

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

  • Multiplexing and concurrency: Several requests can be sent in rapid succession on the same TCP connection, and responses can be received out of order - eliminating the need for multiple connections between the client and the server.
    
  • Stream dependencies: the client can indicate to the server which of the resources are more important than the others.
    
  • Header compression: HTTP header size is drastically reduced
    
  • Server push: The server can send resources the client has not yet requested
    

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

fairy-root avatar Mar 13 '21 04:03 fairy-root

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 avatar Mar 13 '21 04:03 openbullet

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.

openbullet avatar Jan 29 '22 11:01 openbullet

And now we need HTTP/3.0 already

mastercho avatar Nov 07 '23 23:11 mastercho

And now we need HTTP/3.0 already

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

pitagoras530 avatar Nov 08 '23 00:11 pitagoras530

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/

mastercho avatar Nov 08 '23 00:11 mastercho