OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Global constants. | 5 // Global constants. |
6 class Const { | 6 class Const { |
7 // Bytes for "HTTP/1.0". | 7 // Bytes for "HTTP/1.0". |
8 static final HTTP10 = const [72, 84, 84, 80, 47, 49, 46, 48]; | 8 static final HTTP10 = const [72, 84, 84, 80, 47, 49, 46, 48]; |
9 // Bytes for "HTTP/1.1". | 9 // Bytes for "HTTP/1.1". |
10 static final HTTP11 = const [72, 84, 84, 80, 47, 49, 46, 49]; | 10 static final HTTP11 = const [72, 84, 84, 80, 47, 49, 46, 49]; |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 | 697 |
698 void _parseRequestUri(String uri) { | 698 void _parseRequestUri(String uri) { |
699 int position; | 699 int position; |
700 position = uri.indexOf("?", 0); | 700 position = uri.indexOf("?", 0); |
701 _queryParameters = new Map(); | 701 _queryParameters = new Map(); |
702 if (position == -1) { | 702 if (position == -1) { |
703 _path = _uri; | 703 _path = _uri; |
704 _queryString = null; | 704 _queryString = null; |
705 } else { | 705 } else { |
706 _path = _uri.substring(0, position); | 706 _path = _uri.substring(0, position); |
707 _queryString = _uri.substringToEnd(position + 1); | 707 _queryString = _uri.substring(position + 1); |
708 | 708 |
709 // Simple parsing of the query string into request parameters. | 709 // Simple parsing of the query string into request parameters. |
710 // TODO(sgjesse): Handle all detail e.g. encoding. | 710 // TODO(sgjesse): Handle all detail e.g. encoding. |
711 int currentPosition = 0; | 711 int currentPosition = 0; |
712 while (currentPosition < _queryString.length) { | 712 while (currentPosition < _queryString.length) { |
713 position = _queryString.indexOf("=", currentPosition); | 713 position = _queryString.indexOf("=", currentPosition); |
714 if (position == -1) { | 714 if (position == -1) { |
715 break; | 715 break; |
716 } | 716 } |
717 String name = _queryString.substring(currentPosition, position); | 717 String name = _queryString.substring(currentPosition, position); |
718 currentPosition = position + 1; | 718 currentPosition = position + 1; |
719 position = _queryString.indexOf("&", currentPosition); | 719 position = _queryString.indexOf("&", currentPosition); |
720 String value; | 720 String value; |
721 if (position == -1) { | 721 if (position == -1) { |
722 value = _queryString.substringToEnd(currentPosition); | 722 value = _queryString.substring(currentPosition); |
723 currentPosition = _queryString.length; | 723 currentPosition = _queryString.length; |
724 } else { | 724 } else { |
725 value = _queryString.substring(currentPosition, position); | 725 value = _queryString.substring(currentPosition, position); |
726 currentPosition = position + 1; | 726 currentPosition = position + 1; |
727 } | 727 } |
728 _queryParameters[name] = value; | 728 _queryParameters[name] = value; |
729 } | 729 } |
730 } | 730 } |
731 } | 731 } |
732 | 732 |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 | 1500 |
1501 // Return connection. | 1501 // Return connection. |
1502 sockets.addFirst(socketConn); | 1502 sockets.addFirst(socketConn); |
1503 socketConn._markReturned(); | 1503 socketConn._markReturned(); |
1504 } | 1504 } |
1505 | 1505 |
1506 Map<String, Queue<SocketConnection>> _openSockets; | 1506 Map<String, Queue<SocketConnection>> _openSockets; |
1507 Timer _evictionTimer; | 1507 Timer _evictionTimer; |
1508 bool _shutdown; // Has this HTTP client been shutdown? | 1508 bool _shutdown; // Has this HTTP client been shutdown? |
1509 } | 1509 } |
OLD | NEW |