Commit Graph

63 Commits

Author SHA1 Message Date
ajohnsen@google.com 8ca15ec105 Fix HttpHeaders.date and add HttpHeaders.ifModifiedSince.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10793 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-16 06:50:54 +00:00
nweiz@google.com 884404dca2 Add an OutputStream.closed getter.
BUG=3603

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10455 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-09 20:09:19 +00:00
rnystrom@google.com 0bc9b19740 Rename BadNumberFormatException -> FormatException.
Review URL: https://chromiumcodereview.appspot.com//10850034

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10354 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-07 20:56:59 +00:00
ajohnsen@google.com 73477dd9cb Add the ability to get info of a Http connection, e.g. host and port.
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9761 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-19 15:18:50 +00:00
sgjesse@google.com 9f2a6f06a0 Fix HTTP client eviction timer bug
The HTTP client eviction timer should only be cancled and nulled out
when there are no client connections at all.

R=whesse@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9404 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-04 12:27:35 +00:00
sgjesse@google.com b5995d1d9b Add method flush to output stream
R=ager@google.com

BUG=dart:1407
TEST=tests/standalone/src/io/FileOutputStreamTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8422 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-08 07:56:15 +00:00
sgjesse@google.com 2f1cd20085 Small HTTP server fixes
Make empty responses use content length instead of chunked.
Make the default error handler indicate no content for HTTP 1.1 as well as HTTP 1.0.
Remove unneeded null check.

R=ager@google.com

BUG=none
TEST=HTTP tests

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8044 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-29 09:31:32 +00:00
sgjesse@google.com db539915e9 Support using the HEAD request in the HTTP library
There was a number of issues in relation to using the HTTP method HEAD

* The HTTP parser did not parse HEAD correctly
* HEAD respoonse could not have a content length and empty body
* The client could not receive a HEAD response with content length an empty body

I the server we support writing to the output stream when replying to a head request.

They should now be fixed and a test for HEAD have been added

R=ager@google.com

BUG=dart:3205
TEST=tests/standalone/io/http_head_test.dart, tests/standalone/io/http_parser_test.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7986 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-25 10:13:05 +00:00
sgjesse@google.com 5a08f212a2 Support for cookies in the HTTP library
This change adds the list field cookies to all requests and
responses.

For HttpRequest the cookie list will have all the cookies set by
the client in its HttpClientRequest cookie list. These cookies
are passed through the "Cookie" HTTP header.

For HttpClientResponse the cookie list will have all the cookies
set by the server in the HttpResponse cookie list. These cookies
are passed through the "Set-Cookie" HTTP header.

The parsing of the "Cookie" and "Set-Cookie" headers try to
follow RFC 6265.

This change does not add a cookie jar in the http client with
cookie policy for automatic cookie handling.

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

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7943 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-24 13:03:31 +00:00
floitsch@google.com a88e304d29 Deprecate use of timezones.
Review URL: https://chromiumcodereview.appspot.com//10411057

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7911 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-23 16:07:35 +00:00
sgjesse@google.com 7d9ff0d503 Add special handling of the content type HTTP header
This adds parsing of HTTP headers of the form:

  Name=value; parameter1=value1; parameter2=value2

Specialize the implemented header value class into a content type
class.

One could argue whether the "synchronization" between the string
representation and the content type object representation is the best
way, but if the exposed parameters map should just be the standard map
implementation there is no way of detection changes,

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

BUG=dart:2045
TEST=tests/standalone/io/http_test.dart, tests/standalone/io/http_headers_test.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7851 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-22 12:53:35 +00:00
ajohnsen@google.com 33dc2dd6e4 Correctly entirely close client connections, when closing http server.
Also remove duplicate call to _connectionEstablished.

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7448 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-09 10:55:42 +00:00
sgjesse@google.com 56945855e9 Add Exception to the class name for recently added exception classes
R=ager@google.com

BUG=none
TEST=none

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7444 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-09 10:18:24 +00:00
sgjesse@google.com fca01e72b7 Avoid using chunked transfer encoding when the HTTP verision is 1.0.
R=ager@google.com

BUG=dart:2938
TEST=tests/standalone/io/http_content_length_test.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7442 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-09 09:06:28 +00:00
sgjesse@google.com 45c6481a74 Make the HTTP server close non-persistent connections
When closing the connection due to non-presistent connection make sure
that all data are sent to the receiver. For socket close due to errors
or idle timeout destroy the socket.

