You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8a66e1e
Browse filesBrowse the repository at this point in the historyBrowse files
🐛 Address PR cfug#2512 review: keep min SDK at 2.18, drop fromSocket
Per @AlexV525:
1. Revert dio/pubspec.yaml + dio_test/pubspec.yaml min SDK back to
`>=2.18.0 <4.0.0` (the bump to 3.5.0 is no longer needed).
2. Revert dio/lib/src/dio_mixin.dart to `abstract class DioMixin` with
the original TODO comment.
3. Replace the Dart-3.5+ `ConnectionTask.fromSocket(...)` call in
`_pinnedConnectionFactory` with `SecureSocket.startConnect(...)` and
return the stock SDK [ConnectionTask] it produces. We await
`task.socket` once to do the leaf-cert validation; HttpClient
re-awaits the same `Future<SecureSocket>` and gets the resolved
value immediately (Future await is idempotent).
This works on every Dart >=2.18.0 because `SecureSocket.startConnect`
has been in `dart:io` well before the minimum SDK, and the
`ConnectionTask` generic is covariant in its type parameter so
`ConnectionTask<SecureSocket>` is implicitly assignable to
`ConnectionTask<Socket>` at the factory's return position. No
vendoring or `implements ConnectionTask` is required — and
`ConnectionTask` being `final class` from Dart 3.0 onward is no
longer a problem since we never inherit from it.
The maintainer's suggestion to literally "copy ConnectionTask into
the code base" cannot be done across the Dart 3.0–3.4 window (final
class blocks implements; fromSocket didn't exist yet), but
`SecureSocket.startConnect` achieves the same end with zero new
types and zero SDK floor change.
4. Drop the two CHANGELOG bullets that referenced the SDK bump and
the mixin migration. The rest of the entry (the actual cfug#2418 fix)
stays.
No test changes — the factory's observable behavior is unchanged
(approval yields a validated SecureSocket; rejection still throws
`_BadCertificateException` from the same point in `_fetch`'s try
block). All 222 tests pass; `dart analyze lib/` is clean.
0 commit comments