Commit Graph

3172 Commits

Author SHA1 Message Date
rnystrom@google.com eea5e1a621 Fix "package:" stuff on Windows and skip tests on dart2js since it doesn't support it yet.
Review URL: https://chromiumcodereview.appspot.com//10052021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6431 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-11 20:14:08 +00:00
rnystrom@google.com 93e45629c9 Add support for importing using "package:" to the standalone VM.
Review URL: https://chromiumcodereview.appspot.com//10034001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6428 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-11 19:40:51 +00:00
ajohnsen@google.com d480a1eeef Add member localHostname() to the Dart IO Platform class.
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10050011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6409 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-11 12:27:55 +00:00
ager@google.com c6a91ef4b6 Remove check whether async has been used from File objects.
It makes it hard to use libraries and doesn't really help.

R=sgjesse@google.com
BUG=dartbug.com/2426
TEST=

Review URL: https://chromiumcodereview.appspot.com//10054005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6400 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-11 09:27:53 +00:00
ajohnsen@google.com 0117638cf1 Socket.available should never return a negative value.
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10052007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6399 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-11 08:43:34 +00:00
sgjesse@google.com 8efb4d4e8a Address additional comments from http://codereview.chromium.org/9956062/
R=ajohnsen@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10050007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6398 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-11 07:10:49 +00:00
sgjesse@google.com 52eb1e2139 Fix bug in HTTP header parsing
R=ajohnsen@google.com

BUG=dart:2370
TEST=tests/standalone/src/io/HttpParserTest.dart

Review URL: https://chromiumcodereview.appspot.com//10033023

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6397 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-11 07:09:45 +00:00
asiva@google.com 2393f17f1a Fix win32 Socket test errors
SocketInfoTest and SocketPortTest are failing on windows.
Review URL: https://chromiumcodereview.appspot.com//10014037

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6390 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-10 23:29:02 +00:00
ricow@google.com 4a4b4da476 Speculative fix for the windows compilation failure.
Review URL: https://chromiumcodereview.appspot.com//10032030

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6363 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-10 15:47:59 +00:00
sgjesse@google.com e727d8c8b3 Refactor the close and error handling of HTTP connections
* Unify the handling of connection close and connection error.
* The HttpConnection and HttpClientConnection now have separate
  close/error handling
* The HTTP parser gets the connection close indication as it might
  signal end of body for responses with no other length indication

R=ajohnsen@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9956062

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6355 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-10 12:54:54 +00:00
ajohnsen@google.com a4c350c17f Fix signature of GetRemotePeer declaration.
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9999022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6354 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-10 12:24:04 +00:00
ajohnsen@google.com 4ecf48b601 Add remoteHost to Socket.
This is merging the native calls into one, GetRemotePeer, thus
eliminating a potentiel extra call to getpeername.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10032027

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6353 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-10 12:18:12 +00:00
ajohnsen@google.com 358ba443f3 Actually close socket, on eviction timeout.
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10037003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6352 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-10 12:09:47 +00:00
ajohnsen@google.com 1dd508bd44 Add remotePort getter to Socket.
Review URL: https://chromiumcodereview.appspot.com//9963053

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6090 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-02 13:54:03 +00:00
sgjesse@google.com 39ffbe20ae Discard HTTP data written after a socket error
If any type of HTTP connection encounters an error writing additional
data is an error. However in many cases getting exceptions from writes
in this situation is inconvenient.

With this change any data written will be silently discarded after an
error have occoured. The onError will always be called and the user of
the library have the ability to stop generating output data as soon as
possible.

Currently this is default behaviour with no option for changing it.

R=ajohnsen@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9958059

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6089 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-02 13:51:36 +00:00
ajohnsen@google.com 809fca8714 Add a new attachTo method to HttpServer, for using an existing ServerSocket.
Review URL: https://chromiumcodereview.appspot.com//9965053

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6082 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-02 08:24:37 +00:00
ager@google.com 37147fc116 Remove unused thread pool from standalone VM binary.
We are using the thread pool in the VM via native ports.

R=sgjesse@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9875006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5954 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-28 21:57:58 +00:00
asiva@google.com 333d2695ef Fix build break when compiling with gcc 4.6:
../runtime/bin/file.cc: In function 'void Builtin_File_Flush(Dart_NativeArguments)':
../runtime/bin/file.cc:356:12: error: variable 'return_value' set but not used [-Werror=unused-but-set-variable]
cc1plus: all warnings being treated as errors
Review URL: https://chromiumcodereview.appspot.com//9837102

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5923 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-28 02:32:22 +00:00
iposva@google.com de4e574ac3 - Make the URI resolution methods used by the tag handler private.
Review URL: https://chromiumcodereview.appspot.com//9845040

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5921 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-28 01:21:04 +00:00
ager@google.com 65e9e8436c Fix typo that has crept into string input stream.
Add regression test.

R=sgjesse@google.com
BUG=dartbug.com/2322
TEST=standalone/io/StringStreamTest.dart

