Permalink
Browse files

Merge branch 'master' into setexports. Replace the "setExports" sorta…

…-global with a "__module" sorta-global that references the currently loading module.

Conflicts:
	src/node.js
  • Loading branch information...
2 parents da3e31d + 78f8b67 commit ed3216434975b4d9a4fdb352857a3970407f88ea isaacs committed Oct 5, 2009
Showing with 231 additions and 140 deletions.
  1. +2 −2 benchmark/http_simple.js
  2. +1 −1 benchmark/process_loop.js
  3. +1 −1 benchmark/run.js
  4. +1 −1 bin/node-repl
  5. +34 −38 doc/api.txt
  6. +2 −2 doc/index.html
  7. +40 −3 lib/http.js
  8. +33 −0 src/http.cc
  9. +6 −0 src/http.h
  10. +62 −28 src/node.js
  11. +0 −7 src/node.pc.in
  12. +5 −5 src/util.js
  13. +2 −6 test/mjsunit/common.js
  14. +1 −1 test/mjsunit/disabled/test-cat.js
  15. +1 −1 test/mjsunit/disabled/test-http-stress.js
  16. +1 −1 test/mjsunit/disabled/test-remote-module-loading.js
  17. +1 −0 test/mjsunit/disabled/test_dns.js
  18. +2 −2 test/mjsunit/test-buffered-file.js
  19. +1 −1 test/mjsunit/test-delayed-require.js
  20. +1 −1 test/mjsunit/test-event-emitter-add-listeners.js
  21. +1 −1 test/mjsunit/test-exec.js
  22. +1 −1 test/mjsunit/test-file-cat-noexist.js
  23. +1 −1 test/mjsunit/test-fs-stat.js
  24. +1 −1 test/mjsunit/test-fs-write.js
  25. +1 −1 test/mjsunit/test-http-cat.js
  26. +1 −1 test/mjsunit/test-http-client-race.js
  27. +1 −1 test/mjsunit/test-http-client-upload.js
  28. +1 −1 test/mjsunit/test-http-malformed-request.js
  29. +1 −1 test/mjsunit/test-http-proxy.js
  30. +4 −2 test/mjsunit/test-http-server.js
  31. +1 −1 test/mjsunit/test-http.js
  32. +1 −1 test/mjsunit/test-mkdir-rmdir.js
  33. +1 −1 test/mjsunit/test-module-loading.js
  34. +1 −1 test/mjsunit/test-multipart.js
  35. +1 −1 test/mjsunit/test-process-buffering.js
  36. +1 −1 test/mjsunit/test-process-kill.js
  37. +1 −1 test/mjsunit/test-process-simple.js
  38. +1 −1 test/mjsunit/test-process-spawn-loop.js
  39. +1 −1 test/mjsunit/test-promise-wait.js
  40. +1 −1 test/mjsunit/test-readdir.js
  41. +1 −1 test/mjsunit/test-tcp-binary.js
  42. +1 −1 test/mjsunit/test-tcp-many-clients.js
  43. +1 −1 test/mjsunit/test-tcp-pingpong-delay.js
  44. +1 −1 test/mjsunit/test-tcp-pingpong.js
  45. +1 −1 test/mjsunit/test-tcp-reconnect.js
  46. +1 −1 test/mjsunit/test-tcp-throttle-kernel-buffer.js
  47. +1 −1 test/mjsunit/test-tcp-throttle.js
  48. +1 −1 test/mjsunit/test-tcp-timeout.js
  49. +1 −1 test/mjsunit/test-timers.js
  50. +1 −1 test/mjsunit/test-utf8-scripts.js
  51. +1 −1 test/mjsunit/test-wait-ordering.js
  52. +0 −7 wscript
