http2

Use Http/2 to make api calls from javascript

我的未来我决定 提交于 2019-12-06 07:42:14
问题 I know most browsers support http/2 for loading the pages but does this mean I can leverage it when I make api calls using XmlHttpRequest ? More specifically my question is if I make 2 calls to fetch data using XmlHttpRequest does it ensure that both of them use the same tcp connection underneath ? None of the documentation I read any where specifies any thing about http2 support for XmlHttpRequest or how I can explicitly open a http2 connection, make some calls leveraging this and then close

When using http2 in okhttp, why multi requests to the same host didn't use just one connectoin

岁酱吖の 提交于 2019-12-06 07:24:05
问题 I would like to test okhttp's http2 function. And I make multi requsts to same host in async style. But, I found that, it involved multi connections, since the protocol is h2, It should use just one connection, right? The code is below. Ah, I'm using okhttp2.5 public class Performance { private final OkHttpClient client = new OkHttpClient(); private final Dispatcher dispatcher = new Dispatcher(); private final int times = 20; public Performance(){ dispatcher.setMaxRequestsPerHost(2); client

Jetty HTTP/2 Client example

断了今生、忘了曾经 提交于 2019-12-06 03:21:32
I used the client code Jetty provide to us. And some problem occurs. The code I wanna run is here https://github.com/eclipse/jetty.project/blob/master/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/Client.java And actually I know I come across the same problem like this Jetty HTTP/2 client receive server push example I stopped at this guy's update 2 and I have built a new project under the http2-client folder. But the problem still remains. INFO::main: Logging initialized @170ms Exception in thread "main" java.util.concurrent.TimeoutException at org.eclipse.jetty.util

how do I compile cURL with openSSL and nghttp2 on Windows x64?

醉酒当歌 提交于 2019-12-06 02:23:37
first question ever on here, so bear with me :) I've been on the web for the past 3 days trying to find a way to get the following result on my windows machine. example of 'cURL -V' output I need I've found a lot of stuff for macOS and unix, but only bits and pieces for Windows. I'm running xampp, and ultimately I'm trying to get it to send http/2 requests through cURL/PHP. What I've gathered so far is that I need cURL to be compiled with some libraries, like openssl (at least 1.0.2), libcurl with http/2 enabled, and nghttp2. I feel like I'm very close but I'm just missing some steps. What I

ASP.Net HTTP2 PushPromise is slow

喜你入骨 提交于 2019-12-06 02:21:14
I'm trying to implement the Http2 push server functionality using "PushPromise" .NET 4.6.1, for this I have a "html extension" with Razor (we did not implement MVC only used the Razor engine to build the pages). public static IHtmlString PushPromiseStylesheet(this HtmlHelper htmlHelper, string src, bool addDomElement = true) { var context = HttpContext.Current; var path = System.Web.Optimization.Styles.Url(src).ToString(); var headers = new NameValueCollection { { "accept-encoding", context.Request.Headers["accept-encoding"] } }; context.Response.PushPromise(path, "GET", headers); var

How to keep connection alive in Java 11 http client

泄露秘密 提交于 2019-12-05 21:53:28
I'm using the Java 11 HttpClient with HTTP/2 and need to keep connection alive for few minutes, but the builder does not have the option to set it. Is there a way to specify this and make client keep the connection alive for some time? If you build a standard HttpClient e.g. using HttpClient.newHttpClient(); by default a connection pool is created. This pool keeps the connections alive by default for 1200 seconds (20 minutes). If you want to change the keep-alive timeout you can do so using the property jdk.httpclient.keepalive.timeout . However the value is only read once when the class jdk

How to enable h2c in Nginx?

…衆ロ難τιáo~ 提交于 2019-12-05 21:12:41
Is there a way to enable h2c aka HTTP2 cleartext in Nginx 1.9.5 onward? I've tried using h2 over TLs in https://chronic101.xyz and it works, however I would like to implement h2c on port 80 as well. Thanks, chrone It should be as simple as adding http2 in the end of your listen directive. Example: server { listen 80 http2; However, keep in mind that most browsers do not support unencrypted HTTP/2, and so will still serve content as HTTP/1.1. 来源: https://stackoverflow.com/questions/34108188/how-to-enable-h2c-in-nginx

What happens when a browser that supports SPDY receives an HTTP2 (H2) response?

被刻印的时光 ゝ 提交于 2019-12-05 18:57:46
My gut feeling is that a SPDY-capable browser will treat it as though it were a SPDY response. However, the most I can find is a reassurance that an H2 response will degrade gracefully to HTTP1.1. I'm considering serving assets in an H2 oriented manner (multiple requests, no domain sharding, etc.), but I do need to support some non-H2 browsers (e.g. Android 4.1's browser). Will I be OK if all the clients are at least SPDY compliant? Bonus question: are there any complications involved with mixing protocols? We're on a web framework that doesn't support H2, but I'm considering serving most of

NSURLSession HTTP/2 memory leak

試著忘記壹切 提交于 2019-12-05 17:15:24
问题 This My Test cases, point out that when using NSURLSession with a HTTP/2 connection there is memory problem. test1: iOS 9. HTTP/2 server I use NSURLSession to upload 10M file to a HTTP/2 server, if the file uploaded completed everything is ok, But if I cancel the upload task before it's completed, the 10M will never release. test2: iOS 9. HTTPs1.1 server I test the same code with a https1.1 file server, I cancel the upload task or not, everything is ok, the memory back to normal.(10M data is

Is it necessary to cache bust in HTTP/2?

给你一囗甜甜゛ 提交于 2019-12-05 17:06:12
In HTTP/1, to avoid extra network requests that would determine if resources should remain cached, we would set a high max-age or Expires value on static assets, and give them a unique URL for each revision. But in HTTP/2, requests are cheap, so can we get by without cache-busting, and just rely on ETags, last-modified, et al? The only advantage I can see with continuing to bust the cache (besides dually serving HTTP/1 and HTTP/2 clients) would be to save bandwidth checking if resources are out-of-date. And even that is probably going to be insignificant with HPACK. So am I missing something,