| 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 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 | 1244 |
| 1245 void set onError(void callback(e)) { | 1245 void set onError(void callback(e)) { |
| 1246 _requestOrResponse._streamSetErrorHandler(callback); | 1246 _requestOrResponse._streamSetErrorHandler(callback); |
| 1247 } | 1247 } |
| 1248 | 1248 |
| 1249 _HttpRequestResponseBase _requestOrResponse; | 1249 _HttpRequestResponseBase _requestOrResponse; |
| 1250 } | 1250 } |
| 1251 | 1251 |
| 1252 | 1252 |
| 1253 class _HttpConnectionBase { | 1253 class _HttpConnectionBase { |
| 1254 _HttpConnectionBase() : _sendBuffers = new Queue(), | 1254 _HttpConnectionBase() : _httpParser = new _HttpParser(), |
| 1255 _httpParser = new _HttpParser(), | |
| 1256 hashCode = _nextHashCode { | 1255 hashCode = _nextHashCode { |
| 1257 _nextHashCode = (_nextHashCode + 1) & 0xFFFFFFF; | 1256 _nextHashCode = (_nextHashCode + 1) & 0xFFFFFFF; |
| 1258 } | 1257 } |
| 1259 | 1258 |
| 1260 void _connectionEstablished(Socket socket) { | 1259 void _connectionEstablished(Socket socket) { |
| 1261 _socket = socket; | 1260 _socket = socket; |
| 1262 // Register handler for socket events. | 1261 // Register handler for socket events. |
| 1263 _socket.onData = _onData; | 1262 _socket.onData = _onData; |
| 1264 _socket.onClosed = _onClosed; | 1263 _socket.onClosed = _onClosed; |
| 1265 _socket.onError = _onError; | 1264 _socket.onError = _onError; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 if (!_error) { | 1354 if (!_error) { |
| 1356 _socket.outputStream.onNoPendingWrites = callback; | 1355 _socket.outputStream.onNoPendingWrites = callback; |
| 1357 } | 1356 } |
| 1358 } | 1357 } |
| 1359 | 1358 |
| 1360 Socket _socket; | 1359 Socket _socket; |
| 1361 bool _closing = false; // Is the socket closed by the client? | 1360 bool _closing = false; // Is the socket closed by the client? |
| 1362 bool _error = false; // Is the socket closed due to an error? | 1361 bool _error = false; // Is the socket closed due to an error? |
| 1363 _HttpParser _httpParser; | 1362 _HttpParser _httpParser; |
| 1364 | 1363 |
| 1365 Queue _sendBuffers; | |
| 1366 | |
| 1367 Function onDetach; | 1364 Function onDetach; |
| 1368 | 1365 |
| 1369 // Hash code for HTTP connection. Currently this is just a counter. | 1366 // Hash code for HTTP connection. Currently this is just a counter. |
| 1370 final int hashCode; | 1367 final int hashCode; |
| 1371 static int _nextHashCode = 0; | 1368 static int _nextHashCode = 0; |
| 1372 } | 1369 } |
| 1373 | 1370 |
| 1374 | 1371 |
| 1375 // HTTP server connection over a socket. | 1372 // HTTP server connection over a socket. |
| 1376 class _HttpConnection extends _HttpConnectionBase { | 1373 class _HttpConnection extends _HttpConnectionBase { |
| (...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2591 | 2588 |
| 2592 | 2589 |
| 2593 class _RedirectInfo implements RedirectInfo { | 2590 class _RedirectInfo implements RedirectInfo { |
| 2594 const _RedirectInfo(int this.statusCode, | 2591 const _RedirectInfo(int this.statusCode, |
| 2595 String this.method, | 2592 String this.method, |
| 2596 Uri this.location); | 2593 Uri this.location); |
| 2597 final int statusCode; | 2594 final int statusCode; |
| 2598 final String method; | 2595 final String method; |
| 2599 final Uri location; | 2596 final Uri location; |
| 2600 } | 2597 } |
| OLD | NEW |