Version 1.2.0-dev.5.9
svn merge -c 32704 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 32716 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 32723 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 32724 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 32726 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 32727 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
git-svn-id: http://dart.googlecode.com/svn/trunk@32734 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/runtime/bin/socket_android.cc b/runtime/bin/socket_android.cc
index 0ab6af4..6a2d6ce 100644
--- a/runtime/bin/socket_android.cc
+++ b/runtime/bin/socket_android.cc
@@ -238,16 +238,22 @@
memset(&hints, 0, sizeof(hints));
hints.ai_family = SocketAddress::FromType(type);
hints.ai_socktype = SOCK_STREAM;
- hints.ai_flags = 0;
+ hints.ai_flags = (AI_V4MAPPED | AI_ADDRCONFIG);
hints.ai_protocol = IPPROTO_TCP;
struct addrinfo* info = NULL;
int status = getaddrinfo(host, 0, &hints, &info);
if (status != 0) {
- ASSERT(*os_error == NULL);
- *os_error = new OSError(status,
- gai_strerror(status),
- OSError::kGetAddressInfo);
- return NULL;
+ // We failed, try without AI_ADDRCONFIG. This can happen when looking up
+ // e.g. '::1', when there are no IPv6 addresses.
+ hints.ai_flags = AI_V4MAPPED;
+ status = getaddrinfo(host, 0, &hints, &info);
+ if (status != 0) {
+ ASSERT(*os_error == NULL);
+ *os_error = new OSError(status,
+ gai_strerror(status),
+ OSError::kGetAddressInfo);
+ return NULL;
+ }
}
intptr_t count = 0;
for (struct addrinfo* c = info; c != NULL; c = c->ai_next) {
diff --git a/runtime/bin/socket_linux.cc b/runtime/bin/socket_linux.cc
index 08d8fe1..693e5c3 100644
--- a/runtime/bin/socket_linux.cc
+++ b/runtime/bin/socket_linux.cc
@@ -239,16 +239,22 @@
memset(&hints, 0, sizeof(hints));
hints.ai_family = SocketAddress::FromType(type);
hints.ai_socktype = SOCK_STREAM;
- hints.ai_flags = 0;
+ hints.ai_flags = (AI_V4MAPPED | AI_ADDRCONFIG);
hints.ai_protocol = IPPROTO_TCP;
struct addrinfo* info = NULL;
int status = getaddrinfo(host, 0, &hints, &info);
if (status != 0) {
- ASSERT(*os_error == NULL);
- *os_error = new OSError(status,
- gai_strerror(status),
- OSError::kGetAddressInfo);
- return NULL;
+ // We failed, try without AI_ADDRCONFIG. This can happen when looking up
+ // e.g. '::1', when there are no global IPv6 addresses.
+ hints.ai_flags = AI_V4MAPPED;
+ status = getaddrinfo(host, 0, &hints, &info);
+ if (status != 0) {
+ ASSERT(*os_error == NULL);
+ *os_error = new OSError(status,
+ gai_strerror(status),
+ OSError::kGetAddressInfo);
+ return NULL;
+ }
}
intptr_t count = 0;
for (struct addrinfo* c = info; c != NULL; c = c->ai_next) {
diff --git a/sdk/lib/io/http_parser.dart b/sdk/lib/io/http_parser.dart
index 5c3263f..56b3e4c 100644
--- a/sdk/lib/io/http_parser.dart
+++ b/sdk/lib/io/http_parser.dart
@@ -517,6 +517,10 @@
throw new HttpException("Invalid response status code");
}
_state = _State.RESPONSE_LINE_REASON_PHRASE;
+ } else if (byte == _CharCode.CR) {
+ // Some HTTP servers does not follow the spec. and send
+ // \r\n right after the status code.
+ _state = _State.RESPONSE_LINE_ENDING;
} else {
if (byte < 0x30 && 0x39 < byte) {
throw new HttpException("Invalid response status code");
diff --git a/tests/html/html.status b/tests/html/html.status
index cd3b67d..c9d779d 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -16,7 +16,7 @@
[ $compiler == dart2js && $browser ]
custom/created_callback_test: Fail # Support for created constructor.
-# For now dart2js uses the polyfill even on DRT
+[ $compiler == dart2js && ($runtime == safari || $runtime == ff || $runtime == chrome || $runtime == ie9 || $runtime == ie10) ]
custom/document_register_type_extensions_test/namespaces: Fail # Polyfill does not support createElementNS
custom/entered_left_view_test/viewless_document: Fail # Polyfill does not handle this
custom/attribute_changed_callback_test/unsupported_on_polyfill: Fail # Polyfill does not support
@@ -328,6 +328,7 @@
[ $runtime == ff && $system == windows ]
messageevent_test: RuntimeError # Issue 15651
serialized_script_value_test: RuntimeError # Issue 15651
+client_rect_test: Fail # Issue 16890
[ $runtime == ff ]
xhr_test/xhr: Pass, Fail # Issue 11602
diff --git a/tests/standalone/io/http_no_reason_phrase_test.dart b/tests/standalone/io/http_no_reason_phrase_test.dart
new file mode 100644
index 0000000..9db6a64
--- /dev/null
+++ b/tests/standalone/io/http_no_reason_phrase_test.dart
@@ -0,0 +1,42 @@
+// (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// VMOptions=
+// VMOptions=--short_socket_read
+// VMOptions=--short_socket_write
+// VMOptions=--short_socket_read --short_socket_write
+
+import "package:expect/expect.dart";
+import "dart:async";
+import "dart:isolate";
+import "dart:io";
+
+// Test that a response line without any reason phrase is handled.
+void missingReasonPhrase(int statusCode, bool includeSpace) {
+ var client = new HttpClient();
+ ServerSocket.bind("127.0.0.1", 0).then((server) {
+ server.listen((client) {
+ if (includeSpace) {
+ client.write("HTTP/1.1 $statusCode \r\n\r\n");
+ } else {
+ client.write("HTTP/1.1 $statusCode\r\n\r\n");
+ }
+ client.close();
+ });
+ client.getUrl(Uri.parse("http://127.0.0.1:${server.port}/"))
+ .then((request) => request.close())
+ .then((response) {
+ Expect.equals(statusCode, response.statusCode);
+ Expect.equals("", response.reasonPhrase);
+ })
+ .whenComplete(() => server.close());
+ });
+}
+
+void main() {
+ missingReasonPhrase(HttpStatus.OK, true);
+ missingReasonPhrase(HttpStatus.INTERNAL_SERVER_ERROR, true);
+ missingReasonPhrase(HttpStatus.OK, false);
+ missingReasonPhrase(HttpStatus.INTERNAL_SERVER_ERROR, false);
+}
diff --git a/tools/VERSION b/tools/VERSION
index a101173..b639567 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -28,4 +28,4 @@
MINOR 2
PATCH 0
PRERELEASE 5
-PRERELEASE_PATCH 8
+PRERELEASE_PATCH 9