R=ager@google.com

BUG=dart:2918
TEST=tests/standalone/io/http_connection_close_test.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7441 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-09 08:53:41 +00:00
sgjesse@google.com a579f1f449 Implemented W3C complient web socket client interface
Fixed a bug where onMessage events could happen before the onOpen event.

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

BUG=dart:2001
TEST=tests/standalone/io/web_socket_test.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7440 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-09 08:47:07 +00:00
sgjesse@google.com 6e1f264b8a Add redirect support to the HTTP client
Redirection is implemented by re-using the same HttpClientConnection
object for several request/response pairs. There is s redirect method
on the HttpClientConnection object for manual redirection. The
HttpClientConnection object also has properties followRedirects and
maxRedirects to configure automatic redirect handling.

When redirection happen the HttpClientConnection will collect the
redirection history for client einspection and for redirect loop
detection.

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

BUG=none
TEST=tests/standalone/io/http_redirect_test.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7415 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-08 13:32:45 +00:00
sgjesse@google.com 4eea8aac7e Fix wrong type in HTTP library
R=ager@google.com

BUG=none
TEST=none

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7408 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-08 09:52:46 +00:00
sgjesse@google.com 315874e470 Add enumeration of the HTTP headers
R=ajohnsen@google.com

BUG=dart:2045
TEST=tests/standalone/io/http_headers_test.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7377 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-07 13:52:14 +00:00
sgjesse@google.com 370115c39d Better checking and error reporting for HTTP client
R=ager@google.com

BUG=dart:2034
TEST=none

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7371 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-07 11:53:16 +00:00
cshapiro@google.com 1472427af8 Revert "Revert "Implement {Int,Uint}{8,16,32,64} and Float{32,64} typed arrays.""
This reverts commit 63480a81fccbde001494dd535cd06a8fa02ed261.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7352 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-04 23:16:09 +00:00
sgjesse@google.com 018b94882c Improve the handling of the connection header
* The connection header can now have multiple values
* The persistent connection state can be controlled

R=ajohnsen@google.com

BUG=dart:1995
TEST=tests/standalone/io/http_connection_header_test.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7267 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-03 07:08:32 +00:00
sgjesse@google.com a108ef203f Add a web socket client
The web socket client is a implemented as a class which is
created from from a HTTP client connection. This way it is
independent from the HTTP client and is just using the HTTP
client.

The protocol handling is mainly re-using the code from the web
socket server.

Change the handling of setting an onNoPendingWrites handler on a
socket output stream. Now setting a new onNoPendingWrites handler
will trigger a callback when there is no pending data to be
written.

Add socket detaching to the HTTP client as well. Add the ability
to get any unparsed data read from the socket for processing
after the protocol upgrade.

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

BUG=dart:2001
TEST=tests/standalone/io/web_socket_test.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7224 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-02 10:30:38 +00:00
sgjesse@google.com ebc838c963 Check the state of the HTTP request and response when handling headers
The HTTP headers object in request and response objects is now marked
as non-mutable when it cannot be changed. An exception will be thrown
if trying to mutate headers when they are not mutable.

Postponed the sending of the headers until either the first byte of
body data is sent or the empty body is indicated. This is to allow
getting the output stream object and still be able to set headers
until the actual body is touched.

Added checking of the number of bytes of body data transmitted when an
explicit content length is specified.

R=ajohnsen@google.com

BUG=none
TEST=tests/standalone/src/io/HttpHeadersState.dart,tests/standalone/src/io/HttpContentLengthTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7010 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-26 11:43:32 +00:00
sgjesse@google.com f4a87d0e2e Initial web socket server implementation
This implements the web socket protocol as a request handler for
the HTTP server. The HTTP server have been updated with the
ability of getting the socket when a HTTP upgrade request is
processed. This way the web socket implementation is not builtin
to the HTTP server.

The API on the server is:

interface WebSocketConnection {
  void set onMessage(void callback(Object message));
  void set onClosed(void callback(int status, String reason));
  void set onError(void callback(e));

  send(Object message);
  close([int status, String reason]);
}