Review URL: https://chromiumcodereview.appspot.com//9864051

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5904 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-27 20:28:19 +00:00
ager@google.com eafaf035d2 Make the temporary OSError allocation method private.
GetField, SetField, Invoke can now be called with a library target
and with private names. Using that we can make this temporary
utility function private as it should be.

Work is under way to support instance creation through the API.

R=sgjesse@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9773037

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5881 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-27 15:31:00 +00:00
sgjesse@google.com 090cf02d0f Avoid double reporting of errors to HTTPServer onError callback
R=ajohnsen@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9863035

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5871 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-27 11:51:28 +00:00
ajohnsen@google.com e896c90f3b Don't propagate http client error, when no response object is available.
Review URL: https://chromiumcodereview.appspot.com//9863031

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5869 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-27 10:56:43 +00:00
sgjesse@google.com 471f1c772c Add error handling to directory
The directory object now has error handling like the rest of the
dart:io. The added tests to some extend overlaps with some of the
tests in DirectpryTest.dart, but I found it better to have error tests
in a single place.

I removed a few type checks sitting in the C++ code for the native
functions as for file we currently don't have them. I have opened
issue 2305 regarding where to do type checks for dart:io native
functions.

R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9773018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5866 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-27 08:50:35 +00:00
sgjesse@google.com cdc29b23f0 Add error handling to random access file
Now all both sync and async methods on File and RandomAccessFile
should have correct error handling.

Changed readByte and readByteSync to return -1 instead of
reporting an error when end of file is reached. It seems to make
the most sense.

The amount of boiler-plate code in both the native functions and
native port functions in file.cc is growing. Maybe we should
consider some refactoring, e.g. with a table of the expected
argument types for each native port functions together with known
position of the FILE* argument.

R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9839053

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5812 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-26 05:54:49 +00:00
ager@google.com 1ffc9b84a2 Treat EAGAIN/EWOULDBLOCK as requests for retry on socket accept.
On Linux there are a number of protocol errors that can be
returned from accept. According to the linux man pages they
should be treated as EAGAIN.

This should hopefully fix the flakiness of EchoServerStreamTest.

R=iposva@google.com,sgjesse@google.com
BUG=2262
TEST=

Review URL: https://chromiumcodereview.appspot.com//9837060

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5797 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-23 22:39:27 +00:00
sgjesse@google.com ffcb68e182 Fix another syntax error in the HTTP library discovered by dart2js
Clearly I did not test errors on streams from HttpRequest and
HttpResponse - only from HttpClinetRequest and HttpClientResponse.

TBR=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9839044

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5770 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-23 09:16:58 +00:00
sgjesse@google.com e7b8b32534 Fix HTTP library issues reported by dart2js
TBR=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9834043

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5769 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-23 08:33:09 +00:00
sgjesse@google.com 167bce6fba Add error handling to the HTTP library
The socket errors and HTTP parser errors are now handled by the
HTTP library and propagated to the related onError callback.

For HttpClient there is no onError on the HttpClient object
itself. Errors on active connections (including connection
errors) are reported on the HttpClientConnection. Errors on
connections sitting in the keep alive pool are handled by just
closing the connection and removing it from the pool. Errors on
the HttpClientConnection are also reported through the onError
callbacks on any active streams.

I am not particulair happy of the way errors are propagated to
the active streams but that can be refactored later.

Added more checks and tests to the HTTP parser.

R=ager@google.com, ajohnsen@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9834008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5768 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-23 08:00:27 +00:00
sgjesse@google.com 015d6fa4da Change the message body handling in the HTTP parser
The message content detection and handling should now be more
correct and according to the specification (RFC 2616 section 4.3).

* Requests with no Content-Length and no Transfer-Encoding have no message body
* Responses with status code 1xx, 204 and 304 have no message body
* Responses which are responses to HEAD requests have no message body

Also added support for detecting chunk-extensions and ignoring these.

R=ajohnsen@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9812005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5722 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-21 15:41:39 +00:00
sgjesse@google.com 7fa9f1fe88 Add error handling to socket streams
Change the streams onError callbacks to get an Exception argument on
all streams.

Added actual error handling to the socket streams.

As it is difficult to determine where an error should be reported I
decided to call all the registered onError callbacks, that is on the
socket itself and on both input and output stream.

Did some additional cleanup of the naming of OnError argument in some tests.

R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9812007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5717 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-21 14:40:15 +00:00
sgjesse@google.com 57a9175636 Fix checked mode errors
Remove return types from functions which can now return objects of different types.

TBR=ngeoffray@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9816005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5711 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-21 10:37:50 +00:00
sgjesse@google.com 0b3f4a1190 Extend dart:io error handling to all socket functions
There are currently no tests of the error handling, as it is hard to
create consistent tests. I have done some manual tests locally:

* Lowering the number of file descriptors available (ulimit -n) and hitting that limit
* Running two dart programs communicating and terminating one (using Ctrl-C)
* Running two dart programs communicating on two machines and pulling out the network cable.

If there is an error we always call the onError callback and never the onClosed callback.

