From da050a2b160923796fd10dd6911fa28cc7df9c98 Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Wed, 8 Jun 2022 16:57:32 +0000 Subject: [PATCH] Reland "Remove SCREAMING dart:io networking APIs" This is a reland of commit abfdc3d50f6cf66165767da8df4f681a68467178 Original change's description: > Remove SCREAMING dart:io networking APIs > > Bug: https://github.com/dart-lang/sdk/issues/49140 > Change-Id: I50c6cca26597ee4d469b776fcec412ddfed760e1 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246962 > Reviewed-by: Paul Berry > Commit-Queue: Michael Thomsen Bug: https://github.com/dart-lang/sdk/issues/49140 Change-Id: I64a4bdb69909dd864e84efae7dc423fc435e40ce Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247543 Reviewed-by: Oleh Prypin Reviewed-by: Paul Berry Commit-Queue: Michael Thomsen --- CHANGELOG.md | 5 + ...mock_http_headers.dart.weak.outline.expect | 8 +- sdk/lib/_http/http.dart | 124 ------------------ sdk/lib/_http/websocket.dart | 40 ------ 4 files changed, 9 insertions(+), 168 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3791d3c9e44..ac2b73ad6ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,11 @@ them, you must set the lower bound on the SDK constraint for your package to #### `dart:io` +- **Breaking Change** [#34218](https://github.com/dart-lang/sdk/issues/34218): + Constants in `dart:io`'s networking APIs following the `SCREAMING_CAPS` + convention have been removed (they were previously deprecated). Please use + the corresponding `lowerCamelCase` constants instead. + - **Breaking Change** [#45630][]: The Dart VM no longer automatically restores the initial terminal settings upon exit. Programs that change the `Stdin` settings `lineMode` and `echoMode` are now responsible for restoring the diff --git a/pkg/front_end/testcases/nnbd_mixed/mock_http_headers.dart.weak.outline.expect b/pkg/front_end/testcases/nnbd_mixed/mock_http_headers.dart.weak.outline.expect index ed2219b040e..0524cac834d 100644 --- a/pkg/front_end/testcases/nnbd_mixed/mock_http_headers.dart.weak.outline.expect +++ b/pkg/front_end/testcases/nnbd_mixed/mock_http_headers.dart.weak.outline.expect @@ -170,8 +170,8 @@ Evaluated: MapLiteral @ org-dartlang-testcase:///mock_http_headers.dart:13:7 -> Evaluated: SymbolLiteral @ org-dartlang-testcase:///mock_http_headers.dart:13:7 -> SymbolConstant(#noFolding) Evaluated: ListLiteral @ org-dartlang-testcase:///mock_http_headers.dart:13:7 -> ListConstant(const []) Evaluated: MapLiteral @ org-dartlang-testcase:///mock_http_headers.dart:13:7 -> MapConstant(const {}) -Evaluated: SymbolLiteral @ org-dartlang-sdk:///sdk/lib/_http/http.dart:676:8 -> SymbolConstant(#clear) -Evaluated: ListLiteral @ org-dartlang-sdk:///sdk/lib/_http/http.dart:676:8 -> ListConstant(const []) -Evaluated: ListLiteral @ org-dartlang-sdk:///sdk/lib/_http/http.dart:676:8 -> ListConstant(const []) -Evaluated: MapLiteral @ org-dartlang-sdk:///sdk/lib/_http/http.dart:676:8 -> MapConstant(const {}) +Evaluated: SymbolLiteral @ org-dartlang-sdk:///sdk/lib/_http/http.dart:564:8 -> SymbolConstant(#clear) +Evaluated: ListLiteral @ org-dartlang-sdk:///sdk/lib/_http/http.dart:564:8 -> ListConstant(const []) +Evaluated: ListLiteral @ org-dartlang-sdk:///sdk/lib/_http/http.dart:564:8 -> ListConstant(const []) +Evaluated: MapLiteral @ org-dartlang-sdk:///sdk/lib/_http/http.dart:564:8 -> MapConstant(const {}) Extra constant evaluation: evaluated: 268, effectively constant: 91 diff --git a/sdk/lib/_http/http.dart b/sdk/lib/_http/http.dart index 6ea7e646bce..e10c97c31e1 100644 --- a/sdk/lib/_http/http.dart +++ b/sdk/lib/_http/http.dart @@ -384,110 +384,10 @@ abstract class HttpHeaders { static const warningHeader = "warning"; static const wwwAuthenticateHeader = "www-authenticate"; - @Deprecated("Use acceptHeader instead") - static const ACCEPT = acceptHeader; - @Deprecated("Use acceptCharsetHeader instead") - static const ACCEPT_CHARSET = acceptCharsetHeader; - @Deprecated("Use acceptEncodingHeader instead") - static const ACCEPT_ENCODING = acceptEncodingHeader; - @Deprecated("Use acceptLanguageHeader instead") - static const ACCEPT_LANGUAGE = acceptLanguageHeader; - @Deprecated("Use acceptRangesHeader instead") - static const ACCEPT_RANGES = acceptRangesHeader; - @Deprecated("Use ageHeader instead") - static const AGE = ageHeader; - @Deprecated("Use allowHeader instead") - static const ALLOW = allowHeader; - @Deprecated("Use authorizationHeader instead") - static const AUTHORIZATION = authorizationHeader; - @Deprecated("Use cacheControlHeader instead") - static const CACHE_CONTROL = cacheControlHeader; - @Deprecated("Use connectionHeader instead") - static const CONNECTION = connectionHeader; - @Deprecated("Use contentEncodingHeader instead") - static const CONTENT_ENCODING = contentEncodingHeader; - @Deprecated("Use contentLanguageHeader instead") - static const CONTENT_LANGUAGE = contentLanguageHeader; - @Deprecated("Use contentLengthHeader instead") - static const CONTENT_LENGTH = contentLengthHeader; - @Deprecated("Use contentLocationHeader instead") - static const CONTENT_LOCATION = contentLocationHeader; - @Deprecated("Use contentMD5Header instead") - static const CONTENT_MD5 = contentMD5Header; - @Deprecated("Use contentRangeHeader instead") - static const CONTENT_RANGE = contentRangeHeader; - @Deprecated("Use contentTypeHeader instead") - static const CONTENT_TYPE = contentTypeHeader; - @Deprecated("Use dateHeader instead") - static const DATE = dateHeader; - @Deprecated("Use etagHeader instead") - static const ETAG = etagHeader; - @Deprecated("Use expectHeader instead") - static const EXPECT = expectHeader; - @Deprecated("Use expiresHeader instead") - static const EXPIRES = expiresHeader; - @Deprecated("Use fromHeader instead") - static const FROM = fromHeader; - @Deprecated("Use hostHeader instead") - static const HOST = hostHeader; - @Deprecated("Use ifMatchHeader instead") - static const IF_MATCH = ifMatchHeader; - @Deprecated("Use ifModifiedSinceHeader instead") - static const IF_MODIFIED_SINCE = ifModifiedSinceHeader; - @Deprecated("Use ifNoneMatchHeader instead") - static const IF_NONE_MATCH = ifNoneMatchHeader; - @Deprecated("Use ifRangeHeader instead") - static const IF_RANGE = ifRangeHeader; - @Deprecated("Use ifUnmodifiedSinceHeader instead") - static const IF_UNMODIFIED_SINCE = ifUnmodifiedSinceHeader; - @Deprecated("Use lastModifiedHeader instead") - static const LAST_MODIFIED = lastModifiedHeader; - @Deprecated("Use locationHeader instead") - static const LOCATION = locationHeader; - @Deprecated("Use maxForwardsHeader instead") - static const MAX_FORWARDS = maxForwardsHeader; - @Deprecated("Use pragmaHeader instead") - static const PRAGMA = pragmaHeader; - @Deprecated("Use proxyAuthenticateHeader instead") - static const PROXY_AUTHENTICATE = proxyAuthenticateHeader; - @Deprecated("Use proxyAuthorizationHeader instead") - static const PROXY_AUTHORIZATION = proxyAuthorizationHeader; - @Deprecated("Use rangeHeader instead") - static const RANGE = rangeHeader; - @Deprecated("Use refererHeader instead") - static const REFERER = refererHeader; - @Deprecated("Use retryAfterHeader instead") - static const RETRY_AFTER = retryAfterHeader; - @Deprecated("Use serverHeader instead") - static const SERVER = serverHeader; - @Deprecated("Use teHeader instead") - static const TE = teHeader; - @Deprecated("Use trailerHeader instead") - static const TRAILER = trailerHeader; - @Deprecated("Use transferEncodingHeader instead") - static const TRANSFER_ENCODING = transferEncodingHeader; - @Deprecated("Use upgradeHeader instead") - static const UPGRADE = upgradeHeader; - @Deprecated("Use userAgentHeader instead") - static const USER_AGENT = userAgentHeader; - @Deprecated("Use varyHeader instead") - static const VARY = varyHeader; - @Deprecated("Use viaHeader instead") - static const VIA = viaHeader; - @Deprecated("Use warningHeader instead") - static const WARNING = warningHeader; - @Deprecated("Use wwwAuthenticateHeader instead") - static const WWW_AUTHENTICATE = wwwAuthenticateHeader; - // Cookie headers from RFC 6265. static const cookieHeader = "cookie"; static const setCookieHeader = "set-cookie"; - @Deprecated("Use cookieHeader instead") - static const COOKIE = cookieHeader; - @Deprecated("Use setCookieHeader instead") - static const SET_COOKIE = setCookieHeader; - // TODO(39783): Document this. static const generalHeaders = [ cacheControlHeader, @@ -501,9 +401,6 @@ abstract class HttpHeaders { warningHeader ]; - @Deprecated("Use generalHeaders instead") - static const GENERAL_HEADERS = generalHeaders; - static const entityHeaders = [ allowHeader, contentEncodingHeader, @@ -517,9 +414,6 @@ abstract class HttpHeaders { lastModifiedHeader ]; - @Deprecated("Use entityHeaders instead") - static const ENTITY_HEADERS = entityHeaders; - static const responseHeaders = [ acceptRangesHeader, ageHeader, @@ -532,9 +426,6 @@ abstract class HttpHeaders { wwwAuthenticateHeader ]; - @Deprecated("Use responseHeaders instead") - static const RESPONSE_HEADERS = responseHeaders; - static const requestHeaders = [ acceptHeader, acceptCharsetHeader, @@ -557,9 +448,6 @@ abstract class HttpHeaders { userAgentHeader ]; - @Deprecated("Use requestHeaders instead") - static const REQUEST_HEADERS = requestHeaders; - /// The date specified by the [dateHeader] header, if any. DateTime? date; @@ -773,29 +661,21 @@ abstract class ContentType implements HeaderValue { /// /// text/plain; charset=utf-8 static final text = ContentType("text", "plain", charset: "utf-8"); - @Deprecated("Use text instead") - static final TEXT = text; /// Content type for HTML using UTF-8 encoding. /// /// text/html; charset=utf-8 static final html = ContentType("text", "html", charset: "utf-8"); - @Deprecated("Use html instead") - static final HTML = html; /// Content type for JSON using UTF-8 encoding. /// /// application/json; charset=utf-8 static final json = ContentType("application", "json", charset: "utf-8"); - @Deprecated("Use json instead") - static final JSON = json; /// Content type for binary data. /// /// application/octet-stream static final binary = ContentType("application", "octet-stream"); - @Deprecated("Use binary instead") - static final BINARY = binary; /// Creates a new content type object setting the primary type and /// sub type. The charset and additional parameters can also be set @@ -1262,12 +1142,8 @@ abstract class HttpResponse implements IOSink { /// client.findProxy = null; abstract class HttpClient { static const int defaultHttpPort = 80; - @Deprecated("Use defaultHttpPort instead") - static const int DEFAULT_HTTP_PORT = defaultHttpPort; static const int defaultHttpsPort = 443; - @Deprecated("Use defaultHttpsPort instead") - static const int DEFAULT_HTTPS_PORT = defaultHttpsPort; /// Enable logging of HTTP requests from all [HttpClient]s to the developer /// timeline. diff --git a/sdk/lib/_http/websocket.dart b/sdk/lib/_http/websocket.dart index 9503ae303ab..a01823c3753 100644 --- a/sdk/lib/_http/websocket.dart +++ b/sdk/lib/_http/websocket.dart @@ -19,33 +19,6 @@ abstract class WebSocketStatus { static const int missingMandatoryExtension = 1010; static const int internalServerError = 1011; static const int reserved1015 = 1015; - - @Deprecated("Use normalClosure instead") - static const int NORMAL_CLOSURE = normalClosure; - @Deprecated("Use goingAway instead") - static const int GOING_AWAY = goingAway; - @Deprecated("Use protocolError instead") - static const int PROTOCOL_ERROR = protocolError; - @Deprecated("Use unsupportedData instead") - static const int UNSUPPORTED_DATA = unsupportedData; - @Deprecated("Use reserved1004 instead") - static const int RESERVED_1004 = reserved1004; - @Deprecated("Use noStatusReceived instead") - static const int NO_STATUS_RECEIVED = noStatusReceived; - @Deprecated("Use abnormalClosure instead") - static const int ABNORMAL_CLOSURE = abnormalClosure; - @Deprecated("Use invalidFramePayloadData instead") - static const int INVALID_FRAME_PAYLOAD_DATA = invalidFramePayloadData; - @Deprecated("Use policyViolation instead") - static const int POLICY_VIOLATION = policyViolation; - @Deprecated("Use messageTooBig instead") - static const int MESSAGE_TOO_BIG = messageTooBig; - @Deprecated("Use missingMandatoryExtension instead") - static const int MISSING_MANDATORY_EXTENSION = missingMandatoryExtension; - @Deprecated("Use internalServerError instead") - static const int INTERNAL_SERVER_ERROR = internalServerError; - @Deprecated("Use reserved1015 instead") - static const int RESERVED_1015 = reserved1015; } /// Options controlling compression in a [WebSocket]. @@ -68,8 +41,6 @@ class CompressionOptions { /// * `clientMaxWindowBits`: null (default maximal window size of 15 bits) /// * `serverMaxWindowBits`: null (default maximal window size of 15 bits) static const CompressionOptions compressionDefault = CompressionOptions(); - @Deprecated("Use compressionDefault instead") - static const CompressionOptions DEFAULT = compressionDefault; /// No-compression configuration. /// @@ -77,8 +48,6 @@ class CompressionOptions { /// [WebSocket]. static const CompressionOptions compressionOff = CompressionOptions(enabled: false); - @Deprecated("Use compressionOff instead") - static const CompressionOptions OFF = compressionOff; /// Whether the client will reuse its compression instances. final bool clientNoContextTakeover; @@ -300,15 +269,6 @@ abstract class WebSocket static const int closing = 2; static const int closed = 3; - @Deprecated("Use connecting instead") - static const int CONNECTING = connecting; - @Deprecated("Use open instead") - static const int OPEN = open; - @Deprecated("Use closing instead") - static const int CLOSING = closing; - @Deprecated("Use closed instead") - static const int CLOSED = closed; - /// The interval between ping signals. /// /// A ping message is sent every [pingInterval], starting at the first