3.2.0
-
Add support for handling authentication challenges, such as TLS server
trust evaluation:- Add an
onChallengecallback toURLSession.sessionWithConfiguration,
URLSession.delegateandURLSessionTask.delegate. - Add
URLAuthenticationChallenge,URLProtectionSpace,URLCredential,
SecTrust,SecCertificateand theNSURLAuthenticationMethod...
constants (e.g.NSURLAuthenticationMethodServerTrust).
- Add an
-
Add an
onChallengeparameter toCupertinoClient.fromSessionConfiguration,
which makes it possible to trust servers using self-signed certificates or
certificates issued by a private certificate authority, or to implement
certificate pinning. -
Add
URLRequest.assumesHTTP3Capableand
MutableURLRequest.assumesHTTP3Capable. -
Add
OnMetrics, theonMetricsargument of
URLSession.sessionWithConfiguration, andURLSessionTaskMetrics/
URLSessionTaskTransactionMetrics, so the protocol negotiated for a request
(h2,h3,http/1.1) can be read with
URLSessionTaskTransactionMetrics.networkProtocolName. -
Add an
onMetricsparameter toCupertinoClient.fromSessionConfiguration,
which makes theURLSessionTaskMetricsof each request available together
with the request, e.g. the negotiated protocol (h2,h3,http/1.1) and
whether the connection was reused. -
Update package description and declare supported platforms (
ios,macos). -
Fix a memory leak when the
abortTriggerfor anAbortableis retained
past the completion of the response. For example:final abortTrigger = Completer<void>(); // The timer will keep `abortTrigger` alive until it fires in 60 seconds, // even if the response completes before then. Timer(const Duration(seconds: 60), abortTrigger.complete); final request = http.AbortableRequest( 'GET', Uri.https('example.com'), abortTrigger: abortTrigger.future, ); final response = await client.send(request); await response.stream.drain<void>();