This API currently does not have any streaming but collects the
entire message before invoking the onMessage callback. The
current browser web socket API
(http://dev.w3.org/html5/websockets/) works the same way. The
underlying web socket protocol can have unbounded messages so
long term this probably have to change. But for now the only
likely client for a web socket server is a browser.

Currently this is missing tests. The implementation has been
tested by running the WebSocketTest.dart script and connecting
using a browser. This testing have been done using Chrome 19 and
Firefox 11.

I will be adding tests in separate change lists.

The SHA-1 and base 64 code (initially written by
ajohnsen@google.com) can be removed when these algorithms is
available in the dart:crypto.

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

BUG=dart:2001
TEST=none

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6998 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-26 10:15:30 +00:00
sgjesse@google.com 33565cd64a Change the error handling in dart:io
1. Change the argument on all onError handlers from Exception to
Dynamic

2. Throw an exception if an error ocours and there is no error handler
present for handling it.

For sockets there is the complication that an error on a socket is
reported to the socket error handler, and each of the stream error
handlers. The solution to this is to throw an exception if there was
no error handler on either the socket or one of the streams.

Fixed a number of bugs in tests revealed by errors no longer being
silently ignored.

R=ager@google.com

BUG=none
TEST=tests/standalone/src/io/*

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6994 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-26 08:12:17 +00:00
sgjesse@google.com 11b6d128f1 Remove the RequestHandler interface from the HTTP library
Having the RequestHandler interface did no add anything, so it has
been removed. The HTTP server function addRequestHandler and setter
defaultRequestHandler now just takes function.

To use an instance of a class with a request handler member function
the Dart auto closurerization works fine.

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

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6939 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-25 13:27:14 +00:00
sgjesse@google.com b2f08560d4 Add handling of the HTTP Date header
R=ajohnsen@google.com

BUG=none
TEST=none

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6930 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-25 09:16:37 +00:00
ajohnsen@google.com 46da4845f9 Unregister callbacks from socket, when we return the socket for reuse.
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6869 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-24 06:35:08 +00:00
sgjesse@google.com a18d4a2f87 Add HTTP handler registration to the HTTP server
NOTE: This is a breaking change.

The onRequest callback on the HTTP server have been removed in favor
of the ability to register handlers. A handler can be either a
function or an instance of a class which implements a specific
interface. Each handler registration has a regular expression which is
matched against the request path.

There is also a default handler which can be set to handle all
requests which is not matched by any of the registered patterns. If
there is no default handler explicitly set there is a builtin one
which will just return 404 status.

Currently the method is not considered in the matching.

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

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6683 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-18 13:03:43 +00:00
sgjesse@google.com 9e82bc4246 Add test of the HTTP headers object
Fixed a number of bugs revealed by actually testing.

R=ajohnsen@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6669 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-18 06:44:58 +00:00
sgjesse@google.com c9a325f704 Start refactoring of the HTTP header handling
This change moves the headers into a separate object.

There will be follow-up changes for handling whether the headers are
read-only or mutable. Also additional tests will be added later.

R=ajohnsen@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6567 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-16 12:18:45 +00:00
sgjesse@google.com e7f5afdbb8 Add HTTP/1.0 support and simplify persistent connections handling
The HTTP parser now recognized both HTTP/1.1 and HTTP/1.0 in
request and response headers. The only difference between the
handling of HTTP 1.1 and HTTP 1.0 is in the decection of
persistent connections. For HTTP 1.1 persistent connections are
the default and for HTTP 1.0 persistent connections are speficified
throught the "Connection: Keep-Alive" header.

Removed the getters and setters for keepAlive from all the
interfaces. They are not of much use and persistent connection
handling should be transparent. The HTTP client currently always
sends requests using HTTP 1.1 and in the reare cases where one wants the
connection to be closed after the request adding the
header "Connection: close" should work.

With this change using wget to get resources from the chat server.

R=ajohnsen@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6509 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-13 10:58:58 +00:00
ajohnsen@google.com f5bccdbb14 Close socket, and not non-existing outputStream. Fixes crash in HttpServer.
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6455 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-12 09:30:49 +00:00
ajohnsen@google.com abd5d671f5 Mark as closing, when we close the connection manually.
Succeeding calls to write* would have failed without this.

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6454 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-12 06:41:58 +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 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 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
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
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 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 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
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
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