| 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 String get queryString() => _queryString; | 392 String get queryString() => _queryString; |
| 393 Map get queryParameters() => _queryParameters; | 393 Map get queryParameters() => _queryParameters; |
| 394 | 394 |
| 395 InputStream get inputStream() { | 395 InputStream get inputStream() { |
| 396 if (_inputStream == null) { | 396 if (_inputStream == null) { |
| 397 _inputStream = new _HttpInputStream(this); | 397 _inputStream = new _HttpInputStream(this); |
| 398 } | 398 } |
| 399 return _inputStream; | 399 return _inputStream; |
| 400 } | 400 } |
| 401 | 401 |
| 402 String get protocolVersion() => _protocolVersion; |
| 403 |
| 402 void _onRequestStart(String method, String uri, String version) { | 404 void _onRequestStart(String method, String uri, String version) { |
| 403 _method = method; | 405 _method = method; |
| 404 _uri = uri; | 406 _uri = uri; |
| 405 _parseRequestUri(uri); | 407 _parseRequestUri(uri); |
| 406 } | 408 } |
| 407 | 409 |
| 408 void _onHeaderReceived(String name, String value) { | 410 void _onHeaderReceived(String name, String value) { |
| 409 _headers.add(name, value); | 411 _headers.add(name, value); |
| 410 } | 412 } |
| 411 | 413 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 case HttpStatus.GATEWAY_TIMEOUT: return "Gateway Time-out"; | 605 case HttpStatus.GATEWAY_TIMEOUT: return "Gateway Time-out"; |
| 604 case HttpStatus.HTTP_VERSION_NOT_SUPPORTED: | 606 case HttpStatus.HTTP_VERSION_NOT_SUPPORTED: |
| 605 return "Http Version not supported"; | 607 return "Http Version not supported"; |
| 606 default: return "Status $statusCode"; | 608 default: return "Status $statusCode"; |
| 607 } | 609 } |
| 608 } | 610 } |
| 609 | 611 |
| 610 bool _writeHeader() { | 612 bool _writeHeader() { |
| 611 List<int> data; | 613 List<int> data; |
| 612 | 614 |
| 615 // HTTP/1.0 does not support chunked. |
| 616 if (_protocolVersion == "1.0" && _contentLength < 0) { |
| 617 throw new HttpException("Content length required for HTTP 1.0"); |
| 618 } |
| 619 |
| 613 // Write status line. | 620 // Write status line. |
| 614 if (_protocolVersion == "1.1") { | 621 if (_protocolVersion == "1.1") { |
| 615 _httpConnection._write(_Const.HTTP11); | 622 _httpConnection._write(_Const.HTTP11); |
| 616 } else { | 623 } else { |
| 617 _httpConnection._write(_Const.HTTP10); | 624 _httpConnection._write(_Const.HTTP10); |
| 618 } | 625 } |
| 619 _writeSP(); | 626 _writeSP(); |
| 620 data = _statusCode.toString().charCodes(); | 627 data = _statusCode.toString().charCodes(); |
| 621 _httpConnection._write(data); | 628 _httpConnection._write(data); |
| 622 _writeSP(); | 629 _writeSP(); |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1631 | 1638 |
| 1632 | 1639 |
| 1633 class _RedirectInfo implements RedirectInfo { | 1640 class _RedirectInfo implements RedirectInfo { |
| 1634 const _RedirectInfo(int this.statusCode, | 1641 const _RedirectInfo(int this.statusCode, |
| 1635 String this.method, | 1642 String this.method, |
| 1636 Uri this.location); | 1643 Uri this.location); |
| 1637 final int statusCode; | 1644 final int statusCode; |
| 1638 final String method; | 1645 final String method; |
| 1639 final Uri location; | 1646 final Uri location; |
| 1640 } | 1647 } |
| OLD | NEW |