Commit Graph

3601 Commits

Author SHA1 Message Date
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
iposva@google.com 92cddd5ba8 - The dart:io library uses Uri from dart:uri.
- Fix the library tag handler to proper import libraries
  when generating snapshots.
Review URL: https://chromiumcodereview.appspot.com//9655015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5238 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 16:45:57 +00:00
whesse@google.com 3c6d3843fc Add native extensions for the Dart shell to the Windows platform and the Mac OS X platform.
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5235 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 14:34:57 +00:00
sgjesse@google.com 4f1ac7c8c6 Prevent creation of additional FileMode and Encoding objects
R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5234 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 14:02:58 +00:00
sgjesse@google.com 4491ea144d Add writeString method to OutputStream
All output streams now supports writeString which takes the encoding
to be used when transforming the string into a sequence of bytes.

This change also introduces an Encoding interface and Encodings class
as a repository for the supported encodings. Currently this is only
UTF-8, ISO-8859-1 and ASCII. All methods in dart:io which previously
used a String to represent the encoding now uses objects implementing
Encoding.

In this change dart:io is still using the internal UTF-8 encoder used
by the HTTP implementation. I will look into using the one in dart:utf
in a separate change.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5231 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 13:49:20 +00:00
turnidge@google.com 99edc5e69c Spot fix for linux-only source file. Cross fingers.
Review URL: https://chromiumcodereview.appspot.com//9651010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5198 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 23:10:24 +00:00
turnidge@google.com 48de07fb60 Start using Dart_PropagateError in the runtime/bin directory.
Review URL: https://chromiumcodereview.appspot.com//9657001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5197 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 23:06:44 +00:00
iposva@google.com 8e5891cb96 - Fix the dart_no_snapshot binary.
Review URL: https://chromiumcodereview.appspot.com//9639018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5195 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 22:25:29 +00:00
turnidge@google.com c143d26700 Start using Dart_SetField and Dart_GetField in the vm.
Review URL: https://chromiumcodereview.appspot.com//9642003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5185 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 18:36:56 +00:00
dgrove@google.com 98302c85df Unify most of our utf8 implementations. This takes the implementation
from utils/string_encoding and moves it to utils/utf . utils/utf8
goes away.
Review URL: https://chromiumcodereview.appspot.com//9462001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5169 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 13:28:40 +00:00
sgjesse@google.com 300f3fe802 Add support for using an URL for establishing HTTP connections
As the URI library is now part of the standalone VM it makes sense to
have the option of using a URL for opening a HTTP connection

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5153 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 08:44:59 +00:00
iposva@google.com 988862e0ef - Pass Dart_Null() instead of an empty array for unused import maps.
Review URL: https://chromiumcodereview.appspot.com//9630004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5145 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 00:53:56 +00:00
iposva@google.com 69eafdd3cf - Win: Disable logging output during script URI resolution.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5143 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 00:19:39 +00:00
iposva@google.com 8c3715be59 - Win: Remove leading / from file path.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5141 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 00:08:21 +00:00
iposva@google.com e3a8f10c52 - D:\rive\letters
Review URL: https://chromiumcodereview.appspot.com//9608028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5140 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 00:02:17 +00:00
iposva@google.com a37d9578d2 - Fix build: unused vars.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5138 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 23:18:16 +00:00
iposva@google.com 67b02b441d - Proper URI resolution when loading scripts from the standalone binary.
Review URL: https://chromiumcodereview.appspot.com//9614006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5135 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 22:57:57 +00:00
sgjesse@google.com 67d055d29c Fix hostname lookup on Windows
The previous implementation was broken and did not use the result retreived from
gethostbyname. Changed the implementation to use getaddrinfo as gethostbyname has
been deprecated in the Winsock2 library.

Added a test to test that something can be read from www.google.com.

R=ager@google.com

BUG=none
TEST=tests/standalone/src/io/HttpClientTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5097 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 15:18:50 +00:00
sgjesse@google.com f0f34bf277 Add the ability to get the current directory
Added constructor current to directory. Use like this:

var cwd = Directory.current()

R=ager@google.com

BUG=dart:1793
TEST=tests/standalone/src/io/DirectoryTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5087 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 13:23:08 +00:00
rice@google.com 0b4c8203fc Allow std{in,out,err} to be a socket
Review URL: http://chromiumcodereview.appspot.com/9617012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5056 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-06 21:36:07 +00:00
antonm@google.com 5ece65c673 Force non-Unicode build in all configurations.
Review URL: https://chromiumcodereview.appspot.com//9618018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5044 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-06 19:00:08 +00:00
sgjesse@google.com ac12107c2f Add method available to StringInputStream
The StringInputStream did not have any way for checking the number of
available characters. Added method available like on a binary
InputStream.

R=ager@google.com

BUG=dart:1945
TEST=tests/standalone/src/io/StringStreamTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5021 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-06 12:42:30 +00:00