Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I make an HTTP request that only uses HTTP/2

Tags:

go

I am working on some scripts to test our infrastructure at various levels. I am trying to make tests to verify functionality for clients both with and without http2. The docs specify how to disable http2 by overriding Transport.TLSNextProto, but I can't find any way to require http2.

Is there a way to require an http request uses http/2 only? Or if not is there any kind of field or hook to see if it used http2 or not?

like image 953
captncraig Avatar asked May 08 '17 00:05

captncraig


People also ask

Is HTTPS mandatory for HTTP2?

Since browsers only speak HTTP/2 over TLS (so far at least), sites that want HTTP/2 enabled must do it over HTTPS to get users. It provides a gentle pressure on sites to offer proper HTTPS. It pushes more people over to end-to-end TLS encrypted connections.

What is HTTP2 request?

HTTP/2 enables full request and response multiplexing. In practice, this means a connection made to a web server from your browser can be used to send multiple requests and receive multiple responses. This gets rid of a lot of the additional time that it takes to establish a new connection for each request.

Why is HTTP2 better?

HTTP2 is more secure as it uses binary protocol instead of plaintext. HTTP/2 allows the user to have a better web experience by reducing the page load time considerably. It needs the header to be sent just once in binary codes to increase speed.

What is the difference between HTTP 1 1 and HTTP 2?

For example, HTTP/1.1 defines four different ways to parse a message; in HTTP/2, there’s just one code path. It’s true that HTTP/2 isn’t usable through telnet, but we already have some tool support, such as a Wireshark plugin. Why is HTTP/2 multiplexed?

How to make HTTP requests in JavaScript?

In this article, we are going to look at a few popular ways to make HTTP requests in JavaScript. Ajax is the traditional way to make an asynchronous HTTP request. Data can be sent using the HTTP POST method and received using the HTTP GET method. Let’s take a look and make a GET request.

How can I make the httpclient use HTTP/2?

However, when a GET request is made through a .net 4.6 client as below, How can I make the .net client use HTTP/2.0 ? Show activity on this post. 1.Make sure you are on the latest version of Windows 10. 2.Install WinHttpHandler: 3.Extend WinHttpHandler to add http2.0 support: 4.Pass above handler to the HttpClient constructor

Does http 2 need to be encrypted?

After extensive discussion, the Working Group did not have consensus to require the use of encryption (e.g., TLS) for the new protocol. However, some implementations have stated that they will only support HTTP/2 when it is used over an encrypted connection, and currently no browser supports HTTP/2 unencrypted.


1 Answers

You can use Response.ProtoAtLeast(2, 0) to check if it came in over version 2. See: https://golang.org/pkg/net/http/#Response.ProtoAtLeast

like image 172
Jan Zerebecki Avatar answered Oct 16 '22 06:10

Jan Zerebecki