OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 class _HttpHeaders implements HttpHeaders { | 5 class _HttpHeaders implements HttpHeaders { |
6 _HttpHeaders() : _headers = new Map<String, List<String>>(); | 6 _HttpHeaders() : _headers = new Map<String, List<String>>(); |
7 | 7 |
8 List<String> operator[](String name) { | 8 List<String> operator[](String name) { |
9 name = name.toLowerCase(); | 9 name = name.toLowerCase(); |
10 return _headers[name]; | 10 return _headers[name]; |
(...skipping 2455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2466 sockets = new Queue(); | 2466 sockets = new Queue(); |
2467 _openSockets[key] = sockets; | 2467 _openSockets[key] = sockets; |
2468 } | 2468 } |
2469 | 2469 |
2470 // If there is currently no eviction timer start one. | 2470 // If there is currently no eviction timer start one. |
2471 if (_evictionTimer == null) { | 2471 if (_evictionTimer == null) { |
2472 void _handleEviction(Timer timer) { | 2472 void _handleEviction(Timer timer) { |
2473 Date now = new Date.now(); | 2473 Date now = new Date.now(); |
2474 List<String> emptyKeys = new List<String>(); | 2474 List<String> emptyKeys = new List<String>(); |
2475 _openSockets.forEach( | 2475 _openSockets.forEach( |
2476 void _(String key, Queue<_SocketConnection> connections) { | 2476 (String key, Queue<_SocketConnection> connections) { |
2477 // As returned connections are added at the head of the | 2477 // As returned connections are added at the head of the |
2478 // list remove from the tail. | 2478 // list remove from the tail. |
2479 while (!connections.isEmpty) { | 2479 while (!connections.isEmpty) { |
2480 _SocketConnection socketConn = connections.last; | 2480 _SocketConnection socketConn = connections.last; |
2481 if (socketConn._idleTime(now).inMilliseconds > | 2481 if (socketConn._idleTime(now).inMilliseconds > |
2482 DEFAULT_EVICTION_TIMEOUT) { | 2482 DEFAULT_EVICTION_TIMEOUT) { |
2483 connections.removeLast(); | 2483 connections.removeLast(); |
2484 socketConn._socket.close(); | 2484 socketConn._socket.close(); |
2485 if (connections.isEmpty) emptyKeys.add(key); | 2485 if (connections.isEmpty) emptyKeys.add(key); |
2486 } else { | 2486 } else { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2655 | 2655 |
2656 | 2656 |
2657 class _RedirectInfo implements RedirectInfo { | 2657 class _RedirectInfo implements RedirectInfo { |
2658 const _RedirectInfo(int this.statusCode, | 2658 const _RedirectInfo(int this.statusCode, |
2659 String this.method, | 2659 String this.method, |
2660 Uri this.location); | 2660 Uri this.location); |
2661 final int statusCode; | 2661 final int statusCode; |
2662 final String method; | 2662 final String method; |
2663 final Uri location; | 2663 final Uri location; |
2664 } | 2664 } |
OLD | NEW |