OLD | NEW |
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 const int _OUTGOING_BUFFER_SIZE = 8 * 1024; | 7 const int _OUTGOING_BUFFER_SIZE = 8 * 1024; |
8 | 8 |
9 class _HttpIncoming extends Stream<List<int>> { | 9 class _HttpIncoming extends Stream<List<int>> { |
10 final int _transferLength; | 10 final int _transferLength; |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 abstract class _HttpOutboundMessage<T> extends _IOSinkImpl { | 409 abstract class _HttpOutboundMessage<T> extends _IOSinkImpl { |
410 // Used to mark when the body should be written. This is used for HEAD | 410 // Used to mark when the body should be written. This is used for HEAD |
411 // requests and in error handling. | 411 // requests and in error handling. |
412 bool _encodingSet = false; | 412 bool _encodingSet = false; |
413 | 413 |
414 final Uri _uri; | 414 final Uri _uri; |
415 final _HttpOutgoing _outgoing; | 415 final _HttpOutgoing _outgoing; |
416 | 416 |
417 final _HttpHeaders headers; | 417 final _HttpHeaders headers; |
418 | 418 |
419 _HttpOutboundMessage(this._uri, | 419 _HttpOutboundMessage(Uri uri, |
420 String protocolVersion, | 420 String protocolVersion, |
421 _HttpOutgoing outgoing) | 421 _HttpOutgoing outgoing) |
422 : super(outgoing, null), | 422 : super(outgoing, null), |
423 headers = new _HttpHeaders(protocolVersion), | 423 _uri = uri, |
| 424 headers = new _HttpHeaders( |
| 425 protocolVersion, |
| 426 defaultPortForScheme: uri.scheme == 'https' ? |
| 427 HttpClient.DEFAULT_HTTPS_PORT : |
| 428 HttpClient.DEFAULT_HTTP_PORT), |
424 _outgoing = outgoing { | 429 _outgoing = outgoing { |
425 _outgoing.outbound = this; | 430 _outgoing.outbound = this; |
426 _encodingMutable = false; | 431 _encodingMutable = false; |
427 } | 432 } |
428 | 433 |
429 int get contentLength => headers.contentLength; | 434 int get contentLength => headers.contentLength; |
430 void set contentLength(int contentLength) { | 435 void set contentLength(int contentLength) { |
431 headers.contentLength = contentLength; | 436 headers.contentLength = contentLength; |
432 } | 437 } |
433 | 438 |
(...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2572 const _RedirectInfo(this.statusCode, this.method, this.location); | 2577 const _RedirectInfo(this.statusCode, this.method, this.location); |
2573 } | 2578 } |
2574 | 2579 |
2575 String _getHttpVersion() { | 2580 String _getHttpVersion() { |
2576 var version = Platform.version; | 2581 var version = Platform.version; |
2577 // Only include major and minor version numbers. | 2582 // Only include major and minor version numbers. |
2578 int index = version.indexOf('.', version.indexOf('.') + 1); | 2583 int index = version.indexOf('.', version.indexOf('.') + 1); |
2579 version = version.substring(0, index); | 2584 version = version.substring(0, index); |
2580 return 'Dart/$version (dart:io)'; | 2585 return 'Dart/$version (dart:io)'; |
2581 } | 2586 } |
OLD | NEW |