[dart:_http] Fix HttpClientResponse.certificate throwing on insecure connections.

HttpClientResponse.certificate is documented to be null on a insecure
connection:

> HttpClientResponse's X509Certificate get certificate:
>
> Returns the certificate of the HTTPS server providing the response.
> Returns null if the connection is not a secure TLS or SSL connection.

However, it instead throws an UnsupportedException as of Dart 2 due to an
oversight during refactoring. This change restores the original behavior.

Fixes https://github.com/dart-lang/sdk/issues/31931

Change-Id: I1ef22fe3d7165ec876d22309d8aa4316d94c5576
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103843
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
diff --git a/sdk/lib/_http/http_impl.dart b/sdk/lib/_http/http_impl.dart
index f565489..497516c 100644
--- a/sdk/lib/_http/http_impl.dart
+++ b/sdk/lib/_http/http_impl.dart
@@ -320,7 +320,7 @@
   X509Certificate get certificate {
     var socket = _httpRequest._httpClientConnection._socket;
     if (socket is SecureSocket) return socket.peerCertificate;
-    throw new UnsupportedError("Socket is not a SecureSocket");
+    return null;
   }
 
   List<Cookie> get cookies {