HandshakeException
shahmirzali49 opened this issue · 4 comments
shahmirzali49 commented
can you disable certificate validation in http package? ( you can do optional ).
I get this error for some URLs. but I want to download it anyway cause I know there is no problem.
for disabling certificate validation example :
import 'dart:io';
class MyHttpOverrides extends HttpOverrides{
@override
HttpClient createHttpClient(SecurityContext? context){
return super.createHttpClient(context)
..badCertificateCallback = (X509Certificate cert, String host, int port)=> true;
}
}
void main() {
HttpOverrides.global = new MyHttpOverrides();
runApp(MyApp());
}
starkdmi commented
@Shahmirzali-Huseynov, can you implement this by passing the custom HttpClient
?
An example.
shahmirzali49 commented
@starkdmi Yes, I can. but How can I disable certificate validation for the Custom client?
starkdmi commented
@Shahmirzali-Huseynov, here:
import 'package:http/io_client.dart';
final httpClient = HttpClient()..badCertificateCallback = ((X509Certificate cert, String host, int port) => true);
final ioClient = IOClient(httpClient);
await manager.init(isolates: 1, directory: directory, client: ioClient);
shahmirzali49 commented
thanks, @starkdmi