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 class _HttpIncoming extends Stream<List<int>> { | 7 class _HttpIncoming extends Stream<List<int>> { |
8 final int _transferLength; | 8 final int _transferLength; |
9 final Completer _dataCompleter = new Completer(); | 9 final Completer _dataCompleter = new Completer(); |
10 Stream<List<int>> _stream; | 10 Stream<List<int>> _stream; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 _HttpHeaders get headers => _incoming.headers; | 71 _HttpHeaders get headers => _incoming.headers; |
72 String get protocolVersion => headers.protocolVersion; | 72 String get protocolVersion => headers.protocolVersion; |
73 int get contentLength => headers.contentLength; | 73 int get contentLength => headers.contentLength; |
74 bool get persistentConnection => headers.persistentConnection; | 74 bool get persistentConnection => headers.persistentConnection; |
75 } | 75 } |
76 | 76 |
77 | 77 |
78 class _HttpRequest extends _HttpInboundMessage implements HttpRequest { | 78 class _HttpRequest extends _HttpInboundMessage implements HttpRequest { |
79 final HttpResponse response; | 79 final HttpResponse response; |
80 | 80 |
81 // Lazy initialized parsed query parameters. | |
82 Map<String, String> _queryParameters; | |
83 | |
84 final _HttpServer _httpServer; | 81 final _HttpServer _httpServer; |
85 | 82 |
86 final _HttpConnection _httpConnection; | 83 final _HttpConnection _httpConnection; |
87 | 84 |
88 _HttpSession _session; | 85 _HttpSession _session; |
89 | 86 |
90 _HttpRequest(_HttpResponse this.response, | 87 _HttpRequest(_HttpResponse this.response, |
91 _HttpIncoming _incoming, | 88 _HttpIncoming _incoming, |
92 _HttpServer this._httpServer, | 89 _HttpServer this._httpServer, |
93 _HttpConnection this._httpConnection) | 90 _HttpConnection this._httpConnection) |
(...skipping 18 matching lines...) Expand all Loading... |
112 StreamSubscription<List<int>> listen(void onData(List<int> event), | 109 StreamSubscription<List<int>> listen(void onData(List<int> event), |
113 {void onError(error), | 110 {void onError(error), |
114 void onDone(), | 111 void onDone(), |
115 bool cancelOnError}) { | 112 bool cancelOnError}) { |
116 return _incoming.listen(onData, | 113 return _incoming.listen(onData, |
117 onError: onError, | 114 onError: onError, |
118 onDone: onDone, | 115 onDone: onDone, |
119 cancelOnError: cancelOnError); | 116 cancelOnError: cancelOnError); |
120 } | 117 } |
121 | 118 |
122 Map<String, String> get queryParameters { | |
123 if (_queryParameters == null) { | |
124 _queryParameters = _HttpUtils.splitQueryString(uri.query); | |
125 } | |
126 return _queryParameters; | |
127 } | |
128 | |
129 Uri get uri => _incoming.uri; | 119 Uri get uri => _incoming.uri; |
130 | 120 |
131 String get method => _incoming.method; | 121 String get method => _incoming.method; |
132 | 122 |
133 HttpSession get session { | 123 HttpSession get session { |
134 if (_session != null) { | 124 if (_session != null) { |
135 if (_session._destroyed) { | 125 if (_session._destroyed) { |
136 // It's destroyed, clear it. | 126 // It's destroyed, clear it. |
137 _session = null; | 127 _session = null; |
138 // Create new session object by calling recursive. | 128 // Create new session object by calling recursive. |
(...skipping 2199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2338 | 2328 |
2339 | 2329 |
2340 class _RedirectInfo implements RedirectInfo { | 2330 class _RedirectInfo implements RedirectInfo { |
2341 const _RedirectInfo(int this.statusCode, | 2331 const _RedirectInfo(int this.statusCode, |
2342 String this.method, | 2332 String this.method, |
2343 Uri this.location); | 2333 Uri this.location); |
2344 final int statusCode; | 2334 final int statusCode; |
2345 final String method; | 2335 final String method; |
2346 final Uri location; | 2336 final Uri location; |
2347 } | 2337 } |
OLD | NEW |