View
4 benchmark/http_simple.js
@@ -1,7 +1,7 @@
libDir = node.path.join(node.path.dirname(__filename), "../lib");
node.libraryPaths.unshift(libDir);
-include("/utils.js");
+node.mixin(require("/utils.js"));
http = require("/http.js");
fixed = ""
@@ -16,7 +16,7 @@ http.createServer(function (req, res) {
var arg = commands[2];
var status = 200;
- //p(req.headers);
+ p(req.uri.params);
if (command == "bytes") {
var n = parseInt(arg, 10)
View
2 benchmark/process_loop.js
@@ -1,6 +1,6 @@
libDir = node.path.join(node.path.dirname(__filename), "../lib");
node.libraryPaths.unshift(libDir);
-include("/utils.js");
+node.mixin(require("/utils.js"));
function next (i) {
if (i <= 0) return;
View
2 benchmark/run.js
@@ -1,6 +1,6 @@
libDir = node.path.join(node.path.dirname(__filename), "../lib");
node.libraryPaths.unshift(libDir);
-include("/utils.js");
+node.mixin(require("/utils.js"));
var benchmarks = [ "static_http_server.js"
, "timers.js"
, "process_loop.js"
View
2 bin/node-repl
@@ -1,6 +1,6 @@
#!/usr/bin/env node
-include("/utils.js");
+node.mixin(require("/utils.js"));
puts("Welcome to the Node.js REPL.");
puts("Enter ECMAScript at the prompt.");
puts("Tip 1: Use 'rlwrap node-repl' for a better interface");
View
72 doc/api.txt
@@ -16,8 +16,8 @@ An example of a web server written with Node which responds with "Hello
World":
----------------------------------------
-include("/utils.js");
-include("/http.js");
+node.mixin(require("/utils.js"));
+node.mixin(require("/http.js"));
createServer(function (request, response) {
response.sendHeader(200, {"Content-Type": "text/plain"});
response.sendBody("Hello World\n");
@@ -61,11 +61,23 @@ error reporting.
The filename of the script being executed.
+require(path)+ ::
-+include(path)+ ::
See the modules section.
+node.libraryPaths+ ::
-The search path for absolute path arguments to +require()+ and +include()+.
+The search path for absolute path arguments to +require()+.
+
++node.mixin([deep], target, object1, [objectN])+ ::
+Extend one object with one or more others, returning the modified object.
+If no target is specified, the +process+ namespace itself is extended.
+Keep in mind that the target object will be modified, and will be returned
+from +node.mixin()+.
++
+If a boolean true is specified as the first argument, Node performs a deep
+copy, recursively copying any objects it finds. Otherwise, the copy will
+share structure with the original object(s).
++
+Undefined properties are not copied. However, properties inherited from the
+object's prototype will be copied over.
=== The +process+ Object
@@ -119,7 +131,7 @@ Executes the command as a child process, buffers the output and returns it
in a promise callback.
+
----------------------------------------
-include("/utils.js");
+node.mixin(require("/utils.js"));
exec("ls /").addCallback(function (stdout, stderr) {
puts(stdout);
});
@@ -269,7 +281,7 @@ The contents of +foo.js+:
----------------------------------------
var circle = require("circle.js");
-include("/utils.js");
+node.mixin(require("/utils.js"));
puts("The area of a circle of radius 4 is " + circle.area(4));
----------------------------------------
@@ -292,24 +304,20 @@ The module +circle.js+ has exported the functions +area()+ and
object. (Alternatively, one can use +this+ instead of +exports+.) Variables
local to the module will be private. In this example the variable +PI+ is
private to +circle.js+. The function +puts()+ comes from the module
-+"/utils.js"+. Because +include("/utils.js")+ was called, +puts()+ is in the
-global namespace.
++"/utils.js"+.
The module path is relative to the file calling +require()+. That is,
+circle.js+ must be in the same directory as +foo.js+ for +require()+ to
find it.
-Like +require()+ the function +include()+ also loads a module. Instead of
-returning a namespace object, +include()+ will add the module's exports into
-the global namespace. For example:
+Use +node.mixin()+ to include modules into the global namespace.
----------------------------------------
-include("circle.js");
-include("/utils.js");
+node.mixin(process, require("circle.js"), require("/utils.js"));
puts("The area of a cirlce of radius 4 is " + area(4));
----------------------------------------
-When an absolute path is given to +require()+ or +include()+, like
+When an absolute path is given to +require()+, like
+require("/mjsunit.js")+ the module is searched for in the
+node.libraryPaths+ array. +node.libraryPaths+ on my system looks like this:
@@ -411,7 +419,7 @@ Closes the process's +stdin+ stream.
+child.kill(signal=node.SIGTERM)+ ::
-Send a single to the child process. If no argument is given, the process
+Send a signal to the child process. If no argument is given, the process
will be sent +node.SIGTERM+. The standard POSIX signals are defined under
the +node+ namespace (+node.SIGINT+, +node.SIGUSR1+, ...).
@@ -567,8 +575,7 @@ Objects returned from +node.fs.stat()+ are of this type.
=== HTTP
-To use the HTTP server and client one must +require("/http.js")+ or
-+include("/http.js")+.
+To use the HTTP server and client one must +require("/http.js")+.
The HTTP interfaces in Node are designed to support many features
of the protocol which have been traditionally difficult to use.
@@ -665,7 +672,7 @@ The request method as a string. Read only. Example:
+request.uri+ ::
Request URI Object. This contains only the parameters that are
-present in the actual HTTP request. That is, if the request is
+present in the actual HTTP request. If the request is
+
----------------------------------------
GET /status?name=ryan HTTP/1.1\r\n
@@ -676,23 +683,13 @@ Accept: text/plain\r\n
Then +request.uri+ will be
+
----------------------------------------
-{ path: "/status",
- file: "status",
- directory: "/",
- params: { "name" : "ryan" }
+{ full: "/status?name=ryan",
+ path: "/status",
+ queryString: "name=ryan",
+ params: { "name": "ryan" },
+ fragment: ""
}
----------------------------------------
-+
-In particular, note that +request.uri.protocol+ is
-+undefined+. This is because there was no URI protocol given
-in the actual HTTP Request.
-+
-Here is what's available: +request.uri.anchor+, +request.uri.query+,
-+request.uri.file+, +request.uri.directory+, +request.uri.path+,
-+request.uri.relative+, +request.uri.port+, +request.uri.host+,
-+request.uri.password+, +request.uri.user+, +request.uri.authority+,
-+request.uri.protocol+, +request.uri.params+, +request.uri.toString()+,
-+request.uri.source+
+request.headers+ ::
@@ -1000,16 +997,15 @@ stream.addListener('complete', function() {
=== TCP
-To use the TCP server and client one must +require("/tcp.js")+ or
-+include("/tcp.js")+.
+To use the TCP server and client one must +require("/tcp.js")+.
==== +tcp.Server+
Here is an example of a echo server which listens for connections
on port 7000
----------------------------------------
-include("/tcp.js");
+node.mixin(require("/tcp.js"));
var server = createServer(function (socket) {
socket.setEncoding("utf8");
socket.addListener("connect", function () {
@@ -1247,8 +1243,8 @@ result of the last expression.
The library is called +/repl.js+ and it can be used like this:
------------------------------------
-include("/utils.js");
-include("/tcp.js");
+node.mixin(require("/utils.js"));
+node.mixin(require("/tcp.js"));
nconnections = 0;
createServer(function (c) {
error("Connection!");
View
4 doc/index.html
@@ -41,8 +41,8 @@
</p>
<pre>
-include("/utils.js");
-include("/http.js");
+node.mixin(require("/utils.js"));
+node.mixin(require("/http.js"));
createServer(function (req, res) {
setTimeout(function () {
res.sendHeader(200, {"Content-Type": "text/plain"});
View
43 lib/http.js
@@ -125,7 +125,14 @@ function IncomingMessage (connection) {
this.headers = {};
// request (server) only
- this.uri = "";
+ this.uri = {
+ full: "",
+ queryString: "",
+ fragment: "",
+ path: "",
+ params: {}
+ };
+
this.method = null;
// response (client) only
@@ -134,6 +141,21 @@ function IncomingMessage (connection) {
}
node.inherits(IncomingMessage, node.EventEmitter);
+IncomingMessage.prototype._parseQueryString = function () {
+ var parts = this.uri.queryString.split('&');
+ for (var j = 0; j < parts.length; j++) {
+ var i = parts[j].indexOf('=');
+ if (i < 0) continue;
+ try {
+ var key = decode(parts[j].slice(0,i))
+ var value = decode(parts[j].slice(i+1));
+ this.uri.params[key] = value;
+ } catch (e) {
+ continue;
+ }
+ }
+};
+
IncomingMessage.prototype.setBodyEncoding = function (enc) {
// TODO: Find a cleaner way of doing this.
this.connection.setEncoding(enc);
@@ -338,7 +360,19 @@ function createIncomingMessageStream (connection, incoming_listener) {
// Only servers will get URI events.
connection.addListener("uri", function (data) {
- incoming.uri += data;
+ incoming.uri.full += data;
+ });
+
+ connection.addListener("path", function (data) {
+ incoming.uri.path += data;
+ });
+
+ connection.addListener("fragment", function (data) {
+ incoming.uri.fragment += data;
+ });
+
+ connection.addListener("queryString", function (data) {
+ incoming.uri.queryString += data;
});
connection.addListener("headerField", function (data) {
@@ -372,7 +406,10 @@ function createIncomingMessageStream (connection, incoming_listener) {
if (info.method) {
// server only
incoming.method = info.method;
- incoming.uri = exports.parseUri(incoming.uri); // TODO parse the URI lazily?
+
+ if (incoming.uri.queryString.length > 0) {
+ incoming._parseQueryString();
+ }
} else {
// client only
incoming.statusCode = info.statusCode;
View
33 src/http.cc
@@ -96,6 +96,39 @@ HTTPConnection::on_uri (http_parser *parser, const char *buf, size_t len)
}
int
+HTTPConnection::on_query_string (http_parser *parser, const char *buf, size_t len)
+{
+ HandleScope scope;
+ HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data);
+ assert(connection->attached_);
+ Local<Value> argv[1] = { String::New(buf, len) };
+ connection->Emit("queryString", 1, argv);
+ return 0;
+}
+
+int
+HTTPConnection::on_path (http_parser *parser, const char *buf, size_t len)
+{
+ HandleScope scope;
+ HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data);
+ assert(connection->attached_);
+ Local<Value> argv[1] = { String::New(buf, len) };
+ connection->Emit("path", 1, argv);
+ return 0;
+}
+
+int
+HTTPConnection::on_fragment (http_parser *parser, const char *buf, size_t len)
+{
+ HandleScope scope;
+ HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data);
+ assert(connection->attached_);
+ Local<Value> argv[1] = { String::New(buf, len) };
+ connection->Emit("fragment", 1, argv);
+ return 0;
+}
+
+int
HTTPConnection::on_header_field (http_parser *parser, const char *buf, size_t len)
{
HandleScope scope;
View
6 src/http.h
@@ -24,6 +24,9 @@ class HTTPConnection : public Connection {
http_parser_init (&parser_, type);
parser_.on_message_begin = on_message_begin;
parser_.on_uri = on_uri;
+ parser_.on_path = on_path;
+ parser_.on_fragment = on_fragment;
+ parser_.on_query_string = on_query_string;
parser_.on_header_field = on_header_field;
parser_.on_header_value = on_header_value;
parser_.on_headers_complete = on_headers_complete;
@@ -36,6 +39,9 @@ class HTTPConnection : public Connection {
static int on_message_begin (http_parser *parser);
static int on_uri (http_parser *parser, const char *at, size_t length);
+ static int on_query_string (http_parser *parser, const char *at, size_t length);
+ static int on_path (http_parser *parser, const char *at, size_t length);
+ static int on_fragment (http_parser *parser, const char *at, size_t length);
static int on_header_field (http_parser *parser, const char *buf, size_t len);
static int on_header_value (http_parser *parser, const char *buf, size_t len);
static int on_headers_complete (http_parser *parser);
View
90 src/node.js
@@ -13,7 +13,7 @@ node.createChildProcess = function (command) {
};
node.exec = function () {
- throw new Error("node.exec() has moved. Use include('/utils.js') to bring it back.");
+ throw new Error("node.exec() has moved. Use require('/utils.js') to bring it back.");
}
node.http.createServer = function () {
@@ -28,6 +28,61 @@ node.tcp.createConnection = function (port, host) {
throw new Error("node.tcp.createConnection() has moved. Use require('/tcp.js') to access it.");
};
+/* From jQuery.extend in the jQuery JavaScript Library v1.3.2
+ * Copyright (c) 2009 John Resig
+ * Dual licensed under the MIT and GPL licenses.
+ * http://docs.jquery.com/License
+ */
+node.mixin = function() {
+ // copy reference to target object
+ var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !node.isFunction(target) )
+ target = {};
+
+ // mixin process itself if only one argument is passed
+ if ( length == i ) {
+ target = process;
+ --i;
+ }
+
+ for ( ; i < length; i++ )
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null )
+ // Extend the base object
+ for ( var name in options ) {
+ var src = target[ name ], copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy )
+ continue;
+
+ // Recurse if we're merging object values
+ if ( deep && copy && typeof copy === "object" && !copy.nodeType )
+ target[ name ] = node.mixin( deep,
+ // Never move original objects, clone them
+ src || ( copy.length != null ? [ ] : { } )
+ , copy );
+
+ // Don't bring in undefined values
+ else if ( copy !== undefined )
+ target[ name ] = copy;
+
+ }
+
+ // Return the modified object
+ return target;
+};
+
// Timers
function setTimeout (callback, after) {
@@ -197,42 +252,21 @@ node.Module.prototype.loadScript = function (loadPromise) {
// remove shebang
content = content.replace(/^\#\!.*/, '');
- node.loadingModules = [];
-
function requireAsync (url) {
- return self.newChild(url, {});
+ return self.newChild(url);
}
function require (url) {
return requireAsync(url).wait();
}
- function includeAsync (url) {
- var promise = requireAsync(url)
- promise.addCallback(function (t) {
- // copy properties into global namespace.
- for (var prop in t) {
- if (t.hasOwnProperty(prop)) process[prop] = t[prop];
- }
- });
- return promise;
- }
-
- function include (url) {
- includeAsync(url).wait();
- }
+ require.async = requireAsync;
- function setExports (obj) {
- self.target = obj;
- }
-
// create wrapper function
- var wrapper = "function (__filename, exports, require, include, setExports) { " + content + "\n};";
+ var wrapper = "function (__filename, exports, require, __module) { " + content + "\n};";
var compiled_wrapper = node.compile(wrapper, self.filename);
- node.loadingModules.unshift(self);
- compiled_wrapper.apply(self.target, [self.filename, self.target, require, include, setExports]);
- node.loadingModules.shift();
+ compiled_wrapper.apply(self.target, [self.filename, self.target, require, self]);
self.waitChildrenLoad(function () {
self.loaded = true;
@@ -241,8 +275,8 @@ node.Module.prototype.loadScript = function (loadPromise) {
});
};
-node.Module.prototype.newChild = function (path, target) {
- return node.loadModule(path, target, this);
+node.Module.prototype.newChild = function (path) {
+ return node.loadModule(path, {}, this);
};
node.Module.prototype.waitChildrenLoad = function (callback) {
View
7 src/node.pc.in
@@ -1,7 +0,0 @@
-prefix=@PREFIX@
-includedir=${prefix}/include/node
-
-Name: node
-Description: v8 powered non-browser javascript
-Version: @VERSION@
-Cflags: @CCFLAGS@ @CPPFLAGS@ -I${includedir}
View
10 src/util.js
@@ -70,21 +70,21 @@ node.path = new function () {
puts = function () {
- throw new Error("puts() has moved. Use include('/utils.js') to bring it back.");
+ throw new Error("puts() has moved. Use require('/utils.js') to bring it back.");
}
print = function () {
- throw new Error("print() has moved. Use include('/utils.js') to bring it back.");
+ throw new Error("print() has moved. Use require('/utils.js') to bring it back.");
}
p = function () {
- throw new Error("p() has moved. Use include('/utils.js') to bring it back.");
+ throw new Error("p() has moved. Use require('/utils.js') to bring it back.");
}
node.debug = function () {
- throw new Error("node.debug() has moved. Use include('/utils.js') to bring it back.");
+ throw new Error("node.debug() has moved. Use require('/utils.js') to bring it back.");
}
node.error = function () {
- throw new Error("node.error() has moved. Use include('/utils.js') to bring it back.");
+ throw new Error("node.error() has moved. Use require('/utils.js') to bring it back.");
}
View
8 test/mjsunit/common.js
@@ -5,10 +5,6 @@ exports.libDir = node.path.join(exports.testDir, "../../lib");
node.libraryPaths.unshift(exports.libDir);
var mjsunit = require("/mjsunit.js");
-include("/utils.js");
-// Copy mjsunit namespace out
-for (var prop in mjsunit) {
- if (mjsunit.hasOwnProperty(prop)) exports[prop] = mjsunit[prop];
-}
-
+var utils = require("/utils.js");
+node.mixin(exports, mjsunit, utils);
View
2 test/mjsunit/disabled/test-cat.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("../common.js"));
http = require("/http.js");
PORT = 8888;
View
2 test/mjsunit/disabled/test-http-stress.js
@@ -1,4 +1,4 @@
-include('../mjsunit.js');
+node.mixin(require('../common.js'));
var PORT = 8003;
var request_count = 1000;
View
2 test/mjsunit/disabled/test-remote-module-loading.js
@@ -9,7 +9,7 @@ var s = node.http.createServer(function (req, res) {
});
s.listen(8000);
-include("mjsunit.js");
+node.mixin(require("../common.js"));
var a = require("http://localhost:8000/")
assertInstanceof(a.A, Function);
View
1 test/mjsunit/disabled/test_dns.js
@@ -1,3 +1,4 @@
+node.mixin(require("../common.js"));
for (var i = 2; i < ARGV.length; i++) {
var name = ARGV[i]
puts("looking up " + name);
View
4 test/mjsunit/test-buffered-file.js
@@ -1,10 +1,10 @@
-include("common.js");
+node.mixin(require("common.js"));
var testTxt = node.path.join(fixturesDir, "test.txt");
var libDir = node.path.join(testDir, "../../lib");
node.libraryPaths.unshift(libDir);
-include("/file.js");
+node.mixin(require("/file.js"));
var fileUnlinked = false;
View
2 test/mjsunit/test-delayed-require.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
setTimeout(function () {
a = require("fixtures/a.js");
View
2 test/mjsunit/test-event-emitter-add-listeners.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
var e = new node.EventEmitter();
View
2 test/mjsunit/test-exec.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
success_count = 0;
error_count = 0;
View
2 test/mjsunit/test-file-cat-noexist.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
var got_error = false;
var filename = node.path.join(fixturesDir, "does_not_exist.txt");
View
2 test/mjsunit/test-fs-stat.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
var got_error = false;
var success_count = 0;
View
2 test/mjsunit/test-fs-write.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
var path = node.path.join(fixturesDir, "write.txt");
var expected = "hello";
View
2 test/mjsunit/test-http-cat.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
http = require("/http.js");
PORT = 8888;
View
2 test/mjsunit/test-http-client-race.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
http = require("/http.js");
PORT = 8888;
View
2 test/mjsunit/test-http-client-upload.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
http = require("/http.js");
var PORT = 18032;
View
2 test/mjsunit/test-http-malformed-request.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
tcp = require("/tcp.js");
http = require("/http.js");
View
2 test/mjsunit/test-http-proxy.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
http = require("/http.js");
var PROXY_PORT = 8869;
View
6 test/mjsunit/test-http-server.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
tcp = require("/tcp.js");
http = require("/http.js");
@@ -16,6 +16,8 @@ http.createServer(function (req, res) {
if (req.id == 0) {
assertEquals("GET", req.method);
assertEquals("/hello", req.uri.path);
+ assertEquals("world", req.uri.params["hello"]);
+ assertEquals("b==ar", req.uri.params["foo"]);
}
if (req.id == 1) {
@@ -38,7 +40,7 @@ var c = tcp.createConnection(port);
c.setEncoding("utf8");
c.addListener("connect", function () {
- c.send( "GET /hello HTTP/1.1\r\n\r\n" );
+ c.send( "GET /hello?hello=world&foo=b==ar HTTP/1.1\r\n\r\n" );
requests_sent += 1;
});
View
2 test/mjsunit/test-http.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
http = require("/http.js");
PORT = 8888;
View
2 test/mjsunit/test-mkdir-rmdir.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
var dirname = node.path.dirname(__filename);
var fixtures = node.path.join(dirname, "fixtures");
View
2 test/mjsunit/test-module-loading.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
debug("load test-module-loading.js");
View
2 test/mjsunit/test-multipart.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
http = require("/http.js");
var multipart = require('/multipart.js');
View
2 test/mjsunit/test-process-buffering.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
var pwd_called = false;
View
2 test/mjsunit/test-process-kill.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
var exit_status = -1;
View
2 test/mjsunit/test-process-simple.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
var cat = node.createChildProcess("cat");
View
2 test/mjsunit/test-process-spawn-loop.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
var N = 40;
var finished = false;
View
2 test/mjsunit/test-promise-wait.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
var p1_done = false;
var p1 = new node.Promise();
View
2 test/mjsunit/test-readdir.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
var got_error = false;
View
2 test/mjsunit/test-tcp-binary.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
tcp = require("/tcp.js");
PORT = 23123;
View
2 test/mjsunit/test-tcp-many-clients.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
tcp = require("/tcp.js");
// settings
var port = 20743;
View
2 test/mjsunit/test-tcp-pingpong-delay.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
tcp = require("/tcp.js");
View
2 test/mjsunit/test-tcp-pingpong.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
tcp = require("/tcp.js");
View
2 test/mjsunit/test-tcp-reconnect.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
tcp = require("/tcp.js");
var N = 50;
var port = 8921;
View
2 test/mjsunit/test-tcp-throttle-kernel-buffer.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
tcp = require("/tcp.js");
PORT = 20444;
N = 30*1024; // 500kb
View
2 test/mjsunit/test-tcp-throttle.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
tcp = require("/tcp.js");
PORT = 20443;
N = 200;
View
2 test/mjsunit/test-tcp-timeout.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
tcp = require("/tcp.js");
port = 9992;
exchanges = 0;
View
2 test/mjsunit/test-timers.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
var WINDOW = 200; // why is does this need to be so big?
View
2 test/mjsunit/test-utf8-scripts.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
// üäö
View
2 test/mjsunit/test-wait-ordering.js
@@ -1,4 +1,4 @@
-include("common.js");
+node.mixin(require("common.js"));
function timer (t) {
var promise = new node.Promise();
View
7 wscript
@@ -341,13 +341,6 @@ def build(bld):
return x
# process file.pc.in -> file.pc
- pkgconfig = bld.new_task_gen('subst', before="cxx")
- pkgconfig.source = 'src/node.pc.in'
- pkgconfig.target = 'node.pc'
- pkgconfig.install_path = '${PREFIX}/lib/pkgconfig'
- pkgconfig.dict = subflags(node)
-
- # process file.pc.in -> file.pc
node_version = bld.new_task_gen('subst', before="cxx")
node_version.source = 'src/node_version.h.in'
node_version.target = 'src/node_version.h'

0 comments on commit ed32164

Please sign in to comment.