Commit Graph

3601 Commits

Author SHA1 Message Date
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
ager@google.com 493a76dd40 Support passing an environment variable map to child processes.
Fix minor type warning in test.

Reapplication after MacOS bug fix.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6827 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-23 07:54:10 +00:00
asiva@google.com ec9f430cc7 Add infrastructure to create and run benchmarks specific to some VM functionality. This is used to measure performance of specific VM functionality (similar to VM unit tests testing specific VM functionality)
run_vm_tests --benchmarks to run all benchmarks
 or
run_vm_tests CorelibCompileAll
Review URL: https://chromiumcodereview.appspot.com//10069039

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6820 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-21 01:36:23 +00:00
ager@google.com c5d347fcbc Revert "Support passing an environment variable map to child processes."
Apparently the code or the test is broken on Mac.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6795 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-20 12:53:19 +00:00
ager@google.com ee81b6f0a1 Support passing an environment variable map to child processes.
Fix minor type warning in test.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6794 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-20 12:38:57 +00:00
turnidge@google.com 9e2c641658 Remove the deprecated method invocation and field access apis from the
dart embbedding api.  Use the new apis instead.

Fixed a bug where field/function lookup was failing for imported libs.
Added tests.  Had to add a couple of lookup functions to Library.

Fixed a bug in Dart_Invoke -- it wasn't handling a null receiver
correctly.
Review URL: https://chromiumcodereview.appspot.com//10021072

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6769 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-19 21:04:15 +00:00
regis@google.com f955de9bc0 Throw a type error in production mode when the type of the type test is not
declared (issue 2571).
Add test.
Delete bad negative test now covered by new test.
Update status files of different compilers.
Review URL: https://chromiumcodereview.appspot.com//10035058

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6754 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-19 17:01:28 +00:00
sgjesse@google.com 41cc58affa Fix a number of editor errors and warnings in io tests
R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6731 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-19 09:17:14 +00:00
hausner@google.com e74cd5fc3a Static members are not visible in subclasses
Fix for issue 1598.

Lexical scope comes before inherited names. Also, Static members
are not inherited and are not visible in subclasses.
Code in the subclass (or any other code for that matter) has to
qualify the names of these members with the class name.

We had a few tests that were wrong and only passed in the VM because
this was not implemented correctly.

Also had to fix code in frog and dartdoc.

I hope I ran enough tests. I built an all.deps tree using tools/build.py from the root directory, which brought up the frog and dartdoc issues.

Tested:
tools/test.py --compiler=dart2js --runtime=drt
tools/test.py -c none -r drt
tools/test.py -c frog -r drt
tools/test.py -r vm

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6698 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-18 16:09:22 +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
ager@google.com 37b82247ac Remove need to instantiate Platform and make methods static.
This will require an update of the stable test binary. I will upload
a new build when done with the review process.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6682 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-18 11:39:16 +00:00
iposva@google.com cef84bd895 - Update the style of switch statement.
Review URL: https://chromiumcodereview.appspot.com//10083042

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6680 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-18 11:00:33 +00:00
whesse@google.com 7b9880570d Refactor URI processing of native extensions directive #import("dart-ext:foo").
BUG=
TEST=standalone/io/TestExtensionsTest

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6674 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-18 09:58:01 +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
ager@google.com 758943e32a Add read-only environment variable access.
Map<String, String> env = new Platform().environment();

Unfortunately, this is a bit hard to test at this point. I
will move on to implement support for providing an environment
to processes that are started. At that point we can test it
properly.

Another follow-up change will be to remove the instantiation
for Platform. I would like this to be just

Map<String, String> env = Platform.environment();

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6646 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-17 16:20:28 +00:00
ahe@google.com 56f34d7514 Move cygwin_dir to shared gypi file.
Review URL: https://chromiumcodereview.appspot.com//9877003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6626 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-17 11:53:56 +00:00
sgjesse@google.com 20b1747a8a Add missing properties on HttpHeader
R=ajohnsen@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6615 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-17 07:37:47 +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
ager@google.com f366f9d913 Make it an error to call close twice on a file using the async API.
This is to make it consistent with the sync API.

Additionally, fix situations where a non-exception was passed to
error handlers on File objects.

R=sgjesse@google.com
BUG=dartbug.com/2451
TEST=standalone/io/File*

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6564 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-16 11:32:03 +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
ager@google.com 4e1f754730 Fix Process test, fix Process factory, diable tests on dart2js.
Florian and I will investigate the dart2js failures.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6502 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-13 09:21:54 +00:00
ager@google.com 84b0410d5a This is a request for comments.
First attempt at implementing a higher-level API for processes.
Add a startNonInteractive constructor that takes a callback which
is called with the exit code and the complete stdout and stderr
when the process terminates.

Let me know what you think. This obviously needs at least tests.
Not entirely sure what I think about the interface in the first
place.

R=sgjesse@google.com
BUG=1689
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6499 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-13 08:53:35 +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
ager@google.com aba2e48950 Support length operation without opening file.
Use fstat instead of multiple seek calls to get length of
opened files.

R=sgjesse@google.com
BUG=dartbug.com/1592
TEST=standalone/io/File*Test

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6459 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-12 11:47:32 +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
rnystrom@google.com c47bd07592 Fix merge bug.
Review URL: https://chromiumcodereview.appspot.com//10020049

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6435 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-11 20:27:57 +00:00
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