On Windows there is the issue that both closing the connection correctly and terminating one end gives the same error (ERROR_NETNAME_DELETED) so both are reported as connection close. Pulling out the network cable gives a different (real) error on Windows though.

On Mac OS it turned out the for kqueue EV_EOF is also used to indicate errors with the error code set in the fflags field. EV_ERROR is only reported if there is an internal error in  kevent processing (see http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man2/kqueue.2.html).

R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9720045

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5709 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-21 09:39:47 +00:00
ager@google.com a98318a348 Add additional error printing to kqueue failures on Mac.
This is an attempt to get more information on dartbug.com/1876

R=ricow@google.com
BUG=1876

Review URL: https://chromiumcodereview.appspot.com//9705096

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5686 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-20 15:24:14 +00:00
sgjesse@google.com 5e4ae23e44 Support parsing HTTP responses where the body length is not known
The HTTP parser ends the body when the connection is closed.

This only implements this in the HTTP parser - it is not yet used in
the dart:io HTTP library.

R=ajohnsen@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9704009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5641 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-19 11:36:32 +00:00
sgjesse@google.com 168ae8c785 Start better error reporting for sockets
Changed the onError callback for sockets to take an exception argument.

First area to report errors for is name resolution.

Changed the IP address resolution from being synchronous with the
creation of the socket to being asynchronous thsough a lookup
service running on a native port. Currently this lookup service
is static on the socket class as we need to call it from a
factory method. We should probably add a separate name lookup
service at some point.

R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9699017

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5640 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-19 11:26:41 +00:00
iposva@google.com 5ee85db5f4 Reapply part of r5325.
- Fix use of String operator + in IO libraries.

Previously reviewed as part of https://chromiumcodereview.appspot.com/9690003
Review URL: https://chromiumcodereview.appspot.com//9725001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5597 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-16 22:19:23 +00:00
whesse@google.com 3b7099b7e2 Change lookup path for Dart native extensions shared libraries.
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9694045

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5524 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-15 15:49:57 +00:00
ager@google.com 357588d0c9 Change quoting in Process implementation on Windows.
Only quote command and arguments if they contain a space or a tab.
This seems consistent with the way it is handled in other systems.

R=antonm@google.com,sgjesse@google.com

Review URL: https://chromiumcodereview.appspot.com//9701061

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5522 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-15 15:33:06 +00:00
whesse@google.com d51bb2b427 Fix some minor static type issues in dart:io implementation.
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9703023

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5514 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-15 09:34:51 +00:00
ager@google.com c96189c6a9 Wrap all arguments passed to processes in "" on Windows.
I'm not 100% sure that this is what we want. I'll dig into
what other systems are doing tomorrow.

This could make the test scripts work on Windows for Dartium.

Updated windows test binary as well.

R=antonm@google.com,sgjesse@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9699032

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5472 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-14 16:50:16 +00:00
ajohnsen@google.com 94490e2e2a Close connections on server.close(), and call onError on early connection close.
Review URL: https://chromiumcodereview.appspot.com//9700012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5452 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-14 11:24:50 +00:00
sgjesse@google.com 18b878fccd Fix missing member initialization on Mac OS
TBR=ager@google.com

Fix Mac OS build\n\nTBR=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9694037

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5400 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 13:24:17 +00:00
sgjesse@google.com e06beb7f89 Fix Mac OS build
TBR=ager@google.com

BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com//9692045

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5397 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 13:09:24 +00:00
sgjesse@google.com 84836f8c56 Error reporting on File in dart:io
This implements consistent error reporting on all methods on File in dart:io. The async onError method is called with an exception argument which is the same exception as would have been thrown from the corresponding sync method.

The one method on Directory which already did this has been updated as well.

R=ager@google.com

BUG=none
TEST=tests/standalone/src/io/FileTest.dart, tests/standalone/src/io/FileInvalidArgumentsTest.dart

Review URL: https://chromiumcodereview.appspot.com//9630012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5396 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 13:00:47 +00:00
sigmund@google.com 2b5952ac6c SendPort + ReceivePort changes:
- document what are valid messages in SendPort.send
- change SendPort.call to return a future of the reply
- remove ReceivePort.singleShot

Review URL: https://chromiumcodereview.appspot.com//9652001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5368 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-12 22:52:36 +00:00
iposva@google.com 993cd03e41 - Fix build by rolling back r5324, r5325.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5333 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-12 16:31:12 +00:00
iposva@google.com 8ca5ba4d15 - Fix use of String operator + in corelib and standalone libraries.
Review URL: https://chromiumcodereview.appspot.com//9690003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5325 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-12 15:26:55 +00:00
iposva@google.com 4a71dc9de3 - Fix trailing white space.
Review URL: https://chromiumcodereview.appspot.com//9668033

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5266 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 23:12:03 +00:00
regis@google.com e05a6a04ba Fix type checks that wrongly ignored malformed types.
Fix corresponding test.
Fix comment in gypi file.
Fix undeclared type in stream_util.dart.
Review URL: https://chromiumcodereview.appspot.com//9649010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5243 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 18:14:02 +00:00