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

Side by Side Diff: lib/src/web_socket.dart

Issue 853353004: http_parser: update unittest dependency, urls in pubspec and codereview (Closed) Base URL: https://github.com/dart-lang/http_parser.git@master
Patch Set: Created 5 years, 11 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 | « codereview.settings ('k') | pubspec.yaml » ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library http_parser.web_socket; 5 library http_parser.web_socket;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:math'; 9 import 'dart:math';
10 import 'dart:typed_data'; 10 import 'dart:typed_data';
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 headerSize += 8; 585 headerSize += 8;
586 } else if (dataLength > 125) { 586 } else if (dataLength > 125) {
587 headerSize += 2; 587 headerSize += 2;
588 } 588 }
589 Uint8List header = new Uint8List(headerSize); 589 Uint8List header = new Uint8List(headerSize);
590 int index = 0; 590 int index = 0;
591 // Set FIN and opcode. 591 // Set FIN and opcode.
592 header[index++] = 0x80 | opcode; 592 header[index++] = 0x80 | opcode;
593 // Determine size and position of length field. 593 // Determine size and position of length field.
594 int lengthBytes = 1; 594 int lengthBytes = 1;
595 int firstLengthByte = 1;
596 if (dataLength > 65535) { 595 if (dataLength > 65535) {
597 header[index++] = 127; 596 header[index++] = 127;
598 lengthBytes = 8; 597 lengthBytes = 8;
599 } else if (dataLength > 125) { 598 } else if (dataLength > 125) {
600 header[index++] = 126; 599 header[index++] = 126;
601 lengthBytes = 2; 600 lengthBytes = 2;
602 } 601 }
603 // Write the length in network byte order into the header. 602 // Write the length in network byte order into the header.
604 for (int i = 0; i < lengthBytes; i++) { 603 for (int i = 0; i < lengthBytes; i++) {
605 header[index++] = dataLength >> (((lengthBytes - 1) - i) * 8) & 0xFF; 604 header[index++] = dataLength >> (((lengthBytes - 1) - i) * 8) & 0xFF;
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 code == _WebSocketStatus.RESERVED_1004 || 926 code == _WebSocketStatus.RESERVED_1004 ||
928 code == _WebSocketStatus.NO_STATUS_RECEIVED || 927 code == _WebSocketStatus.NO_STATUS_RECEIVED ||
929 code == _WebSocketStatus.ABNORMAL_CLOSURE || 928 code == _WebSocketStatus.ABNORMAL_CLOSURE ||
930 (code > _WebSocketStatus.INTERNAL_SERVER_ERROR && 929 (code > _WebSocketStatus.INTERNAL_SERVER_ERROR &&
931 code < _WebSocketStatus.RESERVED_1015) || 930 code < _WebSocketStatus.RESERVED_1015) ||
932 (code >= _WebSocketStatus.RESERVED_1015 && 931 (code >= _WebSocketStatus.RESERVED_1015 &&
933 code < 3000)); 932 code < 3000));
934 } 933 }
935 } 934 }
936 935
OLDNEW
« no previous file with comments | « codereview.settings ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698