cronet-sample
cronet-sample copied to clipboard
Does Cronet support HTTP/3 (strict UDP transport)?
Hi,
We've been experimenting with Cronet and aioquic, which has a full UDP-transport HTTP/3 implementation.
However, we've had difficulties in making a connection to the endpoint; even with QUIC hints enabled, Cronet still starts with a TCP connection which I am assuming relates to TLS?
Or maybe more to the point, does Cronet support a full HTTP/3 implementation with UDP-only transport?
I have the same problem
Hi, are you still facing this issue? If yes, can we get more details?
Generally, with Quic hints enabled, Cronet races TCP with QUIC and uses whichever succeeds first. See this QUIC discovery document for more details.
Is this the behaviour you are seeing or it doesn't use QUIC at all? Consider sharing a netlog with your cronet version to help us investigate.
Thanks!
same here! i have a hard time finding the netlogs
! here is and example of the path to it:
/storage/emulated/0/Android/data/com.google.samples.cronet_sample/files/cronet1584992935845354237log
but short of rooting the device i can't get to it, or is there another way?
testing with Caddy server, serving my own domain, with the following diff:
diff --git a/android/app/src/main/java/com/google/samples/cronet_sample/CronetApplication.java b/android/app/src/main/java/com/google/samples/cronet_sample/CronetApplication.java
index 32de5f0..fd59abc 100644
--- a/android/app/src/main/java/com/google/samples/cronet_sample/CronetApplication.java
+++ b/android/app/src/main/java/com/google/samples/cronet_sample/CronetApplication.java
@@ -96,6 +96,8 @@ public class CronetApplication extends Application {
// .addQuicHint("storage.googleapis.com", 443, 443)
// .addQuicHint("www.googleapis.com", 443, 443)
+ .addQuicHint( "www.example.com", 443, 80)
+
.build();
}
diff --git a/android/app/src/main/java/com/google/samples/cronet_sample/data/ImageRepository.java b/android/app/src/main/java/com/google/samples/cronet_sample/data/ImageRepository.java
index 28f9350..54d7773 100644
--- a/android/app/src/main/java/com/google/samples/cronet_sample/data/ImageRepository.java
+++ b/android/app/src/main/java/com/google/samples/cronet_sample/data/ImageRepository.java
@@ -18,12 +18,7 @@ package com.google.samples.cronet_sample.data;
public class ImageRepository {
private static String[] imageUrls= {
- "https://storage.googleapis.com/cronet/sun.jpg",
- "https://storage.googleapis.com/cronet/flower.jpg",
- "https://storage.googleapis.com/cronet/chair.jpg",
- "https://storage.googleapis.com/cronet/white.jpg",
- "https://storage.googleapis.com/cronet/moka.jpg",
- "https://storage.googleapis.com/cronet/walnut.jpg"
+ "https://www.example.com/foo.jpg",
};
public static int numberOfImages() {
i made two request to the server by pressing the LOAD button. note that none of the requests start with h3 proto, although quic hint is added.
but worst, the second request doesn't start with quic! it's still proto: h2
.
see further down for logs from chrome browser.
cronet-example
logs, notice that the second request is "pure" quic, i.e. proto: h3
:
{
"level": "info",
"ts": 1691248014.837013,
"logger": "http.log.access",
"msg": "handled request",
"request": {
"remote_ip": "2606:6d00:10:4e1b:1154:8636:2df8:2acf",
"remote_port": "43793",
"proto": "HTTP/2.0",
"method": "GET",
"host": "www.exampel.com",
"uri": "/foo.jpg",
"headers": {
"Accept-Encoding": [
"gzip, deflate, br"
],
"X-My-Custom-Header": [
"Hello-from-Cronet"
],
"User-Agent": [
"CronetSampleApp"
]
},
"tls": {
"resumed": false,
"version": 772,
"cipher_suite": 4865,
"proto": "h2",
"server_name": "www.exampel.com"
}
},
"user_id": "",
"duration": 0.01127414,
"size": 185494,
"status": 200,
"resp_headers": {
"Alt-Svc": [
"h3=\":443\"; ma=2592000,h3=\":8080\"; ma=2592000"
],
"Etag": [
"\"ryxapx3z4m\""
],
"Content-Type": [
"image/jpeg"
],
"Last-Modified": [
"Sat, 05 Aug 2023 14:53:57 GMT"
],
"Accept-Ranges": [
"bytes"
],
"Content-Length": [
"185494"
],
"Server": [
"Caddy"
]
}
}
{
"level": "info",
"ts": 1691248022.2858596,
"logger": "http.log.access",
"msg": "handled request",
"request": {
"remote_ip": "2606:6d00:10:4e1b:1154:8636:2df8:2acf",
"remote_port": "43793",
"proto": "HTTP/2.0",
"method": "GET",
"host": "www.exampel.com",
"uri": "/foo.jpg",
"headers": {
"Accept-Encoding": [
"gzip, deflate, br"
],
"X-My-Custom-Header": [
"Hello-from-Cronet"
],
"User-Agent": [
"CronetSampleApp"
]
},
"tls": {
"resumed": false,
"version": 772,
"cipher_suite": 4865,
"proto": "h2",
"server_name": "www.exampel.com"
}
},
"user_id": "",
"duration": 0.000379062,
"size": 185494,
"status": 200,
"resp_headers": {
"Etag": [
"\"ryxapx3z4m\""
],
"Content-Type": [
"image/jpeg"
],
"Last-Modified": [
"Sat, 05 Aug 2023 14:53:57 GMT"
],
"Accept-Ranges": [
"bytes"
],
"Content-Length": [
"185494"
],
"Server": [
"Caddy"
],
"Alt-Svc": [
"h3=\":443\"; ma=2592000,h3=\":8080\"; ma=2592000"
]
}
}
now chrome logs:
{
"level": "info",
"ts": 1691248232.864167,
"logger": "http.log.access",
"msg": "handled request",
"request": {
"remote_ip": "2606:6d00:10:4e1a:1537:b2:2c93:489d",
"remote_port": "38294",
"proto": "HTTP/2.0",
"method": "GET",
"host": "www.exampel.com",
"uri": "/foo.jpg",
"headers": {
"Sec-Ch-Ua-Mobile": [
"?0"
],
"Dnt": [
"1"
],
"Upgrade-Insecure-Requests": [
"1"
],
"User-Agent": [
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"
],
"Sec-Fetch-Dest": [
"document"
],
"Accept-Encoding": [
"gzip, deflate, br"
],
"Sec-Ch-Ua": [
"\"Google Chrome\";v=\"117\", \"Not;A=Brand\";v=\"8\", \"Chromium\";v=\"117\""
],
"Accept": [
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"
],
"Sec-Fetch-Site": [
"none"
],
"Sec-Fetch-Mode": [
"navigate"
],
"Sec-Fetch-User": [
"?1"
],
"Accept-Language": [
"en-GB,en;q=0.9"
],
"Sec-Ch-Ua-Platform": [
"\"Linux\""
]
},
"tls": {
"resumed": false,
"version": 772,
"cipher_suite": 4865,
"proto": "h2",
"server_name": "www.exampel.com"
}
},
"user_id": "",
"duration": 0.000501864,
"size": 185494,
"status": 200,
"resp_headers": {
"Content-Type": [
"image/jpeg"
],
"Last-Modified": [
"Sat, 05 Aug 2023 14:53:57 GMT"
],
"Accept-Ranges": [
"bytes"
],
"Content-Length": [
"185494"
],
"Server": [
"Caddy"
],
"Alt-Svc": [
"h3=\":443\"; ma=2592000,h3=\":8080\"; ma=2592000"
],
"Etag": [
"\"ryxapx3z4m\""
]
}
}
{
"level": "error",
"ts": 1691248232.910244,
"logger": "http.log.access",
"msg": "handled request",
"request": {
"remote_ip": "2606:6d00:10:4e1a:1537:b2:2c93:489d",
"remote_port": "38294",
"proto": "HTTP/2.0",
"method": "GET",
"host": "www.exampel.com",
"uri": "/favicon.ico",
"headers": {
"Sec-Ch-Ua": [
"\"Google Chrome\";v=\"117\", \"Not;A=Brand\";v=\"8\", \"Chromium\";v=\"117\""
],
"Sec-Ch-Ua-Mobile": [
"?0"
],
"User-Agent": [
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"
],
"Sec-Ch-Ua-Platform": [
"\"Linux\""
],
"Accept": [
"image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8"
],
"Sec-Fetch-Site": [
"same-origin"
],
"Sec-Fetch-Dest": [
"image"
],
"Dnt": [
"1"
],
"Sec-Fetch-Mode": [
"no-cors"
],
"Referer": [
"https://www.exampel.com/foo.jpg"
],
"Accept-Encoding": [
"gzip, deflate, br"
],
"Accept-Language": [
"en-GB,en;q=0.9"
]
},
"tls": {
"resumed": false,
"version": 772,
"cipher_suite": 4865,
"proto": "h2",
"server_name": "www.exampel.com"
}
},
"user_id": "",
"duration": 3.6555e-05,
"size": 0,
"status": 404,
"resp_headers": {
"Server": [
"Caddy"
],
"Alt-Svc": [
"h3=\":443\"; ma=2592000,h3=\":8080\"; ma=2592000"
]
}
}
{
"level": "info",
"ts": 1691248260.18484,
"logger": "http.log.access",
"msg": "handled request",
"request": {
"remote_ip": "2606:6d00:10:4e1a:1537:b2:2c93:489d",
"remote_port": "33986",
"proto": "HTTP/3.0",
"method": "GET",
"host": "www.exampel.com",
"uri": "/foo.jpg",
"headers": {
"Accept-Language": [
"en-GB,en;q=0.9"
],
"If-None-Match": [
"\"ryxapx3z4m\""
],
"Sec-Ch-Ua-Mobile": [
"?0"
],
"Sec-Fetch-Site": [
"none"
],
"Sec-Fetch-Mode": [
"navigate"
],
"Sec-Fetch-User": [
"?1"
],
"Accept-Encoding": [
"gzip, deflate, br"
],
"Sec-Ch-Ua": [
"\"Google Chrome\";v=\"117\", \"Not;A=Brand\";v=\"8\", \"Chromium\";v=\"117\""
],
"Sec-Ch-Ua-Platform": [
"\"Linux\""
],
"Dnt": [
"1"
],
"User-Agent": [
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36(KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"
],
"Accept": [
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"
],
"Cache-Control": [
"max-age=0"
],
"Upgrade-Insecure-Requests": [
"1"
],
"Sec-Fetch-Dest": [
"document"
],
"If-Modified-Since": [
"Sat, 05 Aug 2023 14:53:57 GMT"
]
},
"tls": {
"resumed": false,
"version": 772,
"cipher_suite": 4865,
"proto": "h3",
"server_name": "www.exampel.com"
}
},
"user_id": "",
"duration": 5.4281e-05,
"size": 0,
"status": 304,
"resp_headers": {
"Server": [
"Caddy"
],
"Etag": [
"\"ryxapx3z4m\""
]
}
}
found it (netlog)! https://gist.github.com/257/1241ba19ebea11388b8af33d2eeb0b13
@colibie ?
@257 I was out of office. Sorry about that. I looked at the log and it seems example.com in the hint has been mispelt as exampel.com in the requests?
Also, the provided netlog was not properly truncated. You need to close the app/destroy the mainActivity to stop the netlog. See https://github.com/GoogleChromeLabs/cronet-sample/blob/master/android/app/src/main/java/com/google/samples/cronet_sample/MainActivity.java#L66.
Let me know if the quicHint works with the correct url. If it doesn't, I'd look into replicating with your setup. FWIW, we do have tests that use a quic-only server so it's expected to work.
hi @colibie, misspelling is my fault while editing the logs, please ignore.
i will reproduce the netlog.