Skip to content

Commit 0a385dd

Browse files
munificentCommit Queue
authored andcommitted
Reformat sdk/ using the 3.8 style.
Change-Id: I6e037ab1091cdaaf72b21f558a45b2c5f99304bb Tested: Automated reformatting, so no behavior changes. CoreLibraryReviewExempt: Automated reformatting. Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425147 Commit-Queue: Bob Nystrom <[email protected]> Auto-Submit: Bob Nystrom <[email protected]> Reviewed-by: Lasse Nielsen <[email protected]>
1 parent b2c8a30 commit 0a385dd

File tree

86 files changed

+1316
-1469
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1316
-1469
lines changed

sdk/lib/_http/http.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,10 +2108,9 @@ class HttpException implements IOException {
21082108
const HttpException(this.message, {this.uri});
21092109

21102110
String toString() {
2111-
var b =
2112-
StringBuffer()
2113-
..write('HttpException: ')
2114-
..write(message);
2111+
var b = StringBuffer()
2112+
..write('HttpException: ')
2113+
..write(message);
21152114
var uri = this.uri;
21162115
if (uri != null) {
21172116
b.write(', uri = $uri');

sdk/lib/_http/http_date.dart

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,22 @@ class HttpDate {
5151
];
5252

5353
DateTime d = date.toUtc();
54-
StringBuffer sb =
55-
StringBuffer()
56-
..write(wkday[d.weekday - 1])
57-
..write(", ")
58-
..write(d.day <= 9 ? "0" : "")
59-
..write(d.day.toString())
60-
..write(" ")
61-
..write(month[d.month - 1])
62-
..write(" ")
63-
..write(d.year.toString())
64-
..write(d.hour <= 9 ? " 0" : " ")
65-
..write(d.hour.toString())
66-
..write(d.minute <= 9 ? ":0" : ":")
67-
..write(d.minute.toString())
68-
..write(d.second <= 9 ? ":0" : ":")
69-
..write(d.second.toString())
70-
..write(" GMT");
54+
StringBuffer sb = StringBuffer()
55+
..write(wkday[d.weekday - 1])
56+
..write(", ")
57+
..write(d.day <= 9 ? "0" : "")
58+
..write(d.day.toString())
59+
..write(" ")
60+
..write(month[d.month - 1])
61+
..write(" ")
62+
..write(d.year.toString())
63+
..write(d.hour <= 9 ? " 0" : " ")
64+
..write(d.hour.toString())
65+
..write(d.minute <= 9 ? ":0" : ":")
66+
..write(d.minute.toString())
67+
..write(d.second <= 9 ? ":0" : ":")
68+
..write(d.second.toString())
69+
..write(" GMT");
7170
return sb.toString();
7271
}
7372

sdk/lib/_http/http_headers.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -526,10 +526,9 @@ class _HttpHeaders implements HttpHeaders {
526526
// Content-Length header field when the request message does not
527527
// contain a payload body and the method semantics do not anticipate
528528
// such a body.
529-
String? ignoreHeader =
530-
_contentLength == 0 && skipZeroContentLength
531-
? HttpHeaders.contentLengthHeader
532-
: null;
529+
String? ignoreHeader = _contentLength == 0 && skipZeroContentLength
530+
? HttpHeaders.contentLengthHeader
531+
: null;
533532
_headers.forEach((String name, List<String> values) {
534533
if (ignoreHeader == name) {
535534
return;
@@ -946,8 +945,10 @@ class _ContentType extends _HeaderValue implements ContentType {
946945
if (index == -1 || index == (result._value.length - 1)) {
947946
result._primaryType = result._value.trim().toLowerCase();
948947
} else {
949-
result._primaryType =
950-
result._value.substring(0, index).trim().toLowerCase();
948+
result._primaryType = result._value
949+
.substring(0, index)
950+
.trim()
951+
.toLowerCase();
951952
result._subType = result._value.substring(index + 1).trim().toLowerCase();
952953
}
953954
return result;
@@ -1070,10 +1071,9 @@ class _Cookie implements Cookie {
10701071
"lax" => SameSite.lax,
10711072
"none" => SameSite.none,
10721073
"strict" => SameSite.strict,
1073-
_ =>
1074-
throw HttpException(
1075-
'SameSite value should be one of Lax, Strict or None.',
1076-
),
1074+
_ => throw HttpException(
1075+
'SameSite value should be one of Lax, Strict or None.',
1076+
),
10771077
};
10781078
}
10791079
if (!done()) index++; // Skip the ; character

sdk/lib/_http/http_impl.dart

Lines changed: 64 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ class _HttpProfileData {
104104

105105
Map? formatConnectionInfo(HttpConnectionInfo? connectionInfo) =>
106106
connectionInfo == null
107-
? null
108-
: {
109-
'localPort': connectionInfo.localPort,
110-
'remoteAddress': connectionInfo.remoteAddress.address,
111-
'remotePort': connectionInfo.remotePort,
112-
};
107+
? null
108+
: {
109+
'localPort': connectionInfo.localPort,
110+
'remoteAddress': connectionInfo.remoteAddress.address,
111+
'remotePort': connectionInfo.remotePort,
112+
};
113113

114114
void finishRequest({required HttpClientRequest request}) {
115115
// TODO(bkonyi): include encoding?
@@ -309,10 +309,9 @@ class _CopyingBytesBuilder implements BytesBuilder {
309309
Uint8List _buffer;
310310

311311
_CopyingBytesBuilder([int initialCapacity = 0])
312-
: _buffer =
313-
(initialCapacity <= 0)
314-
? _emptyList
315-
: Uint8List(_pow2roundup(initialCapacity));
312+
: _buffer = (initialCapacity <= 0)
313+
? _emptyList
314+
: Uint8List(_pow2roundup(initialCapacity));
316315

317316
void add(List<int> bytes) {
318317
int bytesLength = bytes.length;
@@ -555,12 +554,11 @@ class _HttpRequest extends _HttpInboundMessage implements HttpRequest {
555554
}
556555

557556
var proto = headers['x-forwarded-proto'];
558-
var scheme =
559-
proto != null
560-
? proto.first
561-
: _httpConnection._socket is SecureSocket
562-
? "https"
563-
: "http";
557+
var scheme = proto != null
558+
? proto.first
559+
: _httpConnection._socket is SecureSocket
560+
? "https"
561+
: "http";
564562
var hostList = headers['x-forwarded-host'];
565563
String host;
566564
if (hostList != null) {
@@ -1172,10 +1170,9 @@ abstract class _HttpOutboundMessage<T> extends _IOSinkImpl {
11721170
}) : _uri = uri,
11731171
headers = _HttpHeaders(
11741172
protocolVersion,
1175-
defaultPortForScheme:
1176-
uri.isScheme('https')
1177-
? HttpClient.defaultHttpsPort
1178-
: HttpClient.defaultHttpPort,
1173+
defaultPortForScheme: uri.isScheme('https')
1174+
? HttpClient.defaultHttpsPort
1175+
: HttpClient.defaultHttpPort,
11791176
initialHeaders: initialHeaders,
11801177
),
11811178
_outgoing = outgoing,
@@ -1540,11 +1537,10 @@ class _HttpClientRequest extends _HttpOutboundMessage<HttpClientResponse>
15401537
}, onError: (e) {});
15411538
}
15421539

1543-
Future<HttpClientResponse> get done =>
1544-
_response ??= Future.wait([
1545-
_responseCompleter.future,
1546-
super.done,
1547-
], eagerError: true).then((list) => list[0]);
1540+
Future<HttpClientResponse> get done => _response ??= Future.wait([
1541+
_responseCompleter.future,
1542+
super.done,
1543+
], eagerError: true).then((list) => list[0]);
15481544

15491545
Future<HttpClientResponse> close() {
15501546
if (!_aborted) {
@@ -2238,11 +2234,10 @@ class _HttpClientConnection {
22382234
);
22392235
_nextResponseCompleter = null;
22402236
},
2241-
test:
2242-
(error) =>
2243-
error is HttpException ||
2244-
error is SocketException ||
2245-
error is TlsException,
2237+
test: (error) =>
2238+
error is HttpException ||
2239+
error is SocketException ||
2240+
error is TlsException,
22462241
);
22472242
} else {
22482243
_nextResponseCompleter!.complete(incoming);
@@ -2521,11 +2516,10 @@ class _HttpClientConnection {
25212516
profileData?.requestEvent(error);
25222517
throw HttpException(error, uri: request.uri);
25232518
}
2524-
var socket =
2525-
(response as _HttpClientResponse)
2526-
._httpRequest
2527-
._httpClientConnection
2528-
._socket;
2519+
var socket = (response as _HttpClientResponse)
2520+
._httpRequest
2521+
._httpClientConnection
2522+
._socket;
25292523
return SecureSocket.secure(
25302524
socket,
25312525
host: host,
@@ -2699,16 +2693,15 @@ class _ConnectionTarget {
26992693
connectionTask = cf(uri, host, port);
27002694
}
27012695
} else {
2702-
connectionTask =
2703-
(isSecure && proxy.isDirect
2704-
? SecureSocket.startConnect(
2705-
host,
2706-
port,
2707-
context: context,
2708-
onBadCertificate: callback,
2709-
keyLog: client._keyLog,
2710-
)
2711-
: Socket.startConnect(host, port));
2696+
connectionTask = (isSecure && proxy.isDirect
2697+
? SecureSocket.startConnect(
2698+
host,
2699+
port,
2700+
context: context,
2701+
onBadCertificate: callback,
2702+
keyLog: client._keyLog,
2703+
)
2704+
: Socket.startConnect(host, port));
27122705
}
27132706
_connecting++;
27142707
return connectionTask.then(
@@ -3030,8 +3023,9 @@ class _HttpClient implements HttpClient {
30303023

30313024
int port = uri.port;
30323025
if (port == 0) {
3033-
port =
3034-
isSecure ? HttpClient.defaultHttpsPort : HttpClient.defaultHttpPort;
3026+
port = isSecure
3027+
? HttpClient.defaultHttpsPort
3028+
: HttpClient.defaultHttpPort;
30353029
}
30363030
// Check to see if a proxy server should be used for this connection.
30373031
var proxyConf = const _ProxyConfiguration.direct();
@@ -3947,13 +3941,12 @@ abstract class _Credentials {
39473941
// http://tools.ietf.org/html/draft-reschke-basicauth-enc-06. For
39483942
// now always use UTF-8 encoding.
39493943
var creds = credentials as _HttpClientDigestCredentials;
3950-
var hasher =
3951-
_MD5()
3952-
..add(utf8.encode(creds.username))
3953-
..add([_CharCode.COLON])
3954-
..add(realm.codeUnits)
3955-
..add([_CharCode.COLON])
3956-
..add(utf8.encode(creds.password));
3944+
var hasher = _MD5()
3945+
..add(utf8.encode(creds.username))
3946+
..add([_CharCode.COLON])
3947+
..add(realm.codeUnits)
3948+
..add([_CharCode.COLON])
3949+
..add(utf8.encode(creds.password));
39573950
ha1 = _CryptoUtils.bytesToHex(hasher.close());
39583951
}
39593952
}
@@ -3972,8 +3965,9 @@ class _SiteCredentials extends _Credentials {
39723965
bool applies(Uri uri, _AuthenticationScheme? scheme) {
39733966
if (scheme != null && credentials.scheme != scheme) return false;
39743967
if (uri.host != this.uri.host) return false;
3975-
int thisPort =
3976-
this.uri.port == 0 ? HttpClient.defaultHttpPort : this.uri.port;
3968+
int thisPort = this.uri.port == 0
3969+
? HttpClient.defaultHttpPort
3970+
: this.uri.port;
39773971
int otherPort = uri.port == 0 ? HttpClient.defaultHttpPort : uri.port;
39783972
if (otherPort != thisPort) return false;
39793973
return uri.path.startsWith(this.uri.path);
@@ -4085,20 +4079,18 @@ final class _HttpClientDigestCredentials extends _HttpClientCredentials
40854079

40864080
String authorization(_Credentials credentials, _HttpClientRequest request) {
40874081
String requestUri = request._requestUri();
4088-
_MD5 hasher =
4089-
_MD5()
4090-
..add(request.method.codeUnits)
4091-
..add([_CharCode.COLON])
4092-
..add(requestUri.codeUnits);
4082+
_MD5 hasher = _MD5()
4083+
..add(request.method.codeUnits)
4084+
..add([_CharCode.COLON])
4085+
..add(requestUri.codeUnits);
40934086
var ha2 = _CryptoUtils.bytesToHex(hasher.close());
40944087

40954088
bool isAuth = false;
40964089
String cnonce = "";
40974090
String nc = "";
4098-
hasher =
4099-
_MD5()
4100-
..add(credentials.ha1!.codeUnits)
4101-
..add([_CharCode.COLON]);
4091+
hasher = _MD5()
4092+
..add(credentials.ha1!.codeUnits)
4093+
..add([_CharCode.COLON]);
41024094
if (credentials.qop == "auth") {
41034095
isAuth = true;
41044096
cnonce = _CryptoUtils.bytesToHex(_CryptoUtils.getRandomBytes(4));
@@ -4123,14 +4115,13 @@ final class _HttpClientDigestCredentials extends _HttpClientCredentials
41234115
}
41244116
var response = _CryptoUtils.bytesToHex(hasher.close());
41254117

4126-
StringBuffer buffer =
4127-
StringBuffer()
4128-
..write('Digest ')
4129-
..write('username="$username"')
4130-
..write(', realm="${credentials.realm}"')
4131-
..write(', nonce="${credentials.nonce}"')
4132-
..write(', uri="$requestUri"')
4133-
..write(', algorithm="${credentials.algorithm}"');
4118+
StringBuffer buffer = StringBuffer()
4119+
..write('Digest ')
4120+
..write('username="$username"')
4121+
..write(', realm="${credentials.realm}"')
4122+
..write(', nonce="${credentials.nonce}"')
4123+
..write(', uri="$requestUri"')
4124+
..write(', algorithm="${credentials.algorithm}"');
41344125
if (isAuth) {
41354126
buffer
41364127
..write(', qop="auth"')

sdk/lib/_http/http_parser.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,8 +1176,11 @@ class _HttpParser extends Stream<_HttpIncoming> {
11761176
assert(_bodyController == null);
11771177
assert(!_bodyPaused);
11781178
var controller = _bodyController = StreamController<Uint8List>(sync: true);
1179-
var incoming =
1180-
_incoming = _HttpIncoming(_headers!, transferLength, controller.stream);
1179+
var incoming = _incoming = _HttpIncoming(
1180+
_headers!,
1181+
transferLength,
1182+
controller.stream,
1183+
);
11811184
controller
11821185
..onListen = () {
11831186
if (incoming != _incoming) return;

0 commit comments

Comments
 (0)