QUIC with HTTP 1

333 Views Asked by At

Can I use QUIC with HTTP 1 (in Android). I have been reading that QUIC works with HTTP 2 but when I used it with HTTP 1 then my HTTP connection time improved.

I was using

urlConnection = (HttpsURLConnection) url.openConnection();
stream = urlConnection.getInputStream();

after QUIC it is:

 val engine: CronetEngine =
            engineBuilder.enableHttp2(true).enableBrotli(true).enableQuic(true).enableHttpCache(
                CronetEngine.Builder.HTTP_CACHE_IN_MEMORY,
                (100 * 1024).toLong()
            ).build()

 val stream: StreamHandler =
            StreamHandlerFactory(engine).createURLStreamHandler("https") as StreamHandler
 val urlConnection: HttpURLConnection = stream.openConnection(url) as HttpURLConnection

inputStream = urlConnection.getInputStream()

I want to understand why connection time reduced with Quic + HTTP 1 if QUIC only supports HTTP 2

1

There are 1 best solutions below

0
Joe On

Answering late here, but Cronet natively supports HTTP, HTTP/2, HTTP/3 over Quic protocols. This is the same library used to power YouTube and other apps - you can read about it in detail here:

https://developer.android.com/guide/topics/connectivity/cronet

You are technically using UDP, and HTTP/1 is over it.