Commit Graph

11 Commits

Author SHA1 Message Date
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 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 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
sgjesse@google.com 9091eeff05 Missing handling of default arguments in socket stream readInto
Also made it a bit easier to write a socket connection test.

R=ager@google.com

BUG=dart:1925
TEST=tests/standalone/src/Regress-1925.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4793 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-01 12:32:52 +00:00
ager@google.com 242bba108b Reapply dart:io API changes.
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4790 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-01 10:07:35 +00:00
ager@google.com fd31551ca4 Revert "Rename blahHandler to onBlah throughout dart:io."
D'oh! I need to update the test binaries as well. Reverting, building
and putting back in again.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4785 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-01 09:43:15 +00:00
ager@google.com 40e0bceab5 Rename blahHandler to onBlah throughout dart:io.
Additionally, change all single-shot methods to take their callback as an argument instead of registering it on the object.

I have attempted to find all uses in the repo but there might
be some firefighting to do when this lands.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4784 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-01 09:36:04 +00:00
ager@google.com ac5c191683 Another attempt at fixing the Socket tests.
The tests did not wait for the server isolate to finish before
exiting the main isolate.

The tests did not correctly count the number of bytes received on
the server-side. We have to count bytes per connection.

There were issues with close handlers being confused for timeouts.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4127 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-10 11:00:15 +00:00
ager@google.com 4bb47cafcd Fix problem with socket input stream on MacOS when reading from tty.
This could cause an empty buffer to be added to an internal BufferList
which violates our assumptions.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4027 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-08 10:51:58 +00:00
ajohnsen@google.com 143de9eb80 Use ByteArray's native for Socket and File.
Review URL: https://chromiumcodereview.appspot.com//9235067

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3812 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-01 21:48:27 +00:00
ager@google.com 4605b5ea33 Minor changes to the dart:io library files.
- Split some of the streams into an interface and an implementation file.
- Add documentation comments where missing.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3616 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-26 10:03:19 +00:00