envoyproxy / envoyproxy/envoy-mobile

Cronvoy: getStatus

Open
#1,519 0 comments 1 reaction 1 assignee Assigned to @DavidSchinazi View on GitHub
cronet enhancement no stalebot
Dominant language
Java
Stars
566
Forks
85
PR merge metrics
No merged PRs in 30d

Description

The Cronet API exposes a peculiar [```UrlRequest.getStatus method```](https://chromium.googlesource.com/chromium/src/+/main/components/cronet/android/api/src/org/chromium/net/UrlRequest.java#410). The Engine "C++ layer" is asked to return its status, however the value is returned by invoking the provided callback method, which will use the Executor passed when creating the UrlRequest. The C++ layer schedules the callback with the [```CronetURLRequestAdapter::GetStatus method```](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/cronet/android/cronet_url_request_adapter.cc#155). This is the callback class:
```
public abstract static class StatusListener {
// Invoked on {@link UrlRequest}'s {@link Executor}'s thread when request
// status is obtained.
// @param status It is one of the values defined in {@link Status}.
public abstract void onStatus(int status);
}
```

And those are the possible [status values](https://source.chromium.org/chromium/chromium/src/+/main:components/cronet/android/api/src/org/chromium/net/UrlRequest.java;l=232):

- ```INVALID = -1```
- ```IDLE = 0```
- ```WAITING_FOR_STALLED_SOCKET_POOL = 1``` // No reference in google code base
- ```WAITING_FOR_AVAILABLE_SOCKET = 2``` // No reference in google code base
- ```WAITING_FOR_DELEGATE = 3``` // No reference in google code base
- ```WAITING_FOR_CACHE = 4``` // No reference in google code base
- ```DOWNLOADING_PAC_FILE = 5``` // No reference in google code base
- ```RESOLVING_PROXY_FOR_URL = 6``` // No reference in google code base
- ```RESOLVING_HOST_IN_PAC_FILE = 7``` // No reference in google code base
- ```ESTABLISHING_PROXY_TUNNEL = 8``` // No reference in google code base
- ```RESOLVING_HOST = 9``` // No reference in google code base
- ```CONNECTING = 10```
- ```SSL_HANDSHAKE = 11```
- ```SENDING_REQUEST = 12```
- ```WAITING_FOR_RESPONSE = 13```
- ```READING_RESPONSE = 14``` // No reference in google code base

Requires changes in Envoy.

This is used by AGSA (Android Google Search App), and an Android library maintained by Google also uses this: [ExoPlayer](https://github.com/google/ExoPlayer/blob/release-v2/extensions/cronet/src/main/java/com/google/android/exoplayer2/ext/cronet/CronetDataSource.java#L988). This does not seem to drive business logic - only informational.

It is suspected that implementing only some of the status would be fine.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.