-
Notifications
You must be signed in to change notification settings - Fork 381
HTTP package: need a way to accept bad certificates #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
<img src="https://avatars.githubusercontent.com/u/4865287?v=3" align="left" width="48" height="48"hspace="10"> Comment by lrhn |
This comment was originally written by [email protected] If this was triaged, I don't see where. |
<img src="https://avatars.githubusercontent.com/u/1343914?v=3" align="left" width="48" height="48"hspace="10"> Comment by sgjesse In dart.io the HttpClient have a callback to handle bad certificates, e.g. import 'dart:io'; void main(List<String> args) { |
<img src="https://avatars.githubusercontent.com/u/1343914?v=3" align="left" width="48" height="48"hspace="10"> Comment by sgjesse Issue dart-lang/sdk#20832 has been merged into this issue. |
This can be done by setting the innerClient within a 'IoClient'. import 'dart:io';
import 'package:http/http.dart' as http;
bool _certificateCheck(X509Certificate cert, String host, int port) =>
host == 'devblog.paypal.com';
http.Client paypalClient() {
var ioClient = new HttpClient()
..badCertificateCallback = _certificateCheck;
return new http.IOClient(ioClient);
} |
update, 'new http.IOClient()' might not build, now use IOClient() or new IOClient() directly with the following import : import 'dart:io';
import 'package:http/http.dart' as http;
import 'package:http/io_client.dart'; //has IOClient
bool _certificateCheck(X509Certificate cert, String host, int port) => true;
http.Client paypalClient() {
var ioClient = new HttpClient()
..badCertificateCallback = _certificateCheck;
return new IOClient(ioClient);
} |
it always returns the called host even with a bad certificate. :( |
all this solutions is not valid for web( |
Hi what's the solution for the web please ? |
Hi!
|
<img src="https://avatars.githubusercontent.com/u/148256?v=3" align="left" width="96" height="96"hspace="10"> Issue by kaisellgren
Originally opened as dart-lang/sdk#17173
I'm trying to read URIs such as http://devblog.paypal.com/feed/ that lead to a bad certificate exception.
Can we add a callback to handle bad certificates in the HTTP package? For .get, .read, etc.?
Simplest reproduce step is: http.read('http://devblog.paypal.com/feed/');
The text was updated successfully, but these errors were encountered: