mirror of
https://github.com/dart-lang/sdk
synced 2024-09-20 23:41:18 +00:00
[dart:io] Stop accessing http header with _add()
Several places adds HttpHeader with _add() instead of public add(). This skips some validation checks. Bug: https://github.com/dart-lang/sdk/issues/40905 Change-Id: Ifcb16fcd40fb93914540f6bf09f476f621c36e15 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138860 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Zichang Guo <zichangguo@google.com>
This commit is contained in:
parent
784b17dd24
commit
6a5b87f92c
|
@ -1760,9 +1760,9 @@ class _HttpClientConnection {
|
|||
request.headers
|
||||
..host = host
|
||||
..port = port
|
||||
.._add(HttpHeaders.acceptEncodingHeader, "gzip");
|
||||
..add(HttpHeaders.acceptEncodingHeader, "gzip");
|
||||
if (_httpClient.userAgent != null) {
|
||||
request.headers._add(HttpHeaders.userAgentHeader, _httpClient.userAgent);
|
||||
request.headers.add(HttpHeaders.userAgentHeader, _httpClient.userAgent);
|
||||
}
|
||||
if (proxy.isAuthenticated) {
|
||||
// If the proxy configuration contains user information use that
|
||||
|
|
|
@ -680,10 +680,10 @@ class _HttpParser extends Stream<_HttpIncoming> {
|
|||
(isUpgrade && isResponse && isUpgradeCode)) {
|
||||
_connectionUpgrade = true;
|
||||
}
|
||||
_headers._add(headerField, tokens[i]);
|
||||
_headers.add(headerField, tokens[i]);
|
||||
}
|
||||
} else {
|
||||
_headers._add(headerField, headerValue);
|
||||
_headers.add(headerField, headerValue);
|
||||
}
|
||||
_headerField.clear();
|
||||
_headerValue.clear();
|
||||
|
|
|
@ -1758,9 +1758,9 @@ class _HttpClientConnection {
|
|||
request.headers
|
||||
..host = host
|
||||
..port = port
|
||||
.._add(HttpHeaders.acceptEncodingHeader, "gzip");
|
||||
..add(HttpHeaders.acceptEncodingHeader, "gzip");
|
||||
if (_httpClient.userAgent != null) {
|
||||
request.headers._add(HttpHeaders.userAgentHeader, _httpClient.userAgent);
|
||||
request.headers.add(HttpHeaders.userAgentHeader, _httpClient.userAgent!);
|
||||
}
|
||||
if (proxy.isAuthenticated) {
|
||||
// If the proxy configuration contains user information use that
|
||||
|
|
|
@ -680,10 +680,10 @@ class _HttpParser extends Stream<_HttpIncoming> {
|
|||
(isUpgrade && isResponse && isUpgradeCode)) {
|
||||
_connectionUpgrade = true;
|
||||
}
|
||||
headers._add(headerField, tokens[i]);
|
||||
headers.add(headerField, tokens[i]);
|
||||
}
|
||||
} else {
|
||||
headers._add(headerField, headerValue);
|
||||
headers.add(headerField, headerValue);
|
||||
}
|
||||
_headerField.clear();
|
||||
_headerValue.clear();
|
||||
|
|
Loading…
Reference in a new issue