Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Side by Side Diff: sdk/lib/io/websocket.dart

Issue 2754013002: Format all dart: library files (Closed)
Patch Set: Format all dart: library files Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sdk/lib/io/string_transformer.dart ('k') | sdk/lib/io/websocket_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * WebSocket status codes used when closing a WebSocket connection. 8 * WebSocket status codes used when closing a WebSocket connection.
9 */ 9 */
10 abstract class WebSocketStatus { 10 abstract class WebSocketStatus {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 String part; 88 String part;
89 if (requested?.parameters != null) { 89 if (requested?.parameters != null) {
90 part = requested.parameters[_serverMaxWindowBits]; 90 part = requested.parameters[_serverMaxWindowBits];
91 } 91 }
92 if (part != null) { 92 if (part != null) {
93 if (part.length >= 2 && part.startsWith('0')) { 93 if (part.length >= 2 && part.startsWith('0')) {
94 throw new ArgumentError("Illegal 0 padding on value."); 94 throw new ArgumentError("Illegal 0 padding on value.");
95 } else { 95 } else {
96 mwb = serverMaxWindowBits == null 96 mwb = serverMaxWindowBits == null
97 ? int.parse(part, 97 ? int.parse(part,
98 onError: (source) => _WebSocketImpl.DEFAULT_WINDOW_BITS) 98 onError: (source) => _WebSocketImpl.DEFAULT_WINDOW_BITS)
99 : serverMaxWindowBits; 99 : serverMaxWindowBits;
100 info.headerValue = "; server_max_window_bits=${mwb}"; 100 info.headerValue = "; server_max_window_bits=${mwb}";
101 info.maxWindowBits = mwb; 101 info.maxWindowBits = mwb;
102 } 102 }
103 } else { 103 } else {
104 info.headerValue = ""; 104 info.headerValue = "";
105 info.maxWindowBits = _WebSocketImpl.DEFAULT_WINDOW_BITS; 105 info.maxWindowBits = _WebSocketImpl.DEFAULT_WINDOW_BITS;
106 } 106 }
107 return info; 107 return info;
108 } 108 }
(...skipping 30 matching lines...) Expand all
139 /// response headers and negotiated maxWindowBits value. 139 /// response headers and negotiated maxWindowBits value.
140 _CompressionMaxWindowBits _createHeader([HeaderValue requested]) { 140 _CompressionMaxWindowBits _createHeader([HeaderValue requested]) {
141 var info = new _CompressionMaxWindowBits("", 0); 141 var info = new _CompressionMaxWindowBits("", 0);
142 if (!enabled) { 142 if (!enabled) {
143 return info; 143 return info;
144 } 144 }
145 145
146 info.headerValue = _WebSocketImpl.PER_MESSAGE_DEFLATE; 146 info.headerValue = _WebSocketImpl.PER_MESSAGE_DEFLATE;
147 147
148 if (clientNoContextTakeover && 148 if (clientNoContextTakeover &&
149 (requested == null || (requested != null && 149 (requested == null ||
150 requested.parameters.containsKey(_clientNoContextTakeover)))) { 150 (requested != null &&
151 requested.parameters.containsKey(_clientNoContextTakeover)))) {
151 info.headerValue += "; client_no_context_takeover"; 152 info.headerValue += "; client_no_context_takeover";
152 } 153 }
153 154
154 if (serverNoContextTakeover && 155 if (serverNoContextTakeover &&
155 (requested == null || (requested != null && 156 (requested == null ||
156 requested.parameters.containsKey(_serverNoContextTakeover)))) { 157 (requested != null &&
158 requested.parameters.containsKey(_serverNoContextTakeover)))) {
157 info.headerValue += "; server_no_context_takeover"; 159 info.headerValue += "; server_no_context_takeover";
158 } 160 }
159 161
160 var headerList = _createServerResponseHeader(requested); 162 var headerList = _createServerResponseHeader(requested);
161 info.headerValue += headerList.headerValue; 163 info.headerValue += headerList.headerValue;
162 info.maxWindowBits = headerList.maxWindowBits; 164 info.maxWindowBits = headerList.maxWindowBits;
163 165
164 info.headerValue += 166 info.headerValue +=
165 _createClientRequestHeader(requested, info.maxWindowBits); 167 _createClientRequestHeader(requested, info.maxWindowBits);
166 168
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 251 }
250 } 252 }
251 253
252 /** 254 /**
253 * A two-way HTTP communication object for client or server applications. 255 * A two-way HTTP communication object for client or server applications.
254 * 256 *
255 * The stream exposes the messages received. A text message will be of type 257 * The stream exposes the messages received. A text message will be of type
256 * `String` and a binary message will be of type `List<int>`. 258 * `String` and a binary message will be of type `List<int>`.
257 */ 259 */
258 abstract class WebSocket 260 abstract class WebSocket
259 implements Stream<dynamic/*String|List<int>*/>, 261 implements
260 StreamSink<dynamic/*String|List<int>*/> { 262 Stream<dynamic /*String|List<int>*/ >,
263 StreamSink<dynamic /*String|List<int>*/ > {
261 /** 264 /**
262 * Possible states of the connection. 265 * Possible states of the connection.
263 */ 266 */
264 static const int CONNECTING = 0; 267 static const int CONNECTING = 0;
265 static const int OPEN = 1; 268 static const int OPEN = 1;
266 static const int CLOSING = 2; 269 static const int CLOSING = 2;
267 static const int CLOSED = 3; 270 static const int CLOSED = 3;
268 271
269 /** 272 /**
270 * Set and get the interval for sending ping signals. If a ping message is not 273 * Set and get the interval for sending ping signals. If a ping message is not
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 void addUtf8Text(List<int> bytes); 415 void addUtf8Text(List<int> bytes);
413 } 416 }
414 417
415 class WebSocketException implements IOException { 418 class WebSocketException implements IOException {
416 final String message; 419 final String message;
417 420
418 const WebSocketException([this.message = ""]); 421 const WebSocketException([this.message = ""]);
419 422
420 String toString() => "WebSocketException: $message"; 423 String toString() => "WebSocketException: $message";
421 } 424 }
OLDNEW
« no previous file with comments | « sdk/lib/io/string_transformer.dart ('k') | sdk/lib/io/websocket_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698