Commit Graph

18 Commits

Author SHA1 Message Date
regis@google.com b86a40f48f Fix type checking of void type.
Fix library and tests accordingly.
Add new test.
Disable new test for dart2js.
Disable some now failing co19 tests (new issue 158 filed).
Hide internal VM String types from user (not complete).
Review URL: https://chromiumcodereview.appspot.com//10787021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9681 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-16 21:34:07 +00:00
regis@google.com dc96874999 Revert fix for type checking of void type, because some top level tests fail.
Review URL: https://chromiumcodereview.appspot.com//10784020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9673 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-16 19:05:38 +00:00
regis@google.com a8ceb243f6 Fix type checking of void type.
Fix library and tests accordingly.
Add new test.
Disable new test for dart2js.
Disable some now failing co19 tests (new issue 158 filed).
Hide internal VM String types from user (not complete).
Review URL: https://chromiumcodereview.appspot.com//10704216

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9672 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-16 18:05:55 +00:00
sgjesse@google.com c0f4bf9672 Implement a MIME multipart parser
Added a MIME multipart parser with tests.

The parser is currently not used but will be used to handle form
posts with content type multipart/form-data.

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

BUG=dart:2488
TEST=tests/standalone/io/mime_multipart_parser_test.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7990 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-25 11:57:02 +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
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 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 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 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
sgjesse@google.com 49859f8d08 Add basic handling to connection upgrade to the HTTP parser
See description in runtime/bin/http_parser.dart on how the upgrade works.

R=ajohnsen@google.com

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6464 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-12 14:31:47 +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
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
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 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 b29e72fdbd Make the HttpParser and HttpUtil classes private
Move to separate files for sourcing these in the tests.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4934 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-05 08:04:04 +00:00