HTTP3 connection on iOS 16

Hi everyone!

I am investigating the feasibility of http3 connections

Refer to this WWDC video https://developer.apple.com/videos/play/wwdc2021/10094/ and the sample code TN3102: HTTP/3 in your app | Apple Developer Documentation

Does URLRequest automatically connect as http3 if the server already supports the following settings?

IN HTTPS alpn="h3,h2"
Alt-Svc: h3=":443"; ma=2592000


After testing, I can only connect as http3 if I enable assumesHTTP3Capable on URLRequest. Is assumesHTTP3Capable required or am I missing something?

It’s been a while since I looked at this but my understanding is that the session caches the HTTP capabilities of the server. So, if you don’t set assumesHTTP3Capable it’ll try a legacy connection the first time. That’ll reveal that the server supports HTTP/3, and the session will cache that for the next connection.

The tricky part here is that HTTP/2 connections are long-lived, so you’ll have to wait for it to time out. IIRC that takes 30 seconds.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Does URLRequest automatically connect as http3 if the server already supports the following settings?

If you set assumesHTTP3Capable the client will try to use H3 on the first attempt, If you have following being sent back to the client:

IN HTTPS alpn="h3,h2"
Alt-Svc: h3=":443"; ma=2592000

Then Alt-Srv will be flagged for that hostname and H3 may be used on subsequent attempts to the server.

HTTP3 connection on iOS 16
 
 
Q